sifting through the thoughts in my mind
Copyright Michael D'Auria © 2008
Call me a loser, but I just hopped on the open source committing bandwagon. I recently started using merb 0.9.x for a new project and there were a few things that I were off, so I used the awesome GitHub, cloned the projects i needed to tweak and went to town. My first official commit was a small tweak to merb-core that correctly took in a custom configured session_id_key and you can see it here :)
Read More.. | Comments (1) | Filed under | Tags github merb
Yea that's right i said it, for wussies! I checked my Google Analytics and noticed that the smallest resolution used to view the site was 1024x768, therefore i took a few minutes to expand the layout by 130 pixels. This enables the longer code segments to fit inside of the images that contain them; I also find it much easier to read. That is all for now...
Read More.. | Filed under | Tags resize
I decided to upgrade my ruby version from 1.8.5 p114 to 1.8.6 p111 today and came across an error when I tried to run merb. Whenever I would try and run the merb command witihin my project it would get as far as “Compiling routes…”, then just stop output. I decided to install rdebug to inspect:
$ sudo gem install rdebug
Then I could check out where it was failing:
merb_project_dir:$ rdebug -d -x ./script/merb
I use ./script/merb here because I had frozen merb to the project so I poke around a bit. After a solid minute of output, there was something that stood out:
bad version, 1.8.6 != 1.8.5
This might not trigger anything to you at first glance, but some of the rubygems you depend on are actually compiled to the version of ruby that you have. Offhand I can think of mysql, datamapper, sqlite3, do_mysql, do_sqlite3, and of course the reason merb was failing, RubyInline and ParseTree. Once I reinstalled these two i was golden:
$ sudo gem install RubyInline ParseTree
Shoot me a comment if you ran into this as well because I couldn’t find anythnig on Google.
Read More.. | Filed under | Tags merb ParseTree RubyInline upgrade ruby
As a follow up to my quick article on creating RDocs for the Ruby Core, you can very easily do the same for Rails and even have generate with Jamis' template. It's as easy as:
$ rake rails:freeze:gems
$ template='jamis' rake doc:rails
Run *rake doc:rerails* if you have already created the Rails RDocs before. You already froze Rails to your app for easier deployment right?
Read More.. | Filed under | Tags
I like being able to go to ruby-doc.org/core if i want to look up some Ruby 1.8 docs, but what if you don’t have the internet? I always compile Ruby myself so I can have the latest security fixes and after I compile I always issue a:
$ rdoc --template=jamis --op <some output dir>
That gives me a local copy of the RDocs so can serve it up via a webserver and look up whatever I desire without the internet, pretty neat. Oh that —template=jamis bit comes from Jamis’ awesome RDoc template that he made in 2005 for use with the Rails RDocs. For its use, take a look at the original article from the man himself.
Read More.. | Filed under | Tags rdoc ruby ruby core
I hate that damn loud beeping noise coming from any machine, even more so from a VM that decided to crash my computer, but that’s another article.
Here’s how you remove the noises from an Ubuntu machine:
$ sudo rmmod pcspkr
$ sudo vi /etc/modprobe.d/blacklist
Now simply add the following line to the end:
blacklist pcspkr
Done and done.
Read More.. | Filed under | Tags
Recently after my article about Bazaar I switched to Mercurial. Bazaar is just WAY too slow for remote repositories, which is what I use so my partner can pull changes, whereas Mercural is very fast. Now let me show you how to go from the SVN code to Mercurial this time.
Here is the snippet of Brian's original code:
def revision
@revision ||= if svn_info_from_working_copy
svn_info_from_working_copy["Revision"].value
else
last_revision_in_log
end
rescue
@revision = "UNKNOWN"
end
def svn_info_from_working_copy
@svn_info ||= YAML.parse(`svn info #{RAILS_ROOT}`)
end
def last_revision_in_log
File.readlines(RAILS_ROOT + "/../../revisions.log").last.split[3]
end
And here is my modified:
def revision
@revision ||= if hg_log_from_working_copy
hg_log_from_working_copy['changeset'].value.split(':').first
else
last_revision
end
rescue
@revision = "UNKNOWN"
end
def bzr_revno_from_working_copy
@hg_log ||= YAML.parse(`hg log #{RAILS_ROOT}`)
end
def last_revision
File.read(RAILS_ROOT + "/REVISION").strip
end
Bazaar made this easier, but the remote repository performance is just too subpar for my use. So there you have it, enjoy.
Read More.. | Filed under | Tags hg mercurial
For development I have been using a VM these days with a web server hosting multiple apps under the same VHost via different directories. What i need to use what this under my 'config/development.rb' files:
ActionController::AbstractRequest.relative_root_url = '/app'
Hope this saves some people time...
Read More.. | Filed under | Tags rails
I came across a little article by Brian Helmkamp on his blog. I thought this was a good idea for SVN, so why not update it for my use with Bazaar? Also, his fallback is to resort to the Capisrano revisions.log file, which is no longer in use with the release of 2.0, so I use the REVISION file.
Here is the snippet of Brian’s original code:
def revision
@revision ||= if svn_info_from_working_copy
svn_info_from_working_copy["Revision"].value
else
last_revision_in_log
end
rescue
@revision = "UNKNOWN"
end
def svn_info_from_working_copy
@svn_info ||= YAML.parse(`svn info #{RAILS_ROOT}`)
end
def last_revision_in_log
File.readlines(RAILS_ROOT + "/../../revisions.log").last.split[3]
end
And here is my modified:
def revision
@revision ||= if bzr_revno_from_working_copy
bzr_revno_from_working_copy
else
last_revision
end
rescue
@revision = "UNKNOWN"
end
def bzr_revno_from_working_copy
@bzr_revno ||= `bzr revno #{RAILS_ROOT}`
end
def last_revision
File.read(RAILS_ROOT + "/REVISION").strip
end
Of course let’s not forget his suggestion of using this in the title of the page:
<title>r<%= @revision %> | ...Normal page title...</title>
Thanks Brian!
Read More.. | Filed under | Tags bzr bazaar capistrano
I was turned onto Slice Host by someone I have never met in person, Brendan Schwartz. He runs a couple of sites, Tropist as well as FameThrower. You should check out both sites, they have really nice designs and clever layouts, specifically FameThrower.
Read More.. | Filed under | Tags
I told myself that once i started this thing that I would actually use it, looks like I was totally wrong.
I found it difficult at times to come up with something smart to say and toss it on here. I want to use this blog as a tool to increase my writing abilities as well as give some people interesting topics to read over. So I guess what I am saying is that I am going to write about everything whenever it dawns on me. The way I see it is, no one is reading this thing anyway…
Read More.. | Filed under | Tags blog suck at blogging
So, you have all these sessions and need to clear them out but are clueless how to do it? It’s actually really simple.
Read More.. | Filed under | Tags clear sessions rails tips
Welcome to my small, never heard of, yet fun blog! The content I aim to blog about is anything related to software engineering, web design, travel and any weird websites or links I come across. Hopefully you will find everything to be entertaining :) I very much like to research new technologies and methods regarding computer engineering, including new emerging programming languages, web server software as well as proper coding etiquette. I jumped onto the Ruby and Rails bandwagon back in June and since then I have helped create trebleNation. Hopefully you find the content that I post amusing so that you come back again for another visit.
Read More.. | Filed under | Tags michael d'auria treblenation who