language-agnostic

What is a good way to manage a list?

I always have trouble designing the user interface when it come to manage a list of object. For example, I need to manage a list of employees. At my work, we always switched between two method of managing the employees: Use a single split screen with the left part being the list of employee, and the right part being the place where yo...

How can I delete fonts from my code, under Windows?

This article showed me how to install fonts from a script, but now I'm faced with the problem of removing them. How can I do that ? Any language is ok, I'll convert the info to what I need later. EDIT: Okay, so I now know how to uninstall fonts ( most of the part at least ). I'm issuing calls to RemoveFontResource. After that I use Send...

Algorithm to optimize parameters based on imprecise fitness function

I am looking for a general algorithm to help in situations with similar constraints as this example : I am thinking of a system where images are constructed based on a set of operations. Each operation has a set of parameters. The total "gene" of the image is then the sequential application of the operations with the corresponding param...

Please recommend the dictionary application or the file format to start with.

I want to write a simple application like the "stardict" (but not so huge), that searches for the phrase in the dictionary and provides the corresponding value. I guess that it is kind of "bicycle" and that it was done many times by different people... But the thing is that all the suitable open software, that is available in the web ...

MVC: pass model / model data to a view from a controller?

If a view needs to acces data from a model, do you think the controller should: a) pass the model to the view b) pass the data of the model to the view c) neither; it shouldn't be the controllers concern. Let the view access the model directly to retrieve the data. Only let the controller give some parameters the view needs to filter th...

MVC beginner question - editing many-to-many relations

I'm using CakePHP to build an application using the MVC Pattern, but my question is language agnostic, I guess. Here's an overview of a part of my data: ITEMS (id, name, description) LOCATIONS (id, name) The items table describes a type of item ("apple", "orange", "banana"), not individual items. Each location can have any number of...

why can't conditional operator be used as a statement

Why can't the conditional operator be used as a statement? I would like to do something like: boolean isXyz = ...; ... isXyz ? doXyz() : doAbc(); where doXyz and doAbc are return void. Note that this is not the same as other operators, for example doXyz() + doAbc() intrinsically needs that doXyz and doAbc return a number-like someth...

How does it know where my value is in memory?

When I write a program and tell it int c=5, it puts the value 5 into a little bit of it's memory, but how does it remember which one? The only way I could think of would be to have another bit of memory to tell it, but then it would have to remember where it kept that as well, so how does it remember where everything is? ...

Code Golf: The wave

The challenge The shortest code by character count to generate a wave from the input string. A wave is generated by elevating (line-1) a higher character, and degrading (line+1) a lower character. Equal characters are kept on the same line (no elevating or degrading done). Input is made of lower case characters and numbers only, lett...

Can you programmatically detect pluralizations of English words, and derive the singular form?

The title says it all: Given some (English) word that we shall assume is a plural, is it possible to derive the singular form? I'd like to avoid lookup/dictionary tables if possible. Some examples: Examples -> Example a simple 's' suffix Glitch -> Glitches 'es' suffix, as opposed to above Countries -> Country 'ies' suffix....

A searchable heap structure

The problem is to access a series of values by two different methods. First, by priority; that is implemented simply enough with a heap. Additionally, it must be possible to "tag" each value with one or more symbols through which a list of items may be accessed. This would be easy enough to implement efficiently by referencing the same ...

Are there any protocols/standards on top of TCP optimized for high throughput and low latency?

Are there any protocols/standards that work over TCP that are optimized for high throughput and low latency? The only one I can think of is FAST. At the moment I have devised just a simple text-based protocol delimited by special characters. I'd like to adopt a protocol which is designed for fast transfer and supports perhaps compress...

i18n Validations

Think Global, Act Local That's what they tell you, however during all my time as I developer I've always seen big companies like Google, Microsoft, Oracle and so do validations in a localized manner: they know which country I'm from so they will try to validate my phone number, postal code and other details such as bank account numb...

Fastest way to write string on Windows?

What would be the absolute fastest possible way to write a string to the standard/console output on Windows? I'm interested in the solution for both null- and non-null-terminated strings. ...

Fullstack or Glue web framework?

Working in web development we see numerous amount of web frameworks growing everyday. We also see people comparing framework X vs framework Y. But technically they all boil down to two types: fullstack or just a glue webframework. A fullstack web framework is a web framework that offers front to back framework. Django and RIFE can bee s...

Simple Deadlock Examples

Hello, I would like to explain threading deadlocks to newbies. I have seen many examples for deadlocks in the past, some using code and some using illustrations (like the famous 4 cars). There are also classic easily-deadlocked problems like The Dining Philosophers, but these may be too complex for a real newbie to fully grasp. I'm loo...

Benchmarking: When can I stop making measurements?

I have a series of functions that are all designed to do the same thing. The same inputs produce the same outputs, but the time that it takes to do them varies by function. I want to determine which one is 'fastest', and I want to have some confidence that my measurement is 'statistically significant'. Perusing Wikipedia and the inte...

Is it possible to construct a turing-complete language in which every string is a correct program?

Is it possible to construct a turing-complete language in which every string is a correct program? Any examples? Even better, any real-world examples? Precisions: by "correct" I mean "compiles", although "runs without error" and "runs without error, and finishes in finite time" would be interesting questions too :) By string I mean an...

Syntactic sugar vs. feature

In C# (and Java) a string is little more than a char array with a stored length and a few methods tacked on. Likewise, (reference vs. value stuff aside) objects are little more than glorified structs with inheritance and interfaces added. On one level, these additions feel like clear features and enhancements unto themselves. On another...

What data structures can efficiently store 2-d "grid" data?

I am trying to write an application that performs operations on a grid of numbers, where each time a function runs the value of each cell is changed, and the value of each cell is dependent on its neighbours. The value of each cell would be a simple integer. What would be the best way of storing my data here? I've considered both a flat...