Musings from an east coast software developer, writer and reader.

From the Blog

Jul
30
Posted by JB at 12:00 pm

A few days ago to the sweet, sweet melodies of Billy Joel, I woke up in the wee hours of the morning to code up a very crude C web server. Of course, I tried to pass it off as a C++ implementation, but in reality I was pulling the wool over your eyes – the only C++ was used to build error messages, and the actual message to send down to the client. Not to mention it was a very crude, basic, implementation of socket handling in C. Nothing fancy.

Yesterday I was talking with some kind folks at the re:build 2011 conference in Indianapolis, and it got me to thinking that there aren’t enough examples of C++ applications talking to the web. You know, actual C++, using the boost libraries and what not. So this morning, after grabbing my amazing breakfast burrito at Henry’s in downtown Indianapolis I scoured the Internet and re-wrote my example application in Boost.Asio.

The code is much simpler, straight forward, and just damned better to look at. As always it is up and available at my Github account for consumption. If you’re interested in seeing the actual difference in implementations than go no further than right here.

I have a few more ideas on web services written in C++, but that’s for another day. Let me know if you have any questions. As always, enjoy the code and report any bugs.

Jul
26
Posted by JB at 11:08 pm

At some point near the end of last week I decided to try out this new fangled operating system that Apple has been toting for the better part of the year. I used their Mac App Store but within the first few minutes I ran into some issues that should have been a forewarning to spending the time to be an early adopter of Lion.

Earlier in the year I installed a developer preview of Lion which did not seem to include too many features. In fact, I did not even remember that I installed this, and when it came to the Mac App Store at first it believed that I already had Lion installed. After some searching through Google and forum posts I was able to figure out how to reset the Mac App Store and get Lion downloaded. The installer kicked off without any problems. This is when the proverbial shit hit the fan.

I was greeted with a failure message that basically told me jack squat. My disk was corrupt and unable to be repaired by the Lion installation image (or the bundled Disk Utility program). This was a real problem. After some quick searching some fellow patrons suggested trying a repair installation with the original Snow Leopard installation disk. I tried this and was met with a little success – I was now greeted with a seemingly updated installer that included Safari and an updated version of Disk Utility. But to no avail was I able to actually get Lion installed on the disk. My laptop was effectively a brick.

Since I was actually busy this weekend (riding the Monster around New Jersey) I decided that I would make an appointment to see the “Genius” bar at the heralded 5th Avenue Apple Store in New York City. This was a big mistake. Despite making the appointment an hour and a half ahead, arriving fifteen minutes before my appointment, it took them a full hour to actually see me. Not the best service thus far. The “Genius” that I met with was baffled at the problem claiming to never have seen the installation do this to a laptop. Great.

What really complicated the matter was that I was using FileVault to encrypt my home directory just in case my laptop got stolen. If it wasn’t for this fact I would have merely copied all of my music, photos, and documents over from the directory to an intermediate storage device. After completing the re-installation of Lion I could copy it over and all is good. But, rightfully so, this was not the way to actually complete the measure.

Now I am writing this without actually attempting to open up the encrypted sparsebundle that my data is stored in. I have a copy on an external drive that I mounted in the Lion installer, and copied over the files from the Terminal application. The actual Lion installation (after using Disk Utility to erase my main disk) went smoothly without a hitch. All of my applications were installed and ready to go after about an hour and a half.

The only thing that remains right now is getting the sparsebundle mounted unencrypted so I can extract the data, and figuring out why my instructions for using a third party device to backup with Time Machine don’t work. It is looking like that Apple is requiring the use of AFP protocol for Time Machine backups. This won’t be too much of a problem as the open source netatalk solves this for all of you Linux users, but for people using an integrated device that runs a stripped down version of Linux it may be a little bit of a pain to get this on the device. Nevertheless, I am on the problem.

Jul
21
Posted by JB at 6:54 am

So, this morning I couldn’t sleep, and around 4:00AM I started messing around with nginx, fastcgi and C++. For awhile now I have been considering the feasibility of an extendable and reusable framework for serving up web content from C++ applications. Of course, all you web programers want to write code in Javascript and Ruby, but sometimes there are applications that can be core to a company that do not need to (or should not) be rewritten merely to service a different type of client. I wrote a little test program that I threw up on my Github.com account.

That’s my reasoning for developing this simple proof of concept application. I didn’t want to actually download the fastcgi libraries that exist for C, mainly because it was 4AM and I am a lazy fuck, so I decided to write up something simple with accept(), recv() and send(). The actual configuration for nginx is quite simple, you can just use their example for proxying to an Apache web server.

For those of you that are just as lazy as I am, click on this big bad beautiful link, and enjoy the show. Later, at some point, I will write up my thoughts on how an actual framework to solve this problem may work (and look), but right now I need to take a shower and go to work.

Jul
07
Posted by JB at 4:07 pm

After riding the motorcycle for a few miles I quickly realized there were a few things that needed to be changed on this bike to make it my own. The immediate changes were definitely the mirrors: I was having problems seeing traffic behind me on the freeway. The choice was simple in this department as I needed something that went on the ends of the handle bars. The only other functional change that I saw in the immediate future was the windscreen. The stock fairing was really pushing the naked sport bike feel and offers little to no protection at freeway speeds. One last change was more of an aesthetic one. The first that I actually knew I was removing from the bike was the rear tail fender. It is absolutely horrible.

Puig windscreen for Ducati 796

After browsing the Ducati Monster Forum for some ideas for bike modifications I came across a post that referenced the Puig racing windscreen brand, and poked around Monster Parts to see what they had available. I settled on a smoked windscreen that doesn’t require any additional mounting brackets (it attaches to the frame). This gives me the flexibility to swap it out for the stock fairing if necessary. One thing that I noticed with this windscreen is that because the head light does not have any type of screen the light shines (and reflects) which is especially noticeable at night. Other than that, I am pleased with the amount of air that gets pushed out of the way on the freeway when at speed, an absolute improvement over the stock fairing.

CRG Arrow mirrors

After taking my first ride up the Garden State Parkway to Red Bank to see the Zinkk crew I noticed that these mirrors were not going to cut it. Even when the riding position lowered (bent down on the tank) it was difficult to see past my shoulders, and while perusing Monster Parts I found the CRG arrow bar end mirrors which looked pretty slick on the stock photography. After installation they proved to be completely adjustable for splitting, if necessary.

Evotec Tail Chop for Ducati 796

The stock rear fender (tail) is disgustingly long and looks completely out of place on this type of motorcycle. Because this actual modification is performed by damn near every Monster owner there are several step-by-step instructions for the installation of the tail chop kit, and I decided on what looked to be the best engineered the Evotec tail chop kit for the Monster series. Unfortunately the instructions are rather sparse, but thanks to the forum there were photo and video instructions to get this piece in smoothly as it requires remounting of the seat lock, turn indicators and rear light.

I think this is going to be all the changes that I have in mind for now. There is one more that I am considering, mainly because I already housed the right turn indicator with my leg, but an integrated tail light must at least look nice and fit on the Evotec kit. I’m going to research this a little more. Later down the road: tank bag, GPS mount, and video camera mount. For now, its time to ride!