What I've learned & still learning these past couple of months...
For the last couple of months, I've picked up new ideas and practices from working with several teams in Hashrocket. These are either required on the job or a set of tools that makes the task easier or something that peaks my interests. I will also recommend some screencasts/talks/book that I've seen/read recently.
So here's my list:
HAML
Haml by Hampton Catlin. I don't think I can ever go back to regular erb mark up and html after using haml. It did look daunting initially but now I love it so much. It makes the code views so much readable and pretty as in pretty organized. I don't have to deal with missing closing tags either as long as I know that my haml are structured well plus it keeps me disciplined. Discipline is exactly what you need for those views.
RSpec's Story Runner
RSpec's Story Runner is quite interesting and I'd really like to be able to do this. It adds a business value. I just wish I can do it with Shoulda. Can I? Does it run separately from RSpec? I haven't looked into it very well. But I'd love to know. If someone can explain it to me then I would love you forever in a friend-ish way! :)
Shoulda
I'm in two different projects at the same time where one was running in RSpec and the other one was in Shoulda. I found I was interested more in the Shoulda tests than the RSpec tests. Our RSpec tests were awesome now don't get me wrong with that but the Shoulda tests were more concise probably because of the macros or there maybe an "IT" factor to the Shoulda tests I've been reading and that would be: Tammer Saleh himself wrote the tests. Coincidentally, Josh Susser said he likes Shoulda too during his Great Test Framework Dance-Off at RailsConf 2008. That kind of solidifies it for me.
Selenium Tests
It's one of those tests that I think I'll be doing on a regular basis on any project I'll be in. Takes a little while to get used to but it's fun to watch as it executes in the browser. I've picked it up from Hashrocket and Jon/L4rk Larkowski did a Selenium demo for me while in Portland for RailsConf 2008 so I've been starting some Selenium tests locally on some personal projects too.
Factory and Factory_Girl
Factory is awesome that it makes it so much easier for me from the front-end side as an assigned front-end developer/designer to generate sample data/content in easy mode way. Now I can adjust the layout with the actual content and all attributes are there. That's a plus side for me. Moving into Facory_Girl but either one is good for me considering the sample data generation is just as easy.
Webrat
Already doing Selenium and still doing Webrat? Webrat just works seamlessly with Rspec's Story Runner so why not? You might write some clunky test but you can't over-test anything and over-testing might even lead to benchmarking which is what we're in dire need of with rails web apps.
Git + GitHub
ZOMG gitHub is the sexiest thing ever so far! Everyone was right about git. If you haven't looked into it yet, then do it now. I've watched the Git-Talk that Scott Chacon made available on gitcasts.com. (Git-talk was Scott's session during RailsConf 2008. One of the good sessions I've missed to see during RailsConf 2008). Then, immediately after watching Git-talk, I got the Git Peepcode. If you watch those two screen cast in those order, it gels more better with the ideas since Git-Talk covers the core principles and then the Git Peepcode by Geoffrey Grosenbach gives you the examples in length.
Pragmatic Screencasts
Episode 1 Everyday Active Record by Ryan Bates. I watched this but unfortunately, I didn't get anything new out of it. I've been doing Rails for 2+ years after all. I would have to try Episode 2 soon. I also bought the three episodes on Ruby Metaprogramming by Dave Thomas. I stopped at Episode 1: Objects and Classes and I decided to resume after I finish reading the ruby book that I'm halfway through.
Book: Beginning Ruby
I've been doing Rails for 2+ years but Ruby is still new to me. Two years yet Ruby is new? Yup! I am perpetually on the front layer of a web app cause of my "I can haz CSS & design skills" as my peers would call it. I can still jam with those models, controllers and test files. In all honesty, I've tried reading every "learn" Ruby book out there but they make me sleepy as hell. Then I found Peter Cooper's Beginning Ruby book finally! I'm halfway into this book and if you want to learn Ruby then this book is an excellent start without getting sleepy. So, this book works for me but something else might work different for you so find your Ruby book if you haven't.
Other notable talks/sessions I've watched
I have not attended neither Goruco 2008 nor MountainWest RubyConf 2008 but these two talks are awesome. The SDD (Story Driven Development) talk by Bryan Helmkamp during Goruco 2008 available via confreaks.com. Bryan Helmkamp is also the author of Webrat.
The BDD with Shoulda talk by Tammer Saleh during MountainWest RubyConf 2008 also available via confreaks.com.
- - -
There's another secret sauce but I'm not sure I can talk about that "tracker" yet since it's in beta mode and we're lucky to be the first testers. Boohooo. I know :(
Now the list above are the things that comes to mind real fast. I'm sure there are others that I've completely overlooked. If given the chance, next time I'd want to pick up more on AJAX, Scriptaculous, more javascript goodness, some pairing and myself brushing up on CSS3.
The conclusion: Life and work is good. Learning new things constantly on the job and being resourceful on where to find the good stuff that makes work easier and funner will always be the factors/traits I'd look to when I say I'm happy with what I'm doing. I learn quick and I'm resourceful so I got those covered. But it's the WHO resource that makes Hashrocket the place to be! I'm not sucking up. It's just for realz. ;p
For the Burning Blade folks....
It'll be much easier to look for the armory of folks in Burning Blade, right? That is correct because Burning Blade PVP people rocks!
Here's a search engine plugin for World of Warcraft armory -- Burning Blade. Just click on the image image and it will install the search engine for Firefox.
Here are other resources:
http://www.latenightpc.com
http://www.wowarmory.com
Cause I just love my theme...don't you love yours? :)
============================
Update: [March 14, 2008] After scrouring the internet to try to remember which theme inspired it, I finally found it! Eureka! It was by Idlefingers
============================
I thought I would give NetBeans/Ruby (nightly build) for MAC a try after reading George Cook's very convincing article on "Netbeans THE best ruby on rails IDE". Oddly enough, I just got so used to my TextMate theme that I also ported it into Coda awhile back. Now, I felt I had to port it on NetBeans too. It takes 6 steps and 3 xml files. It's really easy and anyone can do it too. It's not as perfect as I'd wish it could be but close enough.
UPDATE: I'm a NetBeans Newb! Here's a link/resource for packaging a theme (etc): http://www.netbeans.org/kb/50/substance-look-and-feel.html. I don't feel like packaging 3 xml files. /woops. Anyway, it's nice to know the folder structure if you're new to NetBeans too.
Here's a screen shot of the theme:
Onward with the steps....
Step 1. Duplicate any existing theme in NetBeans under Preferences / Fonts & Colors; name it whatever you want. I named mine "Karuh Dida" for no particular reason.
Step 2. Open Terminal/iTerm
1 2 |
cd home mate .netbeans |
Step 3. Folder Structure
Step 4. Copy & paste xml file:
org-netbeans-modules-editor-settings-CustomFontsColors-highlights.xml
into folder => .netbeans/dev/config/Editors/FontsColors/Karuh Dida
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontscolors PUBLIC "-//NetBeans//DTD Editor Fonts and Colors settings 1.1//EN" "http://www.netbeans.org/dtds/EditorFontsColors-1_1.dtd">
<fontscolors>
<fontcolor bgColor="darkGray" name="guarded"/>
<fontcolor foreColor="yellow" name="caret-color-insert-mode"/>
<fontcolor bgColor="ff121e31" foreColor="white" name="status-bar"/>
<fontcolor bgColor="ff253e5a" name="highlight-caret-row"/>
<fontcolor foreColor="ffcccccc" name="line-number"/>
<fontcolor bgColor="ffe0e8f1" name="block-search"/>
<fontcolor foreColor="ff253e5a" name="code-folding-bar"/>
<fontcolor bgColor="ff38566f" name="selection"/>
<fontcolor foreColor="ff253e5a" name="text-limit-line-color"/>
<fontcolor bgColor="ff38566f" name="highlight-search"/>
<fontcolor bgColor="ff386f4c" foreColor="white" name="nbeditor-bracesMatching-match">
<font style="bold"/>
</fontcolor>
<fontcolor bgColor="red" name="status-bar-bold"/>
<fontcolor bgColor="ff38566f" name="inc-search"/>
<fontcolor bgColor="ff6f3757" foreColor="white" name="nbeditor-bracesMatching-mismatch">
<font style="bold"/>
</fontcolor>
<fontcolor bgColor="ff253e5a" foreColor="white" name="code-folding"/>
</fontscolors>
|
Step 5. Copy & paste another xml file:
org-netbeans-modules-editor-settings-CustomFontsColors-tokenColorings.xml
into folder => .netbeans/dev/config/Editors/FontsColors/Karuh Dida
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontscolors PUBLIC "-//NetBeans//DTD Editor Fonts and Colors settings 1.1//EN" "http://www.netbeans.org/dtds/EditorFontsColors-1_1.dtd">
<fontscolors>
<fontcolor name="whitespace"/>
<fontcolor default="string" name="markup-attribute-value"/>
<fontcolor bgColor="ff2b2b2b" foreColor="ffdddddd" name="default">
<font name="Monaco" size="12"/>
</fontcolor>
<fontcolor foreColor="ff00ccff" name="operator"/>
<fontcolor foreColor="ff7b7b7b" name="comment">
<font style="italic"/>
</fontcolor>
<fontcolor bgColor="red" foreColor="white" name="error"/>
<fontcolor default="keyword" name="markup-element"/>
<fontcolor default="default" name="entity-reference"/>
<fontcolor foreColor="ffd27522" name="keyword"/>
<fontcolor foreColor="white" name="char"/>
<fontcolor foreColor="ff669933" name="string"/>
<fontcolor default="identifier" name="field"/>
<fontcolor name="identifier"/>
<fontcolor default="field" name="markup-attribute"/>
<fontcolor default="identifier" foreColor="white" name="method"/>
<fontcolor foreColor="ffeddd3d" name="number"/>
</fontscolors>
|
Step 6. Copy & paste 3rd xml file:
org-netbeans-modules-editor-settings-CustomFontsColors-tokenColorings.xml
into folder => .netbeans/dev/config/Editors/text/x-ruby/FontsColors/Karuh Dida
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE fontscolors PUBLIC "-//NetBeans//DTD Editor Fonts and Colors settings 1.1//EN" "http://www.netbeans.org/dtds/EditorFontsColors-1_1.dtd">
<fontscolors>
<fontcolor default="number" name="GSF_INT_LITERAL"/>
<fontcolor default="number" foreColor="ff66cc00" name="GSF_FLOAT_LITERAL"/>
<fontcolor name="mod-interface"/>
<fontcolor foreColor="ffd1ceff" name="GSF_INSTANCE">
<font style="bold"/>
</fontcolor>
<fontcolor name="mod-public"/>
<fontcolor foreColor="ff99006b" name="COMMENT_TODO">
<font style="bold"/>
</fontcolor>
<fontcolor name="mod-constructor">
<font style="bold"/>
</fontcolor>
<fontcolor name="mod-enum"/>
<fontcolor default="number" name="GSF_DOUBLE_LITERAL"/>
<fontcolor default="string" name="STRING_TEXT"/>
<fontcolor default="number" name="GSF_LONG_LITERAL"/>
<fontcolor foreColor="ffeddd37" name="STRING_ESCAPE">
<font style="bold"/>
</fontcolor>
<fontcolor name="mod-deprecated" strikeThrough="darkGray"/>
<fontcolor name="mod-annotation-type"/>
<fontcolor default="comment" foreColor="ffaaaaff" name="COMMENT_RDOC">
<font style="bold"/>
</fontcolor>
<fontcolor default="default" foreColor="blue" name="COMMENT_LINK" underline="blue"/>
<fontcolor foreColor="ff8aa6c1" name="mod-parameter"/>
<fontcolor default="whitespace" name="GSF_WHITESPACE"/>
<fontcolor default="keyword" foreColor="ffdd7522" name="GSF_ANY_KEYWORD"/>
<fontcolor name="mod-package-private"/>
<fontcolor name="mod-static">
<font style="italic"/>
</fontcolor>
<fontcolor foreColor="ff99006b" name="GSF_TODO">
<font style="bold"/>
</fontcolor>
<fontcolor default="default" name="COMMENT_BOLD">
<font style="bold"/>
</fontcolor>
<fontcolor default="comment" name="COMMENT_HTMLTAG">
<font style="bold"/>
</fontcolor>
<fontcolor foreColor="ff99ffff" name="GSF_CLASS">
<font style="bold+italic"/>
</fontcolor>
<fontcolor bgColor="ff38566f" name="mark-occurrences"/>
<fontcolor default="comment" name="COMMENT_TEXT"/>
<fontcolor default="8AA6C1" name="GSF_ANY_OPERATOR"/>
<fontcolor foreColor="ffd1ceff" name="GSF_GLOBAL">
<font style="italic"/>
</fontcolor>
<fontcolor foreColor="white" name="mod-field">
<font style="bold"/>
</fontcolor>
<fontcolor foreColor="fff3c55f" name="mod-method">
<font style="bold"/>
</fontcolor>
<fontcolor name="mod-protected"/>
<fontcolor default="string" name="GSF_STRING_LITERAL"/>
<fontcolor default="comment" name="GSF_BLOCK_COMMENT"/>
<fontcolor default="comment" name="GSF_DOCUMENTATION"/>
<fontcolor name="mod-local-variable"/>
<fontcolor name="mod-private"/>
<fontcolor default="error" name="GSF_ERROR"/>
<fontcolor foreColor="ffca4344" name="GSF_REGEXP_LITERAL"/>
<fontcolor default="comment" name="GSF_LINE_COMMENT"/>
<fontcolor foreColor="yellow" name="mod-class"/>
<fontcolor foreColor="ffcc3333" name="GSF_CONSTANT"/>
<fontcolor foreColor="ff5098c2" name="GSF_TYPESYMBOL"/>
<fontcolor name="mod-unused" waveUnderlined="ffff8888"/>
<fontcolor default="identifier" name="GSF_IDENTIFIER"/>
<fontcolor foreColor="ffff006b" name="STRING_INVALID" strikeThrough="ffff006b">
<font style="bold"/>
</fontcolor>
<fontcolor default="string" name="QUOTED_STRING_LITERAL"/>
<fontcolor name="mod-abstract"/>
<fontcolor default="char" name="GSF_CHAR_LITERAL"/>
<fontcolor default="default" name="COMMENT_ITALIC">
<font style="italic"/>
</fontcolor>
</fontscolors>
|
Of course, you can take it from here and customize it further. I wish there was an easier way to export/import themes in NetBeans. If you can easily grab TextMate bundles, then themes should be as easy to grab too, right?
As far as how NetBeans ranks in my books, I don't know yet. I still have to find out but I can't stand not seeing my usual theme in it so I spent two hours doing that first. Imagine that!
Snippets: SVN Delete Missing
September 01, 2007 @ 09:39 AM | posted by carmelyne
(last updated: 09.01.07)Automatically remove files missing from subversion
svn status | grep '\!' | awk '{print $2;}' | xargs svn rm |
REST, LiteSpeed & Attachment_fu
August 03, 2007 @ 12:42 PM | posted by carmelyne
(last updated: 08.09.07)The big picture is with the redirects.
The quick work around...
If you've read my post about FreeImage, then you might be interested to know about the conflict I encountered with a RESTful app on LiteSpeed and using attachment_fu.
This was quite perplexing to be honest. I installed attachment_fu on a restful app, tested on my dev environment which is using Mongrel. I committed to my svn, updated files served on LiteSpeed and uh oh, the upload feature wont work. There's no error message, nothing gets saved at all and returns back as a 200 code. I couldn't debug alas I'm not the all perfect coder either. /wink /wink. I resorted to finding a work around.
First let's get some things clear, the conflict with REST, LiteSpeed and Attachment_fu is on another slice but not on this blog's slice. When I was looking for a work-around the first thing I did was to test the attachment_fu on this blog done by Rick Olson. Justin Palmer did the UI which is great. First, it wouldn't work since I had to give proper permissions to the assigned public image folder. Then everything after that was fine and dandy. Why does it work on here and not on the other slice. I go deep into the code reading line by line but time is running short. I need the upload feature working like yesterday.
For a quick fix, I thought to myself that I will just get LiteSpeed to work with Mongrel for the time being till I get a fix. I visited PickledOnion's excellent blog because he has the LiteSpeed set up goodies. I couldn't find any about Mongrel. That's fine since you really don't need Mongrel if you've chosen LiteSpeed. I emailed Paul aka PickledOnion and told him about my scenario. He said he was looking to getting attachment_fu to work on his project so he'll let me know if he ran into any issues. Us slicers have that special slicer bond. I don't know what that means but OK. ;p
I'm very happy with using LiteSpeed. The free version is good for a simple less traversed site like this blog of mine. Now having said all that, back to the workaround. I went now to the LiteSpeed and Mongrel sites to find some docs on how to set it up. Unfortunately, no docs on LiteSpeed with Mongrel at the LiteSpeed site but there was a short version on the Mongrel site. The one on the Mongrel site is a bit too complex, I can write down my fewer steps for a next blog post. After that, the work around was great. The upload function works under LiteSpeed, Mongrel using attachment_fu.
It continues....
It doesnt stop there. A few nights ago, just one of those long coding nights, I get an email back from Paul saying he has encountered the same issues I was having with LiteSpeed. He's heavy into the detailed configurations and was able to figure out some fixes. He's posted a ticket on the LiteSpeed forums to look into the issue. It looks like the LSapi version has issues with the restful redirects. The LiteSpeed support team is now looking into this so we'll see but for now, I'll be trying Paul's fix. The ticket is right here. It has the fix Paul suggested. I hope they patch it.
Update: (Aug. 5, 2007)
The LiteSpeed Team has updated the LSapi version to perform redirection more intelligently and to do redirect if there is an index file under that directory, otherwise, return it as a 404; that way the URI will be kept when handled by rails dispatcher. The thread
I've tested the LiteSpeed Enterprise version and all works perfectly. Restful Rails app with Attachement_fu on LiteSpeed is a happy little working wonder now.
Unrelated Windows Issue: (Aug. 7, 2007)
If you found this post while looking for a windows solution to error: 'Size is not in the list', I recommend adding the :size option on the model. Starting from 0.kilobytes to your max upload limit as sampled below.
1 2 |
has_attachment :content_type => :image, :size => 0.kilobytes..500.kilobytes |
SSH Tunnel Manager & CocoaMysql
July 30, 2007 @ 11:22 PM | posted by carmelyne
(last updated: 07.31.07)Port Forwarding & connecting remotely to MySQL on your Slice
First, lets set up the forwarding ports using the SSH Tunnel Manager. I usually start with the 29000 ports so there's no conflicts with registered ports. Go to the preferences on SSHTM and add a new connection. Pictures are better than words so here's how the SSHTM set up looks like:
Lastly, setting up CocoaMySQL to connect remotely to the MySQL on your slice using the forwarded ports under preferences:
It's easy and you can easily put two and two together with the screenshots. That's it!
Note:
The SSHTM user/login is generally your server/slice login and the MySQL login is usually different than the sever login so just take note. This set up is for SliceHost but should be general enough to use on other VPS set ups.
FreeImage woes are better than RMagick woes.
First I tried installing FreeImage using this article:
http://seattlerb.rubyforge.org/ImageScience.html
Unfortunately, I get an error with make:
1 2 3 4 |
Source/Metadata/Exif.cpp:498: error: cast from 'BYTE*' to 'DWORD' loses precision make[1]: *** [Source/Metadata/Exif.o] Error 1 make[1]: Leaving directory `/usr/local/src/FreeImage' make: *** [default] Error 2 |
And If I proceeded with sudo make install, another error:
1 2 3 4 5 6 7 8 |
make -f Makefile.gnu install make[1]: Entering directory `/usr/local/src/FreeImage' install -m 644 -o root -g root Source/FreeImage.h /usr/include install -m 644 -o root -g root libfreeimage.a /usr/lib install: cannot stat `libfreeimage.a': No such file or directory make[1]: *** [install] Error 1 make[1]: Leaving directory `/usr/local/src/FreeImage' make: *** [install] Error 2 |
After Googling awhile I found another repo for FreeImage.
So Let's try this again:
1 2 3 4 5 6 |
cd /usr/local/src sudo wget http://ftp.cica.es/ubuntu/ubuntu/pool/universe/f/freeimage/freeimage_3.9.3.orig.tar.gz sudo tar -xvf freeimage_3.9.3.orig.tar.gz cd freeimage-3.9.3.repacked/FreeImage make sudo make install |
Then I did:
1 2 |
gem install -y rubyinline gem install -y image_science |
Now off to my attachment_fu and crossing my fingers that it works.... Yup it works.
I'm not sure if freeimage_3.9.3.orig.tar.gz is the latest version but I'm happy enough that it works with attachment_fu.
I really have no idea why I got the errors above but one thing is for sure: It didn't work for me!
Compiling Ruby 1.8.6 on Ubuntu
July 17, 2007 @ 09:26 AM | posted by carmelyne
(last updated: 08.09.07)Lets do this quickly:
Note: This is not for an upgrade.
- cd /usr/src
- sudo wget http://rubyforge.org/frs/download.php/18421/ruby-1.8.6.tar.gz
- sudo tar -xvf ruby-1.8.6.tar.gz
- cd ruby-1.8.6
- sudo apt-get install build-essential
- ./configure
- make test
- make
- sudo make install
- ruby -v (# == ruby 1.8.6 (2007-03-13 patchlevel 0) [x86_64-linux])
- irb (# make sure irb works)
Then just do a quick update sweep for ubuntu:
- apt-get update
- apt-get dist-upgrade
UPDATE: Getting script/console to work
Error:
/usr/local/lib/ruby/1.8/irb/completion.rb:10:in `require’:
no such file to load – readline (LoadError)
Eeek now script/console won't work. So let's fix that. We'll go back to the archive and do the following:
- cd /usr/src/ruby-1.8.6/ext/readline
- ruby extconf.rb
- make
- sudo make install
Do I need a disclaimer? Hey! I was on my own too when I did this compile. ;p
Hackety Hack on my Deskity Top
May 24, 2007 @ 08:24 PM | posted by carmelyne
(last updated: 06.19.07)What is Hackety Hack?
That's a very good question. It all started with this article by _why back in 2003 titled "The Little Coder's Predicament". But I think the Hackety Hack manifesto is a better way to understand what it is than me babbling about it. :) So click on it and read on => The Hackety Manifesto.
My interest in it:
I've mentioned Hackety Hack on my RailsConf recap which was one of the topics of a BOF session I attended. Jaj and I were actually playing with it before I left for Portland. She finished lesson 1 and totally dug the whole experience. Since I came back, there is a newer version which doesn't spew gecko render errors. I am on Win XP 64bit and she's on Win XP Media. I was the only one that got the errors. I am glad that I don't get any errors anymore with v.0.5.1.
I am playing with Hackety Hack right now and going through the lessons since I was considering mentoring other kids at Jaj's school next school year. It'd be nice to know the ins and outs of the entire Hackety Hack app before I do any mentoring.
The target audience of the app is 13 and over. The eleven year olds seem to follow along well. There shouldn't be any problems for any adult to follow along. This in fact is one of the best way to start learning Ruby.
You can head on over to other Hackety Hack member pages and download their shared files. That's brilliant! There's also a forum that you can go to if you find yourself stuck on something and just want to ask others.
I am very pleased that the Linux version came out today. Waiting for the Mac version soon so I can fire it up on my MBP and say Hackety Hack on my Lapity Lap. (Oh AOK (Andrea) would be so proud of my rhyming!)
Update: (05/29/2007)
For further reading, check out Eric Mill's post on "Hackety Hack: A Growing Contingent".



