If you don’t know, now you know


While ingesting text written by John I-Didn’t-know-you-had-a-cool-blog Flinchbaugh I choked on some good ideas. It’s typical that I’ll be back-slapped by a site which is kinda interesting and spend a good hour or two treating the hypertext like that home made stuffing that the wife cooks in November. You know how you try to cram as much down the ol’ food pipe before the sensory receptor thingies in your stomach lining are aware of the assault? That’s how I blow through a weblog skimming over the flow, the choice of font, browsing the categories. It’s common that during the cram, certain not-so-soft things… turkey bones, cloves from the ham, apple stems because you blindly shovel random entrees on your plate without regard for what’s adornment or what’s edible… are consumed during the process. These items deserve special attention but are mixed with the thing you are shoveling into your system with the end result being an abrupt halt in the progress of consumption. (Am I talking turkey or techie? It must be close to Thanksgiving…) You naturally pull out the thing blocking your airway and examine it. Let’s look at this together.

Starting with the layout, when John first showed me his site I was like, wow… that looks like plain text. After I left the office and brought it up again after hours, I got it. It’s brilliant! Mind you, If you’re not a developer and you’re just looking for something to read you might not agree. But c’mon! Javadoc style posts? a comment section that follow Java syntax? I love it! That’s not the bigger piece I choked on. Various references to gimp only made it part way into the air pipe triggering the gag reflex. I just started trying to use Gimp even though my graphics tool of choice remains Xara. I’m looking at gimp because it’s cross platform. I’m now in a position where I constantly switch between Linux, OSX, and WinXP and depending on the time of day or flavor of the cheddar I may find the need to edit an image. I don’t wanna haff to think about my OS, which features are available, or launch a VM to get the job done. (On Mac I normally launch Parallels to run Xara, a task that’s now taking much longer than it takes to perform the actual edit.)

John mentions making an NFS mountable. I’d been having trouble mounting my Linux box from my Mac using MacFusion maybe I should look at mounting differently? Using a different protocol? (Can Mac easily mount an NFS share?) As much as I dabble in Linux, NFS is one of those things I never dealt with. I always used either Samba or SSH.

Lot’s of other gems on hjsoft.com. Too bad I hadn’t known about it sooner. I guess I never thought to click the link in your comments.

SSH tunnels and remote port forwarding


If you want you can skip the beginning blurb and go right to the recipe.

Every so often you face a tough problem then someone sayz to yuh, “Cliff, have you tried ssh tunnels?” (well that’s what hey would say to you if you were me, and if you were me you would have a habit of making easy problems way tougher than they need to be while you make tough problems easy.) That’s what happened to me a loooong time ago… like around last month. The I was chattin’ with the VP of technology about all things Maven and mobile related explaining how clever we were with our solution to on device testing when he suggested we try ssh tunneling. I read an article that day and got excited because it looked soo easy. Then I made a promise to our mobile dev team that I would prototype it over the weeken. Then I quietly forgot about it. Today the question came up again and I was like, “Oh crap! I never did try prototyping a solution to that problem!” I gave it a good hour of effort before getting stuck. It’s really not that difficult, and after leaving for the day, coming home and attacking it fresh I found that I only had one minor problem… I didn’t read the docs completely. (That’s how it goes when I see something cool. I jump in head first and complain because I always miss something simple and fundamental.) Silly babbling aside I present you the how to on what to do to get to your CPU thru EC2…
(or any other public remote web host)

Ingredients:
1 Remote server running a flavor of ssh. (In my example I assume openSSH as it’s prevalent across many Linux distros.)
1 local computer that you desire to access also running a flavor of ssh (I’m using OS X in my example.)
2 Eggs slightly beaten whites removed.

Recipe:
1. Combine one additional parameter with the default sshd_config file under our server’s /etc/ssh folder. Use vi, nano, kate, gedit or a fancy command like the following.
sudo echo ” GatewayPorts yes” >> /etc/ssh/sshd_config
[For best results supply password when using the above crazy command.] The parameter name is GatewayPorts and the value should be yes to allow clients other than the server itself to tunnel into your local machine.

2. Execute one sshd restart command to allow the new parameter to be considered on the server. Eg.
sudo /etc/sshd restart

3. Add -R [remote port]:localhost:[local port] to 1 1/2 cup of ssh command typing slow to avoid error. The remote port is the port number you wish to tunnel through on the remote machine while the local port is the port you want all traffic to be directed to on the local machine. Eg.
ssh me@myremotehost -R 80:localhost:9002
This can be used to forward all web server requests to a server app running on the crappy Compaq that you used to execute the ssh command.

That’s it! The net result would be a service running on your desktop/laptop/MacBook in your garage appearing as if was running on the public remote web host. So then you point your browser to http://myremotehost and your home equipment gets all the traffic. The secret is the “GatewayPorts yes” property that must be set in the remote host’s /etc/ssh/sshd_config file. That secret value bypasses all common sense security allowing anybody on the internet to peek into your home located machine and access the pictures of you and the kids looking burnt up at Daytona Beach, FL.

Now why would you want to do that? There are all sorts of possibilities that arise when you start playing with tunnels. First off, they run through the security of secure shell, a robust tool that I’ve only begun to understand the capabilities of. (It seems like ssh can do everything from being a secure channel, to enabling sFTP, to being a mountable file system allowing Windows explorer like file browsing, to recording those 10:30am episodes of Judge Judy while you’re at work. Yes, ssh can do that too.) Tunnels work both ways, remote forwarding and local forwarding. If you were behind a firewall that allowed connections to remote ssh hosts but blocked some other port/protocol you could sidestep by doing something similar to the above but substituting the ‘-R’ with a ‘-L’ for a local forward. Then all the traffic sent to the machine you run the ssh command from would be forwarded to the remote host. It’s so simple! Setting up a tunnel is a matter of specifying the port you want to forward from and the port you want to forward to! Use your imagination, and happy port forwarding!

How To Suck At Programming- Put a mandatory reboot at the end of your install script


You have created the slickest software this side of the east coast! People will literally chew through the concrete enclosing the office that houses your cubicle just to get their hands on your latest release. You’ve managed to find a niche that nobody else had even considered. You will become an instant success. Now all that stands between you and the yacht you’re sure to be cruising is the loading of your software on an end user’s machine. You’ve got low level hooks into every facet of the host operating system. That’s what makes your software a killer. Explorer shell integration, low level kernel ties that catch signals on disk writes, the works. A reboot is necessary to activate all of the bells and whistles so at the conclusion of your install sequence you trigger not an optional, not even an ignorable, but a mandatory reboot enforced by a modal dialog box. No time to consult the user, you’ve gotta get your binaries out there so you can sip Pina Colada on your way to Cancoon. The user will understand right? After all everybody reboots all the time! Plus with ubiquity of the Windows operating system it’s almost an oddity to not hear individual computers constantly restarting and playing the Windows startup theme in a busy office.

Never mind the critical and possible unrecoverable work that may be in progress as your installer runs on the desktop of an unbeknownst user. Forget about adding a cancel button so that the save button on an Excel spreadsheet trapped behind your installer’s modality may be clicked. Give no warning about the soon to come power cycling because it’s O.K. In fact it’s so ok that ok is what you put on the only responsive screen widget at the tail end of your installer. The install has completed… square an ok button center of the screen. How about that conclusion message? Pick the best wording to enlighten your users, “You computer has been updated with my killer application which is way more important than the thousands of lives you were campaigning to save with your silly little editorial in the background. Don’t bother trying to drag this dialog out of the way as I have taken liberty to dominate your entire workstation with my insistent dialog. Click the only responsive rectangular button in the middle of the screen to trigger an immediate shutdown and restart rendering the thirty other open windows meaningless and obsolete. Thank you for installing my product and please take the time to fill out my survey which will automatically launch in your browser once your machine regains consciousness.”

So if you wanna appear as arrogant S.O.B. developer, totally screw up somebody’s day, change the tide of the upcoming election, and ultimately suck as a software engineer put a reboot at the end of your install script. The remainder of your installer’s good work will only last a minute but the loss of productivity and pain of unrecoverable work will last a lifetime.

How to suck at programming – Announce a feature hot-deployed to a live server without testing


(Loosely based on a true story… as a tribute to a new WordPress blog that I find very amusing… The idea here is NOT original and I can never be that witty!)

You’re the master of your domain. The one person responsible for making sure the build/deploy system is operational. Also, you’re the only developer who actually knows what’s going on in that tangled mass of technology that nobody else in the company uses but you. Sure it’s different and complicated… but that’s only because the rest of your company co-workers are weenies and don’t have what it takes to sit through 532 pages of text describing the ins and outs of Agile Software through the build system. All they know is their fancy wizards for compile and deploy, but you… yes you, the REAL software engineer know everything that goes on underneath. You can describe each tool involved in the build lifecycle down to the byte code level. That NullPointerException, that wasn’t a programming flaw! That was the team’s resistance towards your efforts externalizing the dependencies! They always assumed that they could reference a member variable directly without calling through the getter method.

At any rate, you’ve become professional. You’ve done hot deploys in your sleep while dreaming of sugar plums and dancing daisies. You once did a hot deploy remotely over dialup with a keyboard that was missing the enter key and space bar! Your expertise is matched only by the sheer number of both cold and hot deploy’s you’ve performed over the years! Why should this one be any different? Besides, the code has been tested on your development server hasn’t it? Forget about that staging area specifically set up for Quality Assurance which mirrors the hardware and configuration of the production machines! Completely bypass policies and procedures checks, and balances set up to protect the company from failure. You know better your your methods are fool proof. Just one command and you’re off and running! deployment never felt so sweet.

You draft an email to the project manager as well as the product owner as you watch the text whiz by in your command window while the hot deploy carries on. “New feature rolled out!”, goes the subject line as you inform all of a successful update completely leaving out the fact that it is still in progress as you type. The deployment completes only seconds after you hit send in Outlook. Time for an early lunch your stomach craves reminding you that you have absolutely no work left on your plate between 11:30 and 12pm while the rest of the company marvels at the new features you’ve unleashed into production.

You high five your buddy that sits across from you bragging about how awesome you both are for totally beating the deadline. You crack a joke about some of the corners that were cut and how nobody will ever notice the easter egg you snuck in as an added bonus. Alls yuh hafta do is enter the Contra code during the splash screen in your Swing based app and a mini Super Mario jumps out. This was included as an insider’s joke on the other hermit developer who actually called out “Mario” in the Olive Garden restaurant the company dined at last year thinking he saw his long lost cousin from Italy. You are totally unaware that your hot deploy only went to one of the 25 production machines situated behind the load balancer that your deployment tool talked to and that you have no security to manually update the others. You are also unaware of the impact this will have to the Fortune500 client that accesses your software remotely… totally unaware of the financial loss that is soon to come from the next seven hours of down time spent diagnosing and finally fixing the problem.

The phone call comes in just as you grab your shades ready to head out in the summer light on your way to an 11:30 dine in at the local buffet. It’s your manager on a call with the director that just got chewed by the CEO. Clueless and unaware that the director is on the line, you answer with arrogance because you two have this understanding from way back when you managed to fix a problem by remotely rebooting twelve Linux machines while on vacation in Jamaica. However the era of you saving the day have long passed (it’s all about what have you done for me lately) and he sounds unamused by the joke you mumble over the phone to him while his boss listens in… a rather serious man who has already begun paper work to hire an assistant manager who will likely assume a direct management over your department. Your manager was unaware of your plans to run the update and only found out about the fiasco after receiving a barrage of phone calls and emails which over took his inbox like angry Persians fighting the Spartans in the final scenes of 300. It’s too late to claim ignorance of the event as you’ve already sent the email company wide. It’s times like this you wish you knew more about automated integration testing. So if you wanna suck at programming, hot deploy to a production box at the same time as you claim success. You’ll only spend the next nine weeks looking for employment before taking a gig at reduced pay but the lesson will last a lifetime!