I'm not too good with SQL and I know there's probably a much more efficient way to accomplish what I'm doing here, so any help would be much appreciated. Thanks in advance for your input!
I'm writing a short program for the local school high school. At this school, juniors and seniors who have driver's licenses and cars can opt to drive...
It's a real shame that in .Net there is no polymorphism for numbers, i.e. no INumeric interface that unifies the different kinds of numerical types such as bool, byte, uint, int, etc. In the extreme one would like a complete package of abstract algebra types.
Joe Duffy has an article about the issue:
http://www.bluebytesoftware.com/blo...
I am currently starting using doxygen to document my source code. I have notice that the syntax is very heavy, every time I modify the source code, I also need to change the comment and I really have the impression to pass too much time modifying the comment for every change I make in the source code.
Do you have some tips to document m...
Question:
I want code for: syntax highlighting (of programming languages)
Language: C# or assembly x86 (preferably C#)
Platform: Windows
Qualifications: most efficient implementation possible / most professional / the way that big corporations like Microsoft do it
Rephrased: How do I implement syntax highlighting in C# for Windows in the...
I'm reading some C code like that:
double function( int lena,double xa,double ya, double za, double *acoefs, ...,
int lenb,double xb,double yb, double zb, double *bcoefs, ...,
same for c,
same for d )
This function is called in the code mor than 100.000 times so it's performance-criti...
Occasionally , we have to write methods that receive many many arguments , for example :
public void doSomething(Object objA , Object objectB ,Date date1 ,Date date2 ,String str1 ,String str2 )
{
}
When I encounter this kind of problem , I often encapsulate arguments into a map.
Map<Object,Object> params = new HashMap<Object,Object>(...
I've refactored how the merged-dictionary (all_classes) below is created, but I'm wondering if it can be more efficient.
I have a dictionary of dictionaries, like this:
groups_and_classes = {'group_1': {'class_A': [1, 2, 3],
'class_B': [1, 3, 5, 7],
'class_c': [1, 2],...
I am wondering which way to reverse a string in Java that is most efficient. Should I use some sort of xor method? The easy way would be to put all the chars in a stack and put them back into a string again but I doubt that's a very efficient way to do it. And please do not tell me to use some built in function in Java. I am interested i...
A colleague needed to sort an array of ActiveRecord objects in a Rails app. He tried the obvious Array.sort! but it seemed surprisingly slow, taking 32s for an array of 3700 objects. So just in case it was these big fat objects slowing things down, he reimplemented the sort by sorting an array of small objects, then reordering the orig...
hello
I would like to know if there is a difference in speed between computing hash value (for example std::map key) of primitive integral type, such as int64_t and pod type, for example struct { int16_t v[4]; };. what about int128_t versus struct {int32_t v[4];}?
I know this is going to implementation specific, so my question ultimat...
In Douglas Crockford's JavaScript: The Good Parts he recommends that we use functional inheritance. Here's an example:
var mammal = function(spec, my) {
var that = {};
my = my || {};
// Protected
my.clearThroat = function() {
return "Ahem";
};
that.getName = function() {
return spec.name;
...
I have a bunch of XML files that are about 1-2 megabytes in size. Actually, more than a bunch, there are millions. They're all well-formed and many are even validated against their schema (confirmed with libxml2).
All were created by the same app, so they're in a consistent format (though this could theoretically change in the future)....
I am trying to figure out just how "efficient" my server-side code is.
Using start and end microtime(true) values, I am able to calculate the time it took my script to run.
I am getting times from .3 - .5 seconds. These scripts do a number of database queries to return different values to the user.
What is considered an efficient exec...
hi,
to be honest, I don't really know what the "small green men" in my cpu and compiler do, so I sometimes would like to know :).
Currently I would like to know what's faster, so that I can design my code in a more efficient way.
So for example I want to calclate something at different points in my sourcecode, when will it be faster to...
I've got the entire contents of a text file (at least a few KB) in string myStr.
Will the following code create a copy of the string (less the first character) in memory?
myStr = myStr[1:]
I'm hoping it just refers to a different location in the same internal buffer. If not, is there a more efficient way to do this?
Thanks!
Note: I'...
Let's say I've got:
Dim los1 as New List(Of String)
los1.Add("Some value")
Dim los2 as New List(Of String)
los2.Add("More values")
What would be the most efficient way to combine the two into a single List(Of String)?
Edit: While I love the solutions everyone has provided, I probably should have also mentioned I'm stuck using the .N...
As a learning exercise I'm trying to put myself a blogging system.
The goal is to code something that will let me create multiple blogs, like blogger.com or wordpress.com, but much simplified.
I would like to ask you, what do you think is best database design for this type of script.
Is it better to have one big table, containing po...
I'm trying to create a large XML tree in R. Here's a simplified version of the code:
library(XML)
N = 100000#In practice is larger 10^8/ 10^9
seq = newXMLNode("sequence")
pars = as.character(1:N)
for(i in 1:N)
newXMLNode("Parameter", parent=seq, attrs=c(id=pars[i]))
When N is about N^6 this takes about a minute, N^7 takes about f...
I'm trying to adopt some best practices to keep my python code efficient. I've heard that accessing a member variable inside of a loop can incur a dictionary lookup for every iteration of the loop, so I cache these in local variables to use inside the loop.
My question is about the loop statement itself... if I have the following class:...
I've done a small experiment as will be shown below and it looks like that a while loop is faster than a for loop in Perl. But since the experiment was rather crude, and the subject might be a lot more complicated than it seems, I'd like to hear what you have to say about this.
Thanks as always for any comments/suggestions :)
In the fo...