Monthly Archives: June 2014

PostgreSQL Join Tables

For our ‘Winter of Code’ we’ve chosen PostgreSQL as the database to be using while working on Spree. I’ve been reading a lot about it, but still get a bit confused on a few things. However, I’ve found this excellent resource, which has interactive exercises plus really great explanations.

I don’t want to forget them, so I’m making a list of them here, and in case he ever removes them, I’m also lifting the content (with links for attribution).

Continue reading

Leave a reply

Node School

Nodeschool

Last Saturday I attended Australia’s first organised NodeSchool. This event was held in the Australian Technology Park in Redfern, and  simultaneously in Melbourne and Hobart.

The aim of the day was to introduce newbies to Node.js by going through some online tutorials. While the program is completely available online, by attending the workshop you could get help from experienced Node developers as well as meet other beginners.

When I showed up on the day I didn’t have much of an idea of what Node.js was. Previously I had mainly been working in Ruby, with a little bit of Python and JavaScript. As the name Node.js implies, the JavaScript I do know was very useful.

Although I just said this workshop was for ‘newbies’ that is actually a bit of a lie. The fun term ‘Node School’ made me think it was for coding beginners, but actually they assumed JavaScript knowledge, and in lesson 2 I was having to use arrays and loops and such to solve the problems. So no, I wouldn’t recommend it for super-beginners.

We started the day simply – by programming a Hello World in Node.js, but it escalated quickly to be writing asynchronous programmes and modules.

Asynchronous programming was a semi-new concept for me. I had heard this term used before because Google Analytics has an asynchronous snippet, which means you can put the code high up in the page, and it won’t interrupt the loading of elements below it (i.e. slow the page load down). The fact that Node.js is asynchronous apparently means that it is very efficient.

The concept of Modules also made sense, because it just meant breaking up the logic into isolated files (or modules).

So while the new concepts made sense, I actually had a lot of trouble processing the idea of ‘callbacks’ (important part of Asynchronous concept). This was not explained super-well on the day – maybe because most people who were attending were advanced enough to already get this concept. By the end of the day, by asking lots of questions, I had a much better idea of the point of callbacks and how to use them. I think, though, that this article could have saved me a bit of time.

The other thing I learnt at Nodeschool? That Node developers are just as lovely and helpful as the Ruby community. I want to go to the Node.js meetups too! So many lovely people, never enough time.

 

 

 

3 Replies

Using My Coding Skills at Work

At the beginning of my coding journey I had big aspirations about how I would use my coding skills in my job. The most ambitious was that I basically thought I would be building the equivalent of a CRM. After about 3 months, and a lot of feeling stupid, I just customised our existing CRM…

While that was a bit discouraging, I have been using my skills to do a few other work tasks

1. Writing some custom Javascript to allow our clients to use Google Analytics to track their ‘personas’ (see more here about how I set up the custom dimensions)

2. Some other custom Javascript which you can use as an Adwords script to check whether certain products in an ecommerce store are currently available or not, and if not, switch off the ad that goes to that page. (It’s funny that I haven’t been learning Javascript really, but Google products allow you to use Javascript, so I have muddled my way through and it just shows that some coding concepts are easily transferrable).

3. A certain client was having trouble with reporting during their redesign because the developers kept taking off their Google tag manager which would cause all their analytics to stop. After this happened twice I wrote a Ruby script to check for the presence of google tag manager, ran it on a scheduler in Heroku and used Sendgrid to send an email if it wasn’t working.

4. I am using Sinatra and Ruby to write an app that will allow you to enter a URL and return some SEO information – e.g. external links, canonical tag, meta data and hopefully http header.

So when I think about it – I’ve been able to use my coding skills in my job quite a bit!

Leave a reply

What Will It Be Like To Work On Open Source?

Before I officially start work on this open source project I want to record my questions and feelings on the subject, so that after 3 months of working on it, I can see how my opinions change.

My Innermost Thoughts

1. This project (Spree) is overwhelmingly big. I will never be able to understand what this ‘whole’ thing does.

2. I can’t imagine what a beginner could contribute to an open source project.

3. How could I possibly help write documentation for software, without an intense/complete knowledge of it, and how could a beginner ever have that level of knowledge?

Oh dear – how negative all my initial thoughts are! Let’s get some positive ones down

4. I am so excited to work on a ‘real’ project because I assume this will be teaching me completely new things that ‘tutorials’ and my own little hacks never could.

5. I am excited to learn the processes of a ‘real’ developer (i.e. my mentor Trung), and hopefully adopt some of their habits.

6. I assume this is going to give me excellent experience in using GitHub, which I still struggle with.

7. I hope to come out of this having written quite a lot of rspec.

8. I hope this gives me a lot more confidence and makes me realise – wow, I can do things! (Surely if this wasn’t true, they wouldn’t even have this Rails Girls Summer of Code thing, lest it be massively demoralising).

 

Leave a reply

Revisiting Basic Concepts

While preparing for our Winter of Code, I was thinking I needed to better understand a few concepts that I use all the time, but really need to articulate what they mean/do.

RVM

RVM is the Ruby enVironment Manager. It enables switching between ruby environments.

You can use it to install a new ruby version, delete one, check which one you’re using, migrate gemsets from one ruby to another, and more.

Bundler

While RVM manages your ruby versions, Bundler manages your gems.

Ruby projects use bundler to track and install the exact gem versions that are needed for the project so you don’t have to go and install each one of them separately, keep them updated, re-check which version you’re using in each project, etc.

HomeBrew

Homebrew is a package manager for OSX. If you want to install software, like for Spree we need to install imagemagick, – we can just go $ brew install, and it will download the source, all it’s dependencies, compile them and save them. Just one command!

Rails Asset Pipeline

The asset pipeline concatenates and compresses JavaScript and CSS assets. In Rails 4 the asset pipeline is extracted out of rails into the sprockets-rails gem. The asset pipeline achieves the following:

  • Concatenates assets so that the number of requests that a browser makes to render a web page is reduced. It concatenates all JS into one master. js file and all CSS into one master .css file. (Although this can be customised to group files however you like).
  • The asset pipeline also minifies or compresses files. For CSS this is by removing whitespace and comments. (For JS it is a bit more complicated).
  • It allows coding assets via a higher-level language – with precompilation down to the actual assets.(It allows Sass for CSS and CoffeeScript for JavaScript.)
  • In production, Rails inserts an MD5 fingerprint into each filename so that the file is cached by the web browser. The cache is invalidated if you change the file (or the fingerprint).

 

 

 

Leave a reply