language-agnostic

Space efficiency of algorithms...

It seems like none of the algorithm textbooks mentions about space efficiency as much, so I don't really understand when I encounter questions asking for an algorithm that requires only constant memory. What would be an example of a few examples of algorithms that uses constant memory and algorithms that doesn't use constant memory? ...

Dangers of Implementing Programming Frameworks into Project Source Code Prior to Release Candidate Status?

I've been dwelling on this topic for a long time now. I just wondered if anyone else out there shared my opinion. Isn't it essentially a bad idea integrating preview versions of programming frameworks into your project code before they are at release candidate level?! I had a situation a few months ago where my boss insisted on using th...

Opinions on using My as a class name prefix

Personally, I've never liked the MyObject naming of classes. I would guess that the status quo would agree but I'd like to see the other side of the argument and if there's any validity to it. ...

Socket throttling because client not reading data fast enough?

I have a client/server connection over a TCP socket, with the server writing to the client as fast as it can. Looking over my network activity, the production client receives data at around 2.5 Mb/s. A new lightweight client that I wrote to just read and benchmark the rate, has a rate of about 5.0Mb/s (Which is probably around the max ...

Optional vs. mandatory terminators in context-free grammar definition

In a book chapter about compilers, there's the following grammar definition and example code. ... statement: whileStatement | ifStatement | ... // Other statement possibilities | '{' statementSequence '}' whileStatement: 'while' '(' expression ')' statement ifStatement: ... // Definition of "if" statemen...

Is GPGPU a hack ?

Hello Folks, I had started working on GPGPU some days ago and successfully implemented cholesky factorization with good performacne and I attended a conference on High Performance Computing where some people said that "GPGPU is a Hack". I am still confused what does it mean and why they were saying it hack. One said that this is hack b...

Should persistent objects validate data upon set?

If one has a object which can persist itself across executions (whether to a DB using ORM, using something like Python's shelve module, etc), should validation of that object's attributes be placed within the class representing it, or outside? Or, rather; should the persistent object be dumb and expect whatever is setting it's values t...

Find out running on XP embedded

Is there a way to find out if my program is running on XP embedded? I've tried .NET System.Environment.OSVersion, but the version information looks like that of a "normal" Windows XP, except for the minor version number, and relying on that seems to fragile to me. ...

How to plan huge software projects?

We've started a huge project. We know what it has to look like but not how to implement it. We started by writing prototypes to test different implementations. What we're lacking is the overview of the overall development progress. We don't know if we spend too much time on details or if those details are important enough to spend the ti...

Matching hours/minutes/seconds in regular expressions - a better way?

So I need to get hours, minutes and seconds out of entries like these: 04:43:12 9.43.12 1:00 01.04 59 09 The first two is hours, minutes and seconds. Next to is minutes and seconds. Last two is just seconds. And I came up with this regexp, that works..: \A(?<hours>\d{1,2})(?::|\.)(?<minutes>\d{1,2})(?::|\.)(?<seconds>\d{1,2})\z|...

Could someone explain the math behind how this cube-rotating script works?

If you go to the following link you'll see a really cool Javascript simulation of a cube that rotates based on your mouse position. Simulation: here. If you view the source of the cube rotating script you'll see: <script type="text/javascript"> /* I wrote this script in a few minutes just for fun. It's not made to win any compe...

Optimizing cartesian requests with affine costs

Hello, I have a cost optimization request that I don't know how if there is literature on. It is a bit hard to explain, so I apologize in advance for the length of the question. There is a server I am accessing that works this way: a request is made on records (r1, ...rn) and fields (f1, ...fp) you can only request the Cartesian prod...

Is there a generally available HTTPS POST smoke test?

When debugging an HTTP client, one of your first tests is likely to be a Google search, which lets you see whether your client does non-SSL GETs properly. Everyone knows where it is, everyone can use it, and everyone can see whether it succeeded. My client has a problem with HTTPS POST. I can reproduce it locally with my specially set...

How could this manner of writing code be called?

I'm reviewing a quite old project and see code like this for the second time already (C++ - like pseudocode): if( conditionA && conditionB ) { actionA(); actionB(); } else { if( conditionA ) { actionA(); } if( conditionB ) { actionB(); } } in this code conditionA evaluates to the same result on both compu...

How to change the background of an image with transparent pixels?

The exact background color is known. Imagine an anti-aliased font on a green background. Now we want to change the background color of the image to red. So.. How do I extract the "non-background" portion of the color from the pixel and add it (or "blend") on top of another bg color afterwards? We also know the font color, so we know w...

Code Golf: Seven Segments

The challenge The shortest code by character count to generate seven segment display representation of a given hex number. Input Input is made out of digits [0-9] and hex characters in both lower and upper case [a-fA-F] only. There is no need to handle special cases. Output Output will be the seven segment representation of the inpu...

How do you let others trust your code and use it?

I write hobby code from time to time. The thing is these tools, classes or tiny libraries of code end up in a flash stick with hopeless future! I would love to develop my projects further, and let other programmers trust them. If you were going to use something you found on the Internet, what is the most important thing you look for in t...

The importance of learning a lower level language

Possible Duplicates: Am I wasting my time learning C and other low level stuff ? Is knowing some basic low-level stuff essential to all programmers? Lots of people recommend to me learning a low-level programming such as Forth, C, or even Assembler, but I'm still a little uncertain of the actual importance of learning a low-le...

Have you attempted a refactoring only to give up on it?

I recently attempted a large refactoring (yes I know smaller increments and unit testing along the way is preferred) that I just had to walk away from. It's not that I couldn't have done it, but I realized that the time to do it right wasn't justified in the business sense. Normally I am one to tackle refactoring with no fear because of ...

Weighted, load-balancing resource scheduling algorithm

A software application that I'm working on needs to be able to assign tasks to a group of users based on how many tasks they presently have, where the users with the fewest tasks are the most likely to get the next task. However, the current task load should be treated as a weighting, rather than an absolute order definition. IOW, I need...