language-agnostic

Fastest way to get value of pi

Solutions welcome in any language. :-) I'm looking for the fastest way to obtain the value of pi, as a personal challenge. More specifically I'm using ways that don't involve using #defined constants like M_PI, or hard-coding the number in. The program below tests the various ways I know of. The inline assembly version is, in theory, th...

Function for creating color wheels

This is something I've pseudo-solved many times and never quite found a solution that's stuck with me. The problem is to come up with a way to generate N colors that are as distinguishable as possible where N is a parameter....

When to use unsigned values over signed ones?

So I hear a lot of opinions about this, and I wanted to see if there was anything resembling a consensus. When is it appropriate to use an unsigned variable over a signed one? What about in a for loop? for (unsigned int i = 0; i < someThing.length(); i++) { SomeThing var = someThing.at(i); // You get the idea. } As I said, I...

Generate list of all possible permutations of a string

How would I go about generating a list of all possible permutations of a string between x and y characters in length, containing a variable list of characters. Any language would work but it should be portable....

What is your solution to the FizzBuzz problem?

See here Write a program that prints the numbers from 1 to 100. But for multiples of three print "Fizz" instead of the number and for the multiples of five print "Buzz". For numbers which are multiples of both three and five print "FizzBuzz". Disclaimer: I do realize this is easy, and I understand the content of the Coding Horror post ...

The Definitive Guide To Website Authentication

Form Based Authentication For Websites Please help us create the definitive resource for this topic. We believe that stackoverflow should not just be a resource for very specific technical questions, but also for general guidelines on how to solve variations on common problems. "Form Based Authentication For Websites" should be a fine t...

What books would you recommend for a beginning Software Developer?

Post answers with the author/book pair. Let's keep it language-neutral. Here's the Coding Horror Recommended Reading list Edit: Related Stackoverflow Question What is the Single Most Influential Book Every Programmer Should Read...

Using combinations of sets as test data

I'd like to be able to test a function with a tuple from a set of fringe cases and normal values. For example, in testing a function that returns true when given three lengths that form a valid triangle, I'd have specific cases, negative numbers, small numbers, large numbers, values close-to being overflowed, etcetera. Then generating co...

GUI Programming APIs

Alright, this is a rather odd question that doesn't have one true answer: What is the * Best || Easiest to Use || Most Powerful || Cleanest * GUI API or library (tk, SWING, Qt, etc.) you have had the privilege to use? I've had conversations with friends about how annoying XYZ API was to deal with and how someone could build a bette...

Format string to title case

How do I format a string to title case?...

Efficiently get sorted sums of a sorted list

You have an ascending list of numbers, what is the most efficient algorithm you can think of to get the ascending list of sums of every two numbers in that list. Duplicates in the resulting list are irrelevant, you can remove them or avoid them if you like. To be clear, I'm interested in the algorithm. Feel free to post code in any la...

Internationalization in your projects

How have you implement Internationalization (18n) in actual projects you've worked on? I took an interest in making software cross-cultural after I read the famous post by Joel, The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!). However I have yet to able to take...

A little diversion into floating point (im)precision, part 1

Most mathematicians agree that e ** (πi) + 1 = 0. However, most floating point implementations disagree. How well can we settle this dispute? I'm keen to hear about different languages and implementations, and various methods to make the result as close to zero as possible. Be creative! ...

Windows Help files - what are the options?

Back in the old days, Help was not trivial but possible: generate some funky .rtf file with special tags, run it through a compiler, and you got a WinHelp file (.hlp) that actually works really well. Then, Microsoft decided that WinHelp was not hip and cool anymore and switched to CHM, up to the point they actually axed WinHelp from Vis...

Followup: Finding an accurate "distance" between colors

Original Question I am looking for a function that attempts to quantify how "distant" (or distinct) two colors are. This question is really in two parts: What color space best represents human vision? What distance metric in that space best represents human vision (euclidean?) ...

Followup: "Sorting" colors by distinctiveness

Original Question If you are given N maximally distant colors (and some associated distance metric), can you come up with a way to sort those colors into some order such that the first M are also reasonably close to being a maximally distinct set? In other words, given a bunch of distinct colors, come up with an ordering so I can use a...

How can I modify .xfdl files? (Update #1)

The .XFDL file extension identifies XFDL Formatted Document files. These belong to the XML-based document and template formatting standard. This format is exactly like the XML file format however, contains a level of encryption for use in secure communications. I know how to view XFDL files using a file viewer I found here. I can also ...

Learning to write a compiler

Preferred Languages : C/C++, Java, and Ruby I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Java, and Ruby so I prefer resources that involve one of those three, but any good resource is acceptable. ...

Writing A "Conway's Game of Life" Program

Alright, so I've always wanted to write myself a nice little Game of Life program where you could play with the rules and adjust the number of cells and such; I've just never really had the time to mess around to do this (until recently). I understand the basic algorithm and such (if you don't, go to the Game of Life Wikipedia page to c...

Could you recommend a good free project hosting website?

Something like Google Code or SourceForge, but for closed source projects and better access management. Found links to these 3 on a forum: https://opensvn.csie.org/ SVN https://www.freepository.com/ CVS http://devjavu.com/ - SVN Anyone had any experience with them?...