efficiency

Most efficient code for the first 10000 prime numbers?

I want to print the first 10000 prime numbers. Can anyone give me the most efficient code for this? Clarifications: It does not matter if your code is inefficient for n >10000. The size of the code does not matter. You cannot just hard code the values in any manner. ...

What is the most efficient graph data structure in Python?

I need to be able to manipulate a large (10^7 nodes) graph in python. The data corresponding to each node/edge is minimal, say, a small number of strings. What is the most efficient, in terms of memory and speed, way of doing this? A dict of dicts is more flexible and simpler to implement, but I intuitively expect a list of lists to be...

Is there a performance difference between i++ and ++i in C++?

We looked at this answer for C in this question: http://stackoverflow.com/questions/24886/is-there-a-performance-difference-between-i-and-i-in-c What's the answer for C++? ...

Efficient workday

What are people's tips for an efficient workday. For example, sometimes I find myself procrastinating over something, generally just putting it off (especially if there is no deadline breathing down my neck). To counter this, I sometimes try creating a list of things to do for the next hour or so. This often can work, but I'd still occas...

Algorithmic complexity of XML parsers/validators

I need to know how the performance of different XML tools (parsers, validators, XPath expression evaluators, etc) is affected by the size and complexity of the input document. Are there resources out there that document how CPU time and memory usage are affected by... well, what? Document size in bytes? Number of nodes? And is the relati...

How do I avoid read locks in my database?

Answers for multiple databases welcome! ...

What are the best keyboard macros for programming in windows?

I like putting shortcuts of the form "g - google.lnk" in my start menu so google is two keystrokes away. Win, g. My eight or so most frequent applications go there. I also make links to my solution files I am always opening "x - Popular Project.lnk" Are there any better ways to automate opening frequently used applications? ...

What tools/techniques can benefit a solo developer?

Hello, I am a solo developer, working in a very small web development firm. There is occasional support for development from contractors, but for the most part, if code is written in the office, I am writing it. Many of the articles and such on here talk extensively about the tools and techniques used for collaboration of developers ...

How do you do team-building?

Team building, in my opinion, is often misunderstood concept! The wikipedia definition is also very theoretical. But i think it is real critical skill for any team leader. So, How do you "team-build"? Do you just book some conference room in a big hotel and discuss the same things you do at your regular meetings? Or you do you tak...

Need to create a layered dict from a flat one

I have a dict, that looks like this: { 'foo': { 'opt1': 1, 'opt2': 2, }, 'foo/bar': { 'opt3': 3, 'opt4': 4, }, 'foo/bar/baz': { 'opt5': 5, 'opt6': 6, } } And I need to get it to look like: { 'foo': { 'opt1': 1, 'opt2': 2, ...

Progress Reports

I'm not talking about the kind you get in college, but rather implementing progress reports on the Job for developers. My thoughts in organizing a development team is encouraging and, to some extend, requiring regular progress updates were developers would report on what they did in the last hour or few hours and how long tasks took. Be...

Prisoner's Dilemma Algorithm

After watching The Dark Knight I became rather enthralled with the concept of the Prisoner's Dilemma. There must be an algorithm that that maximizes one's own gain given a situation. For those that find this foreign: http://en.wikipedia.org/wiki/Prisoner%27s_dilemma Very, very interesting stuff. Edit: The question is, what is, if any,...

Sql Server 2005 efficiency savings?

Are there good efficiency savings using Sql Server 2005 over Sql Server 2000? Or does it just have more services etc Has anyone seen their system work any quicker after making the upgrade? ...

Java: Advice on handling large data volumes. (Part Deux)

Alright. So I have a very large amount of binary data (let's say, 10GB) distributed over a bunch of files (let's say, 5000) of varying lengths. I am writing a Java application to process this data, and I wish to institute a good design for the data access. Typically what will happen is such: One way or another, all the data will be ...

Running many virtual machines on a single host

I have a need to run a relatively large number of virtual machines on a relatively small number of physical hosts. Each virtual machine isn't doing to much - each only needs to run essentially one basic network service - think SMTP or the like. Furthermore, the load on each is going to be extremely light. Unfortunately, the numbers are...

Bad Database Design - Is my table too large?

I have a poorly designed database. One of the most important tables has 11,000+ entries. We would like to expand our system, and I am wondering if this table grew to 5x its size, would this be a problem? It's 15360 kB in size... if that matters. I'm using phpMyAdmin, the server is a Fedora Linux box (nothing fancy), The load is light....

Is there a better way to find midnight tomorrow?

Is there a better way to do this? -(NSDate *)getMidnightTommorow { NSCalendarDate *now = [NSCalendarDate date]; NSCalendarDate *tomorrow = [now dateByAddingYears:0 months:0 days:1 hours:0 minutes:0 seconds:0]; return [NSCalendarDate dateWithYear:[tomorrow yearOfCommonEra] month:[tomorrow mon...

Which free database system is best to store, and compute/analyze large text comparisons out of which the database would make usable statistics?

Hey, I got to create script that would compare thousands of large texts (to each other). And I'm wondering if MySQL is the best solution for this. Is there any other free databse system I could use to do simple - but processor-time consuming computing? Please, throw me into your knowledge's pool! Edit: Nature of documents - 500-7000 c...

Storing values in the web.config - appSettings or configSection - which is more efficient?

I'm writing a page that can use a couple of different themes, and I'm going to store some information about each theme in the web.config. Is it more efficient to create a new sectionGroup and store everything together, or just put everything in appSettings? configSection solution <configSections> <sectionGroup name="SchedulerPage">...

Databases: Are "TEXT" fields less efficient than "varchar"?

Is it less efficient to use TEXT than varchar in an SQL database? If so why? If not why would you not just always use TEXT? I'm not targetting a specific database here but oracle is probably the most relevant, although I'm testing on MySQL for the time being as part of a proof of concept. ...