tag:blogger.com,1999:blog-92019545879038061292023-11-15T08:28:15.875-08:00yeah devuseful information for developers keen on learning and staying on the edgeUnknownnoreply@blogger.comBlogger4125tag:blogger.com,1999:blog-9201954587903806129.post-46431439901324408072008-09-22T08:28:00.000-07:002008-09-22T08:40:42.704-07:00Installing the Erlang Textmate bundleCame across <a href="http://netcetera.org/cgi-bin/tmbundles.cgi?bundle=Erlang">this script</a> <a href="http://oneless.blogspot.com/2007/04/howto-erlang-textmate-bundle.html">recently</a> that bascially checked out and installed an Erlang TextMate bundle. If you're wanting to install an Erlang bundle into TextMate, this is how you do it. <div><br /></div><div><ol><li>In TextMate, go to Bundles >> Bundle Editor >> Show Bundle Editor</li><li>If you do not currently have "Erlang" as an option in the list of Bundles to the left, go ahead and create a place holder one. To do so, click the "+" sign down below and select "New Bundle". This script you're about to run will create "Erlang" so I'd recommend naming it something like "erlang" or "erlang-tmp".</li><li>In this new bundle, add a new command and call it "reload" or "erl-bund-checkout" or whatever works for you. For the "Save" option select "Nothing". For the Input option, select "None" and for the Output option select "Show as tool tip". Then copy and paste in this code into the "Command(s):" text-box: <pre>#!/bin/sh<br /><br />LC_CTYPE=en_US.UTF-8<br />SVN=`which svn`<br /><br />echo Changing to Bundles directory...<br />mkdir -p /Library/Application\ Support/TextMate/Bundles<br />cd /Library/Application\ Support/TextMate/Bundles<br /><br />if [ -d /Library/Application\ Support/TextMate/Bundles/Erlang.tmbundle ]; then<br /> echo Erlang bundle already exists - updating...<br /> $SVN up Erlang.tmbundle<br />else<br /> echo Checking out Erlang bundle...<br /> $SVN --username anon --password anon co http://macromates.com/svn/Bundles/trunk/Bundles/Erlang.tmbundle/<br />fi<br /><br />echo Reloading bundles in TextMate...<br />osascript -e 'tell app "TextMate" to reload bundles' </pre></li><br /><li><br /> That's it!. Now you can run that command by selecting it from the "Bundles" menu and after you do, you'll see a tooltip showing you what was checked now. You will also see the new "Erlang" Language option in the Bundles menu and as a Language option at the bottom of the TextMate window. <br /></li></ol></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9201954587903806129.post-19990257133785138202008-09-20T14:40:00.001-07:002008-09-21T08:43:43.419-07:0018 sites good web developers must know aboutThe best web developers are always looking to not only hone their craft, but also for ways to stay updated on what's happening on the cutting edge. With our time stretched so thin as it is, we don't often have time to scour the web for new sites or other up and comers who have something new to offer or something interesting to say. That is where this list comes in. If you're a web developer of any kind and you love what you do, you should at least know about these sites. If you know of a site that you believe should be on this list, feel free to leave a comment telling me all about it. The list of sites that all good web developers must know about (in no meaningful order) are as follows:<br /><br /><div><ol><li><a href="http://news.ycombinator.com/">Hacker news</a> - For those who don't know, this is a reddit-type news site from the Y Combinator folks. Here you'll find everything from arguments over the state of Lisp to startup advice. </li><li><a href="http://www.reddit.com/r/programming/">Programming.reddit.com</a> - Reddit's programming section. Similar to Hacker News but often more related to actual programming. </li><li><a href="http://ajaxian.com/">Ajaxian</a> - Ajaxian is a good way to stay on top of developments in the javascript world and the various javascript libraries currently in existence. If anyone of them made any interesting progress, you would hear about it here. </li><li><a href="http://stackoverflow.com/">Stack Overflow</a> - Don't you hate sites that hide their useful content behind subscription fees and ads? Unlike other programming help type sites, Stack Overflow is actually quite useful. People ask questions and (most of the time) knowledgeable people answer them.</li><li><a href="http://www.infoq.com/">InfoQ</a> - Decent articles and good interviews with more focus on the enterprise dev community.</li><li><a href="http://github.com/">Github</a> - It's almost like a social network for developers. You can watch other peoples branches, fork their project and make it your own, donate to projects and a more. Since open source projects get hosted for free, Github is a no brainer for those who use Git as their SCM solution. </li><li><a href="http://www.thinkvitamin.com/">Vitamin</a> - Usually a good resource for a broad range of web development related content. </li><li><a href="http://thedailywtf.com/">The Daily WTF</a> - What ever you do, make sure you're never doing anything ridiculed on this site. </li><li><a href="http://lambda-the-ultimate.org/">Lambda the Ultimate</a> - This blog isn't specific to a one programming language or topic over another but it covers a broad range of programming languages and developments, issue and best practices related to them. The forums are also good to peruse. </li><li><a href="http://confreaks.com/">Confreaks</a> - With this site being more specific to the Ruby industry, this was meant to bring light to sites that offer the same service but for whatever languages/industry you're more interested in. (some other notable sites in this category are <a href="http://video.google.com">Google Video</a> and <a href="http://www.omnisio.com/">Omnisio</a>)</li><li><a href="http://www.webmonkey.com/">Webmonkey</a> - Resuscitated after being killed off a few years ago, Webmonkey is a good place to go for more technical tutorials, a decent blog and quite a few cheat sheets.</li><li><a href="http://googletesting.blogspot.com/">Google's Testing Blo</a>g - Because we should all be doing it...testing that is.</li><li><a href="http://google-code-updates.blogspot.com/">Google's Code Blo</a>g - Good source of good content from a big company full of smart people.</li><li> <a href="http://nettuts.com/">Nettuts</a> - A lot of decent content covering a broad range of topics. From PHP to iPhone developing (nothing to specific there of course, thanks to the nda), they'll occasionally throws interviews into the mix. </li><li><a href="http://www.dzone.com/links/index.html">DZone</a> - A more focused and more cluttered digg-like site. A good way to find new sources of decent content. </li><li><a href="http://www.codinghorror.com/blog/">Coding Horror</a> - Entertaining blog that's update pretty consistently. Jeff Atwood (the writer) is one of the two founders (<a href="http://www.joelonsoftware.com/">Joel Spolsky</a> is the other) of Stack Overflow (mentioned above). </li><li><a href="http://math-blog.com/">Math-Blog</a> and <a href="http://www.arsmathematica.net/">Ars-Mathmatic</a>a - Because it never hurts to know a little math.</li><li><a href="http://techcrunch.com">TechCrunch</a> - A good way to find out what's going on with the business side of the internet. If you're thinking of starting your own company, it's always good to check TechCrunch (and <a href="http://www.crunchbase.com/">CrunchBase</a>) to see if you have any competition and to see how they compare.</li></ol><div>Did i miss anything?</div></div>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9201954587903806129.post-17530670276256906262008-09-17T21:10:00.000-07:002008-09-17T21:55:56.453-07:00Running Edge Merb and Datamapper<p>Merb and Datamapper are the new hotness. We all know it. To be able to currently use them to their fullest potential, you may want to run both on edge to make sure you're running with the latest fixes and features. The problem with that is that merb and datamapper are splintered into quite a few gems. Enough to make installing each one by hand kind of a pain. To alleviate this page, there are a few sake tasks you can grab for both Merb and Datmapper to make the process of running on edge a little easier. These are the steps that worked for me: </p><br /><br /><ol><br /> <li><h3>Install Sake</h3><br /> <pre>sudo gem install sake</pre><br /> <p>First, you'll need to actually install the Sake gem. If you don't know what sake is, check out this post on <a href="http://errtheblog.com/posts/60-sake-bomb">err.the_blog</a>. Sake tasks are basically system-available rake tasks. </p><br /> </li><br /> <br /> <li><h3>Install the Merb sake tasks</h3><br /> <pre>sudo sake -i http://merbivore.com/merb-dev.sake</pre><br /> <p>Now you can install the merb sake tasks. We'll use these tasks later to actually install Merb and it's minions.</p><br /> </li><br /><br /> <li><h3>install the Datamapper sake tasks</h3><br /> <pre>sudo sake -i http://datamapper.org/dm-dev.sake</pre><br /> <p>And we can't forget about the Datamapper sake tasks.</p><br /> </li><br /><br /> <li><h3>make a place to download these gems</h3><br /> <pre>sudo mkdir /opt/merb_edge</pre><br /> <pre>sudo cd /opt/merb_edge && sake merb:clone</pre><br /> <pre>sudo cd /opt/dm && sake dm:clone</pre><br /> <p><br /> I opted to store them in my /opt folder but feel free to store them wherever you'd like. This will download the various edge gems for each project to your machine.<br /> </p><br /> </li><br /> <br /><li><h3>now install them both!</h3><br /> <pre>sudo sake merb:install:all</pre><br /> <pre>cd dm</pre><br /> <pre>sake dm:install</pre> <br /><p><br /> These tasks will actually run through and install the various gems we just downloaded. Watch the commands fly by and take comfort in the fact that you didn't have to do this manually.<br /></p><br /><br /><li>and that's it! You're now running edge Merb and Datamapper</li><br /><br /></ol>Unknownnoreply@blogger.com0tag:blogger.com,1999:blog-9201954587903806129.post-22324637935294118962008-09-14T21:39:00.000-07:002008-09-15T00:53:15.155-07:00The Ultimate introduction to Merb<h3>Hello Merb</h3><b>Why Merb?</b><div><b><br /></b><div> <a href="http://www.merbivore.com/">Merb</a> is a Mode-View-Controller (MVC) web-based framework that takes a slightly different different approach to web development compared to that other Ruby web framework, Ruby On Rails. With Merb you can choose your ORM (<a href="http://datamapper.org/">DataMapper</a>, <a href="http://sequel.rubyforge.org/">Sequel</a> and <a href="http://ar.rubyonrails.org/">ActiveRecord</a>), template engine (<a href="http://haml.hamptoncatlin.com/">Haml</a> or eRuby).</div><div><br /></div><div><b>From Install to "Hello World"</b></div><div><br /></div><div><ol><li><strong>Install Merb and it's dependencies</strong><p>To install Merb, all you need to run is </p><pre>sudo gem install merb --include-dependencies</pre> <p></p></li><li><strong>Generate your Merb application</strong><p>To generate a your Merb app's folder (in this case, we'll call our app "merbtest"), all you need to run is </p><pre>merb-gen app merbtest<br /></pre>This will generate all of the base files and folders for your Merb app. <p></p></li><li><strong>Fire your app up</strong><p>Technically, at this point you can fire your app by just running </p><pre>merb</pre> from your app's root. By default, you'll be able to access your app at http://localhost:4000. You will get the default "Welcome to Merb" page which also tells us, amongst other things, how to get rid of this page (This page also happens to be the 404 page. You can view it in the app/views/exceptions folder).<p></p></li><li><strong>Setup your routes</strong><p> Your route configuration will take place in the config/router.rb file. Like Rails, you get the default route of ":controller/:action/:id" which is fine unless you have a number of "resource" routes and you want to prevent GET requests from hitting your create and destroy methods (or any other method you want to be only accessible via POST). For the purpose of this introduction to Merb, let's set a specific route for our controller we have yet to create. Comment out the r.default_routes and add this route:</p><pre> r.match('/hello').to(:controller => 'hello', :action => 'show') </pre>. This will map any requests sent to localhost:4000/hello to the hello controller's show method. I guess we should go create that controller.<p></p></li><li><strong>Creating Controllers</strong><p>To create the "Hello" controller, run </p><pre>merb-gen controller hello --testing-framework rspec </pre> Telling the generator what testing framework you're using lets merb generate the related test files which in our case would be a spec file for our controller and helper we just created. Run <pre>merb-gen controller</pre> if you'd like to see the other optional flags. <p></p> <p>Now that we have a controller, all we need to do is define our show method and create the associated view template. Add this to your Hello controller </p><br /><pre><br />def show<br />@hello = 'hi'<br />render<br />end </pre> and this to your app/views/hello/show.html.erb file: <pre> say <%= @hello > </pre> and that's it.<p></p></li><br /><li><strong>Setting up your ORM</strong> <p> As far as ORM's go, I've been wanting to try Sequel, so let's run with that. to install it, run:<br /></p><pre><br />sudo gem install merb_sequel<br /></pre> and in your config/init.rb add or uncomment<br /><pre><br />use_orm :sequel<br /></pre><p></p> <p>Now we have Sequel ready and willing. Run merb in your app root to have Sequel create a sample database.yml in your config folder you can copy from. Your database.yml file will need to look something like this:<br /></p><pre><br />:development: &defaults<br /> :adapter: mysql<br /> :database: merbtest_development<br /> :username: root<br /> :password:<br /> :host: localhost<br /><br />:test:<br /> <<: *defaults :database: merbtest_test <br />:production: <br /> <<: *defaults :database: merbtest_production </pre><br /></li> <p></p> <p> To actually populate the database we'll need a model and an actual migration to set our table up. Let's start with the model. Run </p><pre><br />merb-gen model book<br /></pre>And now we have our model and model spec file. To generate our first migration just run<br /><pre><br />merb-gen migration add_books_table --orm sequel<br /></pre> Or, at least it should create the migration for you. When I wrote this, I wasn't getting any migration files created. If you don't get any migration files, create it! Either way, your schema/migrations/001_add_books_table.rb file should have the following:<br /><pre><br />class AddBooksTable < Sequel::Migration<br /> def up<br /> create_table :books do<br /> primary_key :id<br /> varchar :title, :author<br /> timestamp :created_at<br /> text :description<br /> end<br /> end<br /><br /> def down<br /> execute 'DROP TABLE books'<br /> end<br />end <br /></pre><br /> To actually run the migration, all you need to do is run<br /><pre><br />rake sequel:db:migrate<br /></pre> I'll leave the actual populating of the database with actual data as an exercise for the reader :)<p></p></ol><b>Merb Resources</b></div><div>Like what you see and you want to learn more? Here are a few useful Merb links and resources that will help you get further:</div><div><br /></div><div>Official Merb site: <a href="http://www.merbivore.com/">http://www.merbivore.com/</a></div><div>Official Merb Documentation:<a href="http://merbivore.com/documentation.html"> http://merbivore.com/documentation.html</a></div><div>Official Merb Discussion Group: <a href="http://groups.google.com/group/merb">http://groups.google.com/group/merb</a></div><div>Merb ticket tracking: <a href="http://merb.lighthouseapp.com/dashboard">http://merb.lighthouseapp.com/dashboard</a></div><div>Merb IRC rm: #merb on irc.freenode.net</div><div>Merb Wiki: <a href="http://wiki.merbivore.com/">http://wiki.merbivore.com/</a></div><div>Merb Source: </div><div> merb-core: git clone git://github.com/wycats/merb-core.git</div><div> merb-more: git clone git://github.com/wycats/merb-more.git</div><div>Merb Community News/Tutorials: <a href="http://merbunity.com/">http://merbunity.com/</a></div><div>Merb tutorials, screencasts and news: <a href="http://www.merbcast.com/">Merbcast</a></div><div>How to contribute to Merb: <a href="http://gweezlebur.com/2008/2/1/so-you-want-to-contribute-to-merb-core-part-1" style="text-decoration: none;">http://gweezlebur.com/2008/2/1/so-you-want-to-contribute-to-merb-core-part-1</a></div><div>Popular Merb ORMs </div><div>DataMapper - <a href="http://datamapper.org/">http://datamapper.org/</a></div><div>Sequel - <a href="http://sequel.rubyforge.org/">http://sequel.rubyforge.org/</a></div><div>Alternative (to ERB) template engine:</div><div>Haml - <a href="http://haml.hamptoncatlin.com/">http://haml.hamptoncatlin.com/</a></div></div>Unknownnoreply@blogger.com0