Tuesday, October 16, 2012

Using Wordpress for a Simple News Web Widget.


I often find myself needing a simple blog type news feed for the various sites I'm creating.  In the past when I was still doing my primary development on .NET I rolled my own solution using a SQL database to hold the entries.  At first I'd just put the data into the database directly but of course over time I wanted to be able to edit and add new entries from a web interface.  So I found myself incorporating TinyMCE and pretty soon I was writing a whole management interface just for editing news posts.  I knew it was time to stop myself before completely falling prey to NIH syndrome.

Lately I've been doing a fair amount of small projects using Wordpress and it seemed that I could just use its CMS to hold my news posts. I'd now have a repository for my posts as well as the ability to edit them.

In order to use the post data in my other sites I wanted to export my posts in JSON format. I've written a fair amount of JSON exporting code server side so I knew this wouldn't be a problem. Luckily I took a look in the Wordpress plugin repository and there's already a pretty nice plugin that dumps any post in JSON.

If you want to do this you first need to download and install the latest version of Wordpress.  This should take you all of 5 minutes unless you've never done it before in which case it might take you 30 minutes if you need to install LAMP or WAMP if you're on Windows.  You can also do it in about 5 minutes on an Amazon EC2 micro instance by following this excellent guide.

You will also need to download the JSON plugin and copy it to the plugins directory.  You can now create new posts in Wordpress and pull the data out in JSON. 

I'm using this for my Madtown yoga website.  If you look at the site you will see a list of  news posts on the right that are fed by the Wordpress blog.

The simple blog interface is here, where you can see a series of posts in the default wp skin. If you look here you can see the exact same posts rendered out as JSON data. Since I'm only using the blog as a data repository I didn't bother messing with the Wordpress UI. 

If you look at the HTML for the news section on the right you will only see two lines of relevant code.

<script src="/Scripts/wpnews.js" type="text/javascript"></script>
<div id="news-widget-container"></div>

I've implemented this as a web widget. A web widget is a way to allow people to very simply place some kind of functionality on a web page.  A container div with a specific ID is placed on the page and then that div is filled in on the client side by the corresponding JavaScript. If you want a good tutorial on web widgets you can check out this article.  It's the article I used to originally craft this news widget a few months ago.

In this case the JavaScript checks to see if JQuery v1.6.4 is currently loaded on the page and if not it loads it. It then reads the data from my Wordpress site as JSON into an array and then adds the posts as a series of divs to the HTML DOM . The actual formatting of the data is handled by a separate CSS file.

If you want to have some fun make a simple text document on your desktop that looks like this and save it as test.html.

<html>
<script src="http://madtownyoga.com/Scripts/wpnews.js" type="text/javascript"></script>
<div id="news-widget-container"></div>
</html>


If you then open this test.html file in your browser you should see an unformatted list of my news posts in the document you just created. If you add in the line

<link href="http://madtownyoga.com/Content/Site.css" rel="stylesheet" type="text/css" />

you will then see it with my formatting applied to the divs.  What's nice about widgets, besides the simplicity of using them, is the ability to their look on your page.  In this case add simple formatting to the classes FrontPageNewsTitle and FrontPageNewsContent and you can make my news feed look however you like on your web page.

If you take a look at the source code for wpnews.js it should be pretty straight forward to understand what I'm doing.  The majority of the code at the bottom is simply used to get JQuery loaded up if it isn't already used on the page.

A special note to be aware of when pulling data from a web site in JSON  format. Often when pulling data into a web widget the domain which has the data may be different from the domain from which we load our page.  The issue here is that JavaScript is not allowed to load JSON data cross domain. The way that you solve this problem is by using a format called JSONP. The only difference in JSON and JSONP is that in the latter case the data is wrapped in a function and then returned as an object when that function is called.  Since code can be loaded and executed cross domain you just got around the problem!


Monday, September 24, 2012

Raspberry Pi a la Node - Running nodejs on the Raspberry Pi

My local hackerspace Sector67 held a 24 hour build fest this weekend. Late last week in preparation for the event a few of us purchased some Raspberry Pi's.  If you're not familiar with the Pi, it's a credit card sized ARM based computer with a USB port, Ethernet port, GPU,  HDMI and Composite video out that runs Linux for about $35.  You can read more about it at the link above but the "overall real world performance is something like a 300MHZ Pentium 2, only with much, much swankier graphics."

I bought 2 with the plan to install nodejs on them.  I figured it'd be a super cheap way to create a web based controller people could use in other projects.  I'm happy to say it only took me about 3 days to make this a reality.  However it was pretty much 3 days of frustration that I'd like to keep the rest of you from having to experience so here's the scoop.

I bought the bare bones Raspberry Pi for $35.  When you buy the bare bones card you're going to need some more hardware to make it run. Here's a quick list:

1) Class 4 SD card from 4 gigs to 32 gigs in size.  The Pi uses this for its boot device.
2) A 5v 700mA micro usb power supply.
3) A powered usb hub.
4) USB Mouse/keyboard.
5) A monitor with HDMI input or an HDMI to DVI converter if your monitor is DVI only.
6) An SD card reader/writer to image the SD card with the linux boot image.

My Pi's arrived in the middle of the week along with the 2 32g SD cards I ordered off Amazon.  I rooted around my junk hardware closet and dug out an extra USB keyboard/mouse and an old Blackberry phone power supply that was 5V/650mA micro USB.  The one thing I realized I was missing was an SD card reader/writer.  I made a quick search on the internet and found that my local Target claimed to have a $10 cheap-o reader in stock.  Of course when I got there they didn't have it but they did have a $20 Belkin universal media writer as well as a couple of powered USB hubs on closeout for $5 each.  So I grabbed them and headed over to Sector67 to get things up and running.

The first order of business was to get the linux images on to my SD cards.  I decided to do this from my Windows based laptop so I downloaded the latest Debian image from the Raspberry Pi download page.  The actual release I picked up was the September 18th Raspbian "Wheezy" image.  After downloading and unzipping the image I was left with an .img file I needed to get onto the SD cards.  In order to facilitate this I needed a piece of imaging software called Image Writer for Windows.  After downloading and installing this I was able to quickly image both my SD cards with the Raspbian .img file.

Here's where I ran into my first problem.  I have a Dell monitor with HDMI input but I didn't have it at Sector.  I had an HDMI cable with an HDMI to DVI converter but when I plugged it in all I got was a blank screen.  I tried it with both Pi's and both of them did the same thing.  Ok fine, the Pi's also have a composite video output so I tried that next.  Same problem.  For some reason when I plugged both the composite and HDMI/DVI in at the same time I suddenly got video out through the HDMI/DVI combo.  If I unplugged the composite or the HDMI/DVI neither output would work.  If I plugged them both back in then the HDMI/DVI would work.  At least it allowed me to get working on the thing.  Later on I switched to my HDMI monitor with a straight HDMI connection and everything was fine.  However, I did experience some weirdness in that occasionally I would get a weird "puttering" sound through the HDMI audio.  This happened on both Pi's so I'm not quite sure what's up with that.

I was finally up and running with a basic Linux image on my Pi.  Now it was time to try and get nodejs up and running.  I did some looking around the web and the best article I could find was this one from July.  It looked highly promising.  Here's where I ran into my next gotcha.  While editing with VI I found that I couldn't enter a # character on my keyboard.  I got around it by cutting and pasting a # from somewhere else in the document but a few minutes later when I needed to use the | character on the command line I knew I was going to have to fix the problem.

The image that is on the Raspberry Pi website was obviously generated by someone in the UK as the keyboard settings are set for a UK keyboard and this is what was causing me grief.  To fix this issue you first have to type in the following:

$ sudo dpkg-reconfigure keyboard-configuration

You'll have to go through a few dialog boxes to select your keyboard and the region of US.  At one point you have to select Other to get to the other regions besides the UK ones.

After finishing you can reboot the system or just do the following:

$ sudo invoke-rc.d keyboard-setup start

Moving on with a functional keyboard I followed the instructions in the article and downloaded the 6.15 node distribution and attempted to get it compiled on the Pi.  So here's where things started to suck.  The first thing I found was it took anywhere from a 90 minutes to 2 hours to compile the v8 library on the Raspberry Pi.  I immediately, and by immediately I mean 90 minutes later, I ran into a problem when trying to link the library.  After searching around the net for a solution I found what I thought was my issue and recompiled.  90 minutes later I ran into another issue.  This went on for some time with trying different compiler options to get things working.  After 4 hours or so of frustration I decided to head home and work on it there.  Here came my next problem.  In my haste to head home I didn't bother issuing a


$ sudo halt
so when I got home my SD disc image was corrupted and wouldn't boot correctly.  Awesome.  So after a re-imaging of the card, upping the file system to use all the card, (I didn't mention this earlier but you need to do this to use all the space on the card and it takes like 30 minutes), and fixing the keyboard thing I was ready to go back at it.

Now for another woe.  The Pi has an option to overclock/overvolt it for better performance.  In the past this wasn't recommended and could void your warranty.  As of the latest release there is a turbo mode that lets you crank up your 700MHz processor in a variety of steps to 1GHz.  However they note that you need to "test stability" as it's dependent on your Pi and your power supply.

At this point I was getting pretty frustrated with compile times so I cranked that baby up to 1GHz, re-downloaded node and got to work compiling.  Unfortunately this ended really quick as for some reason the node compile died almost immediately.  I took a look at the file that wouldn't compile and found that the text file was corrupted.  Turns out that my "stability" was not good.  I assumed that my power supply was not up to the job, so I cranked my CPU back down to 700 MHz and reformatted again to get rid of my corrupt files.

I continued to get nowhere with building node and spent a lot of time searching for other ways to get it to build.  I probably tried 3 different articles that people had posted as well as one binary distribution that immediately died with a segmentation fault.  Finally on Saturday morning I came across this gist.  This is the one that made it all happen.  Down near the bottom is the post from a month ago with the script that worked for them as well as me:

export NODE_VER=0.8.7
cd ~
rm -rf ~/work/node-build/node-$NODE_VER;mkdir -p ~/work/node-build && cd ~/work/node-build
rm -rf ~/opt/node-$NODE_VER;mkdir -p ~/opt/node-$NODE_VER

curl -O https://github.com/adammw/node/commit/arm-patches-2.patch

curl http://nodejs.org/dist/v$NODE_VER/node-v$NODE_VER.tar.gz | tar xz
cd node-v$NODE_VER
git apply --stat --apply ../arm-patches-2.patch

./configure --shared-openssl --without-snapshot --prefix=~/opt/node-$NODE_VER

date;time make CFLAGS+=-O2 CXXFLAGS+=-O2 install;date


If you copy this into a shell script and run it you should get an actual build of node 0.8.7 and npm that works.  After the build I was quickly able to install express and have a web site up and running on the Raspberry Pi.  I was also able to install the serialport library for nodejs and talk to an Arduino board over the USB connection (a topic for another day).

I was so excited to have node running that I even went ahead and compiled redis for the Pi as well.
I just pulled down the distribution off this link  and did a

$ make -j 2
When it's done it will tell you to run "make test" which I did as well just for grins.  This takes quite a while to run but it passed everything for me.

I'm really looking forward to messing around with this more.  A super cheap, super tiny embedded linux system that is powered by nodejs has got me fired up to put all sorts of stuff online.  A HUGE HUGE tip of the hat to Adam Malcontenti-Wilson for the gist that got me up and running.

Finally here's the obligatory screenshot of my Raspberry Pi running the default Express installation on nodejs.


Wednesday, September 5, 2012

Yoga, Morse Code, and that Damn Song!


After an extended break I'm back to doing yoga 3 or 4 times a week.  I roll out for the 6 am class at Capital Fitness, grab a coffee on my way back from Pinkus Mcbride and by 7:15 I'm drinking it while catching up on the webs.

I really enjoy yoga.  It gives me an hour to center myself and pretty much changes my attitude for the day.  I can tell when I've been away from it.  It's hard to get other tech guys to try it out but luckily I know a few who have and they've become converts as well.

Last Monday I got up, got all my stuff together and headed out the door at 5:50 A.M.  It takes me 5 minutes to walk to the studio so my timing was perfect. I got down to the elevators and after pushing the button I heard it.  There was a faint electronic sound coming from somewhere that was going "Beep beep beep, beeeeeep beeeeeep beeeeep, beep beep beep".  3 short beeps, 3 long beeps, and then 3 short beeps.  Now maybe it's because I'm old or was a boy scout, but I recognized that immediately as SOS, the international Morse code cry for help.

I tried to track the source but couldn't get a bead on where it was coming from.  At the same time another tenant came out in scrubs obviously headed off to his job at a hospital somewhere.  I asked him if he heard the beeping and he said "Yeah it's been doing that for a while."  I said "Well that's Morse code for SOS" and he responded, "Whoa you're right, you should call our landlord or 911 or something."  He then jumped in the elevator and took off.

Now there is no way I'm making it to yoga.  There are people out there who will roll into yoga class late.  I'm not one of them.  It's just too disruptive and not good manners. I'm thinking calling 911 is not a great idea. The only solution is to call my landlord.

Our landlord is a pretty cool guy and he lives right above us in our building.  This is great since when something is wrong in the building it's typically fixed immediately.  I happen to have his cell phone so I decided it was time to wake him up.  I went back to our apartment and gave him a ring.  After a sleepy "Hello" I explained what was up and I'm pretty sure he was thinking "WTF, why are you calling me about this" but he agreed to meet me at the elevators in a couple minutes.

After hearing the beeping from the air vent he agreed that something was up.  We headed down a floor and couldn't hear anything, so we went back up a couple floors where the sound was loudly emitting from a service closet.  After unlocking it the cause was pretty apparent.  The drain for the building's air conditioner was clogged and water was pooling in the closet.  My landlord had put a moisture meter in the room for this very occurrence and it was sending out the "SOS" message over and over.

I was a little pissed at this point.  Wouldn't an annoying electronic "whoop whoop", or siren, or anything other than "SOS" have been just as effective?  Perhaps not as it probably wouldn't have stopped me in my tracks on the way to yoga if it had been anything else. But still......

Later in the day I sent him an email apologizing for getting him out of bed at 6 A.M. but that it would make a good blog post. His response was

"I was almost up anyway and better safe than sorry.  
You're right--you are likely the only person who knows the SOS sequence. 
Please be sure to list how quickly McBride responded too."

So if you're ever looking for an apartment know that McBride Companies has awesome response time to apartment issues, even if they have annoying Flash Music on their website. Seriously go listen to it.

Thursday morning I went off for my usual 6 am Yoga class.  Before the class got rolling our instructor Erin said we'd be working on opening up for Hanumanasana, also known as the splits, not exactly my forte. She also said she had put together an inspirational playlist for the day.

Now  if you asked me to name what tranquil yoga song we'd be starting off with I can guarantee you that my first 10,000 guesses would not be the song that haunts my life, Europe's Final Countdown.  If you remember, it was only a few months ago I last ran into this song outside my bedroom window.  When it came on I pretty much lost it. I was laughing so hard I couldn't even pay attention to what was going on.

As a bonus here's a couple of pretty decent yoga type tunes relating to the Monkey God,  Hanuman. One is by MC Yogi and the other one by Wah.

Namaste!




Wednesday, July 25, 2012

Sherman Hemsley - Peace

Sherman Hemsley left us yesterday and that sucks.

In the late 90s we were releasing our product ACID to the market and getting ready to hit COMDEX and NAMM (our largest trade shows).  One day our head of marketing Roy Elkins came up to me and said that he was considering using Sherman Hemsley as our spokesperson at the tradeshows.  Roy had been long time friends with Sherman and what many people didn't know was Sherman was a musician.  Roy had hooked him up with a copy of ACID and Sherman was loving making his own music with it.

At COMDEX we had these giant laminated 10 foot tall head shots of Sherman.  When we came back I remember that one of those hung on the wall of our shipping department for years.  Every day you'd roll through there would be a giant Sherm staring at you.  There was something right about that.  One of the guys from that shipping department works in sales today at Sonic Foundry.  A couple years ago I asked him if he knew whatever happened to that poster. He wasn't sure and we both were a little bit bummed that it'd been lost.  I have know idea where I'd ever hang it but I really wish I still had it.

A good friend of mine Steve who worked for Creative Labs, the makers of the Soundblaster card, came up to me one day during the convention.  As he stood looking over at Sherman he said, "You guys really have Sherman Hemsley as your spokesperson for ACID.  Man, I love you guys, you're so weird!" He then quickly rushed over to meet him.

Later that evening Roy, Rimas, and I were sitting at a black jack table in the casino of our hotel.  Sherman had told Roy that he wanted to come down and hang with us for a while.  It was pretty apparent when Sherman had hit the casino.  I swear that every single table in that casino turned and looked when he went by.  You could hear people saying "Hey! isn't that George Jefferson?".

I didn't get to spend a lot of time with Sherman, but from what I did I noticed a humble, sincerely nice man.  His voice always quiet and a huge smile as he met with adoring fans.  He loved music, and he loved making music.  I am lucky to have met him.

I have a lot of mementos from my days at Sonic Foundry, but this is one of my favorites.  At the shows we handed out CD's with 3 tracks that Sherman had created using ACID.  His vocals are buried quietly in the tracks, much like the gentle soul that he was.  His simple message of "peace", so representative of the man.  So where ever you are are Sherman Hemsley, "Peace".

Sherman CD

Tuesday, July 3, 2012

On my way!

I'm "On my way!" to Mexico for my annual house building trip.  Each year I join my dad and about 100 others to build 5 houses outside Tecate.    It's always a test in connectivity since we stay at a small ranch with lots of bunk beds and iffy wireless.  It's also a serious test of my rudimentary Spanish.

I fly out to San Diego a day ahead of time to buy tools and such so last night I dropped in a local Mexican restaurant to grab some food.  While I was waiting I heard a guy say to his girlfriend/wife "Not only are you ruining my life but you're ruining my meal as well".  Classy.

Can someone tell my why Apple decided that the auto-correct in the IPhone should change "omw" to "On my way!".  Really Apple?  We don't all know what omw means?  Someone there decided that we should all look super cheery with "On my way!". I don't know why this bugs me so much.

Nos vemos!



Friday, June 22, 2012

Automatic Teller UI, Can we fix this please?

While sitting in a restaurant last night I was watching the waitress use the touch screen POS system.  I'm always interested in the user interface of systems like this, and though it certainly seemed functional enough, I have to say that the button look and layout was just plain ugly.  I could only think "would it really have been that hard to pretty this thing up a bit."

Earlier in the day I had stopped at my local Chase ATM to grab some cash.  The woman in front of me finished up her transaction and rushed off.  When I approached the screen I was met with the "Do you want another transaction?" screen.  While I was pressing the "No" response, I thought "Thank God I'm not somebody who would extract cash from this person's account".

Which brings me to one of my biggest User Interface pet peeves.  Why does this screen exist?  What programming genius decided that every person who ever uses an ATM should be asked if they would like to perform another transaction?  I have got to believe that literally 99% of all users walk up to an ATM and perform a single transaction.   Whoever designed this decided that it was better for 99 people to have to press NO, taking the chance that they walk away and have money stolen from their account, for the convenience of the 1 person who does multiple transactions.

Some bank web-sites even mention this in their ATM security section.  And I quote:

"Make sure you have finalized the transaction and removed your card before leaving the ATM. Some ATMs ask if you want "another transaction". You must reply "No" to close out your card's transactions. If you do not close your card's transactions and remove your card, the next ATM user can use your card."

The simple answer here is to do away with this screen. Let the 1 out of 100 users who actually wants to do a deposit and get some cash re-swipe his card and reenter his PIN.

Occasionally you still run into ATMs that have the "suck your card inside mechanism."  A number of times I've watched people walk away counting their money leaving their card inside the machine.  I never understood why those machines don't kick out the card and then dispense your money. No one is ever going to leave without their money.  It would've been so simple to just change the order of cash dispersion and card ejection and problem solved.

As a programmer these kinds of things make me nuts.  I'm hoping that the ATM industry did lots of research and there's something I'm missing here. There is some mysterious reason why they chose to program these machines in this fashion.  My guess is it was someone not thinking about it, or someone who did, but thought that fighting to get the change made late in production was too much of a hassle.  No matter what the reason it's not helping out the poor person who doesn't have an honest person behind them when they forget to press No.

Tuesday, June 12, 2012

Using Webstorm or PHPStorm and Mocha for unit testing in Node.js




I have been working on a node.js project and decided I wanted to get some unit testing going .  I did some research and there are a lot of test frameworks out there for node.  You can use Jasmine, node-unit, Expresso, Mocha or a myriad of other frameworks.  Apparently this is a problem people have decided to solve over and over and over.  After a bit of research I settled on Mocha.  It’s written by the same guy who writes the awesome Express library and is well supported. 

You can write your unit tests in a variety of formats whether you like BDD or TDD and you can write them in either javascript or coffeescript.  Mocha is pretty deep and supports all sorts of input and output formats. There is actually a great tutorial on peepcode called Full Stack Node JS that goes into a lot of stuff on getting started with node and has a lengthy section on testing with Mocha. Spend the $12 right now it’s worth it. 

After you get done watching that you should be able to write some basic unit tests in javascript or coffeescript and run them from the command line using npm test.  I say “should” because like all things “node”, documentation is pretty sparse.  Be prepared to do some googling. 

So now that I was able to write unit tests and run them from the command line I should've been happy as a clam right?  Wrong.  Typically when I’m writing code I like to write a test method and then run it in a debugger.  I did some searching around and couldn't fine a way to do this with Webstorm, my choice of javascript editor.  I like Webstorm because you can debug your javascript from within the IDE and single step through the code. If you need to do PHP stuff you probably want to buy PHPStorm as it has all of the functionality of Webstorm plus the ability to work with PHP.  I bought Webstorm first but 6 months after the fact the people at JetBrains were nice enough to give me a discount when I upgraded to PHPStorm.

When you run the Mocha test framework it runs a node.js program that takes a list of test files on the command line.  I realized that if I could figure out a way to pass the files without having to use the command line I could probably debug my js files that are loaded by Mocha.  My plan was to run the mocha.js file from Webstorm in debug mode and that would then load up my test js files. After spending a few hours digging into the Mocha code, it looked like the plumbing was there for what I needed but it was still going to take some time to figure out exactly what to do.

I don’t know why but for some reason I decided to poke around a bit on TJ Holowaychuk’s blog (the author of Mocha).  I clicked on “About” which took me to the footer of his blog. By coincidence the last blog entry on the page from March 24th said:

“A new JS API was added, which mocha(1) now utilizes. This higher-level JS API will make it easier for those who want to script the testing process with Mocha. I have yet to document this API but it looks like this:”

There it was right in front of me.  20 lines of code that would help me do exactly what I needed to put together my own “runner” file for doing my unit tests in a project.  Holy stroke of luck! I found the “I have yet to document this API” statement to be quite humorous since you rarely find heavily documented node.js libraries.  Here’s what I’m doing to make my test files Mocha compatible as well as debuggable from within Webstorm.

First add Mocha to your node project by doing the usual "npm install mocha" and make a directory called test.  This is where all your tests will live.  You can make subdirectories for your tests if you’ve got lots of them but make sure everything lives in test.  In test you create a base file called testRunner.js.  This file has the code you need to load your other tests and it is the file you will run in debug mode from within Webstorm.  

Your project should look something like this:




The code for testRunner is as follows

var testFiles=["test/_helper.js","test/tests.js","test/tests.coffee"];


var Mocha = require('mocha');


var mocha = new Mocha;


mocha.reporter('spec').ui('bdd');


for (var i =0;i<testFiles.length;i++){


 mocha.addFile(testFiles[i]);


}

var runner = mocha.run(function(){

                console.log('finished');

});

The array at the top is where you put the names of the files that contain all your tests.  As you can see above I’m going to run 3 test files named _helper.js,tests.js, and tests.coffee.  The _helper.js is stub file and all it contains is the follow line of code:

require('coffee-script');

If you’re not going to write any of your test scripts in coffeescript then you don’t need to include this file.  If you are, then make sure it’s the first file in your list of tests.

The next lines of code load Mocha, create an instance of it, specify that you want to use the behavior driven development style of tests, add the test files, and then run them. When you run this from Webstorm the output from your tests wlll show up in the Webstorm console window and you can single step through the code for debugging. 

I hope this helps some of the other people out there who were trying to figure out how to work with Mocha and Webstorm.

Wednesday, June 6, 2012

Programming with the IPad.. not so much

Lately I’ve been doing a lot of coding for Wordpress and node.js. So with my dead laptop I wanted to see if I could get any work done on a recent trip with my IPad.

With my laptop I’ve got everything I need for this kind of development. I have Wordpress running under IIS on my laptop and use Chrome with its built in debugger to debug html, css and javascript on the client side. For node.js I again use Chrome for client side debugging and Webstorm for code editing and server side debugging. I can quickly make code changes and see the results both client and server side. This is just not possible on the IPad.

First let’s look at the client side. On the IPad you don’t have the advantage of a nice client side debugger for web pages. You can turn on the Safari debug window in the IPad settings section but all this will show you is when you’ve got a Javascript error. It’s almost useless. I did find a tip for viewing the source of web pages. Basically it saves a short amount of Javascript into a book mark, which you then select when you’re on a web page. It runs the following code:


 var sourceWindow=window.open('about:blank');

 var newDoc=sourceWindow.document; 

 newDoc.open(); 

 newDoc.write('<html><head><title>Source of' +

              document.location.href +

              '</title></head><body></body></html>');

 newDoc.close();

 var pre=newDoc.body.appendChild(newDoc.createElement("pre"));

 pre.appendChild(newDoc.createTextNode(document.documentElement.innerHTML));



The code opens a new blank window. Writes an empty html page with the title “Source of” and the url of the current page. It finishes by appending the html source of the current page into a text element of the new page. Voila! You’ve got source.

Now for the server side. I have yet to find an “app” that lets me run node.js or the Wordpress php software on the IPad. So basically I was stuck using the IPad as a terminal to a server. I needed two things to make this happen. First I needed a server on which to run Wordpress and node.js. Second I needed to be connected to said server anytime I want to do work. The latter was a bit of a pain on this trip as even though the plane said it had wifi, it didn’t, and my AT&T coverage in Georgia pretty much sucked as well as the DSL from Southern Bell. But putting aside the whole connection issue lets look at what it took to actually get up and running from a server standpoint.

There are a lot of hosting options out there these days but I wanted something I could get up and running quickly, inexpensively, and that let me at a command line interface.  The last requirement was so I could install and run any software I wanted for development. The thing that fit the bill was Amazon’s EC2 instance. Amazon has a variety of levels of cloud server that you can spin up for varying prices. The cool thing is that to get people started they allow you to run a micro instance for free for up to a year. This allows you to fire up your own linux server at their expense. You can’t get crazy with it and you surely don’t want to use it for any real production but for my purposes of doing light weight development it would do the trick.

Setting up an ec2 instance is relatively painless. There are a few things you’ll need to know including you need to edit your security settings to open up some ports. They’re all closed off at first and you’re going to need to open them up for node, http, and ssh. If you don't do this it can be pretty frustrating at first trying to figure out why you can't shell in to your instance.

You’re going to need something that allows you to ssh into your ec2 instance and the thing i use is putty for windows. You’ll need to set up putty to use your private key from amazon. Once you’ve done this you can bring up a shell on your ec2 linux instance and install pretty much anything you want. I installed both Wordpress and node.js on mine, opened up the ports I needed and was ready to roll. I also installed mongodb as I needed a database for my node.js development.

There are two apps you’re going to want for working with the code on yourIPad in conjunction with your ec2 instance. These are Textastic a sweet little context sensitive code editor and Prompt by Panic. Prompt is an ssh client for the IPad that works really well. In fact I installed node.js and mongodb from my IPad using Prompt. The important thing to know is that both Textastic and Prompt will need to have key pairs to work with the ec2 instance and you will need Putty to generate those for you. Here’s additional info on hooking up ec2 with Prompt.

Once you've done all this you're ready to make code changes on your ec2 instance from your IPad.

I got a call from Best Buy while I was out of town that my laptop was back from Asus and I literally stopped to pick it up on the way home from the airport. What I found is that while you can do work using the IPad I wouldn’t really consider it an alternative to a laptop for full on development.  I found myself frustrated not being able to do basic editing and debugging tasks without jumping through hoops. It’ll definitely get you out of a pinch if you want to log on a server and do some basic maintenance of code but that’s about it.

Maybe I’m missing something and I’d love to hear from others with suggestions for better methods of development or tools.

As an aside another tool I use alot and works fine from the IPad is jsfiddle.net. This site allows you to edit code snippets of html,css, and javascript online and see the results immediately. You can save the code, iterate on it and share it with others. I highly recommend it.

In conclusion I'd say I actually did a fair amount of work. I’m just not sure I was really productive,  since the majority of the work I did was just setting up my IPad to prove the concept that I could do work with it.

Tuesday, June 5, 2012

Facebook making it interesting

I saw this letter Paul Graham put together for the Y-Combinator folks yesterday and I thought it was interesting.  When I was down at Tech Stars in April everyone was absolutely giddy about Facebook's purchase of Instagram. It didn't matter whether it was an organizer, participant, or investor they were all simply besides themselves with $$$ in their eyes over that acquisition.  I remember thinking "oh geez valuations of start-ups are going to be over the top now."

It's still too early to see what effect the Facebook IPO will really have but the one line I agree with 100 percent is this:

 "I often tell startups after raising money that they should act as if it's the last they're ever going to get. "

It reminds me of a conversation I had one time at NAMM with an unnamed band member from what you'd call a One Hit Wonder Band of the 80's.  He told me that when they had their first (and only) hit that they blew all the money from it as they figured they'd just write another hit.  After all, they had it figured out now and it was easy.  Needless to say that didn't happen.

Unfortunately I've heard this same kind of bravado now from a number of young entrepreneurs.  I often say "hey I could be wrong here, but..." and then try to impress on them how hard it can be to raise money.  The problem is when the first round is easy it's often hard to convince them that the second might be harder.

I really hope they are able to keep their visions going if they need more capital. Even if they can't I guess they can always go back to working a day job just like the one hit wonder bands ended up touring Brazil for years to come.

Sunday, May 27, 2012

Ipad Road Warrior

2 months ago my Macbook Pro finally bit the dust after four years. I guess it’s to be expected but it did it at the worst time, a few days before I left town. I went out to the local Mac store and talked to one of the local “geniuses” who told me it was $400 just to send it in and have it looked at. Needless to say I decided against that and instead took it to Sector 67 and let the peeps there gut it for parts.

I needed something relatively quick so I went out to Best Buy and bought an Asus Zenbook for around $1000. It’s a nice little unit much like the Macbook Air and I was super happy. Well that was until a few days ago when the battery decided to fritz out. It was stuck at 68% charge and it wouldn’t charge any higher. If you unplugged the laptop it would immediately power off meaning it wasn’t holding a charge. I called up Asus and talked to a tech support person and after 20 minutes on the phone he decided I needed to ship it back to them. He said it was going to take 2 to 3 weeks for them to fix the laptop however their RMA system was down so he asked me if I could call back another time.

So now I’m really not a happy camper. I took the laptop back to Best Buy where I bought it and they said they couldn’t take it back but that they could ship it to Asus for me. This was at least more helpful than Asus and their broken RMA system. First they wanted me to take it home and reset it back to its default to make sure this wasn’t an operating system issue. So I took it home for the night and reset the system wiping out days of work I had spent setting it up to do development. This didn’t fix the problem so the following day I took it back to Best Buy and they shipped it off to Asus.

So here I am without a laptop and about to head out of town for weeks at a time over the next 6 weeks. What’s a software guy to do?

Well I have this Ipad, so maybe it’s time to figure out if I can use this thing to be productive. I did a bunch of research on the web and talked to one of the resident super Apple geeks at Sector 67 and here’s what I’ve come up with.

First you can’t write lots of text on an Ipad without a keyboard. So I quickly ordered a Logitech blue tooth keyboard from Amazon. It actually works quite well and I’m typing this entry on it right now.

Next I did some research on apps and what I was going to need to be successful with this ipad productivity endeavor. The app I’m using to write this is called Elements. This is an app that is good at text entry and supports markdown, a pseudo html notation format.

Elements, like the other apps I’m going to get to, all use dropbox as one of the places where they store files. I was already using dropbox since I needed a cloud storage space for files when moving between my computers at home and my computer at Sector 67 as well as my laptop. If you’re not using dropbox you should look into it. It’s free for small amounts of storage and I’m also using it with git for source code control.

In the past I’ve done most of my source code control in Perforce which we used at Sonic Foundry. Perforce also has a free installation of their server for personal use. The problem is that once you go beyond a couple people it gets relatively expensive. It doesn’t work well for people who are working disconnected and I needed a solution where I can connect from a linux box as well as a windows box. Lastly I needed something that would let me interconnect across the interwebs without having to setup and expose a whole server. Thus I chose git as my new scc solution. I know I could use github with a private account but for now using git with dropbox does the trick. Here’s a really good article on how to do it if you’re interested.

OK so now I’ve got the ability to write blog entries using Elements and have them stored on dropbox. When I bought my Ipad I bought the wireless version as I really didn’t want to have to subscribe to another phone plan. These days you can usually find wireless wherever you are but occasionally that’s not true. It’s especially not true when you are staying in a casino playing poker. Well that’s not 100% accurate. You can find wireless in most casinos. It will just cost you $10-$15 a day for what is usually a pretty crappy connection.

Last time I was in Council Bluffs Pdub and I were both in need of an internet connection and I finally decided to give AT&T the extra $20 a month to turn my iphone into a personal wireless hotspot. Although I find it ridiculous that they’re charging me extra for something my phone already does, the convenience and cost savings over paying a casino or hotel a daily fee is worth it. It’s come in handy a number of times where the wireless available in airports, hotels and other places has been pay only or just plain non-existent. It also makes for good times when other people see your network available to their phones or laptops when you’re in a restaurant or bar.

So now I should be able to take this content, convert it to html in Elements and paste it into the editor on blogspot. I’ve already uploaded a picture of me writing this on the front porch, from my Iphone to dropbox to see if I can get a picture in here as well.








Since we’ve covered blog postings on the fly this seems like a good stopping point. The next entry is going to be about working with code and servers from the Ipad.

Update: Getting the picture onto blogger was a bit of a hassle. Getting it on my ipad from my iphone was no big deal. I simply copied it up to dropbox from my iphone and then copied it down from dropbox to my ipad. Both times I just used the dropbox app. The problem was there is no way to upload it from the ipad to blogger using the web interface. I'm planning to switch all my blogging to Wordpress so I guess I could've just given up for now.

Instead after googling around I found that there is another app out there called BlogPress that interfaces directly with blogger. Once I loaded it up I had no problem getting the picture up. However, I clicked on the photo and saw that it's being hosted at BlogPressApp.com with some advertising and such. If I had known that was all it was going to do I could have shoved the photo on one of my public sites myself and then linked to it. It also completely munged up the formatting of my previous text for this entry. I won't be using this app after I get switched over.

Wednesday, May 2, 2012

Why wuntusk?

A few weeks ago I decided that I needed a new company name.  Although Uncle Gringo Enterprises has served me well for the last year on Linked-In, it lacked a certain "je ne sais quoi".  I wanted something simple and catchy but somehow linked to my philosophy on life and business.  Pdub and I were driving back from a poker tournament in Council Bluffs, Iowa, along highway 80, giving me plenty of time to think on the problem.

These past couple years I've been doing a fair amount of yoga and in turn I ended up doing some reading on the Hindu devas.  If you've never read the Ramayana or the Mahabharata you're really missing out on some awesome stories.  A portion of the Ramayana includes my favorite Hindu deva Hanuman, the monkey god.  Hanuman was incredibly devoted to Rama, and when Rama's wife Sita was kidnapped, he did all sorts of cool stuff to help out, including turning into a cat, burning down a city with his tail, and bringing back a whole mountain, but I digress.

Another deva more familiar to yogis around the world is Ganesha. He's the one with the elephant head on a boy's body. Ganesha is patient, kind, and humble and the deva of intellect and wisdom. He is "the remover of obstacles" and typically invoked before the undertaking of any new project.

The ancient sage Vyasa asked Ganesha to scribe the Mahabharata in a single sitting.   Ganesha knew that no normal pen would work for this, so he broke off one of his own tusks and used it as the pen for the enormous task.  Thus Ganesha is typically depicted with a broken tusk or "one tusk".

So there you have it the "one tusk" became wuntusk, and it all just kind of popped out of my head on the drive home.  When I got home I tried a few different fonts with the word and I really liked the way it looked in the moderna font.

Props to my friend Kalindi for being the only person I know of who immediately got the name.


Saturday, April 28, 2012

Startup Weekend Day 2.. Not Quite The Final Countdown

Today is the 2nd day of Startup Weekend.  I slept lightly last night as I was still jazzed from the happenings of the opening night. That's probably why I snapped awake to the whistling of  Europe's "The Final Countdown" outside my window.  Yep that's right, someone was walking down Butler Street at 7 a.m. whistling the opening to this timeless ditty.  I love living downtown, and that's not even sarcastic.

Last night started off with great food provided by Pedro's.  I have to give them an extra hat tip as in this age of  mild, milder, and basically ketchup with onions, their verde sauce had a bit of a kick. By the way, no one is going be lacking for food at this event. Following that there was an intro by the organizers, and some fun and inspirational speeches from the local entrepreneurati.  Then came the pitches...

The way this worked was anyone there was allowed to get up and make a one minute pitch for an idea.  Once all the pitches were made anyone who wanted a second chance was given another minute.  So about an hour or so later we'd listened to some 50 different ideas.  Everyone got 3 post it notes and people wandered around the room talking to the idea-bringers and then sticking their note on the 3 ideas they liked best.  The votes were tallied and 15 ideas were picked to move forward.  Unfortunately 2 of the ideas I thought had serious potential, didn't make it out of the first round.

After all this came the team formation.  People moved from group to group discussing the merits of the ideas and trying to find a group they wanted to work with.  Two teams refused to be put down by the voting process and went rogue.  They hadn't been assigned a "space" in the room so they hung a sign around their necks and worked the room looking for team members. That's entrepreneurial spirit. I finally got out of there around 12:30 after a 30 minute programming discussion in the parking lot. 

Today teams are finalized and then the work begins with the judging tomorrow.

One thing I want to mention was an announcement by the City of Madison.  They're launching an open data initiative and this weekend they've opened up an API to query data on every property in Madison.  I got to talk with Alder Scott Resnick who was super helpful, and after the usual smartphone/email misspelling hijinx helped me get the info to access the servers.  I ended up poking at it for an hour last night and now know the assessed value of my apartment building, the houses I lived in in college, and various commercial properties on East Washington.  It's not so much that you couldn't get this data before, but now you can get at it programatically, and that's going to lead to cool apps.  How about a graphical map of the isthmus with a view of properties currently for rent, and data drawn right from the city showing, rooms, bathrooms, property owner. You get the picture.

We're planning on banging on it more at Startup Weekend.  I have to give a hand to Madison's IT group and Mayor Soglin.  A lot of work went into getting this ready for this weekend.  It's still in an alpha/beta form but they've really done a great job.  Hopefully we don't cause any server crashes.












First casualty of the weekend.. my shirt... caught it on a hook and ripped it to shreds, but they gave out T-shirts so I'm even. Oh, and I registered entrepreneurati.com halfway through writing this post  .. don't even try.




Friday, April 27, 2012

Sector67, My New Home

Capital Entrepeneurs Week continues this weekend with Startup Weekend.  I'll be there mentoring starting tonight.  It should be interesting as my understanding is more than 100 people have signed up to participate.

I got involved through my new group of friends over at Sector67.  Remember how I went to San Antonio and ran across the collaborative workspace Geekdom?  Well when I returned I knew I needed to find something like this in Madison.  Turns out that there is one only it's smaller, runs on a hell of a lot less money, and is just as cool.

So what is this place?  It's many things, but mostly it's a place where people hang out, exchange ideas, and help each other to make stuff.  It's also a classroom, lab, woodworking space, foundry, glassblowing, metalworking, sewing, pottery, programming, and just about anything else space. From the moment I wandered in I knew I had found a place to spend some serious time.

Sector67 is a non-profit started by Chris Meyer.  I'm not sure if Chris started it to make a space for creative people in Madison to build stuff or if he just wanted to hang out in the best geek clubhouse ever made.  It's probably a little bit of both and he's certainly achieved both goals.  Chris, like many of the people you'll find there, knows a little about everything, and a lot about most things.  He's a great resource and he's always helping someone build something, acquiring new stuff for the space, or teaching a class on anything from welding to microcontroller programming.

Since I left Sonic Foundry I have been accumulating computer and electronics stuff to play with for various projects.  Unfortunately this has slowly turned the living room into a computer lab.  I'm now renting a space down at Sector67 and have moved it all (well most of it) down there.  It's sometimes not the best place for writing software, particularly when Chris is teaching engine repair to a group of 7 high school students.  Even headphones have a hard time blocking out the BANG BANG BANG of a  15 year old taking a hammer to an old lawn mower engine.  But the vibe in Sector67 is worth it.  You can't help but want to create stuff while you're there.


There is a live web cam on the Sector67 site which will show you what's going on in the main room at any given time.  A buddy of mine texted me a pic the other day saying "hahahah just saw you on the Sector67 cam".  I'm talking to Chris who's eating his lunch.  I was telling him that it's hard to figure out if he's cooking his lunch in the toaster oven or if insulation is burning off something.  The two smells are really similar.




So I plan on being a part of this place and so should you.  Don't be intimidated.  Sector67 is kind of like doing yoga for the first time.  You walk into a room with a bunch of people doing stuff that you can't imagine you'll ever be able to do. All you need to do is start.  Next thing you know you're doing it along with everyone else.  And if you've got kids you should check out this list of classes.  If I had kids I'd buy them a membership just so they had a place to hang out and do cool stuff.



Wednesday, April 25, 2012

Techstars Cloud

Earlier this month I headed down to San Antonio to watch eleven start-up companies present the results of their 3 months spent at the start-up accelerator, Techstars Cloud.

Techstars is one of a variety of programs set up to accelerate start-ups using investment and mentoring.  In return they take a small portion of the company.  Techstars Cloud happened to be focused on a group of companies all who were trying to do "cloud" solutions, with San Antonio being the perfect location as that's where Rackspace is.

I've been working with a number of small start-ups here in town, one a Y Combinator graduate, TrustEgg, was started in part by one of my former engineers at Sonic Foundry, Gabe Krambs. Gabe is one of those super talented guys who I always knew I was lucky to have around.  Then last winter I had the opportunity to meet one of the founders of VidMaker,  Dale Emmons, a former Sony employee had been working with his buddies Ryan and Yuri to build video editing for the cloud. At that time they were waiting to hear from Techstars.  It wasn't but a couple weeks later and they were off to San Antonio.  So 6 weeks ago when they asked me if I'd like to come down and watch them present on their demo day I jumped at the chance.

First let me get snarky for a second...After a pleasant evening in San Antonio, including drinks with the VidMaker guys, I headed to the presentation in the morning.  Now I've practiced yoga for some time and one thing that's always struck me is how unaware of personal space sweaty yogis tend to be.  But I'll tell you they have absolutely nothing on tech geeks. Just try to navigate yourself through a crowded group of tech boys half of which are wearing backpacks bigger than a guy headed up Mt. Everest.  I mean seriously what is in those packs? I thought this was Techstars "Cloud" not Techstars "I've got a rack of servers and my tennis shoes strapped to my back".

The presentations by the 11 companies were limited to about 5 minutes each and were extremely polished.  The VidMaker presentation was particularly well received, partly due to the recent Instagram  acquisition, and also because they were the one business model that the layperson could wrap their head around.  The other 10 were definitely more technical and aimed at people who are looking for SaaS solutions.

Here's the program with info on each company and here are some comments on a few of them

appsembler - A pretty cool concept for developers who are looking for easy hosting, billing, support and deployment of software as a service products.  I had a chance to talk with Nate Aune at the After Party.  He's a sharp guy and he hooked me up with the early beta.  This is a product that could save a lot of time for small SaaS developers who don't want to be bogged down with all the backend maintenance costs.

cloudability - monitors and manages spending by companies on their cloud services.  These guys had a killer presentation wrapped up by announcing that every Rackspace customer got a free cloudability account.  They are solving a serious pain point for many companies and are going to do well.

cloudsnap - provides middlewear that allows you to connect web apps together without having to know about underlying api's.  They provide a web interface that basically says whenever new data is added to this web application, take it, massage it, and send it over to this other web application.  I had a chance to talk with their CEO about how they were adding to their supported application list. In order to maintain quality they're doing all the coding which is understandable. Eventually as they expand they may be able to have a 3rd party api that would let companies define their data input and outputs.  This would've been nice back when I was working on Mediasite. If we'd been able to provide an adapter to cloudsnap it would've been trivial for us to move data in and out of Salesforce whenever someone engaged with a Mediasite presentation.

Tempo - provides the ability to save tons of time log data in the cloud.  Think things like temperature sensors and other devices that log tens, hundreds, or even thousands of data points a minute.  I spent a lot of time talking with Andrew their CEO at the After Party.  They were all heading back to Chicago right after that to keep working on their company.  He had a lot of good insight on the companies there and I hope to spend some time at their space in Chicago in the next few months.

VidMaker - The Madison guys who are going to take the world by storm with collaborative video editing.  I'm sure you'll be hearing more about them from me over the coming months.  They're back in town and probably hiring.

Lastly while I was out there I met the head of the collaborative workspace Geekdom.  This is a pretty cool idea.  People coming together in a communal space to help each other build cool things.  I found myself thinking I need to find a place like that where I can hang my hat.... (foreshadowing)


Oh and I almost forgot.. these enterprising engineers decided to start some kind of new booze.. met them at the party as well.. it was a little sweet but they said they're working on it...drinkupsmart


Tuesday, April 10, 2012

Evernote & Trello - two tools that make my life better

In the last year since I left my job as CTO at Sonic Foundry I've found myself having to survive on my own without an IT staff.  This means I've had to deal with the everyday tasks of setting up network storage, maintaining a network, dealing with software, contacts, email and all the other stuff you take for granted when you work in a company. On that note I just wanted to quickly make a post on 2 tools that really do make my life better on a daily basis. 

The first one is Evernote.  By now most of you probably know about this piece of software but if you don't go to the link right now and install it.  You can come back and read the rest of this later.  Go..now..I'm serious.....
Evernote is your notepad for everything.  I use it all the time when I travel.  Recently I was in Las Vegas playing poker and I ran into a guy who I had met in Reno.  Because of Evernote I was able to completely freak him out. When he sat down at the table I called him by name and then asked him how his trip to Cancun ended up. I use it for flight/hotel reservations.. taking pictures of wine labels I like, web pages with programming info, and just about anything else I can possibly take a note on.  The program is free but you can pay $5 a month if you find it useful.  Pay them the $5 you will get more than that in use.

The other free program I stumbled on recently is trello If you're constantly making lists of things you need to do, or even worse, you don't, then this is your tool.  Trello allows you to create tasks and keep track of them in a really simple and intuitive manner.  It uses boards to tell you what's being worked on, who's working on what, and where something is in a process. Live Evernote it's one of those tools that you won't know how great it is until you start using it.  Go to trello, make a free account and then just start making lists of stuff to do.  You'll thank me later.