language-agnostic

Staying Relevant As a Programmer

I am interested in hearing how various people remain in the Software Engineering industry for so long in their careers. I am at a crossroads myself as I have worked with Network Engineering, Communications, VoIP, Parking, Government Contracting, and Military related projects. Question: How does one manage to stay relevant as a programme...

What language will protect my source code?

I wish to create shareware software that contains a registration algorithm. I am looking for a programming language, that cannot be easily decompiled into readable code. For example, C# can be decompiled into readable code. What are my options? Edit: I'm looking for something that can be only decompiled into assembly. Delphi, for exa...

Library for Creating Animated Presentations

Is there any library for creating animated presentations? Although the question is language-agnostic, I'm specifically biased towards WPF, yet I wouldn't mind you giving examples of libraries for any other language, or a visualization language of some sort. ...

Law of Demeter violation proves useful. Am I missing something?

I have some code like this in my application. It writes out some XML:- public void doStuff( Business b, XMLElement x) { Foo f = b.getFoo(); // Code doing stuff with f // b is not mentioned again. } As I understand it, the Law of Dementer would say this is bad. "Code Complete" says this is increasing coupling. This method s...

Why programming languages do not include spaces in the method "identifiers"?

This may seem like a dumb question, but still I don't know the answer. Why do programming languages do not include spaces in the names ( for instance method names )? I understand it is to facilitate ( allow ) the parsing, and at some point it would be impossible to parse anything if spaces were allowed. Nowadays we are so use to it ...

Data Access object: Singleton or many small ones?

When developing an application (web, win, whatever) which does alot of data access, is it better to keep your data access object open for the length of the request (i.e. do many things in a row, then close it when you finish), or keep opening and closing new ones? protected aDataContext dc = new aDataContext(); vs private aObject Get...

Code Golf: Ulam Spiral

The Challenge The shortest code by character count to output Ulam's spiral with a spiral size given by user input. Ulam's spiral is one method to map prime numbers. The spiral starts from the number 1 being in the center (1 is not a prime) and generating a spiral around it, marking all prime numbers as the character '*'. A non prime wi...

Calculate percent at runtime

I have this problem where I have to "audit" a percent of my transtactions. If percent is 100 I have to audit them all, if is 0 I have to skip them all and if 50% I have to review the half etc. The problem ( or the opportunity ) is that I have to perform the check at runtime. What I tried was: audit = 100/percent So if percent is...

Using magic strings or constants in processing punctuation?

We do a lot of lexical processing with arbitrary strings which include arbitrary punctuation. I am divided as to whether to use magic characters/strings or symbolic constants. The examples should be read as language-independent although most are Java. There are clear examples where punctuation has a semantic role and should be identifi...

Graph Theory: Find the Jordan center?

I'm trying to find the set of vertices that minimizes their distance to other vertices on a weighted graph. Based on a cursory wikipedia search, I think that this is called the Jordan Center. What are some good algorithms for finding it? Right now, my plan is to get a list of the weight for each branch emanating from a given vertex. The...

What kind of learning algorithm would you use to build a model of how long it takes a human to solve a given Sudoku situation?

I don't have much experience in machine learning, pattern recognition, data mining, etc. and in their underlying theory and systems. I would like to develop an artificial model of the time it takes a human to make a move in a given Sudoku puzzle. So what I'm looking for as an output from the machine learning process is a model that can...

Algorithm to implement kinetic scrolling

What are the good algorithms to apply to kinetic scrolling implementation? The feature would be tested on custom UI list. While I am targeting mobile devices (those that do not have this feature built-in), any algorithm or code example from different programming field may also suit. Thank you. ...

General strategy for finding the cause of random freezes?

I have a application which randomly freezes, including the IDE and it's driving me mad. That makes me wonder: What's a good general strategy for finding the cause of random freezes? ...

Enhancements to programming languages that had to be withdrawn after release?

Are there examples of significant enhancements to major programming languages that were fully released and then found to be sufficiently flawed that they had to be withdrawn? UPD @Jeff Foster has an example of a feature that is not consistently implemented and I'd take those as answers UPD There is a grey area between Deprecated and w...

Undo/Redo with immutable objects

I read the following in an article Immutable objects are particularly handy for implementing certain common idioms such as undo/redo and abortable transactions. Take undo for example. A common technique for implementing undo is to keep a stack of objects that somehow know how to run each command in reverse (the so-call...

Is it any way to implement a linked list with indexed access too?

I'm in the need of sort of a linked list structure, but if it had indexed access too it would be great. Is it any way to accomplish that? EDIT: I'm writing in C, but it may be for any language. ...

Rethrowing exception question

I read several posts on exception handling/rethrowing exceptions on here (by looking at the highest voted threads), but I am slightly confused: -Why would you not want the immediate catch block to handle an exception but rather something above it? -Also, I read quite frequently that you should only handle exceptions which you can "hand...

What's wrong with type classes?

Type classes seem to be a great possibility to write generic and reusable functions in a very consistent, efficient and extensible way. But still no "mainstream-language" provides them - On the contrary: Concepts, which are a quite analogical idea, have been excluded from the next C++! What's the reasoning against typeclasses? Apparentl...

OOP: When is it an object?

I'm trying to understand object orientation. I understand it a little bit of course, but sometimes I'm not 100% clear. How do you decide what should be turned into an object (small object part of another big whole object) or what is not worth being an object, or maybe it should be just a property of that big whole object? For a door, I...

How can I generate this pattern of numbers?

Given inputs 1-32 how can I generate the below output? in. out 1 1 1 1 2 2 2 2 1 1 1 1 2 2 2 2 ... Edit Not Homework.. just lack of sleep. I am working in C#, but I was looking for a language agnostic algorithm. Edit 2 To provide a bit more background... I have an array of 32 items that represents a two dimensional checkerboard. I...