Problem Solving

July 13th, 2013

Yesterday’s lesson was that the better solution to a problem usually only becomes obvious when you’re almost done solving the problem.

What To Do

July 12th, 2013

Sometimes, in fact many times, we are faced with the difficulty of what to work on. With so many projects and tasks, and so little time to complete them, it becomes as much work to decide what to do as it is to do it.

Today, I’m faced with that decision.

Do I work on the projects that I have been working on, that is a ranked and prioritized task in my current contract work list?
If I do this, then I make money, and I get one step closer to closing this project.

Do I depart from the list completely, try to take a step to freeing up time later on by working on automating some server build processes?
If I do this, then I make money, and I get to reduce the time I spend next time I have to build these servers.

Do I depart completely from paid work and instead put the time into my own project?
This would give me personal satisfaction and maybe down the road I might earn money.

Do I even want to spend this time behind the keyboard? Should I instead go do something to make the place I live a little better/cleaner?
Well, it’s house tasks, so I have to do them eventually. If I do them now, when I’m a little tired, then I can focus on work when I’m awake and rested again.

Or do I slack off and watch some TV, take a small mind vacation?
‘Nuff said about this.

It’s these decisions that we make every day. This isn’t even a developer thing, but rather just an everyone thing. We all have to make these kinds of decisions all the time, working out the benefits and costs in our head to decide where to direct the time we have.

Tonight, I think I’ll be a little productive and work on actual paid contract work.

This is part of being a contractor, working whenever you can focus enough to get some time done. And that leads into the next thing to write about.

One of the challenges we face every day is getting work done. It’s kind of different from working in an office, where just showing up is enough to get paid. As contractors, we have to focus and work, and we only get paid when we do. Sometimes it requires so much discipline to sit down and write code, to grind through the problem we are on, instead of gaming for a few more minutes, a few more hours. The benefit and the drawback of working from home is that you can do whatever you want.

Work in a towel after just stepping out of the shower because I didn’t want to put on pants? Did that.
Take a phone call and play with my cat at the same time? Have the scratches to show.
Play Minecraft for 3 hours because the code I was working on was boring and I got stuck? Absolutely.

Volumes have been written about this, about how so many people burn out doing this kind of work and have to go back to an office job.

I’m proud to say I’m a freelancer, and that I work from home.
It shows I have the discipline to keep logging hours.

Speaking of which…

Shift The Graph

February 19th, 2012

I have started working with an Arduino. For someone getting started in electronics, this device, and the community around it make it so much easier to learn. Within two minutes of plugging it in and starting the software, I was able to do something.

Fast forward a bit, this project is the first big project I have taken on. It is a 10 segment bar graph that I wired up, but now, I am moving it’s control from the 10 analog pins to some shift registers. This frees up most of the pins that I needed initially, and doesn’t make control more difficult.

A shift register is like a bucket brigade. Each bucket is one bit on the register, and as you pass it bits, the rest of them get passed one down the line. So, to control which legs of the shift register are powered and which not, I just have to pulse 1’s and 0’s into the register until I get it set the way I want. Since the LED segments are controlled by the shift register legs, they’re set by what is pulsed to the register.

If I want to have an alternating pattern, the registers contain these values
[code] [10101010] -> [10101010]
// Register 1 -> Register 2[/code]

If I were to push one more bit down the line, they would all move one step along.
[code] [01010101] -> [01010101]
// Register 1 -> Register 2[/code]

If I wanted to push the segments to all lit, the register just has to be fed 1’s.
[code] [11111111] -> [11010101]
// Register 1 -> Register 2[/code]

Part List

  • Arduino
  • 10 x 330Ω Resistors
  • 10 Segment LED bar graph or 10 x LED’s
  • 2 x 74LS164N Shift Registers (or any non-164 shift register, your wiring may be different)
  • Wires and Breadboards


  • For this project, I’m not using the reset ability of the 164, so that pin has been tied to V+.
  • There is an Arduino function called shiftOut() that would make this a little easier. I have not used it because I wanted to shift the bits myself to get a better feel for what it was doing.
  • To wire the shift registers to the Arduino, it’s pin 2 on the Arduino to the clock pin (pin 8) on the first or second shift register (since they’re both wired together), and pin 3 Arduino to data pin (pin 1) on the first shift register.

#define DATA 3
#define CLOCK 2

void setup() {
pinMode(DATA, OUTPUT);

for(int i = 0; i < 10; ++i){
digitalWrite(DATA, LOW);
digitalWrite(CLOCK, HIGH);
digitalWrite(CLOCK, LOW);

void loop() {
for(int i = 0; i < 10; ++i){
int hilo = random(0, 2);

case 0: digitalWrite(DATA, LOW); break;
case 1: digitalWrite(DATA, HIGH); break;

digitalWrite(CLOCK, HIGH);
digitalWrite(CLOCK, LOW);

jQuery Pagination Top And Bottom

March 10th, 2011

Thanks goes to VNSMANIAN2006 for the code for a quick top and bottom pagination element with jQuery Pagination. The original note can be found here:

And here is how I used it:
$.get("ajax.php?getcount=1", {}, function(data){
$("#pagination").pagination(data, {
num_edge_entries: 2, num_display_entries: 6, items_per_page: 20,
next_show_always: false, prev_show_always: false,
callback: function(page_index, jp){
$.get("ajax.php?p="+page_index, {}, function(data){
return false;

And all I did was add the #paginationb div below the table.

WordPress - Entries (RSS) and Comments (RSS) - © 2011 Ben Dauphinee