Professional Rails developers know that ’script/console’ is an essential tool for testing and debugging applications. However, it can be tricky to read the output of large Objects such as a query result set. Here is an example of what we typically see in an IRB result set:
To get around this, for the most part we learn little tricks like this:
print MODEL.all.to_xml
Doing the above will give you a more eye friendly xml formatted version of the contents of your Object. This works decently granted you are not overriding the “to_xml” method and serving just a few of the Object attributes. There are other time consuming ways(but sometime necessary) methods of print out debug information. One way is to write a for loop, using “puts” statements, or perhaps write a method in IRB. There is a better way.
Hirb was develop to help soften this pain. It will pretty print ActiveRecord results sets in such a way as you my see in the Mysql console.
SOURCE Saw this post recently and had to share the Klingon QA Program.
The top 12 things likely to be overheard if you had Klingon programmers working for you:
Specifications are for the weak and timid!!
This machine is a piece of GAGH! I need dual Pentium processors if I am to do battle with this code.
You cannot really apprecaite Dilbert unless you’ve read it in the original Klingon.
Indentation?! I will show you how to indent when I indent your skull!
What is this talk of ‘release’? Klingons do not make software ‘releases’. Our software escapes, leaving a bloody trail of designers and quality assurance people in its wake!
Klingon function calls do not have “parameters” – they have “arguments”- and they ALWAYS WIN THEM.
Debugging? Klingons do not debug. Our software does not coddle the weak.
I have challenged the entire Quality Assurance team to a Bat-Leh contest! They will not concern us again.
A TRUE Klingon warrior does not comment his code.
By filing this bug report you have challenged the honor of my family. Prepare to die!
You question the worthiness of my code? I should kill you where you stand!
Our users will know fear and cower before our software! Ship it! Ship it and let them flee like the dogs they are!
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
The first ceremonial action many developers take when playing with a new language or framework is running the “Hello World”. I have done many myself. Its that sort of need for this developer instant gratification before pressing forward. Lately my take on it, has been to have a little fun with it.
Case and point, Xzibit A:
I have been wanting to try out the Mack Framework after hearing Jason talk about it on the Rails Envy Podcast. As I was playing with it, I started noticing,,, well just check out the “Pimp-My-Ride” version.
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
We have been hearing alot recently about Google’s new mobile SDK. With all of the fanfare around the IPhone SDK, I was glad to see a little competition for innovation sake.
My take so far
Having a Java background I found it much easier to get up and running.
I love the fact that you can develop in Eclipse for Android.
I also like the fact that its completely open. Also there is no over arching comity that
decides whether or not your applications is worthy or not.
Though Android looks promising, I plan to continue with learning the IPhone SDK for a couple
of reasons:
The Iphone has an application market.
The Apple does control the quality of applications on the market, and I see that as a good thing.
I want to learn Objective C.
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
So we have a website which requires us to have a mobile version. When we have users
traffic the site using their mobile phone(not just iphone), we cant simply serve up
the average flash enabled, javascript enable, with larger then life imagery.
That said, heres what we need. A plain version of the site that has mostly just informative material. maybe even a couple scaled down images.
My path of “Mobi” discovery has led me to mobile-fu
This lite and slick plugin make dealing with mobile users a bit more automatically.
Implementation:
Add “has_mobile_fu” in your Application controller.
Now the detections is automatic. In the simples usage all we have to do is create a custom view.
For example. let say that we have to create a controller whose main purpose in life is to list the latest
technology.
./script/generate Controller Hotness index
We have a boring “index.html.erb” file now
Now in order to have a mobile version of the index page, we have to create “index.mobile.erb”
heres what I added:
<h1>I'm mobile yo!</h1>
<h2>Demoing my mad mobi detection skillz</h2>
<%= image_tag 'skillz.jpg' %>
BAAM
Thanks to the guys of railseveny.com for their informative podcast which I credit for helping me discover mobile-fu.
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.
I have been feeling some pain lately. No, not physically(thanks for caring).
It has to do with the licensing wrapped around the “ffmpeg” tool.
Heres why I care. I’ve been thankfully included on some really kick butt projects. One of which is
to create a video conversion sharing service which is client agnostic. Users have to be able
to upload large videos to which will be shared with other web users.
For now, lets ignore all of the framework fairies and service trolls that will wrap this problem domain and address the basic “soil” of this project which is CONVERSION.
Enter FFMpeg
Exit sanity
FFMpeg is easy enough to install. You can even (in my case) apt-get install ffmpeg. Thats
were I started out. Awesome, no errors! Lets test it out
This was mine test:
ffmpeg -i /path/to/movie.mov -ar 44100 -r 12 /path/to/movie.flv
It did the conversion, but when I played the movie.flv, there was no sound.
Let me rephrase. All of the movie content was there but nothing was coming out of the speakers.
Guess what, out of the (apt-get) box ffmpeg does not convert the sound.
Ubuntu even has a busted wiki page titled “Fixing ffmpeg on Ubuntu “. I say its busted because
the instructions are outdated.
In order for FFMpeg to convert movies audio you must compile it with Lame MP3 encoding support.
I know that now. You know that as well now. This reminds me of a personal “development” belief.
In troubleshooting, 90% of your time is spent solving the problem, and the final 10% is used
fixing the problem. In other words most all of my time was spent figuring out “how” to fix this,
and very little fixing this.
So actually its not that hard once you understand the caveats. So, Im hoping help you save what
left of your healthy hair follicles.
Install Ubuntu server. I used Ubuntu 8.04.1.
Once you have a prompt, install all of the FFMpeg dependencies:
sudo apt-get build-dep ffmpeg
Now install the conversion support libraries:
sudo apt-get install liblame-dev libfaad-dev libfaac-dev libxvidcore4-dev liba52-0.7.4 liba52-0.7.4-dev libdts-dev checkinstall
Now we need to get source code of ffmpeg:
apt-get source ffmpeg
Doing that will download a folder containing the source of FFMpeg. Change directories into it:
cd ffmpeg-*/
Now configure and compile FFMpeg with audio and friends support:
./configure --enable-liba52 --disable-debug --enable-libfaad --enable-libfaac --enable-gpl --enable-xvid --enable-pthreads --enable-libvorbis --enable-pp --enable-libtheora --enable-libogg --enable-libgsm --enable-swscaler --disable-debug --enable-shared --prefix=/usr
make
This will build a debian package with can be managed easier by the system then just doing a “make install”
sudo checkinstall -D make install
Bask in glory and success with the FFMpeg having audio support.
Share and Enjoy:These icons link to social bookmarking sites where readers can share and discover new web pages.