language-agnostic

Is a Class special when it has no members?

I just realize some of my classes have no members. It has several public functions and maybe private functions and everything is passes through params. I realize functional programmers do this all the time but is this class considered special if it access nothing outside of the class and only uses its params for reading (except for out p...

should i allow user to change email when using email as username?

I am using the email address as a username and am allowing users to change their email... which obviously also changes their login. Is there any reason why allowing this flexibility would be a problem? users are tracked with userid. thanks ...

Application to help explain a GUI

When a graphical user interface is documented, it usually include a screenshot. In the screenshot different buttons and interactive objects are marked with a letter and below, in a list, its explained what the "button marked with a red A" actually does. I currently do this myself in Paint .Net, its really hard to make it look even decen...

What are some unusual languages you have used for a CGI application?

I'm sure we (I'm referring to web developers) have at one time or another used a web scripting language like php, perl, python, or asp. But, we know you can also write cgi applications in languages like C. So, has anyone used an unusual language for writting CGI applications? By unusual, I mean a language that is not generally known fo...

Is my understanding of type systems correct?

The following statements represent my understanding of type systems (which suffers from too little hands-on experience outside the Java world); please correct any errors. The static/dynamic distinction seems pretty clear-cut: Statically typed langauges assign each variable, field and parameter a type and the compiler prevents assignme...

How do I explain APIs to a non-technical audience?

A little background: I have the opportunity to present the idea of a public API to the management of a large car sharing company in my country. Currently, the only options to book a car are a very slow web interface and a hard to reach call center. So I'm excited of the possiblity of writing my own search interface, integrating this func...

throw new exception vs writing message back to user (avoiding exception)

I see a lot of code written where an exception is thrown if a parameter is not in the right form, or whatever. Basically "throw new ...". What is the benefit of this? The exception can be avoided by checking the parameters (Eg if null, write message back to webpage/winform). Why is this approach not used when an exception is expensive? ...

Does ORM for social networking sites makes any sense?

The reason why I ask this is because I need to know whether not using ORM for a social networking site makes any sense at all. My argument why ORM does not fit into social networking sites are: Social networking sites are not a product, thus you don't need to support multiple database. You know what database to use, and you most likel...

How to encapsulate image files into emails ?

Hi, Can someone explain me how to create "simple" email with embedded images files ? I know that there are tons of RFC that explain it but I don't really succeeded to do it. I have to build the body text of the email programmatically, without using any framework. Don't ask me about the language is used... Images are base64 encoded. Co...

How do you search through your own libraries of source code?

I write/modify code in multiple file formats like perl, html, css, php, javascript, autohotkey script, ... etc. I often search my personal library of source code for examples of syntax or complex logic for reuse in new code. Or, I will search through a directory tree for code references to a particular string (e.g. all references to a p...

What are the most important structured software design principles?

Today I saw a job description that requires "significant experience coding in C++ and a thorough grounding in structured design principles", so I thought about what these principles are. First I felt it was a little odd to see C++ and "structured design" in one sentence, then I thought, OK C++ is a multi-paradigm programming language, so...

What are the advantages of Lazy Evaluation?

What advantages are there to Lazy Evaluation as opposed to Eager Evaluation? What performance overhead is there? Is Lazy Evaluation going to be slower or faster? Why(or does it depend on implementation?)? How does lazy evaluation actually work in most implementations? To me it would seem like it would be much slower and memory intensiv...

Algorithm for a strategy game

This is a question I have been toying with for a week or so, proposed by a colleague: Imagine a game played on a 36x36 grid. The goal of the game is to create four corners of a square of any size (eg., 2x2, 3x3, 4x4, and so on). The first player places a game-piece anywhere except the center four grid spaces. After the first move, p...

US Government APIs?

I'm working on an app to provide an easy way for people to track the status of a bill [and various other political information]. I love the idea of OpenCongress, for instance, which surfaces summary information on legislation as it navigates the political process, but I'd like it if it had a tag-based search system and some other rich s...

Functions for value intervals

I'm currently dealing with a lot of possibly indefinite date spans, ie. StartDate EndDate --------- --------- 01JAN1921 31DEC2009 10OCT1955 null ... where the other end of the interval might be unknown or not defined. I've been working on little functions for detecting overlap, whether an interval is a subinterval of a...

Reading Source Code Aloud

After seeing this question, I got to thinking about the various challenges that blind programmers face, and how some of them are applicable even to sighted programmers. Particularly, the problem of reading source code aloud gives me pause. I have been programming for most of my life, and I frequently tutor fellow students in programming,...

Is is ever appropriate to put functionality in a DTO?

Is it ever appropriate to put functionality other than basic setters and getters in a DTO? ...

What is the reason for using the page's header as a link to itself?

I noticed many web sites use <h1><a href="/subdir/somepage/">bla bla</a></h1> in the page example.com/subdir/somepage/ Why do they do that? SEO? Compliance to some standard I don't know? Does it really help users in any way? EDIT: after many of the answers obviously misunderstood me. I'm not talking about a link to the homepage of t...

Splitting an rgb uint into its seperate r g b components

I have an rgb colour stored as an uint. I can create this from the rgb values using the bitwise left and bitwise or opperator in an expression like this: colour = r<<16 | g<<8 | b; I want to do the opposite. I have the final number and I want the r, g and b values. Does anyone know how to do this? ...

What is the term for this (UML?) diagram and what program can make it?

The question is pretty self-explanatory. Is there a technical name for that diagram? Is it considered UML? Second of all, what sort of program might have been used to generate it? I'd like to make one of my own. I'm running Windows 7, but suggestions for programs on other operating systems are welcome too. ...