language-agnostic

Describing the Relationship for Each Combination of Objects (Language-Agnostic)

I need to describe a two-combination of objects. I am trying to describe reciprocal relationships for these objects based on a list of criteria. Think of it this way: I have, say, 3 football players: Andy, Ben, and Charles. For each combination, they are compared with a list of criteria: physical, tactical, skill. The comparison is simpl...

When is a good time to start thinking about scaling?

I've been designing a site over the past couple days, and been doing some research into different aspects of scaling a site horizontally. If things go as planned, in a few months (years?) I know I'd need to worry about scaling the site up and out, since the resources it would end up consuming would be huge. So, this got me to thinking,...

Can knowing C actually hurt the code you write in higher level languages?

The question seems settled, beaten to death even. Smart people have said smart things on the subject. To be a really good programmer, you need to know C. Or do you? I was enlightened twice this week. The first one made me realize that my assumptions don't go further than my knowledge behind them, and given the complexity of software ru...

Finding smallest angle between vectors in logarithmic time.

I have n=10000 10-dimensional vectors. For every vector v1 I want to know the vector v2 that minimizes the angle between v1 and v2. Is there a way to solve this problem faster than O(n^2)? ...

What is the difference between a Map and a Dictionary?

What is the difference between a Map and a Dictionary? I am not asking for how they are defined in language X or Y(which seems to be what generally people are asking here on SO), I want to know what is their difference in theory. I know a Map is an object that maps keys to values. Isn't a Dictionary the same? Thanks ...

Programming practice

I've decided to get some experience working on some project this summer. Due to local demand on market I would prefer to learn Java (Standard and Enterprise Editions). But I can't even to conjecture what kind of project to do. Recently I had some ideas about C. With C I could to contribute to huge Linux projects. I don't mean that my wo...

int i vs int index etc. Which one is better?

Possible Duplicates: Is a variable named i unacceptable? What is an ideal variable naming convention for loop variables? Coming from a C background I've always used int i for generic loop variables. Of course in big nested loops or other complex things I may use a descriptive name but which one had you rather see? int i; f...

How do software events work internally?

Hello! I am a student of Computer Science and have learned many of the basic concepts of what is going on "under the hood" while a computer program is running. But recently I realized that I do not understand how software events work efficiently. In hardware, this is easy: instead of the processor "busy waiting" to see if something hap...

Does installation occur during runtime, or during compile time?

According to published books suitable for a Wikipedia reference: Does installation occur during runtime, or during compile time? 'a "run-time error" is detected after or during the installation or copying of the program' -- Wikipedia ...

When did you feel comfortable with programming?

I've been programming for about 6 months, but i still feel like i haven't learned anything. Or maybe i'm overwhelmed by the things i still don't know. Am i doing something wrong here or is this normal? I want to be able to work as a freelancer in a year or two, but i'm not sure if that goal is achievable. So when did you feel comfortab...

How is spin lock implemented under the hood?

This is a lock that can be held by only one thread of execution at a time. An attempt to acquire the lock by another thread of execution makes the latter loop until the lock is released. How does it handle the case when two threads try to acquire the lock exactly the same time? I think this question also applies to variou...

File Fix-it codegolf (GCJ 2010 1B-A)

Last year (2009), the Google Code Jam featured an interesting problem as the first problem in Round 1B: Decision Tree As the problem seemed tailored for Lisp-like languages, we spontaneously had an exciting codegolf here on SO, in which a few languages managed to solve the problem in fewer characters than any Lisp variety, using quite a...

Embedded "Smart" character LCD driver. Is this a good idea?

I have an embedded project that I am working on, and I am currently coding the character LCD driver. At the moment, the LCD driver only supports "dumb" writing. For example, let's say line 1 has some text on it, and I make a call to the function that writes to the line. The function will simply seek to the beginning of the line and wri...

What is the difference between these two nloglog(n) sorting algorithms? (Andersson et al., 1995 vs. Han, 2004)

Swanepoel's comment here lead me to this paper. Then, searching for an implementation in C, I came across this, which referenced another paper on an algorithm described here. Both papers describe integer sorting algorithms that run in O(nloglog(n)) time. What is the difference between the two? Have there been any more recent findings ...

Deal with undefined values in code or in the template?

I'm writing a web application (in Python, not that it matters). One of the features is that people can leave comments on things. I have a class for comments, basically like so: class Comment: user = ... # other stuff where user is an instance of another class, class User: name = ... # other stuff And of course in my...

Why optional parameters must appear at the end of the declaration

In all programming languages supporting optional parameters that I have seen there is a imitation that the optional parameters must appear at the end of the declaration. No required parameters may be included after an optional item. What is the reason for that ? I guess it can be compiler/interpreter requirement. ...

Highly efficient filesystem APIs for certain kinds of operations

I occasionally find myself needing certain filesystem APIs which could be implemented very efficiently if supported by the filesystem, but I've never heard of them. For example: Truncate file from the beginning, on an allocation unit boundary Split file into two on an allocation unit boundary Insert or remove a chunk from the middle of...

Basis for claim that the number of bugs per line of code is constant regardless of the language used

I've heard people say (although I can't recall who in particular) that the number of bugs per line of code is roughly constant regardless of what language is used. What is the research that backs this up? Edited to add: I don't have access to it, but apparently the authors of this paper "asked the question whether the number of bugs pe...

Valid HTTP header? `GET /page.html Http1.0`?

Ok so I've been reading up on HTTP and found this page. This is an example HTTP request that was posted there: GET /http.html Http1.1 Host: www.http.header.free.fr Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, Accept-Language: Fr Accept-Encoding: gzip, deflate User-Agent: Mozilla/4.0 (compatible; MSIE 5.5; Windows NT 4.0...

what is the difference between round() & trunc() function?

I am very confused about these functions? ...