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

From the Blog

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!

Jun
02
Posted by JB at 10:17 pm

Ducati Monster 796

For the past few years I have been contemplating getting my motorcycle endorsement on my driver’s license. After talking with a few friends of mine, doing some research online, and a little more research in person, I decided that I knew what I wanted to purchase for my first motorcycle. The last time that I rode anything with two wheels that was not powered by my own legs was quite some time ago and it wasn’t exactly what you’d call good practice for riding a motorbike. Because of this, and several people insisting that I should take the basic rider’s course, I signed up to a riding academy a few minutes from my apartment in Jersey City. A few days after that I bought my Monster.

A friend suggested that I take a look at both the Triumph, and the Ducati brands. After some researching online I was pretty much sold on the Ducati Monster – the bike looked awesome, great reviews, and the price was right – so I went at the beginning of May to Cross Country Ducati in Metuchen to take a look at their Monster selection. After a little prodding, and some luck, I settled on a red Monster 796 (803cc) with Anti-lock brakes. About a week later the bike was delivered to my parent’s house, and I went for some riding in the high school parking lot.

Front fairing on the Monster

I did the right thing by taking the basic rider’s course, even though it was on Memorial Day weekend, a little over ninety degrees outside, and in Paterson. I was able to pass the examination and earn a waiver for my motorcycle endorsement, and on Tuesday I rode up to the DMV (twice!) and had it added to my driver’s license. Before I left to head back up to North Jersey for work on Tuesday evening I took the bike out for a solo spin around town: I went up Nugentown road, Green street, Railroad avenue, Forge road, and all the way up Route 539 to the intersection of Route 72 (and back). Not too shabby. If all goes well I am planning on spending a lot of time riding this summer getting used to the Ducati, especially during the Gettysburg bike week at the beginning of July. So if you see me somewhere around make sure to give a thumbs up!

I also was able to get a telephoto lens relatively cheap for the digital SLR, and I plan to take some awesome photos of not only the bike, but where the bike takes me this summer. The ones that you see above were taken with the original, stock lens that came with the Rebel XTi. I am hoping to find a affordable wide angle lens for some more artistic shots.

Mar
29
Posted by JB at 9:43 pm

After talking about it for several years now, telling my friends (and family) that I would eventually get around to doing it, and working through some good times (and hard ones) to get it ready, I am both happy and relieved to flip the switch for registration on the Type Aloud. I spent the night putting the final touches on the release candidate while watching Arnold bust some ass in Eraser.

Type Aloud has been a dream of mine for at least four years now. I envisioned a writing and reading community where people will not only be able to share their stories (and poems) but also get collaborative feedback for both editing, and hopefully, print publishing. Some of the most intriguing writing I have read came from people that were not published professionally. I look forward to being able to read (and write!) much more than I have in the past with this service. My primary goal is not to be profitable: Type Aloud is a service that I want to use myself. I am a lucky man if I am able to break even.

For those of you that consider yourselves an amateur writer, or anyone who has the itch to tell a good story, please head on over to Type Aloud where you can sign up and begin writing! Over the next couple of weeks I am going to start posting some of my own work, and I will be (trying) to get some local writers to do the same. The more, the merrier.

Now its time for me to go to bed.

I am going through the Type Aloud code trying to improve queries, implement some fragment caching, and generally clean anything up that I can before flipping the proverbial switch on this bad boy. I came across something a few weeks ago that, combined with the awesomeness that is Arel, makes my life a hell of a lot easier writing queries.

These named scopes have been around in Rails for awhile now, but as always I am coming late to the party. Because Type Aloud contains “draft mode” where stories and chapters can both be in an unpublished state I need to be able to call only the chapters and here is a quick, simple way to do that on the model.

scope :published, lambda {
   joins(:story).where(:disabled => false, :stories => {:disabled => false}).includes(:story, :user)
}

The named scope will filter out any chapters that are not published or any chapters in stories that are not published. This is very important when displaying, let’s say, a random chapter for reading that may not have yet been published in an existing story. The last statement at the end there will eager load the story (and user) because there really is never an instance where I don’t want the story (user) records associated with this. Here are the queries that are executed.
And here and the queries that are executed from this little snippet.

SELECT `chapters`.* FROM `chapters` INNER JOIN `stories` ON `stories`.`id` = `chapters`.`story_id` WHERE (`chapters`.`disabled` = 0) AND (`stories`.`disabled` = 0)
SELECT `stories`.* FROM `stories` WHERE (`stories`.`id` = 1)
SELECT `users`.* FROM `users` WHERE (`users`.`id` = 2)

And of course, this is what the signature looks like from the controller.

@chapter = Chapter.published.limit(1).first

For this particular operation it resulted in a 0.5ms improvement in time spent during the Active Record phase. That may not sound like a lot, but it actually is a 19 percent time optimization. Good stuff!

Mar
02

Today was a very long day, and I expected tonight to be quite the norm lately (uneventful) but spending a little time tonight reflecting actually has turned out to be something, at least that I think, will make me better in the short term. The past couple of months have been a wild ride for many reasons (there really are many) stemming from relationships, to work and even friendships dwindling and being replaced by other, more important social relationships. I usually write my thoughts in a little black book that hopefully will be burnt in the not-so-distant future, but I’ve told myself lately in order to promote Type Aloud I need to do a little more to get people to be interested in the person behind the website, if that sounds like a crock of shit or not.

One thing that I have not (ever, really) been afraid of is to state my opinion. I don’t pride myself in being an idiot; I know when to keep my mouth shut even when I shouldn’t, but I also know when people need to hear what I have to say. Just more lately the person on the other end of my verbal sparring tended to push back without realizing that I was merely giving advice and not trying to start World War III. There are just times in life that you need to hear the bitter, brutal, honest truth and sometimes you really only listen to it from people that you trust. There are other times that you are too stubborn to listen at all, and then you tend to get bitten in the ass.

I have been called several names by people that do not really know me. Some people call me a nerd, a geek, very few people call me a genius, but I tend to hear the utterance of asshole more than all of them. I know that I can be an asshole if I want to be, but I believe that it boils down to people not quite understanding where I am coming from. My view on the world is quite abysmal; I am not what I would describe as religious person, and I generally do not really have any faith in the human race as a whole. Really, how could I? The world is full of death, famine, war and generally a bunch of unhappy people that are content with being exactly that: unhappy.

If I am bothered by something I am damn well going to voice my opinion. Now, I am lucky enough to live in a part of the world where I am not going to be castrated for doing so, but even those around me tend to complain and bitch more often than not. My commute home from work I hear (and see) people that have given up on life. They are tired, hopeless, shell of human beings who go through the motions because they feel as-if there is nothing left for them to live for. This is the kind of shit that makes me sick. I think one of the only things I enjoyed about not being in the city landscape is that there are generally less people, and a smaller sample of people meant that you saw a less amount of unhappy souls.

This is partially the reason why I started Type Aloud; some of the best memories I have are those where my nose was stuffed in some book. I can also admit that I did what most kids do and leafed through the pages until the end because I did not want to read the whole book if it bored me. Shit, I still do that with novels that I purchase because I realize three-quarters of the way through that it is a piece of crap. There is just a part of me that needs to know the ending of a story in order to sleep at night.

For me, Type Aloud represents a place that all of these sad souls can come home and lose themselves for a few hours in reading. Despite the people in my life that are causing problems, think that I am an asshole, or otherwise have ill feelings towards me and mine: I always have the people who spend their time and effort writing their pains, wonders and dreams onto digital parchment. That’s the kind of life that I hope for.