language-agnostic

Programmatically Lighten a Color

Motivation I'd like to find a way to take an arbitrary color and lighten it a few shades, so that I can programatically create a nice gradient from the one color to a lighter version. The gradient will be used as a background in a UI. Possibility 1 Obviously I can just split out the RGB values and increase them individually by a certa...

How would you store and query hours of operation?

We're building an app that stores "hours of operation" for various businesses. What is the easiest way to represent this data so you can easily check if an item is open? Some options: Segment out blocks (every 15 minutes) that you can mark "open/closed". Checking involves seeing if the "open" bit is set for the desired time (a bit lik...

Which games include coding in gameplay?

One title per answer. ...

What are some good strategies to allow deployed applications to be hotfixable?

In an ideal world, our development processes would be perfect, resulting in regular releases that were so thoroughly tested that it would never be necessary to "hotfix" a running application. But, unfortunately, we live in the real world, and sometimes bugs slip past us and don't rear their ugly heads until we're already busy coding awa...

Operating Systems that *are* the application

Conventional operating systems launch and provide services to applications. The app is like a black-box to the OS, and the app provides the UI for getting real work done with the computer. Are there any operating systems which are the other way around? Where the OS provides the UI for doing useful work with the computer, and application...

What's the best way to serialize data in a language-independent binary format?

I'm looking into a mechanism for serialize data to be passed over a socket or shared-memory in a language-independent mechanism. I'm reluctant to use XML since this data is going to be very structured, and encoding/decoding speed is vital. Having a good C API that's liberally licensed is important, but ideally there should be support f...

for-loop mechanism efficiency tips

As I am using for-loops on large multi-dim arrays, any saving on the for-loop mechanism itself is meaningful. Accordingly, I am looking for any tips on how to reduce this overhead. e.g. : counting down using uint instead of int and != 0 as stop instead of >0 allows the CPU to do less work (heard it once, not sure it is always true) ...

How to approach something complex?

You know that particular part of your code that is essential for the project but will probably take a lot of time to get it done? Do you ever get the feeling that you'd rather work on something else (probably less important) or not code at all instead of working on that part? That beast you try so hard to avoid and use every lazy trick y...

How many lines of debugged code do you produce in a day's work?

How many lines of debugged code do you produce in a day's work and what language would that be? I know some languages are a little more difficult to work with but on average, how many? ...

Near Sorting Algorithms - When to use?

From time to time I browse the web and look for interesting algorithms and datastructures to put into my bag of tricks. A year ago I came across the Soft Heap data-structure and learned about near sorting. The idea behind this is that it's possible to break the O(n log n) barrier of compare based sorts if you can live with the fact that...

What are the best resources to learn about capacity planning

For a server-side software engineer who wants to be better informed in discussions about capacity planning, what are the best resources on the Web? ...

What is the worst 'gotcha' you've experienced?

I'd like to hear some of the more pernicious 'gotchas' that exist out there. Any language, system, or library is fine. ...

What is your smallish web development company setup?

I work for a small web development company (only 2 to 3 developers) that work on a wide range of projects for different customers (everything from CMS's to eCommerce sites). Usually we work on our own projects but occasionally we need to work together on one. We use subversion as our source control software and sites are developed in ....

Generate getters and setters (Zend Studio for Eclipse)

Hi!, I'm using Zend Studio for Eclipse (Linux), and I'm trying to generate getter and setters methods in a PHP class. I try to do this: http://files.zend.com/help/Zend-Studio-Eclipse-Help/creating_getters_and_setters.htm but I haven't "Generate Getters and Setters" option in Source Menu, it's missed! Could u help me? Thanks! ...

Advantages and drawbacks of chainable methods?

I really love the philosophy of chaining methods, like jQuery emphasys in its library. I found it quite elegant and clear. Being primarily Java developper, I've always wondering myself why this practice was not more used in this language. For example, the Collection interface was not designed in the that way (for adding/removing methods...

What is the opposite of 'parse'?

I have a function, parseQuery, that parses a SQL query into an abstract representation of that query. I'm about to write a function that takes an abstract representation of a query and returns a SQL query string. What should I call the second function? ...

preconditions and exceptions

Suppose you have a method with some pre and post-conditions. Is it ok to create an exception class for each pre-condition that is not accomplished? For example: Not accomplishing pre1 means throwing a notPre1Exception instance. ...

What is a Lambda?

Could someone provide a good description of what a Lambda is? We have a tag for them and they're on the secrets of C# question, but I have yet to find a good definition and explanation of what they are in the first place. ...

Can a Sequence Diagram realistically capture your logic in the same depth as code?

I use UML Sequence Diagrams all the time, and am familiar with the UML2 notation. But I only ever use them to capture the essence of what I intend to do. In other words the diagram always exists at a level of abstraction above the actual code. Every time I use them to try and describe exactly what I intend to do I end up using so much h...

Tool for adding license headers to source files?

I'm looking for a tool that will, in bulk, add a license header to some source files, some of which already have the header. Is there a tool out there that will insert a header, if it is not already present? Edit: I am intentionally not marking an answer to this question, since answers are basically all environment-specific and subject...