↓ Archives ↓

Get SSH Protocol Links Working in Ubuntu+Chrome+Unity

This has been plaguing me for years and I finally figured it out. Thanks to eleperte who created ssh-xdg-open, I was finally able to see what to do. Ssh-xdg-open didn't work for me, but there was enough information available for me to figure out the missing pieces.

Forget about gconftool and you don't need ssh-xdg-open. If all you want is working ssh://protocol links, then just use xdg-mime to set the default application for handling ssh protocol links and create an application handler with the same name as that application.

xdg-mime default ssh.desktop x-scheme-handler/ssh cat << EOF > ~/.local/share/applications/ssh.desktop [Desktop Entry] Version=1.0 Name=SSH Launcher Exec=bash -c '(URL="%U" HOST="\${URL:6}"; ssh \$HOST); bash' Terminal=true Type=Application Icon=utilities-terminal EOF

All this does is launch bash, parse the host from the URL and executes ssh. When ssh exits, it executes bash again so the window stays open. I wrote it this way because you can't count on everything to work all the time and if you don't keep the window open, the error messages will vanish into the ether and your sanity with them.

Is UglifyJS Really Worth It?

Like the rest of the world, RightScale has been moving more and more of its application from the server to the client. That means we've suddenly found managing larger and larger piles of JavaScript. All that JavaScript needs to be delivered to clients as quickly as possible in order to minimize the time customers spend waiting for web pages to load.

So we created a nice little build tool leveraging Grunt which among other things takes all that JavaScript and compiles it into one big blob for each application. In order to make that big blob as small as possible, we use UglifyJS.

Unfortunately, some of our apps are so big that running the uglify Grunt task can take a long time. Ideally, this task would be fast enough to where it could be run at or just before deploying. Fast enough is a pretty subjective term, but we deploy code all the time to production and various kinds of staging systems, so fast enough becomes however long you want to wait for code deploys in addition to the time it already takes. In my case, three extra minutes is not fast enough.

Continue reading →

Upload to YouTube Through Google API v3 and CORS

Do a search on google for "youtube api javascript upload" and you'll get all kinds of results. There are a huge number of ways people try to get around the document same origin policy to make an HTTP request using JavaScript. Lets go through some of them:

You can create a real HTML form and submit it with JavaScript, and you can avoid the page refresh by submitting to an iframe. You can use jsonp to sneak by and load remote JavaScript using a script tag. You can fruitlessly attempt to muck with document.domain. There are all kinds of other crazy hacks people use to circumvent the same origin policy, but they are all either severely limited, or suffer in terms of your ability to control the HTTP request parameters and properly handle the response in failure scenarios.

Another option is to skip the whole idea of submitting your requests directly from the browser to the remote server. You can install your own proxy server on the same domain as your client JavaScript application and make requests to your proxy which then makes the disallowed requests for you because your proxy server isn't governed by the same origin policy. This method gives you full control over the entire process, but setting up and maintaining a proxy server, paying for bandwidth and storage, and dealing with the added complexity might be too expensive and time consuming. It might also be totally unnecessary.

CORS is here to save the day. CORS has existed for a long time, but for some reason (maybe browser compatibility reasons), it hasn't yet caught on in a big way. Many well-known APIs, including Google's YouTube Data API v3 already support CORS. And chances are, the browser you're currently using supports CORS too.

Continue reading →

automated trading via optionshouse api

Trading securities is a dangerous game. It can be difficult to develop a strategy and stick to it in the face of an emotional marketplace that stampedes from one extreme to the other. Sticking to a trading strategy takes time, discipline and serious balls far beyond the capacity of most human beings.

One way rise above the impediments is to encode your strategy into an algorithm and instruct a machine to execute that strategy for you. You can still freak out and pull the plug at any time, but until you do, machines can execute your strategy without hesitation or emotion. Just the exercise of encoding potential trading strategies into machine instructions is enough to spot problems and potential weaknesses.

Continue reading →

in praise of the mundane

It's easy to fall into the trap of feeling special. From our own perspective we seem so original and in many respects we really are unique. Western society rightly encourages us to celebrate the things that make us special. Individuality is virtuous.

In reality, we're much more similar than we are different. The great ideas we have are at best incremental improvements on existing theory. At worst, they're complete plagiarism. Even the problems we face are just as commonplace. Nothing is new. Nothing is special. If you think otherwise, you're only deluding yourself. As the ecclesiast said so long ago:

That which has been is that which will be, And that which has been done is that which will be done. So there is nothing new under the sun. Is there anything of which one might say, “See this, it is new”? Already it has existed for ages Which were before us. (Ecclesiastes 1:9,10 NASB)

There is nothing new under the sun, and yet we act as though there is. I see this pattern all over the place in the software world. We worry and fret over our silly problems and bite our nails wondering how to solve the same problems that have been solved countless times before. We think, "Here is some problem that is uniquely mine. In fact, this problem is so unique that I must invent a new kind of solution."

Continue reading →

getting started with cloud computing

I was talking to a friend (lets call him Dave) the other day. He had a good idea on how he could run his QuickBooks accounting software in the cloud. By running the software in the cloud, he wouldn't need to ship QuickBooks backup files back and forth to his accountants, he could just launch a cloud instance and let the accountants RDP into the instance and use the software.

It sounds great, but Dave is cheap and he wanted to run this on an EC2 t1.micro and the machine just couldn't handle it. So of course he wanted to upgrade the instance. Being the cloud computing guy that I am, he called me up and asked me how to do it. At first, I thought it was a silly question, and I told him that of course it is impossible to upgrade the memory on a running EC2 instance.

Continue reading →

jQuery Deferreds and the jQuery Promise Method

jqXHR and the Promise Interface

jQuery 1.5 features a brand new mechanism for dealing with asynchronous event-driven processing. This system, called deferreds, was first implemented for jQuery's $.ajax method and so we'll be looking closely at that method.

$.ajax({ url: "/some/url", success: function(r){ alert("Success: " + r); }, error: function(r){ alert('Error: ' + r); } }); Continue reading →

hp 02 ciss for my photosmart c7280

Having been thoroughly satisfied with prior HP printer experiences, I made the mistake of purchasing a brand new HP Photosmart c7280. I'm a big fan of these all-in-one devices. I especially like having a WiFi interface, and scanning to a USB disk as opposed to some ridiculous TWAIN protocol is such a great idea it's hard to imagine why some devices still don't support it. But all the things I love about this printer are outweighed by the horrible ink system.

Lets start with the most obvious problem with these ink cartridges. They're way too small, the color cartridges are only 11 mL. I've seen claims that they can yield up to 500 pages. I have no data to argue with that figure, but I can tell you it seems very high compared to what I've seen. Continue reading →

Arduino WiShield + MAX7219 7 Segment Display

For this project, I wanted to build a device capable of displaying up to 8 digits on a seven segment display. Sounds easy, right? The catch is, I wanted to retrieve these digits from the Internet over WiFi.

I took this opportunity to try out the ever-popular Arduino platform. Arduino turned out to be a good choice for this project for several because it has:

  • an easy to use, Arduino compatible WiFi adapter (WiShield) put out by asynclabs
  • a library available for talking to the WiShield with examples included
  • a MAX7219 interface library
  • an onboard USB programmer and a software programmer that works on Ubuntu
Continue reading →

new opportunities at rightscale

"To be honest, I was a little surprised it didn't happen earlier," was a common sentiment directed toward me as news spread that I was leaving the Fresno Bee. I had been carefully scanning job listings every day for at least a year and occasionally applying for one that seemed like a good fit. As time wore on, I become more and more aware of how lucky I was to have found the kind of job I did find in Fresno. I can count on one hand the number of Fresno-based job openings that piqued my interest over the course of a full year. None of them excited me enough to leave a perfectly good job at the Bee.

Strangely enough, my small effort in packaging uWSGI for Ubuntu was what prompted some communication with a RightScale employee who encouraged me to apply for a position. I almost didn't because I've grown so attached to my friends and family in Fresno, but the reality of my situation was apparent. If I wanted an exciting job with lots of growth potential, I would have to move.

The Fresno Bee was a great employer. It had fostered the growth of my skills and talents, my supervisors had always been kind and flexible, but the time has come for me to either move on to pursue growth or settle down in Fresno. I think I'm too young to settle down.

RightScale provides me with a new set of opportunities to really push the limits of technology and I am very excited to start work tomorrow.