Posts

ps1 and ps2 are pointers to a character array, what does this do?while (*ps2++=*ps1++);
It is my favorite example of bizarre looking C code which utilizes pointers, pointer increments, unary operation precedence, C-string null termination and the evaluation of an assignment. Breaking it down a little "*ps2++=*ps1++" means the same thing as this:*ps2 = *ps1;
ps2++;
ps1++;
Since ps1 and ps2 are character pointers the first line dereferences each and sets the value of ps1 to the memory pointed to by ps2. The second and third lines just increment each pointer. Both are pointing to character arrays, so they now point to the next character in the array.

The final important detail is that a cstring ends with a null terminator. So eventually the loop will get to the strings end and assign "'\0' = '\0'", which evaluates to '\0', which is false. Thus ending the loop.

I've been wanting to setup some sort of automatic backup on my personal data for quite some time, but have always settled on manually copying important documents to a second hard drive. Well thanks to THIS nice guide to setting up rsync and cron I now have it setup.

Short guide shorter:

1) Create a bash script with the following (note there are only two lines below, the command is long):

One of my favourite things in Linux is having multiple workspaces. Something I didn't know until recently is that you could name your workspaces, and with a simple trick have the name displayed on your top or bottom panel.

Took the first steps on a new project, an automatic cat feeder. The plan is to have it completed by Thanksgiving so that the cats have something to eat while I'm out of town. That being said, I cut the pieces for the box out of some 1/4" MDF and have a lot of work to do.

More treasures from the landfill, this is something I took apart a year or two ago. The only reason its still kicking around is because of the motor, which will be re-purposed in another project someday. There's nothing left to identify what model it is, anyone know?

There isn't much left for the front. Everything interesting has been ripped out including an old bulb, lens and a switch. The bulb's reflector was actually used in another project. In the top corners are a couple spokes which were probably used to attach the reels, film would go through the slot in the bottom right where the bulb and lens used to be.

Will Winder is a software developer. In his four years of study at UNH he took variety of advanced Computer Science courses including Object Oriented Design, Computer Networks, Artificial Intelligence and Compiler Design. He has been working professionally using C, C++ and Java since graduating in 2006. In his free time he continues to expand his skills by involving himself in many projects, some of which can be seen on this blog.