New Site with Jekyll July 23rd 2013

The old version of my site was powered by laravel, and for what I used it for that was over-kill. I have tried out Octopress in the past and liked it, so I thought I would try the source and use Jekyll. It quickly turned into my new site! Jekyll is very easy to learn and gives you an amazing amount of flexibility out of the box. Once you add on the plugins you can create there seems to be almost no limit.

I was initially only going to handle the projects that I post, since that is the biggest part of this site. Then I decided I wanted to add in the blog I had started. That work working well, but they I ran into some difficulty with having pagination on the blog, but not on the projects. Luckily, I was able to find a blog post that lead me down the path to a plugin that would work for my situation.

Jekyll seems to be amazing and I look forward to seeing what else I can do with it.

Service Now June 20th 2013

I recently switched jobs, and at the new company my department makes use of Service Now. I must say, I am impressed with the product. It is sold as an ITIL compatible help desk solution, but it is so much more. You are able to customize nearly every aspect of the system if you wish. Want to rearrange a page? Done. Want a wizard so people enter their issues correctly? Done. All of this customization is done through their interface, which I expect you can customize, and through JavaScript scripts.

Their platform runs on Java and uses Mozilla's rhino JavaScript engine for the server-side script processing. Everything is stored in a relational database, but you don't really have direct access to it.

The system is very flexible, and it even has some build in functionality for web services. You can connect to their service using WSDL and SOAP or by using HTTP requests to get JSON, XML, CSV responses back. I think there may also be PDF responses? I'm not sure since I haven't used them. Here is one of the big issues: I said you could use HTTP requests, but you don't really get to make RESTful requests. You end up with these horrendous lists of parameters on your requests that can get very unruly.

There is one other big issue in my mind. Everything is done with JavaScript, which isn't bad. However, their JavaScript does not look especially nice. It also doesn't promote very good practices. Some things get put into functions, and then the functions are called. Others are just monolithic in nature and have no functions and are all "global". I have been using a lot of IIFEs since I have no idea what the environment is like for my code, and I have no clue if the scripts are all thrown together, or if they are run individually.

That is really it for big issues. They have taken a lot of the annoying aspects out of making a web application. They take care of rendering for the most part, they have ACLs, they have logging, they have scheduled tasks. They even have decent documentation, which is always nice to find.

Foundation instead of Bootstrap? May 13th 2013

There seem to be an increasing number of people throwing rants about overuse of Twitter Bootstrap. This is not one of them, I like Twitter Bootstrap. It is great for people who are not designers and need to put together something that looks decent. It makes putting together a site easy. That said, you can kind of tell when it is used. The buttons are usually a dead giveaway, and customizing it is not for the faint of heart.

For those reasons I decided to give something else a try for a project I am putting together. I decided to give Foundation a try. It has a gem available, so it is designed to work nicely with Ruby on Rails, and it seems to be very flexible.

The documentation on the grid system requires you to read the whole thing, not just skim it and start going. One very nice thing about their grid system is that there are different classes for different size screens. It's great for when you want space on either side of the screen on large screens, but want to lose the extra space on a smaller one. If you don't understand what I mean take at the Bottles coming soon page. Compare it between your computer and phone.

I haven't had to do too much customizing to Foundation yet, but it looks like it is meant to handle that a bit better than Bootstrap.

Bootstrap Lightbox Update May 2nd 2013

I took a bit of a break from working on Bootstrap Lightbox. I just needed to get away and be lazy for a while, but I am back. The other week I re-wrote the whole thing again. I'm sure that gets tiring for some, but I had several reasons:

  • I wanted to do a little as necessary as Twitter updates Bootstrap
  • I wanted Bootstrap Lightbox to focus on images
  • I needed more JavaScript practice

So, here is what is going on. The modal JavaScript is now a dependency. I take its functions and extend them and only modify the ones for lightbox that need it. This reduced the amount of work required significantly. If people want to extend or tweak Bootstrap Lightbox to use with non-image content or with carousels then they are welcome to do so, but that isn't what Bootstrap Lightbox is for. I'm focusing on images and that makes the code much easier to work with. This will make it a lot easier to add in some image gallery functionality. The old JavaScript was a mess, but now it is a lot cleaner and easier to understand.

So, what do I plan to do next? I am thinking about adding a feature so that you don't need to add any extra HTML to your page. The feature would be optional, but it would provide a good basis to take care of image galleries.

The new version is still a work in progress, but I think I have it all working. It should be released soon.

Ruby on Rails Exceptions April 11th 2013

I've been learning Ruby and Ruby on Rails recently, and I was working on an application today that gave me some trouble in one particular area. The application is a simple application to allow IT to post the status of different systems so people can be aware of any issues. There are three models involved:

  • Services
  • Statuses
  • Events

An event references both a service and a status. I needed to be able to ensure a status being deleted wasn't referenced by any events. The callback and the database query were easy, but I was having issues when it came to showing an error as to why the status wasn't deleted. After a bit of Googling I found that exceptions seems to be the best way to do this. That was good to know, but I still had to figure out how to use them for this case. I had trouble finding any good example of an exception being used, so I figure I ought to post what I came up with.

status_controller.rb

class StatusesController < ApplicationController
...
  def destroy
    @status = Status.find(params[:id])
    begin
      @status.destroy
    rescue Exception => e
      flash[:error] = e.message
      redirect_to statuses_url
      return
    end

    respond_to do |format|
      format.html { redirect_to statuses_url }
      format.json { head :no_content }
    end
  end
end

status.rb

class Status < ActiveRecord::Base
...
  before_destroy :check_existing_events

  private
...
  def check_existing_events
    raise Exception.new("Events exist that use that status.") unless Event.where(:status_id => self.id).count == 0
  end
end