Best practices, structuring of code, dissecting algorithms and talking about the “Why?”
So I was tinkering around with some code and thought "Hey, wouldn't it be great to create a class that could be used to tie into bit.ly's API for shortening URLs?" After having this thought I also thought "I am hungry" so went to get some lunch. Then when I came back, I got to work putting together a quick class that a programmer could use in their projects for ...
Almost on a daily basis we run across posts that ask about using a .NET language to read and update a database. Oh it might have a slight variation like "How do I load a value from a database into a textbox?" or "How do I read a database into _______ control and then update the database?" So I figured I would put a few little snippets here to show ...
A user recently came up with an interesting project today that frankly I had never really played around with too much... playing sound clips using Java's AudioSystem. The problem he was having was two fold actually. How does one go about throttling a sound (preventing the user from triggering the sound multiple times so that they overlap themselves and causing a scrambled mess that sounds like spirits you would hear ...
The basic idea of a function was to give it information and have it return a single value as a result. That result could have been an integer or a float or even an object or struct. On that principle alone many great programs have been made. However, there came a need for returning multiple values from a function. Sometimes the function not only needed to return a single value ...
The Johnson-Trotter algorithm is an algorithm for figuring out permutations given a value set. A permutation is a way of altering the values in a set to create a different unique sequence from the original. If we have the set 1, 2, 3, 4, 5... one permutation would be 2, 1, 4, 5, 3 and another would be 3, 4, 2, 1, 5. Using a quirky little algorithm, we can ...
So I am cruising around the Dream.In.Code boards when I stumble across an interesting post about creating a shapes tool for a graphics Java program. If you are unfamiliar with the shapes tool, the idea is that you click a button, select a shape and then draw the shape onto some window of the program. Select a square, an ellipse or some fancy star and KAPOWY! you have a masterpiece ...