Steps to learn Ruby on Rails

Posted on April 12, 2009 by Andy Callaghan.
Categories: Final project, Open source, Rails, Tips and tricks, lists.

I have pretty sucessfully taught myself Ruby on Rails from scratch with no real help from any one resource or book – in this post I will show you in some steps on how to learn the basics of Ruby on Rails, as well as some of the more detailed and difficult concepts to grasp.

In this post I will assume that you have already programmed in an interpreted or compiled language – C++, Java, Perl, Python are all perfect starts to a programming career.

Make sure you read all of this article before you begin, so you can see how your Rails skills will develop.

Start hacking

This is how all good programmers begin: with a weekend of time and an old fashioned hack-a-thon. I personally started with building a simple recipe app with collections of recipes in according to ingredients etc… 

  • Install Ruby, Rails and Gems and get them working
  • If you’re on Windows, you need a Linux virtual machine to do your development in. You’ll have A LOT of problems with Rails’ incompatibilities with Windows. Just do it, trust me!
  • Make the simple ‘Hello World’ app.
  • Hack away.

It is up to you this stage however.

Buy a few decent books

It’s all good me saying “Just get stuck in”, but I did need a lot of physical textual help with my learning curve of Ruby on Rails more complex areas. Not all the books that I bought were helpful or even in date, but there was a few that I found were invaluable to my learning.

Book one: Advanced Rails Recipes

Book two: RailsSpace

Book three: Rails Recipes

 

Subscribe to Railscasts

Ryan Bates presents a weekly video podcast in all areas of Rails. The later episodes tend toward more advanced areas of Rails, but if you get all of the episodes, you will find it difficult to get stuck with development in Rails.
www.railscasts.com

Brother MFC 215c printing in Suse 10.2

Posted on August 12, 2007 by Andy Callaghan.
Categories: Linux, Tips and tricks.

This may be very specific all of a sudden, but I've been having a few problems installing my Brother MFC 215c printer on Linux.

To aid anyone that needs to know, this is how ya do it…

  1.  Download the CUPS wrapper for the driver.
  2. Download the LPR printer driver.
  3. Simply double click LPR driver to install
  4. Install the wrapper using these commands:
  • Hit Alt-F2 to get the run dialoug
  • Type in "  konsole –type=su   "
  • When asked, enter in root password.
  • Change to the director of the downloaded rpm wrapper using the command " cd /home/andy/ " for example.
  • "   rpm -ihv -nodeps MFC210Clpr-1.0.2-1.i386.rpm     "
  • After that last command hit Alt-F2 again, type in 'Cups'
  • Go to the 'Administration' tab at the top.
  • Click 'Add this printer' next to the MFC 210C option.

You're done!

Mod_rewrite underscores as dashes in URLs

Posted on July 24, 2007 by Andy Callaghan.
Categories: Linux, Tips and tricks.

At work I was faced with a problem — to rewrite all the URLs of a website that have underscores in, to dashes. This is to aid a painful transition to manage the website with the MODx php CMS.

Here is the mod_rewrite code that converts any underscores in an URL to dashes.

 # Rewrite underscores for dashes in URLs  – upto 6 underscores
RewriteCond %{REQUEST_URI} ^(.*)_(.*)/$
RewriteRule (.*)_(.*)/ http://www.microplop.com$1-$2/ [R=301]

RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)/ http://www.microplop.com$1-$2-$3/ [R=301]

RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)_(.*)/ http://www.microplop.com$1-$2-$3-$4/ [R=301]

RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)_(.*)_(.*)/ http://www.microplop.com$1-$2-$3-$4-$5/ [R=301]

RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)_(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)_(.*)_(.*)_(.*)/ http://www.www.microplop.com$1-$2-$3-$4-$5-$6/ [R=301]

RewriteCond %{REQUEST_URI} ^(.*)_(.*)_(.*)_(.*)_(.*)_(.*)_(.*)/$
RewriteRule (.*)_(.*)_(.*)_(.*)_(.*)_(.*)_(.*)/ http://www.microplop.com$1-$2-$3-$4-$5-$6-$7/ [R=301]
 

Hope this helps 

Google Sitemap template for Movable Type

Posted on June 26, 2007 by Andy Callaghan.
Categories: Google, Tips and tricks.

I got annoyed that all the current Google happy site maps for Movable Type out there are not complete, and do not span you're entire site's pages… therefore I made another one. Feel free to take it and play, so long as the top notice is kept.

<?xml version='1.0' encoding='UTF-8'?>
    <urlset xmlns="http://www.google.com/schemas/sitemap/0.84"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.google.com/schemas/sitemap/0.84
    http://www.google.com/schemas/sitemap/0.84/sitemap.xsd">

<!– Google XML Sitemap Template for Movable Type by Andy Callaghan –> 

                <url>
                          <loc><$MTBlogURL$></loc>
                          <priority>1.0</priority>
                                <MTEntries lastn="1">
                          <lastmod><$MTEntryModifiedDate format="%Y-%m-%d"$></lastmod>
                                </MTEntries>
                          <changefreq>daily</changefreq>
                 </url>

                 <url>
                        <loc><$MTBlogURL$>archives.html</loc>
                        <priority>0.9</priority>
                               <MTEntries lastn="1">
                        <lastmod><$MTEntryModifiedDate format="%Y-%m-%d"$></lastmod>
                               </MTEntries>
                        <changefreq>daily</changefreq>
                </url>

                <MTEntries lastn="5">
        <url>
            <loc><$MTEntryPermalink$></loc>
                  <lastmod><$MTEntryModifiedDate format="%Y-%m-%d"$></lastmod>
                        <changefreq>weekly</changefreq>
                        <priority>0.8</priority>
        </url>
                </MTEntries>

                <MTEntries lastn="5" offset="5">
        <url>
            <loc><$MTEntryPermalink$></loc>
                  <lastmod><$MTEntryModifiedDate format="%Y-%m-%d"$></lastmod>
                        <changefreq>weekly</changefreq>
                        <priority>0.7</priority>
        </url>
                </MTEntries>

                <MTEntries lastn="10" offset="10">
        <url>
            <loc><$MTEntryPermalink$></loc>
                  <lastmod><$MTEntryModifiedDate format="%Y-%m-%d"$></lastmod>
                        <changefreq>weekly</changefreq>
                        <priority>0.6</priority>
        </url>
                </MTEntries>

                <MTEntries lastn="1000" offset="20">
        <url>
            <loc><$MTEntryPermalink$></loc>
                  <lastmod><$MTEntryModifiedDate format="%Y-%m-%d"$></lastmod>
                        <changefreq>weekly</changefreq>
                        <priority>0.5</priority>
        </url>
                </MTEntries>

              <MTTopLevelCategories>
                <url>
                       <loc><$MTCategoryArchiveLink$></loc>
                       <changefreq>weekly</changefreq>
                        <priority>0.8</priority>
                       <MTEntries lastn="1" category="<$MTCategoryLabel$>
                        <lastmod><$MTEntryModifiedDate format="%Y-%m-%d"$></lastmod>
                       </MTEntries>
                </url>
            </MTTopLevelCategories>

             <MTArchiveList archive_type="Monthly">

             <url>
                       <loc><$MTArchiveLink$></loc>
                       <changefreq>monthly</changefreq>
                       <priority>0.6</priority>
             </url>
            </MTArchiveList>

    </urlset>

How to write better Google ads

Posted on May 18, 2007 by Andy Callaghan.
Categories: Google, Tips and tricks.

The following is a list of the easiest and strongest ways to make you Google Adwords more effective:

  1. Plan the ad
    This may sound obvious, but so many people don't do it. Plan the ad's words and selling point carefully before making the ad. This will avoid nearly all grammatical and spelling errors.
  2. Use rhythmic techniques
    To spice up the mental sound of an advert, you can use Haiku – a traditional Japanese poetry writing technique. In Haiku, each line has a set number of syllables usually 5 on first then 7 then 5 again and so on. Here's an example of Haiku:
    Easy Revision
    Learn from the Computing Pros,
    Storm through your exams!
    www.Microplop.com
    This ad may not stand out straight away but if read, 
  3. Use punctuation to emphasise key words
    Punctuation is often neglected in advertising, but it can make a real difference to the style, look and sound of your ad. Use the extended set of keys: , . ? / : ; # ~ + – ¬ | .It may be difficult to add these in some style of ads, but use your imagination. Be careful not to overdo it though.
  4. Use metaphors, similes, alliteration and personification – the basis of emotive writing. Look at appropriate wikpedia pages for help with these – I can't do it on here!
  5. Incorporate relavant dates within ads
    Very, very few ads have dates like deadlines for offers etc. in. This is usually because the ad template is set once, and then never changed. Apply recent offers or deals that appear legitimately on your website for a CTR boost.
  6. Free culture
    Use the word free legitimately and convincingly in your ad text to attract the people who just want free stuff, bless them!

XML-RPC pinging sites

Posted on March 28, 2007 by Andy Callaghan.
Categories: Tips and tricks.

Bloggers… add these addresses to your list of pinging services to help get your traffic up. http://rpc.pingomatic.com/ http://rpc.technorati.com/rpc/ping http://1470.net/api/ping http://api.feedster.com/ping http://api.feedster.com/ping.php http://api.moreover.com/ping http://api.moreover.com/RPC2 http://api.my.yahoo.com/RPC2 http://api.my.yahoo.com/rss/ping http://bblog.com/ping.php http://bitacoras.net/ping http://blog.goo.ne.jp/XMLRPC http://blogdb.jp/xmlrpc http://blogmatcher.com/u.php http://blogsearch.google.com/ping/RPC2 http://blogsearch.google.com/ping/RPC2 http://blogsearch.google.com/ping/RPC2 http://blogupdate.org/ping http://bulkfeeds.net/rpc http://coreblog.org/ping/ http://mod-pubsub.org/kn_apps/blogchatt http://ping.amagle.com/ http://ping.bitacoras.com http://ping.blo.gs/ http://ping.blogg.de/ http://ping.bloggers.jp/rpc/ http://ping.blogmura.jp/rpc/ http://ping.cocolog-nifty.com/xmlrpc http://ping.exblog.jp/xmlrpc http://ping.feedburner.com http://ping.myblog.jp http://ping.rootblog.com/rpc.php http://ping.syndic8.com/xmlrpc.php http://ping.weblogalot.com/rpc.php http://ping.weblogs.se/ http://pinger.blogflux.com/rpc/ http://pingqueue.com/rpc/ http://rcs.datashed.net/RPC2/ http://rpc.blogbuzzmachine.com/RPC2 http://rpc.blogrolling.com/pinger/ http://rpc.britblog.com/ http://rpc.icerocket.com:10080/ http://rpc.newsgator.com/ http://rpc.pingomatic.com/ http://rpc.tailrank.com/feedburner/RPC2 http://rpc.technorati.com/rpc/ping http://rpc.weblogs.com/RPC2 http://rpc.wpkeys.com/ http://services.newsgator.com/ngws/xmlrpcping.aspx http://signup.alerts.msn.com/alerts-PREP/submitPingExtended.doz http://topicexchange.com/RPC2 http://trackback.bakeinu.jp/bakeping.php http://www.a2b.cc/setloc/bp.a2b http://www.bitacoles.net/ping.php http://www.blogdigger.com/RPC2 http://www.blogoole.com/ping/ http://www.blogoon.net/ping/ http://www.blogpeople.net/servlet/weblogUpdates http://www.blogroots.com/tb_populi.blog?id=1 http://www.blogshares.com/rpc.php http://www.blogstreet.com/xrbin/xmlrpc.cgi http://www.feedsky.com/api/RPC2 http://www.holycowdude.com/rpc/ping/ http://www.imblogs.net/ping/ http://www.lasermemory.com/lsrpc/ http://www.mod-pubsub.org/kn_apps/blogchatter/ping.php http://www.newsisfree.com/RPCCloud http://www.newsisfree.com/xmlrpctest.php http://www.popdex.com/addsite.php http://www.snipsnap.org/RPC2 http://www.weblogues.com/RPC/ http://xmlrpc.blogg.de http://xping.pubsub.com/ping/ https://phobos.apple.com/WebObjects/MZFinance.woa/wa/pingPodcast http://www.packetmonster.net/xmlrpc.php

How to synchronise iPods with Amarok

Posted on March 6, 2007 by Andy Callaghan.
Categories: Apple, Linux, Open source, Tips and tricks.

It has always been tricky to find a way to sync ipods in Linux, but I’ve found a way.

1. Get Amarok (version >= 1.4.4)

2. Make sure you have libipod installed – this allows iPod file functions.

3. Initialise all music in Amarok.

4. Initialise iPod

5. Goto ‘Playlist’ on the left menu bar

6. Under ‘Smart Play lists’ -> Collection -> All Collection.

7. Right click -> Synchronise to media device.

8. Goto ‘Media device’ on left menu bar.

9. At the bottom of the left pane under ‘Transfer Queue’ it should now read ‘All Collection’

10. Underneath the top menu bar select ‘Transfer’

Sorted!

Reduce spam with Guerrilla Mail

Posted on February 13, 2007 by Andy Callaghan.
Categories: Internet, Tips and tricks.

Found this service:

www.guerrillamail.com

You create a temporary email address which expires in 15 mins for your use on websites which need verification etc.

Dual-head nVidia powered displays on openSuse linux: Simple!

Posted on February 4, 2007 by Andy Callaghan.
Categories: Linux, Open source, Tips and tricks.

Recently I told you that I was scrapping Windows. Well a few weeks down the line, I had a few problems with my multi-headed setup with my graphics card – the nVidia Geforce 7600 GT.

I installed the new version of openSuse without any problems; Setting up an Apache server with php, cgi and ruby on rails all in the drop of a hat (not a fedora here, sorry Dr. AAA).

On first boot it displayed only on one of the screens, giving a dark off-centre shadow on the other screen – oh fudge I thought.
A quick look on t’internet was no good, as the hard Linux nerds told me to get down and dirty in the X11 configuration files.

Before I even thought about considering this, I checked with nVidia themselves, and they gave me the closed-source Linux drivers – which didn’t download properly: parity errors. I then added the legendarily named ‘packman’ repository to YaST2 – openSuse’s software manager.

A quick tick of a box and the nVidia drivers installed. When I rebooted, a little pop-up box came up helpfully saying, ‘Multi-head configuration found. Would you like to enable it?’. openSuse you beautie! It was as simple as that.

As a whole, Linux treats two screen setups a hell of a lot better than Windows does – it is a lot smoother in maximising windows and video across both screens, much more considered controls and configuration, and the openGL effects look mental on it!

So there you have it, openSuse, Linux and nVidia on Linux all rock as far as dual-head configs go.

8 simple ways to improve your website

Posted on February 2, 2007 by Andy Callaghan.
Categories: Internet, Tips and tricks.

The following is a brief explanation of how to optimise web content for search engines such as google, msn etc…

  1. Call-to-Action
    Never have a link saying ‘Click here!’.
    Always have a links that say: ‘More info on blah blah’.
    Make sure that the link always loosely describes the target page.
  2. Consistent and simple email signatures
    Make your site’s layout and theme consistent with a short CSS based signature which is consistent with all your employees.
  3. Customer-based passages
    Instead of, ‘With our product, you can do this!’
    Try, ‘At Microplop.com, we always aim to provide you with the highest possible service possible’
    This maybe seen as management talk, but it will increase the period of time a user stays on your site.
  4. State a privacy and copyright statement
    Goto http://creativecommons.org/ and create a license that will tell your customers about copyright issues and their rights to copy your content.
    Have a link in all outgoing emails saying – ‘We value your privacy’, which links to your site’s privacy agreement. This has been known to increase email subscription rate of up to 250%, as the customer feels safer with you having their details.
  5. Use superlatives carefully
    Superlatives in your content are dangerous. Words such as ‘best, cheapest, most visited…’ are strong words, and are rarely proven on websites.
    Where a superlative is used, cite it’s reference and proof from a 3rd party of it being true.
  6. Custom 404 error pages
    You will be able to setup custom 404 (page not found) error pages on your server. These are most effective if the same site layout is kept, with a site-map and webmaster email address in full display so the user can interact better with your site, and stay on it longer.
  7. Update regularly and predictably
    This is the hardest one to manage. If you add quality content at the same time roughly every week or every day(on Fridays, 9pm), your natural rankings will hugely benefit.
    If there is a huge gap in postings, your site’s natural rankings will fall.
  8. Publish pictures of the team, and address of business
    Having a sense of physical address of the business and ‘a face to a name’ greatly helps the customer trust you with their money.