Category Archives: Programming Languages

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

Visual Basic for Excel – Getting Started

Although I have been discouraged from learning anything about Visual Basic by some people…I am doing it anyway!

Visual Basic is a ‘high level’ programming language created by Microsoft. (Apparently high-level means that there is a strong abstraction from the details of the computer, which means it might use more ‘natural language’, should be easier to use, and might hide or automate significant areas of the programme to simplify. This sounds good to me, a beginner).

I have become interested in it over the years, purely because you can use it to automate things in Excel. After I had learned a bit of JavaScript, I went into VBA in Excel to try and make something and I saw that the language made some kind of sense – so I think I am ready to start learning a bit more about it. Note that you can learn the basics of Visual Basic without needing VB Professional, just because there is an editor inside MS Excel.

I’m going to start learning Visual Basic for Excel – or Excel VBA (Visual Basic for Applications) – and I’m going to try to use this http://www.excelvbatutor.com/

Apparently you can use VBA in a number of Microsoft Office applications, and not just Excel, so this could be even more useful than I originally thought.

Accessing the Editor

  1. Click the command button, Which is the one under ActiveX Controls. (Not the other button, which is under Form controls.) This inserts a command button, and if you click on it, it will take you to the Visual Basic Editor. Visual Basic Command Button

 

 

 

 

2.  Alternatively, you can click on Visual Basic in the Developer ribbon and start writing  functions inside the VB Editor

Visual Basic Editor

 

 

 

 

What the Visual Basic Syntax Looks Like

If you choose option 1, the command button, then when you double click on it, it will take you to the Visual Basic Editor, which will already have a bit of code in it, looking like this:

Private Sub CommandButton1_Click()

End Sub

You can write some text between these two lines to make the button do something

Visual Basic Excel

 

 

 

 

 

This will Fill up cells A1:A10 with that text. To see it in action, you have to click out of design view (on developer tab), then click on the button.

Where it says .Value it is because it is giving you the value of that cell. There are a lot of other things you can use other than .Value.  e.g.

  • .Select –  You could have Range(“A1:A4”).Select to select a  range.
  • .Font.Color – to change colour of font (uses RGB)
  • .Interior.Color – to change the colour of the cell background

NOTEthe annoyingness of having to remember that coding languages won’t accept my spelling of colour.

Declare a Variable

Like in other programming languages, if you want to save values  you will need to assign them to variables by

  1.  Giving the variable a name (no spaces or periods)
  2. Assign the variable a data type

You have to declare them before you use them.

If you give the variable type a value like

name=”Tracy”

– then data type is a string. If you don’t yet have a value, but you know that the name variable has to be a string, then in the Editor you can declare the variable like this

Dim name As String

(Trick – Dim name As String *10 – means that the max characters allowed for the name variable is 10).

Write a message Box

message=MsgBox(Prompt, Style Value,Title)

Visual Basic Message Box

 

 

 

Where message is the variable.

Prompt is the message in the box (“Click Yes to Proceed, No to stop”)

Style Value refers to the kind of buttons (vbYesNoCancel)

Title, is in the top of the box (“Login”)

You can also use an Input box.

name= InputBox(“Enter your name”)

 Some Other things you can do in Visual Basic for Excel:

  • Use control flow – with If/Else/Then statements
  • Use Loops with For….Next and Do…Loop
  • Select Case statements e.g. If it is A say “Apple”, if it is B say “Banana”. Etc. The shortcut way of doing a lot of if/else statements
  • Cut up strings using LEFT, RIGHT, LEN, MID. Etc.

To be honest – I don’t think I have yet learnt anything which I couldn’t do with normal Excel formulae…but I am only halfway through the lessons on that site, and the second half promises some useful applications, so we will see.

In other ‘learning to code’ news

  1. TreeHouse – still very impressed by the high quality of the videos, and all I am learning. Expect to add a new module to my site over the weekend in practicing my PHP.
  2. Codecademy – I lost 10 days of my streak (booo), and I hate to say…. I think I might have gone off it a bit. No, not because I lost my streak, but maybe the TreeHouse comparison isn’t helping. Also, I have given up on the Python section. It started off ok, but it is very repetitive and boring. Sometimes it doesn’t make sense until you go to the next lesson. There are some frustrating bugs. Oh, and yes, I lost quite a lot of work due to their database problem the other week. I seem to recall that the jQuery section was kind of crap like this at one point, and then they rewrote it…so I might go back in later. I am going to stop on Python and start anew with Ruby and see if I can reignite the love for Codecademy.
  3. I have had stories published on Commonwealth Banks, Women in Focus and SEOMOZ this week.

 

Leave a reply

Programming? Development? What Am I Talking About?

It is probably painfully obvious to everyone in the world that I am new to programming, simply because of the way that I write about the topic.

For example, I have been known to talk about programming languages like HTML and CSS – but wait a minute! They aren’t even programming languages (right?). They’re markup languages. Der.

On Codecademy I am learning about JavaScript, Python and Ruby – but they don’t really tell you the basics of programming. Like – where all these things fit in together, what they do, why there are so many different languages, what the difference is between a programmer and developer, etc.

Programming languages are used for controlling the behaviour of a computer – and like normal languages, programming languages conform to rules for syntax and semantics, which you have to learn. This is what I am learning in Codecademy.

But to find out a bit more about the wider world of programming (development? coding?), I have had to do a bit of my own research. And you know what I have discovered? Infographics can explain things pretty succinctly. When I need to learn things, I am often now Googling +topic +infographic, or going straight to Pinterest! (By the way, say hi to my Pinterest Programming board – what should I add?)

Hey, I work in marketing, I thought I was at the over-saturation point with infographics a long time ago – however, the passion has been re-ignited. They do have a purpose for learning and digesting difficult information!

Here is one I have found about the evolution of the main programming languages. I think it summarised in 10 minutes of reading, what I have been trying to understand from Wikipedia, StackOverflow, etc. for the last 2 hours.

History of Programming Languages

Leave a reply