Justin Kan about his first experience using programming on the job:
A couple more hours of applied effort and I had a macro that looped through all the images in a directory tree and laid them out in Excel. I spent the next four days surfing the web and handing out files.
The first time I did any programming it was more than likely a “Hello World” script in ASP. However, I do remember doing something very similar to what Kan did to automate a process which a fellow employee spent hours a day doing.
I worked for a brokerage and each and every day a fellow employee had to take about 100 stock ticker symbols and run reports on them and input that data into an Excel spreadsheet. This was circa 2000. This went on for nearly a year before I caught wind of what they were doing. On a break or at lunch I was talking to this person and they explained to me what they did nearly every morning for two hours. I was astounded.
When I got back to my desk I fired up my code editor (EditPlus I believe) and in about an hour I had built a very simple PHP script to pull the relevant information for all 100 stock tickers using Yahoo! Finance’s CSV creator. Then a simple Excel macro formatted the data the way that this person had been doing. In all it took the script and macro about 45 seconds to run and create an email with the new data as an attachment.
It wasn’t long after I shared this workflow with my boss that the person that had been doing that job needed to figure out something else to do or they’d probably be of little use to the company. Whoops. Not my intention.
Another co-worker and friend at the time bought me a sticker from Thinkgeek and stuck it to the side of my computer. It read “Go away or I’ll replace you with a very small Shell script.” (Now available in T-shirt form.)
There has been a lot of hoopla lately about the fact that people believe that everyone should learn to code. Some are taking that quite literally to mean that everyone should learn how to build applications or websites. I don’t take it that way. I think everyone should learn the “languages” that their applications speak so that they too can take advantage of working smarter rather than harder. If you are tasked with using Excel all day become the very best at it you can be. And that means being able to program macros. If you are asked to use multiple applications on a Mac learn how to use Services or Automator to do some of your reoccurring tasks for you.
This type of programming won’t put you out of the job. It will free you up to get more work done. To use your time to do other things rather than the same thing every single day. If you do the same task more than once a week you should seriously consider learning how to automate it.
Paul Ford, of NYMag, about Facebook:
The company is also technologically weird. For example, much of the code that runs the site is written in a horrible computer language called PHP, which stands for nothing you care about. Millions of websites are built with PHP, because it works and it’s cheap to run, but PHP is a programming language like scrapple is a meat. Imagine eating two pounds of scrapple every day for the rest of your life — that’s what Facebook does, programming-wise. Which is just to say that Facebook has its own way of doing things that looks very suspect from the outside world — but man, does it work.
I use PHP. Which makes sense because man do I love scrapple.
I’ll leave the comparisons to other languages and frameworks out of this and just say that I’m happy to see that PHP 5.4 will have a built-in web server for doing things like local development without the need for installing Apache. Excellent.
Speaking of RSS to Twitter (which now supports OAuth by the way) the reason I was able to update that project so easily was due to the generosity of Tijs Verkoyen who has an open source PHP wrapper for just about every API you need.
My handy dandy little script that makes it easy to parse an RSS feed and send links to Twitter using PHP just got a nice little update. It now supports OAuth and has been cleaned up quite a bit.
Oh, version 1.0 is still available.
Or, the video in which my head explodes.
For more information, see the Viddler developers page.
Note: If you are using Google Reader you may not be able to see this video. The Reader team is dragging their feet on supporting Viddler’s latest embed code. Come on over to my site to see it.
After searching on GitHub for scripts that did the same thing I didn’t come up with much. Hopefully this both fills that void and gets better because it is now out in the open.
Update January 19, 2010: This script is now available on GitHub. Go forth and fork.
Today I noticed that my now ancient PHP script to update Twitter automatically using PHP/cron needed to be updated. It turns out that Twitter stopped recognizing URLs with ? in them as clickable links. Here is an example tweet where you’ll notice this happening.
I could have told Twitter and asked that they update the way they handle URLs but in reality my script was old, slow, too long, and shouldn’t include ? anyway so I figured I’d write a new one from scratch that included my short URL scheme.
So, here is the PHP script to parse an RSS feed and send the posts to Twitter. It includes a caching mechanism so that you won’t have duplicate URLs posted to Twitter. If you want it, take it. However, if you are better than I am at PHP (most 6yr. olds are better than I am at programming) then I ask that you fork the script on Gist and try to improve it.
Next up we have Anthony Sterling, self-proclaimed “PHP addict”, who has rewritten the script to make the configuration a bit easier. He also changed the way the cache is saved. He’s using a hashed version of the title for each post as his key. I do not believe this to be the best way to go, since post titles can easily change after publishing – but I do like that the script is about 20 lines shorter and the code is arguably cleaner.
Thanks to both Kyle and Anthony for their versions. Lets keep this going and see if we can get this script much more succinct, stable, faster, and usable by others?
Me, on The Viddler Developers Blog:
“The Viddler team is using CodeIgniter more and more for our internal PHP projects. Obviously we need to use CodeIgniter with the Viddler API quite a bit so we figured weâ€™d share with you how easy it is to include PHPViddler, the open source PHP API wrapper class for the Viddler API, in your CodeIgniter application.”
Read more in the blog post titled How to: Use the Viddler API with CodeIgniter.
Go forth, and hack! Oh, and its completely open source too. (More on this later.)
Sometimes I just can’t help myself. I’m a hacker. Not the type of hacker that wants to break into a bank’s records and steal your personal information or anything – the type of hacker that just likes to make up fun solutions to interesting problems.
Viddler’s current lack of any way to record video on a mobile phone, for instance. More specifically the iPhone. I take a lot of mobile photos (more here) on my iPhone. I’ve wanted to shoot videos on my iPhone too. Now I can.
The first step I had to take was to jailbreak my iPhone. Qik’s iPhone application, while not perfect, allows me to shoot video on my iPhone and have it be recorded, live, on Qik’s servers. In fact, if the connection is good enough you can watch me recording the video only a few seconds delayed.
Viddler bagels! Recorded with iPhone.
But I wanted my video on Viddler. It is my player of choice. Qik’s player is great, especially since it allows you to watch the video as it is being recorded. It also has some interesting interactive features like chat. But, like MTV – I want my Viddler.
So my second step was to build a bridge from Qik to the Viddler. Once the live session has been saved as an FLV Qik creates an RSS feed with a link to the video file. I’ve built a dead simple PHP script that reads that RSS feed, downloads the FLVs, and then transfers them to Viddler. I then took the liberty of creating a quick bit of code that then Twitters the link to the video on Viddler. I do this for my mobile photos posted to Flickr so I thought why not do that for mobile videos as well.
After talking with Qik about this bridge we’ve both decided to do something a little bit better than what I have hacked together using nothing more than what I had access to. So stay tuned. Â Until then, you may have my script that I wrote in an hour to play with.