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

From the Blog

Jan
06
Posted by JB at 11:56 pm

Last year I wrote a little blog post about my New Year’s resolutions. After the beginning of the year getting off to a rocky start I was going to forgo the whole official post thing, but I feel that tonight may be the night that I needed to write a little bit. I only achieved some of the items off of last year’s list. Instead of recapping my failures for the year I think I am just going to dive right into the good stuff.

  1. I will travel outside of the United States.

    Last year I made a note to take a proper vacation. This is something that I do not believe that I achieved, but there are reasons for that. So my first resolution is that I will travel outside of the United States this year. I do not have an official plan on when (or where) but some of the ideas that are floating around include either Mexico or, better, Europe.

  2. I will finish what I start.

    Last year saw many beginnings for me. I started a new career with a great bunch of individuals, I got nearly done with my writing community and there are many other things that I could go into. This year I want to finish some of the short-term projects that I have started. My plan for the first month of the year is to get an initial beta up of my my writing community, Type Aloud, which has been in the making for several years now.

  3. I will find someone that understands and accepts me.

    I enjoy writing software. I talk about technology, watch movies, read and write, and cook food. Any person that comes into my life needs to completely understand and accept me, for me. No substitutes.

  4. I will take the GRE and apply to graduate school.

    I have not decided yet what my major will be, but while doing that I need to prepare by taking the proper tests. Once I decide where and what I want to study I need to (obviously) apply and get accepted. The short list includes NYU and Columbia University in New York City.

  5. I will continue to eat healthier and live a more active life.

    Last year I did not achieve my weight loss goal, but I did get half-way there. I stopped eating junk food, started eating more fruit and vegetables, and began cooking meals at home more often than I had before. I also started packing my own lunch a few days a week to save myself some money.

  6. Write more words, play more video games and enjoy life.

    My passions include many things. Last year I said that I wanted to begin writing a book. For me, the first step in that is getting Type Aloud out of the door. I have several ideas for books (and short stories) that I want to start penning as soon as I have a website to write them on! Some of my other modes of relaxation include playing video games. I can probably count the games that I played with friends on one hand. This has to change.

  7. Drink more beer and open source more software.

    For some reason last year I drank less beer (alcohol in general) and wrote less software, especially open source. These two things I want to change, and I feel that they’ll both contribute to an overall, better, me. All of you should hold me to it.

  8. I will find someone who will stay here, and not move away.

    I don’t need to explain this. Anyone special in my life needs to be here, in my life.

I think that’s the list. Right now I am going to head to bed and hope that there isn’t too much snow here in the morning so I can get to work and end the week on a high note. Peace and happy New Year everyone.

The holidays always seem to creep up on me.

This is the first holiday season I have been at my new gig and we’ve been quite busy busting our asses to get everything in line for next year. So the past few weeks I haven’t had a lot of time to get work done on Type Aloud but that all changed earlier this week.

For the past couple of weeks I have been sitting on the code and focusing on getting the design done. That meant learning a lot of interaction in Rails that I did not know before, working on some CSS beautification and generally cleaning up the god awful standard forms that are generated through the Rails scripts. I decided earlier in the week that I would send out an e-mail to all of my testers and let them know I am planning on pushing a release candidate for their testing.

After some successful UX testing tonight I am going to try to push a new candidate each night for the foreseeable future. My plan is to release to beta on New Years eve flipping the switch on-or-around midnight in a ceremonious occasion which will involve the consumption of a lot of booze. But all that hinges on the UX and integration/functional testing that myself and my testers are going to perform.

Next week the goal is to send out the invite to everyone who has signed up for early access and shut off the form in preparation for the switch. So if you’re a writer, reader or poet and you’re interested in getting involved and helping me out feel free to sign up with your e-mail address. Its free, and I won’t sell them to some clearing house.

Good times are ahead!

Dec
05

After several months of tinkering I have finally, successfully, gotten my hackintosh setup complete with working sound. Last night I got home from Food+Tech Hackathon in SoHo and decided that I was going to make it my mission to get this heap in working order. After about an hour, a shower and some Jameson, the bad mamma jamma was running smooth like butter.

Some other not-so-awesome achievements was finally installing Outlook 2011 on my MacBook after being embarrassed because I was unable to open up a spreadsheet while working on Milk Hack. Which, in and of itself, deserves a little bit of explanation. I decided to go to this food hackathon hosted by the great Danielle Gould and one of the ideas that was proposed was her own: to find get some visualizations in pricing information released by the USDA.

Now most of you that know me can attest that I absolutely hate the process of wrapping my head around statistics, but I love information and data hacking. Luckily enough I was joined by the R guru Drew Conway and what he was able to produce was a sweet animation that we threw up on vimeo. After pouring through several spreadsheets of data I then went to work on what is now the design of http://milkhack.com.

All in all it was a great day spent outside of the cold day in New York City. Big props go out to the Gojee team for hosting the event at their offices. I had a blast, met some great people and ate some amazing food. Who could ask for more?

I have been doing some hacking on Type Aloud and I was looking for an answer to a question that was bugging me: what is the best way to use link_to with a vanity URL setup? I asked my question over at Stack Overflow and I figured I would post the answer to the question here in case anyone was looking as I was.

Inside of my application the route setup is quite simple.

match '/:id', :to => "users#show"
match '/:user_id/:id', :to => "stories#display"

Now I want to be able to make a very simple call inside of my view logic which will print out a pretty URL. Since I am using resource definitions for several controllers I cannot use the normal Rails URL helpers. The answer to my question is actually quite simple, and I already have used it before, but what I wasn’t doing was correctly passing through the objects into the helper. Here are the changes that you need to make to those routes above.

match '/:id', :to => "users#show", :as => "vanity_show_user"
match '/:user_id/:id', :to => "stories#display", :as => "vanity_show_users_story"

And finally inside of your view you would build both links like the following.

<%= link_to @story.name, vanity_show_users_story_path(@user, @story) %>
<%= link_to @user.name, vanity_show_user_path(@user) %>

I hope that this helped you out as much as it helped me! Kudos to the amazing Ryan Bigg for the original answer.

The past couple of weeks I have been doing some research because I am planning on working on a FastCGI Model-View-Controller framework for developing web application services in C++. I am a C++ engineer by day and have been working with the language for nigh on a decade. The brief research I was able to do has shown me that there are no DataMapper or Active Record open source libraries available.

What Exactly Is The N+1 Query Problem?

When using an abstract framework to build a data model for use with an SQL-esque language you generally need to build a set of classes to model the schema in said language. For Type Aloud, lets say that I want to display all of the stories in a set of categories after you get them back based upon two slugs taken from the site’s URL.

SELECT id FROM categories WHERE slug='sci-fi' OR slug='fantasy'
SELECT id, name FROM stories WHERE category_id = 0 OR category_id = 1

How many queries will be run? At most there will be two queries, but what about if none of the categories match the two slugs provided? That first dangling select query will be executed each and every time even if there are no matches to search against. How can we fix this?

SELECT * FROM stories 
INNER JOIN categories ON stories.category_id = categories.id 
AND (categories.slug = 'sci-fi' OR categories.slug = 'fantasy')

This type of explicit join will allow you to execute a single SQL query and, in the long run, will save you thousands of CPU cycles with your web applications. This type of data mapper already exists in Ruby on Rails using the Data Mapper gem which is freely available. But as of right now there is no such framework available (unless I am mistaken) in C++ which gives you the power and flexibility to build your data models and eat your cake too. My first plan in developing an MVC framework is to work on architecting a proper data mapper library for C++.

Anyone else game?

I decided to take some long needed rest away from the computer and enjoy my Thanksgiving holiday with friends and family. This has put some of my development initiatives on the back burner. I am aiming to gear up this weekend and hopefully be able to release a little tidbit at the end of this weekend just for the special someones who sign up for the service early. The current goal is to have story and chapter submission, viewing and commenting up by the end of this weekend.

I will continue the remaining work and slowly release the bits out to my testers. I expect (and hope) those of you that have signed up are ready and willing to start writing some short stories, and eventually, poems!