Search Results

Search found 1375 results on 55 pages for 'asymptotic complexity'.

Page 34/55 | < Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >

  • Get/save parameters to an expected JMock method call?

    - by Tayeb
    Hi, I want to test an "Adapter" object that when it receives an xml message, it digest it to a Message object, puts message ID + CorrelationID both with timestamps and forwards it to a Client object.=20 A message can be correlated to a previous one (e.g. m2.correlationID =3D m1.ID). I mock the Client, and check that Adapter successfully calls "client.forwardMessage(m)" twice with first message with null correlationID, and a second with a not-null correlationID. However, I would like to precisely test that the correlationIDs are set correctly, by grabing the IDs (e.g. m1.ID). But I couldn't find anyway to do so. There is a jira about adding the feature, but no one commented and it is unassigned. Is this really unimplemented? I read about the alternative of redesigning the Adapter to use an IdGenerator object, which I can stub, but I think there will be too many objects.=20 Don't you think it adds unnecessary complexity to split objects to a so fine granularity? Thanks, and I appreciate any comments :-) Tayeb

    Read the article

  • Given a number N, find the number of ways to write it as a sum of two or more consecutive integers

    - by hilal
    Here is the problem (Given a number N, find the number of ways to write it as a sum of two or more consecutive integers) and example 15 = 7+8, 1+2+3+4+5, 4+5+6 I solved with math like that : a + (a + 1) + (a + 2) + (a + 3) + ... + (a + k) = N (k + 1)*a + (1 + 2 + 3 + ... + k) = N (k + 1)a + k(k+1)/2 = N (k + 1)*(2*a + k)/2 = N Then check that if N divisible by (k+1) and (2*a+k) then I can find answer in O(N) time Here is my question how can you solve this by dynamic-programming ? and what is the complexity (O) ? P.S : excuse me, if it is a duplicate question. I searched but I can find

    Read the article

  • Inserting asyncronously into Oracle, any benefits?

    - by Karl Trumstedt
    I am using ODP.NET for loading data into Oracle. I am bulking inserts into groups of a 1000 rows each call. Is there any performance benefits in calling my load method asynchronously? So say I want to insert 10000 rows, instead of making 10 calls synchronously I make 10 calls asynchronously. My database is using ASSM right now but otherwise plenty of freelists are used of course. The database server has several cores as well. My initial tests seem to point to a performance increase, but maybe there is something I cannot see? Potential deadlock or contention issues? Of course, there is added complexity in handling transactions and such doing my load this way.

    Read the article

  • Port a Rails App from Windows to Mac

    - by Ryan Max
    Hello I've been a Rails developer on Windows for quite some time now, but I recently completed my biggest project yet (it's quite extensive, took me over a year to build) but I am having trouble deploying it. The combination of it's size, complexity and a windows environment is making it needlessly complex to deploy. I am thinking about getting an old mac mini and using it just for rails development. Is there any way I can port my app to this mac, without having to start over? I can't find any resources on the internets about this.

    Read the article

  • Recursive Functions for Beginners?

    - by cam
    I'm looking for a few recursive function examples, preferably ones that show increase in complexity. I understand basic recursive functions, but I'm having trouble implementing them in my code. I've never used them in my code before, and I know it doesn't always call for it, but I'd like to try. Is there a good resource with examples, and maybe challenges of some sort? Or even some simple math problems (Project Euler-style?) that I could use recursion on? For examples, I prefer C#, but anything works.

    Read the article

  • ASP NET forms Authorization: how to reduce duration?

    - by eddo
    I've got a web page which is implementing cookie based ASPNET Forms Authentication. Once the user has logged in the page, he can edit some information using a form which is created using a partialview and returned to him as a dialog for editing. The action linked to the partial view is decorated as follows: [HttpGet] [OutputCache(Duration = 0, VaryByParam = "None")] [Authorize(Roles = "test")] public ActionResult changeTripInfo(int tripID, bool ovride=false) { ... } The problem i am experiencing is the latency between the request and the time when the dialog is shown to the user: time ranges between 800 and 1100 ms which is not justified by the complexity of the form. Investigating with Glimpse turns out that the time to process the AuthorizeAttribute (see snip) sums up to at least 650 ms which is troubling me. Looking at the Sql server log, the call which checks the user roles takes, as expected, virtually nothing (duration 0). How can I reduce this time? Am I missing some optimization?

    Read the article

  • finding the total number of distinct shortest paths between 2 nodes in undirected weighted graph in linear time?

    - by logan
    I was wondering, that if there is a weighted graph G(V,E), and I need to find a single shortest path between any two vertices S and T in it then I could have used the Dijkstras algorithm. but I am not sure how this can be done when we need to find all the distinct shortest paths from S to T. Is it solvable on O(n) time? I had one more question like if we assume that the weights of the edges in the graph can assume values only in certain range lets say 1 <=w(e)<=2 will this effect the time complexity?

    Read the article

  • What kind of work benifits from OpenCL

    - by Daniel
    Hey All First of all: I am well aware that OpenCL does not magically make everything faster I am well aware that OpenCL has limitations So now to my question, i am used to do different scientific calculations using programming. Some of the things i work with is pretty intense in regards to the complexity and number of calculations. SO i was wondering, maybe i could speed things up bu using OpenCL. So, what i would love to hear from you all is answers to some of the following [bonus for links]: *What kind of calculations/algorithms/general problems is suitable for OpenCL *What is the general guidelines for determining if some particular code would benefit by migration to OpenCL? Regards

    Read the article

  • Non-trivial desktop apps that use Ruby?

    - by Mark A. Nicolosi
    I'm about to start a project developing a Ruby desktop application. I expect to to be fairly big and I want to learn techniques for dividing code among modules and other techniques for managing complexity. Most large apps I've looked at are Rails apps, but these aren't very helpful, because most of the work is done by Rails itself. What source code would you recommend I take a look at? I'm not interested in libraries or Rails apps, because I get how they do things. CLI apps are OK, but I'm mostly interested in GUI apps (I'm using Gtk+, but I can learn just as much from apps using other GUI toolkits).

    Read the article

  • How much faster are register based architectures than stack architectures?

    - by drozzy
    Studying compilers course, I am left wondering why use registers at all. It is often the case that the caller or callee must save the register value and then restore it. In a way they always end up using the stack anyway. Is creating additional complexity by using registers really worth it? Excuse my ignorance. Update: Please, I know that registers are faster than RAM and other types of cache. My main concern is that one has to "save" the value that is in the register and the "restore" it to. In both cases we are accessing some kind of cache. Would it not be better to use cache in the first place?

    Read the article

  • Sorting array of 1000 distinct integers in the range [1, 5000], accessing each element at most once

    - by Cronydevil
    Suppose you have an array of 1000 integers. The integers are in random order, but you know each of the integers is between 1 and 5000 (inclusive). In addition, each number appears only once in the array. Assume that you can access each element of the array only once. Describe an algorithm to sort it. How i can sorting? If you used auxiliary storage in your algorithm, can you find an algorithm that remains O(n) space complexity?

    Read the article

  • Which parallel sorting algorithm has the best average case performance?

    - by Craig P. Motlin
    Sorting takes O(n log n) in the serial case. If we have O(n) processors we would hope for a linear speedup. O(log n) parallel algorithms exist but they have a very high constant. They also aren't applicable on commodity hardware which doesn't have anywhere near O(n) processors. With p processors, reasonable algorithms should take O(n/p log n/p) time. In the serial case, quick sort has the best runtime complexity on average. A parallel quick sort algorithm is easy to implement (see here and here). However it doesn't perform well since the very first step is to partition the whole collection on a single core. I have found information on many parallel sort algorithms but so far I have not seen anything pointing to a clear winner. I'm looking to sort lists of 1 million to 100 million elements in a JVM language running on 8 to 32 cores.

    Read the article

  • resort on a std::vector vs std::insert

    - by Abruzzo Forte e Gentile
    I have a sorted std::vector of relative small size ( from 5 to 20 elements ). I used std::vector since the data is continuous so I have speed because of cache. On a specific point I need to remove an element from this vector. I have now a doubt: which is the fastest way to remove this value between the 2 options below? setting that element to 0 and call sort to reorder: this has complexity but elements are on the same cache line. call erase that will copy ( or memcpy who knows?? ) all elements after it of 1 place ( I need to investigate the behind scense of erase ). Do you know which one is faster? I think that the same approach could be thought about inserting a new element without hitting the max capacity of the vector. Regards AFG

    Read the article

  • Port a Rails App from Windows to Mac or Linux

    - by Ryan Max
    Hello I've been a Rails developer on Windows for quite some time now, but I recently completed my biggest project yet (it's quite extensive, took me over a year to build) but I am having trouble deploying it. The combination of it's size, complexity and a windows environment is making it needlessly complex to deploy. I am thinking about getting an old mac mini and using it just for rails development. Either that or install unix on another box. Is there any way I can port my app to this mac or linux machine, without having to start over? I can't find any resources on the internets about this.

    Read the article

  • Partially parse C++ for a domain-specific language

    - by PierreBdR
    I would like to create a domain specific language as an augmented-C++ language. I will need mostly two types of contructs: Top-level constructs for specialized types or declarations In-code constructs, i.e. to add primitives to make functions calls or idiom easier The language will be used for scientific computing purposes, and will ultimately be translated into plain C++. C++ has been chosen as it seems to offer a good compromise between: ease of use, efficiency and availability of a wide range of libraries. A previous attempt using flex and bison failed due to the complexity of the C++ syntax. The existing parser can still fail on some constructs. So we want to start over, but on better bases. Do you know about similar projects? And if you attempted to do so, what tools would you use? What would be the main pitfalls? Would you have recommendations in term of syntax?

    Read the article

  • Find a common element within N arrays

    - by kunjaan
    If I have N arrays, what is the best(Time complexity. Space is not important) way to find the common elements. You could just find 1 element and stop. Edit: The elements are all Numbers. Edit: These are unsorted. Please do not sort and scan. This is not a homework problem. Somebody asked me this question a long time ago. He was using a hash to solve the problem. I was thinking if SO has solved similar problems.

    Read the article

  • Game Objects Talking To Each Other

    - by PhilCK
    What is a good way of dealing with objects and having them talk to each other? Up until now all my games hobby/student have been small so this problem was generally solved in a rather ugly way, which lead to tight integration and circular dependencies. Which was fine for the size of projects I was doing. However my projects have been getting bigger in size and complexity and now I want to start re-using code, and making my head a simpler place. The main problem I have is generally along the lines of Player needs to know about the Map and so does the Enemy, this has usually descended into setting lots of pointers and having lots of dependencies, and this becomes a mess quickly. I have thought along the lines of a message style system. but I cant really see how this reduces the dependencies, as I would still be sending the pointers everywhere. Thanks. PS: I guess this has been discussed before, but I don't know what its called just the need I have.

    Read the article

  • Should i use TabContainer for multiple pages?

    - by Tim
    I'm considering if it is a good idea to use an ASP.Net TabContainer-Control in the way that every TabPanel contains content of a different page. For example: Next i want to implement in my application is the masterdata management. Normally i would create one aspx page for every masterdata-table (f.e. Customer - MD_Customer.aspx). Then i would add a link into my Menu to this page. Now i'm thinking of creating one aspx page for all(Masterdata.aspx) with a Tabcontainer and an UpdatePanel for every type of Masterdata. The link it the menu could have an additional MDType as URL-Parameter. My main concerns are related to performance(one "page" for every TabPanel currently means 7 "pages" in one) and maintainability because of increasing complexity. Is it a good approach or a bad idea? Thanks

    Read the article

  • Giving users a "reputation system" - Should I... ?

    - by RadiantHex
    Hi folks, I'm thinking of adding a reputation system to a web application, the site is already being used so I'm trying to be careful about my choices. I'm developing in Django/Python, thought this would be important. Reputation is generated in all actions that contribute to the site, similar to Stackoverflow's system. I know there are literally millions of ways of implementing this, and this is why I feel quite lost. Two alternatives I am not sure about are: Keep track of reasons why reputation was incremented Ignore reasons in order to reduce complexity of the site and overhead Would be happy with a few pointers, and directions. Would be very much appreciated!

    Read the article

  • We failed trying database per custom installation. Plan to recover?

    - by Fedyashev Nikita
    There is a web application which is in production mode for 3 years or so by now. Historically, because of different reasons there was made a decision to use database-per customer installation. Now we came across the fact that now deployments are very slow. Should we ever consider moving all the databases back to single one to reduce environment complexity? Or is it too risky idea? The problem I see now is that it's very hard to merge these databases with saving referential integrity(primary keys of different database' tables can not be obviously differentiated). Databases are not that much big, so we don't have much benefits of reduced load by having multiple databases.

    Read the article

  • ReportViewer with DataSets

    - by bearrito
    I have a question about the following architecture. I am importing my business objects into my client using WCF. Due to the complexity of the business objects ( nested hierarchies ) I want to flatten out my business objects into a dataset/datatable. There are many more tutorials and how-to on successfully using datatables in a report than with a business object so I am pretty attached to this idea. My question is what sort of DataSet should I use? Strongly typed or not? If strongly typed how do I import my business objects into the Datatables?

    Read the article

  • Arrange 0's & 1's in a array

    - by Ganesh M
    This is one of an interview question which I had recently. I would like to know others perception of approach for this problem. Question: You are given a structure which holds an employee details with two elements as int Deptartment and string Name. struct Employee { string Name; int Dept; } You are given details of N Employees among which there are N/2 employees Dept are 0's and N/2 employees dept are 1's arranged in some random order. You need to sort the employee details based on their Dept value and it should be stable i.e., the order of 1s and 0s in the original record should be maintained. For example, given the following sample data: Name Dept X1 0 X2 1 X3 0 X4 1 X5 0 after sorting the result should be: Name Dept X2 1 X4 1 X1 0 X3 0 X5 0 The algorithm should be stable and the complexity should be o(N), with constant space for additional variables (which means sorting should be done in-place).

    Read the article

  • How can I use edit_in_place in the show of a different model in Rails?

    - by Angela
    I have a model Campaign and the campaign/show goes through a loop of the Emails. Campaign has_many Emails. <h2>Emails to Send Today</h2> <% for email in @campaign.emails %> <p><strong>Email: </strong><%= link_to email.title, email_path(email) %> sent after <%= distance_of_time_in_words(email.days.days) %></p> <% end %> I would like to be able to edit in place the subject and/or the email.days value from the Campaign/show page. How do I do that? (Added complexity, these are clickable links).

    Read the article

  • On Linux do people chroot a Java Web Application or use IPTables and run as non-root?

    - by Adam Gent
    When you run a Java Servlet Container that you would like to serve both static and dynamic content on port 80 you have the classic question of whether to run the server as: As root in hopefully a chroot jail if you can (haven't gotten this working yet) As a non root user and then use IPTables to forward port 80 to some other port (1024) that the container is running on Both: As a non root user, IPTables, and chroot jail. The problem with opt. 1 is the complexity of chrooting and still the security problems of running root.The problem with opt. 2 is that each Linux distro has a different way of persisting IPTables. Option 3 of course is probably idea but very hard to setup. Finally every distro has the annoying differences in daemon scripts. What do people find as the best distro agnostic solution and are there resources to show how to do this?

    Read the article

  • Count double palindromes in given int sequence

    - by jakubmal
    For a given int sequence check number of double palindromes, where by double palindrome we mean sequence of two same palindromes without break between them. So for example: in 1 0 1 1 0 1 we have 1 0 1 as a palindrome which appears 2 times without a break, in 1 0 1 5 1 0 1 we have 1 0 1 but it's separated (apart from the other palindromes in these sequences) Problem example test data is: 3 12 0 1 1 0 0 1 1 0 0 1 1 0 12 1 0 1 0 1 0 1 0 1 0 1 0 6 3 3 3 3 3 3 with answers 8 0 9 Manacher is obvious for the begging, but I'm not sure what to do next. Any ideas appreciated. Complexity should be below n^2 I guess. EDIT: int is here treated as single element of alphabet

    Read the article

< Previous Page | 30 31 32 33 34 35 36 37 38 39 40 41  | Next Page >