Category Archives: Programming

My Github repo of SMSified experiments

Smsified 1Earlier in the week I mentioned a quick python app I wrote to send SMS messages using SMSified. I’m storing that code and some other experiments up in a Github repo at:

https://github.com/danyork/smsified-experiments/

If you are a Github user and also interested in building SMS apps, please feel free to “watch” that repo and follow along with my own experiments. Code will probably be a mixture of python and Node.js, with occasional other languages thrown in.

Follow The Tropo Blog To Learn About Developing For Voice, SMS, IM, Twitter…

TropologoWant to learn about how to build apps that interact with people via voice, text messaging / SMS, instant messaging and Twitter? Using languages like Ruby, python, PHP, Groovy and Node.js?

If so, check out the Tropo blog for some cool examples, tutorials and videos. As I was catching up on my Twitter feed this morning, I noticed a great post there about responding differently to different types of users and a short video about using SMS to find the time and date of tweetchats. Cool stuff!

P.S. And yes, in full disclosure Tropo.com is a cloud communications service of my employer, Voxeo, and I do myself sometimes write on the Tropo blog, particularly about python or Node.js. However, if I didn’t think what they are writing about there is in fact interesting, I wouldn’t mention it here. 🙂

Get the New Stable Release of Node.js (version 0.4.0) – Many Improvements, Features, Fixes

NodejslogoNews out of the Node.js community today is the second stable release of Node.js, version 0.4.0. You can download it from the site or grab it from the Github repo. The Node.js Manual and Documentation has also been updated for version 0.4.0.

Looking through the Changelog at all the changes in the 0.3.x releases and the final 0.4.0 release, there’s an impressive amount of work that’s gone on. There’s a great writeup about the 0.4.0 announcement on the Node.js site that summarizes the overall changes. Some of the changes I found most interesting include:

  • Major overhaul (seems almost like a complete rewrite) of the TLS/SSL system.
  • New and improved HTTP client.
  • Changes that will help with module management.
  • Upgrade to the latest V8 JavaScript engine and the new built-in debugger which Ryan Dahl created a video about
  • A new “os” module.

All in all a solid bunch of changes. I’m upgrading my servers…

P.S. There is a helpful Wiki page about migrating Node.js apps from 0.2 to 0.3.x (which is now 0.4.0) that can help you understand what you need to change to upgrade. (In my case, my apps were built on later 0.3.x builds and are currently relatively basic, so my upgrade is easy.)

Using PostBin to Debug Webhooks

Recently I was trying to debug a python app that ran on Tropo.com Scripting and made a web call back to an application on another server. I wanted to see exactly what was being sent in the HTTP POST rom Tropo to the other server… and that’s when my colleague Mark Headd pointed me over to PostBin.org:

postbin.jpg

PostBin is very cool because literally all you do is click the “Make a PostBin” button and then you get a URL that looks like

http://www.postbin.org/1dlalso

Now you just do a HTTP POST to that URL and… ta da… the results of your post appear on the new webpage.

It’s a very cool way to debug webhooks!

P.S. Obviously there is no language limitation here. I happened to use python because that was what I was debugging, but you can use PostBin with ANY language that is sending HTTP connections.

Textastic – a great iPad code editor

Lately I have been looking for a code editor for the iPad … and am VERY impressed so far by Textastic. It is not a free app, but it has been well worth the money already. with it, i was able to very easily create the rough draft of an HTML email newsletter on my flight down to Florida… i have also done some codinv in it…

The are a range of great featurea, but the most prominent one is the simple extra row on top of the keyboard that gives you characters commonly used in programming. HUGE timesaver! as shown in the image below, you can work with multiple files… all in all I am extremely impressed. Many thanks to the friends on Twitter who suggested it!

Slides: Node.js, Event Loops and How To Stop Writing Spaghetti Code

As a comment to my recent post on understanding event-driven programming, Tom Hughes-Croucher left a pointer over to a presentation he gave last year about Node.js and event-driven programming. I enjoyed his style and would have liked to hear him give it in person… here it is embedded for anyone else looking to understand more on Node.js and the world of the Event Loop:

NodeFu – Free Hosting of Your Node.JS Apps In The Cloud!

NodeFu.jpgHave you been experimenting with Node.JS (as I have) and wished you had a place to host your Node.js apps? If so, you may want to check out NodeFu.com, a new hosting service that just launched today.

Created by my friend and co-worker Chris Matthieu out of frustration with not getting invites for some of the other new Node.js hosting services, NodeFu is hosted up in Amazon EC2 and currently offers free hosting of Node.js apps to anyone interested.

Getting Started

As shown on the NodeFu home page, the process of using NodeFu is fairly straightforward. You request a coupon (an invite) via a commandline curl:

curl -X POST -d "email=your_address[email protected]" http://nodefu.com/coupon

When you get an email confirming your invite, you can register an account, provide our ssh public key, etc.

From then on out all deployments happen purely through git commands. You start out by registering a new NodeFu application via another command-line curl command:

curl -X POST -u "testuser:123" -d "appname=myapp&start=hello.js" http://api.nodefu.com/app

NodeFu will respond with some JSON that includes the port number your app will run on and the name of the git repo you will push to. You then just do two git commands:

git remote add nodefu the_url_returned_by_our_api
git push nodefu master

And your NodeFu app will be live at http://appname.nodefu.com. As you work on your app, you just do more commits to your local git repo and then do a “git push nodefu master” when you want to update the live app. Once you push to NodeFu, your app should automagically be updated.

A Very Basic Example

You can see NodeFu in action in a VERY basic form at:

http://dany2.nodefu.com

As I write this post today, that app is literally a super basic “Hello, World” Node.js app. The code is visible up on GitHub at https://github.com/danyork/nodefu-dany2 and hopefully in the next bit I’ll have a chance to turn it into something a bit more involved.

Building Voice and SMS Apps with NodeFu

I’ve also created a Tropo app at http://tropohello.nodefu.com which uses the Tropo WebAPI library for Node.js to return JSON to Tropo.com where you can connect to the app using voice, SMS, IM or Twitter. Right now I only have voice and SMS wired up, but you can try out the app at any of these numbers:

Voice & SMS Messaging: +1-850-462-8472
Skype Voice: +990009369991478810
SIP Voice: sip:[email protected]
INum Voice: +883510001827346

Tropo is providing the voice and SMS connectivity and then communicating with my app running over on NodeFu.com. Pretty cool stuff!

Learning More and Trying It Out

You can just go to NodeFu.com to learn more and ask for an invite. Chris has invited 50 people in so far and plans to be giving out more invites over the next few days. It’s notable that Chris has open-sourced the entire codebase for NodeFu, so anyone else could really just download Chris’ code and set themselves up with their own NodeFu-like site:

https://github.com/chrismatthieu/nodefu

Here’s a video explaining what Chris is trying to do:

Other Options

I should note that Chris isn’t alone in coming up with a service like this. The comments to the Hacker News story about Chris’ site (and also the Mashable story) show a range of other Node.js hosting options, including:

… and a couple of others were listed, too, but they seem to offer other forms of hosted JavaScript versus Node.JS hosting.

The key point of all of this is that for those of us experimenting with Node.JS, this is truly a wonderful time to be trying it out, because we now have so many options before us!

Node Tuts – a video podcast tutorial on learning Node.js

In my continued interest to learn more about Node.js, I was recently pointed to an enjoyable set of video podcasts called “Node Tuts” and available at:

http://nodetuts.com

In each episode, host Pedro Teixeira walks you through how to perform some task using Node.js. He uses a combination of the command line, TextMate (to view the code) and his web browser. I have only started working through the series, but so far I have already picked up a few tips and learned about a few new modules to check out.

These episodes are recordings of Pedro hacking away and do include mistakes he makes (and corrects). This actually was okay because it helped me check my own knowledge. There was one show where I thought “he didn’t declare that module” and sure enough he had to go back and correct that. The rawness of the recording, though, was helpful in understanding how you could debug code in Node.js.

I do also like that each episode builds on the previous one (so far). It provides a useful way to expand your knowledge based on what you just learned.

As I mentioned, I am only starting to work through the recordings, but so far I have found them quite helpful!

Learning Node.js – a video from Ryan Dahl

I have admittedly become a bit fascinated with Node.js lately. In part because it uses that most mundane of web programming languages, JavaScript… the language looked down upon by so many, but actually quite powerful with the right tools. In part because I’m intrigued by a event-driven I/O. And in part because it’s so trivial to get web services up and running (and yes, that is true of other frameworks as well).

If you’ve been interested in learning more about Node.js, this video may help you as it helped me:

One note: It’s from November 2009, which in web language terms that is quite old… and Node.js has evolved a bit from where it was in this video. For instance, the “tcp” module mentioned in an early demo is now the “net” module. (I found some good examples of current usage.)

Ultimately my goal is to experiment with the Tropo WebAPI library for Node.js to build voice, SMS and Twitter apps using Tropo.com. Right now, though… I’m just having fun learning a new way to program!

Python heading up O’Reilly’s recent book promotion?

oreillybooks.jpgTwo days ago, Tim O’Reilly published an interesting post around the books people chose as part of O’Reilly’s Cyber-Monday deal. What I found interesting was the number of books all about…

python!

Given that I’ve been programming now and then in python for over 10+ years, I just found it both interesting and pleasing to see that python is still growing in interest. Google has certainly driven much of that interest in recent years with AppEngine, but Tim O’Reilly points to “data science” as a new driver:

… while Python has a large following in data science. It’s particularly interesting, and important, that using Python to collect data from sensors (“Real World Instrumentation with Python”) made it onto the list.

Very cool to see!

P.S. I agree with Tim that the list is a very interesting view into what programmers (who buy from O’Reilly) are interested in…