Monday, November 02, 2009

Verizon FIOS Disappoints … Again.

When I heard FIOS was coming to my town, I got in line.  I couldn’t wait to get what I felt was the best technology in the market.  True, I’m no fan of Comcast.  Competition is good.

The core technology that gets me my signal?  Fine, can’t complain.  As far as I know it’s even faster than I had before.  I have no complaints.

It’s the extras.  The user experience.  For instance?  Take the DVR option.  I have several TVs, and a common scenario is to start watching some primetime show, like a Grey’s Anatomy or something, downstairs in the main family room with HD.  But often my wife will say “Can we finish watching this upstairs?”  Verizon has a Home Sharing option that allows exactly this.  Very handy.

Except for the limitations.  Like, for instance, it won’t “downscale”.  So with a standard tv upstairs I have to record all my programs in standard (even though the box itself is a HD box) if I ever want to stream them.  I’ve learned to live with that. It also can’t be programmed from the remote boxes, so if you finish watching most of your programs upstairs on the bedroom tv you can’t just hit Delete – you have to remember, next time you’re downstairs, to purge all the old shows you’re done with.  An annoyance, but you can live with it.

The latest disappointment though comes with the new Media Manager for Mac.  I’ve got all the family photos on a Mac Mini (which, also, is connected up to the HD tv in my family room).  That’s also where I rip the kids’ DVDs, and manage all my iTunes stuff.  So when they said “Run this software and your iTunes media will show up on your FIOS boxes” I thought, “Awesome.”

Except for one small problem – it only works on the DVR box.  In a “Home Sharing” setup, you only have 1 DVR box in the house, and the rest are just dumb satellite player boxes.

See the problem?  In order to share recorded television shows, you need – are required to have – exactly one Home Sharing DVR.  If you had a DVR box in every room, you could get Media Manager content on every DVR box.  But then you couldn’t share recorded tv programming!

That’s what bugs me.  I appreciate having to work the kinks out of the system.  But here you’ve got a clear cut case of Verizon setting up mutually exclusive features, and then leaving it up to the customer to realize that.   I’m not even misinterpreting it, either, as I had a lengthy conversation with Verizon Support over Twitter when I discovered this problem and they confirmed that yes, the options are mutually exclusive.  Get multiple DVRs to share media manager content, or get one DVR to share recorded tv shows, but not both.

I hope they get some of these major problems worked out.  I doubt it, given the underlying architectural problem (namely, the remote boxes are without a hard drive and thus doomed to be brain dead).  But, still.  Hope remains.

Tuesday, October 27, 2009

Who Is Blocking / Locking My Windows Clipboard ?

Ever had this problem? Suddenly you realize that cut-and-paste doesn’t work.  You try it a couple of times to make sure you’re not being an idiot, but nope, something’s wrong.  You try it in several apps, and it’s just plain stopped working.

Turns out there’s a reason for this, and it has lots of blah blahs.  Eventually you should end up over here where someone was nice enough to create an unlocking utility.  I just tried it, works great.

Monday, September 28, 2009

iPhone Keypad Tip

I suppose this could work for any cell phone, really, but I never fully appreciated the need for it until my iPhone.

You know how you call a service that requires a boatload of button pushing, like checking your bank balance or phoning in a renewal for a prescription, and you’re left constantly pulling your phone up to your ear to see what’s being said, and then down in front of you so you can type the next number?  If you ever make a mistake while typing and it starts talking to you, you won’t even hear it until you’re 8 numbers into your mistake and thoroughly confusing the thing.

Next time, put it on speaker phone.

Now you can keep it right in front of you while you type, and still hear what’s being said.

When you’re done with the typing, take it off speaker phone and talk to the human.

Wednesday, September 23, 2009

Spying On Competitors with Bit.ly

I see a link on Twitter that I’m not interested in retweeting personally, but I’d like to see how well it’s doing.  In this case it’s a work-related URL that’s not appropriate for my personal Twitter account.  But couldn’t it just as easily be my competitor that I want to check up on?

Bit.ly is my URL shortener of choice because it lets you track the action that your links are getting – as well as how many other people have used bit.ly to track that same link.

* Click on the bit.ly link to get to the original source.

* Now, use bit.ly to shorten it yourself.  Make sure you’re signed in.

* When your new shortened link appears at the top of your history, it’s going to say something like “0 out of 50”.  The 0 represents your copy, because you haven’t done anything with it.  But if that second number is anything greater than 0?  It means that other people have used bit.ly to shorten and publicize that URL.

So for instance if you run a blog, sending your headlines out to Twitter, and you’re following your competitors wondering how much traction their headlines get?  Now you can check up on them.  You can even delete your own copy of the links if you don’t want to clutter up your own list.  Just use this trick to take a peek.

Tuesday, September 22, 2009

Don’t Rely On Windows Update

http://blogs.chron.com/techblog/archives/2009/09/windows_7_some_ingredients_may_not_be_fresh.html

You’d think that something like this would be obvious, but it’s good when a high profile blogger brings up the problem.  If you think that just clicking Install everytime Windows Update tells you to will get you everything you need, you’re quite mistaken.  Microsoft only serves up drivers that the vendors have provided to them, and in the case of Windows 7, only those that have passed the approval process.

It doesn’t necessarily tell you that, though.  So you’re left thinking that if Update has no updates for you, you’ve got the most recent.  And that’s not true.  You’ve got the most recent that Microsoft has provided.  If you head off to the vendor’s site you’re often going to find a more recent version.

Disclaimer : If I haven’t mentioned it in the past, I work for DriverAgent (http://www.driveragent.com), whose flagship product specializes in exactly this service.  We do go out and crawl the vendors, keeping a database of the latest drivers for everything we can get our hands on. 

Wednesday, August 05, 2009

Unpacking Packed Javascript

You ever try to learn a new trick from a web page by looking at the source, only to discover code that looks like this?

eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c ….

That’s been “packed” (note the parameters to the function?) specifically so you can’t read the source.

It’s also easy to get around.  The browser at one point or another has to unpack it to run it, so what you need to do is catch it someplace where you can display it.

Copy your ugly packed code, and open up Firefox’s Error Console. 

Paste the packed code into the “Code” text box.

At the front of the string add the text   “eval=alert;” and then click Evaluate. 

This should bring up an alert box containing your unpacked code.

It’s such a pain in the neck, in fact, that there are also plenty of online tools that will go ahead and just do it for you.

Tuesday, August 04, 2009

Testing with Rails : Can I Test External / Outside Apps?

Most of our application is written in PHP, and not likely to be rewritten anytime soon (though that is a different topic).  However I’m well aware that this doesn’t have to stop the introduction of Ruby on Rails into the mix.  Our newest push for enhanced quality, testing and metrics gives me an idea:  Can I use the latest and greatest testing tools like Cucumber and RSpec to build up a test suite to run against our existing application?  I particularly like the idea of having a business language for test cases so I can write things like this:

Feature : Have a pleasant and useful homepage

In order to navigate around the site easily

As a Guest

I want to see useful links in the navigation menu

Scenario : Main Menu

Given I’m on the homepage

And I am not logged in

Then I should see a link called “Member Login”

And I should see a link called “Register”

And I should not see a link called “My Account”

That works for me.  I could write bunches and bunches of those.  (It may help that I’m an old natural language guy who’s always had a soft spot for such interfaces.)

However, the natural behavior of Cucumber if I’m doing it right is to assume that “homepage” is a route into the existing Rails app, and that’s not what I want.  I actually want it to map to my production site, complete with http://www.mysite.com syntax.

I found this link from Erik On Rails that talks about creating a new Mechanize session.  But when I do that, my next statement (“should see”) fails because it thinks I got nil content back from the visit to my url.

Is it supposed to be this hard?  I see a whole bunch of articles about using these tools to do what sounds like the same thing I want (i.e. testing something other than a native Rails app) but I can’t seem to find the answer to my question.  Can I hit an external, fully defined url, get back the content, and crawl/test that content?  How??

Wednesday, June 03, 2009

iPhone Programming Update

Ok, good progress lately.

* I think I’ve finally gotten a handle on the “Watch videos on the thing using the television and remote control, while simultaneously being VNCd in and writing code.”   Get yourself a VNC server running on a non-standard port.  Login as your programming user.  Now, with fast user switching, switch to the login screen.  On your television, switch to your video-watching user.  On your laptop, VNC in as a client to your non-standard port (the default port would be the currently-logged-in user, you see).  Working like a charm for me.

* Have gotten a good amount of Objective C written, compiled and running on the simulator – including an RSS reader, and a Sqlite3-backed todo list (still working on that one).  I do not love the language, but I guess I’ll have to get used to it.

For the curious, I found the I Code Blog tutorials the best ones out there.  Perfect combination of baby step projects (that build into larger ones), clear instructions written out “Select File, New, New UIViewController…”, screenshots, as well as an actual description of what code you just wrote and why you need it.  Interesting choice, he puts all the source code in images, rather than text.  I assume this is to avoid cutting and pasting and having people steal it, but I find an added benefit – typing in the actual code gets it in your brain better.  You begin to feel the syntax of the language, the frequency of certain terms, and so on.  Also, you will no doubt make a few typo mistakes, that you will have to go find, causing you to look at the code again, a different way.

I figure by the beginning of next week I’ll be through the tutorials and able to start writing actual code of my own.  That oughtta be interesting…

Thursday, May 28, 2009

Mac is 0 for 2 today, not a good day

Serious setbacks today as I hit 2 major obstacles to what I thought I could do with my new Mac setup.

1) I have half a dozen different ways to play videos of various sorts on my Mac, which you’ll recall is hooked up to my television.  Maybe for the kids to watch a show, maybe for me to have something on in the background besides Scrubs reruns.  But if I want to also get work done on the machine in a graphic way, how can I do that?  I’m told that if I had two physical monitors attached to the Mac it is easy to set up a video playing application full screen in one of them, and work in the other.  But in VNC/screen sharing world it appears that whatever the television connected screen is doing, I am also stuck doing in my VNC window.  So that means that while I’m working on the Mac, I don’t get to watch any of my cool videos.

2) Found out that Rhodes requires an ObjectiveC application called RhoRunner to work.  Only makes sense, it’s basically an interpreted environment.  I can live with that.  But the interpreter provides a browser-like toolbar that I don’t like, and if I want to change that… I have to learn XCode and Objective C.  :(  I might as well just write my apps in that anyway, then, no?   Problem – working the Interface Builder in Objective C apparently *requires* you to perform a “control mouse drag” event and you know what?  My VNC windows don’t want to generate that.  Not quite sure what the deal is with that, but it’s pretty well confirmed – I can go direct to keyboard on Mac and it works fine, but on none of my VNC clients can I get it to send a control drag sequence.

 

I can live without #1, although it is disappointing.  But living with #2 would pretty much mean that I can’t sit at the laptop and work on ObjectiveC code.  That would be a serious damper on my plans.

Anybody got any suggestions?  Know a way I can get around the control limitation?

Friday, May 22, 2009

Language Juggling. Fun!

I’m being deeply geeky today. If I were to add up all of the projects being juggled at the moment it’d look a little something like this:

* listening to (and keeping an eye on visually) podcasts about Objective C.

* trying to bring up an application in Rhodes, better known as “Rails for iPhone”.

* familiarizing myself with fallback plan PhoneGap, which is basically HTML/Javascript for iPhone

* building a new feature for the day job in Rails

* porting an existing feature in PHP

* mapping said feature to a content management system that, as most do, has its own XML based layout language

* properly skinning that PHP using CSS, again as dictated by how the CMS wants it organized

Naturally, some of them are coming up a little short :).

Wednesday, May 20, 2009

Mac Update : Building Apps

On the “family media center” front I invested $15 in an app called SofaCouch that puts the little mini remote on steroids, allowing it to control whatever applications you wish.  Now instead of dealing with the limitations of Front Row I can just have it launch iTunes for music, DVD Player for movies, and so on.  Perfect.

As my time frees up I can spend more of it working on app development.  I got the Rhodes kit running, which is basically Rails for iPhone development.  While I was able to get the code installed and the simulator running, I cannot seem to get a Hello World app running.  Not quite sure what I’m doing wrong, but if that is a roadblock for too long I will shift over to Phonegap, which is more of an HTML/Javascript solution (that has been called “Adobe AIR for iPhone”).  I just want to get something on the device of my own creation, that’s my primary goal right now.  Doesn’t have to be app-store worthy, I just want my own software on the device.

Friday, May 15, 2009

Mac Update : Setback

So last night while waiting for Grey’s Anatomy to start, I tried to show how nonchalantly I could now just flip to our video jukebox, and in this case play an episode of Fawlty Towers, which I just discovered my wife loves. 

My whole iTunes directory was gone.  That’s not cool.

Thinking back, I had cold rebooted the thing earlier that morning because it hung on me for something, and this was the first time using it since then.  I’d also moved my iTunes directory onto my external drive.  Obviously something was amiss.

All my files still existed, luckily.  But for some reason iTunes had failed to remember that I’d moved the directory, instead apparently choosing to recreate itself an empty directory in the usual spot.  Worse, no amount of saying “It’s over HERE, darnit!” could make it work.  So I ended up importing all my stuff over again, a process that took way more time than it would have taken to watch the show. 

Spent the rest of the night flipping through iPhoto directories and deleting everything that got swept up in the tidal wave, like all the ancient Thumbnail directories, icons from various software installs, etc…  how annoying.  One of these days I’ll get to do some coding.

On that note, I did actually sign up for the developer program, so I’m committing myself to making something happen.  Note – Apple seems to offer a deal where for $99 you can either register as yourself (an individual), or a company name.  Who would not choose company name?  Sounds much more professional.  But then the next page says “Yes, we will expect you to provide documentation that you have the official right to this name” like incorporation papers, etc…  Which I of course did not have, so I stuck with little old individual me.

Challenge : Simulating Split

As programming languages and libraries become more complex, you don’t find the same sort of puzzling little challenges you used to in the old days.  One of my favorite questions to ask interviewees a long time ago was “Write the round() function when all you have is the floor function.”  (One of many answers:  Add 0.5 to your number, and then execute floor() on it. Blah blah blah excepting for negative numbers and any other nitpicks, this is not the point of my post….)

Here’s the challenge I found today.  I’ve got a file pathname stored in a database string.  They come from a variety of sources so there’s no inherent pattern in them other than the usual http:// to start, separated by / delimiters.  Turns out that for a report I need a quick way to get just the file portion – so, just the last bit.

With a split() function I’d be fine.  This is one of those things that’s easy to do in something like awk where you just ask for the last field.

But I’m in MySQL, and unless I missed something, MySQL doesn’t have a split.  I found several examples of how to simulate it using a fixed number of nested substr() and locate(delim, string) calls.  That works – if you know ahead of time which bit you need, i.e. “I need the 4th field.”

Well, here I don’t know.  All I know is that I need the last one.

I spotted the quick and simple answer as soon as I saw it.  Anybody know what answer I saw?

Wednesday, May 13, 2009

Mac Journal : Storage

I’ve had an external Terabyte drive kicking around for awhile, but could never get the hang of using it with the work laptop – the constant unplugging made it useless for things like iTunes storage.  But with a dedicated machine now, it only makes sense.

Almost immediately upon plugging it in to the Mini, Time Machine popped up and said “Oh, cool, I’ll use this then, shall I?”  Yeah – but it has to reformat it first.  This does not make me happy about the 75gig of stuff I’ve already got on there.

So I actually prune that down to about 40Gig, copy that to the Mini’s local drive, then format the Terabyte, just so I can now put it back :).

While I’m in there I move my iTunes library – a good 50Gig as well – to be served directly off the box.  I notice that Time Machine renamed the drive “Time Machine Backups”, I’m hoping that it doesn’t think I just devoted an entire Terabyte just for backups.  I want to use that for actual storage of videos and things, too.

Since I’d dusted off the Archive drive, I also told iPhoto to go to town on the thing.  Had fun looking at pictures of my first daughter’s birth, that I haven’t seen in 6 years.  I wish iPhoto had let me just say “Point my photo library to this other volume”, I could not find that option.  Oooo…..maybe I can softlink it?

Tuesday, May 12, 2009

Mac Journal : New Purchase

So I got myself a Mac Mini this weekend.  Couple of factors led up to it:

  • We really have no central machine in the house.  I have my work laptop (Windows), my wife has a Linux netbook for email and such, and then at any given time I’ve got a couple of cobbled machines in various states of usefulness, ranging from the old Dell laptop next to the TV that the kids sometimes play on, to the desktop machine down in the basement that sounds like it’s on its last legs.
  • Our pictures and videos are scattered all over the place.  With no central machine, I tend to use the most powerful machine available to me, which ends up being my current work laptop.  Over the years and the jobs, pictures tend to get scattered.  Plus, the simple act of going out for Mother’s Day and my wife saying, “Can we see the pictures?” ends up being half a dozen operations as I shuffle around cables and AV ports and things to bring them up in a way that people don’t have to huddle around the laptop.
  • The kids don’t have any meaningful computer time, be it for games or educational.  That troubles me.
  • I am getting tired of reading magazine articles about people with no programming experience whipping up the next 99cent utility and pulling down $100k in 6 months. :)

All those things together make a Mac Mini sound like a good investment.  I can hook it up to the HD tv in the family room and use it like a video/photo/music jukebox, first and foremost.  With a wireless keyboard and mouse the kids can get some play out of it simply by turning to HDMI2, something they already know how to do, and not have to worry about booting up a machine and hanging around for a few minutes just to get a game started.  Plus, I can VNC into it from my laptop and develop to my heart’s content.

I will keep notes here as I learn.  Interestingly I’m finding that running a VNC window from inside my Linux virtual actually seems faster than doing it natively from Windows.  I even pulled one up on the iPhone, just to see if I could do it :).  The performance seems acceptable (I got the base, $600 model), I was ripping DVDs and FTPing over my iTunes collection from the work laptop, all while setting up a Rails environment for myself. 

Having fun so far!

Wednesday, May 06, 2009

Announcing “Phoenix Freeze”

Disclaimer : This is talking about a product release from the company I work for.  I didn’t work on this particular project, it’s a big company.  So if you think that constitutes being spammy, here’s your chance to bail out…

Attached is the press release for my company’s latest product, something called “Phoenix Freeze.”  It’s actually a pretty cool idea. You know what Bluetooth is, right?  The key bit of the technology being that once you get two paired devices into proximity with each other, they can recognize that fact and start working together?

Well, Phoenix Freeze takes the opposite approach – how about if your computer recognizes when you walk away from it?  When you’re sitting at your desk, you pair your computer and your cell phone (for example).  Now you get up and leave, and oh shoot, you forgot to lock your screen.  No worries!  Your computer knows you’ve left it, and it’ll go ahead and lock for you.  Even better – when it detects that you’ve come back, it’ll unlock and be all ready waiting for you.  Seems like just the thing for security-conscious companies (I’m looking at you, financial institutions…)

[ If I didn’t work on this project, what do I do?  Well, I work on the web side of things.  So if you go ahead and buy it, you’ll probably trip over some code that I wrote somewhere along the line… ]

------------------------------------------------------------------------------

Phoenix Technologies(R) Puts the 'Freeze' on Unwanted Access to Laptops With New Bluetooth Proximity Lock System

--Combining the power of Bluetooth technology with embedded security, Phoenix Freeze(TM) gives laptop and netbook users a proximity-based system for remote control locking and unlocking data access

MILPITAS, Calif., May 6, 2009 /PRNewswire-FirstCall via COMTEX News Network/ -- Phoenix Technologies Ltd. (Nasdaq: PTEC), the leader in PC 3.0(TM) products, services and embedded technologies, today announced the availability of Phoenix Freeze(TM), a patent-pending solution for laptops and netbooks, that provides users with a convenient, always-on Bluetooth proximity system that automatically locks down a laptop whenever the user walks away from it.

Freeze pairs a Bluetooth(R) mobile phone with the user's laptop so that the laptop immediately locks whenever the user walks away with their phone. When the user returns within a certain proximity (pre-defined by the user) of their mobile computer, it automatically unlocks. This combination offers safety, security, and peace of mind without the annoying effort required to constantly lock and unlock the PC with passwords or finger swipes.

For those who are particularly cautious or those with a critical need to secure data, the Freeze laptop proximity lock can be made a part of a multifaceted authentication process that reduces the time and effort required to achieve a highly secure yet convenient PC experience.

Freeze is available immediately to consumers via download as well as to PC OEMs for incorporating into new laptops. Consumers may download this Bluetooth proximity lock at http://www.PhoenixFreeze.com, or from Phoenix's PC upgrade, tools and diagnostics site http://www.esupport.com .

Freeze complements and adds a second level of laptop security to FailSafe(TM), a true embedded and innovative theft deterrence and data loss protection technology. In the event of loss or theft, FailSafe enables laptop and netbook users to lock down their hard drive, erase data, and completely disable and trace the location of their laptop. With FailSafe and Freeze combined, users have a comprehensive security ecosystem on their laptops that safeguards their digital lives.

"Security and ease-of-use are the cornerstones of our PC 3.0 strategy of building products and services that deliver new levels of protection as well as performance, simplicity and efficiency, to make mobile PCs as fun and easy to use as mobile phones," said Woody Hobbs, President and CEO of Phoenix Technologies. "Phoenix Freeze raises the bar for mobile PC anti-theft technology, adding an additional layer of security for those who view their data as even more precious than their laptops and want it protected from unwanted exploration in their absence, however brief. Now, with Freeze, locking down access to your laptop is as simple as walking away with your cell phone in your pocket."

Features:

User Configurable

    --  The registration/installation and user interface screens are configured
to enable ease-of-use so that the Freeze laptop proximity lock works
immediately
-- Intuitive GUI allows customization by user. For instance, the proximity
zone and power savings settings can be defined by the user

-- One phone with Bluetooth technology can control multiple laptops


Lock/Unlock

    --  The Windows XP, Vista password lock is activated when the paired
Bluetooth enabled phone moves outside the security proximity zone and
automatically unlocked when inside

-- Bluetooth proximity locking adds to a multifaceted authentication
process for enhanced laptop security


Green (Power Savings) Modes

    --  Built-in intelligence detects when a Bluetooth device is out of
proximity range. If the power savings mode is selected, the laptop
screen powers off. The screen is automatically turned on again when the
user with the Bluetooth phone is within the configured proximity lock
range

-- For maximum power settings, the laptop can be configured to enter sleep
mode as the user exits the proximity lock range. To wake the system, the
user will need to press the resume button


About Phoenix Technologies Ltd.

Phoenix Technologies Ltd. (Nasdaq: PTEC) is the global market leader in system firmware that provides the most secure foundation for today's computing environments. The PC industry's top system builders and specifiers trust Phoenix to pioneer open standards and deliver innovative solutions that will help them differentiate their systems, reduce time-to-market and increase their revenues. The Company's flagship products and services -- Phoenix SecureCore, MicroCore, Embedded BIOS, FailSafe, Freeze, HyperSpace and eSupport.com -- are revolutionizing the PC user experience by delivering unprecedented performance, security, reliability, continuity, and ease-of-use. The Company established industry leadership and created the PC clone industry with its original BIOS product in 1983. Phoenix has 159 technology patents and 136 pending applications, and has shipped in over one billion systems. Phoenix is headquartered in Milpitas, California with offices worldwide. For more information, visit http://www.phoenix.com.

Phoenix, Phoenix Technologies, Phoenix SecureCore, Embedded BIOS, Phoenix Freeze, FailSafe, HyperSpace, PC 3.0, eSupport.com and the Phoenix Technologies logo are trademarks and/or registered trademarks of Phoenix Technologies Ltd. All other marks are the trademarks of their respective owners.

    Contact:
Phoenix Technologies Ltd.
Global Press Office
Tel.: +1 408 570 1060
public_relations@phoenix.com


SOURCE Phoenix Technologies Ltd.

http://www.phoenix.com

Copyright (C) 2009 PR Newswire. All rights reserved

Monday, April 06, 2009

Ruby-XSLT on Ubuntu

Mostly for my own reference since I know I’ll need this in the future:  Here’s the best instruction I found in getting ruby-xslt to compile and install on Ubuntu:

http://www.industryzero.com/2008/07/17/how-to-install-ruby-xslt-on-ubuntu/

Two steps, worked like a charm.

Thursday, April 02, 2009

In Honor of Conficker

And with apologies to Full Metal Jacket…

Gunnery Sergeant Hartman: [after discovering Private Pyle's unpatched Windows server] Jesus H Christ. Private Pyle, why is your server running unpatched Windows?
Private Gomer Pyle: Sir, I don't know, sir.
Gunnery Sergeant Hartman: Private Pyle, if there is one thing in this world that I hate, it is an unpatched Windows server! You know that don't you?
Private Gomer Pyle: Sir, yes, sir.
Gunnery Sergeant Hartman: If it wasn't for dickheads like you, there wouldn't be any viruses in this world, would there?
Private Gomer Pyle: Sir, no, sir.
Gunnery Sergeant Hartman: GET DOWN!

Tuesday, March 17, 2009

Dead Machine Juggling

So this past week my work computer (the infamous Lenovo T400 that randomly reboots) gave up the ghost, and started throwing a blue screen on boot.  Consistently.  That’s not good.

What do you do?  Here’s the challenge – there’s a virtual machine file on that computer that houses all my daily work.  I want that.  It’s 8gig in size.  How do you get it off the machine? Can’t burn it to a disk, that I know of – DVD caps out at 4gig, right?  If there is a device that can record larger storage capacity, I don’t have access to it.

I try swapping the drive into a T61 here at the office.  No good – still blue screens.

I try booting up to my Fedora thumb drive.  This works, and allows me to see the Windows drive mounted, but it does not see my network connection.  So this doesn’t help me, it just taunts me.  I’m stuck on the machine.

It just so happens that last week I bought a USB terrabyte drive for backups.  So I plug that in and move everything off the machine.  Everything, that is, except for my 8gig virtual machine, which craps out at 4gig.  Apparently whatever file system this drive is using can’t handle a bigger file than that?

What next?

I take it home and try all the Linux distros I have lying around – Puppy, Slax, Mint, Ubuntu.  All of them seem to have the same problem of not recognizing my network.  Not quite sure what’s up with that.

At last, on a drive I didn’t even realize I had, I find frickin EEEbuntu, that I made to play with my wife’s netbook and never got around to using.  Turns out that this not only books my Thinkpad, but it actually sees my wireless network.  I’m up!

I try ftp’ing the file to the only place I know, one of my GoDaddy hosted accounts.  Long story short it runs all night and I’m never sure if it is done because it never comes back, I have to kill it.

Worse, when I try to pull the file back down on my other work machine (my dev server), it seems to die on me every 5 minutes or so.  I think I’m getting throttled.

At last the pieces line up for me, though:  on my work network I boot up the “dead” machine into EEEbuntu, get on the work network, FTP the file to my dev server, which is a local box.  This time it goes like lightning.

Now boot up the brand new box that IT department sent me, pull virtual machine down again, and I’m back up and running.

Fun!

Tuesday, February 17, 2009

If We Love What We Do, Why Are We Trying To Not Do It?

Seems like the Universe wants me to talk about something today, as at least 4 different sources have all touched on the same topic – namely, what is the essence of the “hacker” programmer.  You know what I mean if you read my blog – the passionate, lives and breathes for it, if you didn’t pay him (and even if you do) he’ll do it anyway sort of guy who was born to this stuff, you can see it in his eyes when he talks about it.  Know the type?  Heck, you might be the type.  I’d like to think I am, when the stars align.

Now, here’s the question – we love what we do, right?  We wake up in the middle of the night because we just thought of the fix for a bug, and we have to get up at 2:30 to code it.  If we don’t have enough work at the day job, we come up with projects for ourselves at night.  True?  Or at least, true enough for discussion?

How come we’re also so busy trying to stop doing it?  One of the core principals for many (Ruby on Rails fanatics in particular) is, Don’t Repeat Yourself.  Said another way, “Programmers are lazy, and that’s a good thing.”  We are always on the lookout to refactor some code, or build a tool to get around a job we were doing by hand.  Asked to solve one problem, we imagine 10 variations of the problem and write a program once that will solve all of them, just in case we’re going to be asked.

See the paradox?  On the one hand we love it, but on the other it seems like we spend our days trying to find ways to get around doing it.

So what it is, exactly, that we’re after?  It’s obviously not writing code.  When you refactor, chances are very good that you’re refactoring your own code, so it’s not like you can say “I wrote better code in place of code that sucked.”  Maybe you can, but that’d be because your perception changed, you probably didn’t think the code sucked the first time you wrote it.

If the perfect IDE existed where it wrote the code for you, would you use it?  Or would you want to hack the code generator to see how it worked?  What is the part that we love so much, and how do we know it when we’ve found it?

Thursday, February 12, 2009

Cult Of iPhoneality

There’s a battle going on at my house around my iPhone.  I say that I’m a proud, wired geek who optimizes his use of the technology around him to improve his life.  My wife says I’m addicted to the damned thing.  (Coincidentally, I just got my wife a Netbook for Christmas and she’s recently discovered Facebook….)

So, last night around 2am, one of the kids woke us up.  Wandering back to bed, I tap my iPhone screen to look at the email icon, and I’ve got a message, so I pick up the iPhone to read it.  Just then my wife walks in.  “Talk about addicted!” she says, “It’s 2am, why are you reading your email?”

“Why wouldn’t I?” I counter, as we get into bed.  “It’s information, it’s one finger tap away, now I know what’s waiting for me in the morning.  It’s not like I’m writing back.”

In the dark, there’s a pause, and then I try an experiment.  “You awake?”

“Yes,” she says.

“Want some music?”

“Got any Chicago on that thing?”

I don’t.  But I do have Pandora, so I go to that and fire up a Chicago channel.  A few minutes later she was asleep.

I’ll convert her yet. :)

Tuesday, February 10, 2009

Rails / ActiveRecord : Created_At and GMT (or is it UTC?)

I’ve got a production Rails app (yay!) running side by side with a legacy PHP app, and the model is mixed – my new User object has_many of the old php Account object.    This is fine, they’ve agreed to behave, but there’s a problem.  The created_at and other timestamp info on my Users table is in GMT(*), while the Accounts table is in local.  I need these to be consistent because there’s logic I have to write relative to the creation times (i.e. how long after the user was created, was the account created…).  Is there a configuration available to me in Rails that will force created_at to be local time instead of GMT(*)?

(*) It is actually my own local time (EST) +5.  I keep calling it GMT, but not sure that’s accurate.

UPDATE:  Ok, if I understand this right, it’s using UTC because I don’t have a default timezone set.  I can live with that.  But why, in irb or script/console, if I do “Time.now.zone” does it say EST?  Doesn’t that mean that either a) I do have it set someplace, or else b) Rails is smart enough to figure it out?  Where then is the “no default, therefore UTC” thing being invoked, that I have to change?

UPDATE:  Never mind, I’m an idiot, it’s right there in config/environment.rb:

# Make Time.zone default to the specified zone, and make Active Record store time values
# in the database in UTC, and return them converted to the specified local zone.
# Run “rake –D time” for a list of tasks for finding time zone names. Comment line to use default local time.
# config.time_zone = ‘UTC’

Friday, February 06, 2009

Ever seen a Linux install modified Windows software?

Ok, this is a new one on me.  At work I have a laptop, lid closed, connected to an external monitor.  I run Windows XP, forced to by The Man.  Today I fire up the Wubi installer to grab myself a couple dozen gig of drive space easily, and make a Linux partition.

Everything goes smoothly, I reboot, get an Ubuntu option, and presto I’m in Linux.  First step, naturally, is the whole “get it updated and customized” thing.  As Linux often does on laptop installs, it tells me “The graphic driver is proprietary for your card, do you really want to install it?”  I say yes, what the heck.

Machine installs something, then tells me I have to reboot, no problem.  Monitor doesn’t come back.  Odd.

I open the lid of the laptop to find that it has booted Windows.  Hmmmm, I think – perhaps the dual boot thingie must be done from the main screen?  I reboot, select Ubuntu.  Ubuntu does not come up – halts on bootup.

I reboot into Windows.  And here’s where it gets odd….my second monitor still won’t come up?  I see that a whole new piece of software – the Intel Graphics For Mobile Manager or something – is installed and running on my machine, and it only likes my main laptop screen.

That’s weird.  I did not install that.  My best guess is that the proprietary driver I installed from Ubuntu somehow also installed this thing!?

I uninstall that, and I’m back to normal – I get my second monitor back.

I have not yet gone into the Ubuntu install because I’m at work and can’t waste the productive time.  But has anybody heard of such a thing?  Is it something in the nature of this Wubi thing that I never really left Windows, and it was really installing Windows software even when it told me I was in Linux?

Tuesday, February 03, 2009

How Rails/Migrations Almost Cost Me My Job (*)

(*) Well, yeah, it’s my own damned fault, but still!

We are not a Rails shop, we’re a typical LAMP house.  But we’re trying to do the right thing and bring more Rails into the mix, with the intention of rearchitecting completely that way.  So I had a project that I was helping somebody launch – just a simple maintenance tool, which would live on an internal machine but point to the production database.  Up until this point the project has been pure Rails, developed with sqlite3 and staged with mysql, all moving around with migrations. There’s really only a single table, it just so happens that once it gets to production, this table will live in a legacy database of 50 or so tables that were not produced by Rails migrations.

So, trying to do everything right, we create a special database user just for this case, who can remotely access the production boxes, just from this IP.  We even limit his rights to nothing but create, so I can run the migration.

Migration errors out – we did not give him SELECT privilege, so it cannot execute “show fields”.  Darnit.  I go in, give him SELECT, and run it again.

Now it fails telling me the table already exists.  I go in as root, drop the table, and try again.

Now it fails wondering where the table went.

A whole bunch of stuff happened here, with me trying to figure out how to get free of the “SQL does not jive with what migrations thinks happened” trap.  In the process I grant my user drop privileges, thinking that perhaps if I unwind the migration, dropping the table, that I will then get everything back in sync.  Still does not work.

At this point I find the db:migrate:reset task, which according to the doc “Resets your database using your migrations” something something, it gets cut off.  This translates in my brain as “Gets my SQL and migrations back in line with each other”, so I run it.

And it promptly drops my entire production database.

I am guessing, now that I have a chance to breathe, that there’s some assumption in there that basically says, “The whole database is controlled with migrations, therefore we will drop it all and start over, executing each migration from the beginning.”  Small problem for those of us who only wanted to use migrations to add new tables, not muck with the legacy stuff!  I thought at best it would drop the one table I had asked it to create.

Like I said, it was my mistake – that user should not have had drop privileges, and I should not have been effing around applying commands against production data that I had never used before.  Luckily it is not the end of the world and we’ve resurrected just about everything that was lost.

I am still confused, however, about how I would have properly solved my problem – what do you do when the state of the database is out of line with what the migrations think should be there?  Does the task I was hoping for, that brings the two in line, exist?  Maybe I could make hand modifications to bring the database up to a certain state and then somehow single to Rails, “Ok, assume you have executed migrations up to version X, whether or not you actually did.” 

Wednesday, January 21, 2009

PHP : Getting a PHTML download dialog box on Linux?

Blogging this mostly for notes, as it was a stupid simple solution but no amount of googling gave me what I needed:

You’re setting up a LAMP server, probably on Ubuntu though I suppose it could happen on Windows.  You’re getting this annoying error, when you try to hit your index.php page, that asks you to download or open the PHTML file.   You do some researching, say “Ah, heck, I forgot to apt-get install php5” or libapache2-mod-php5 or whatever, and you get those and you restart apache, but no matter how many times you bang your head against the wall, it doesn’t go away.  Worse!  You create a brand new php file, and that sumbitch works.  But your existing code doesn’t.

With me?  Had that problem?

Yeah, clear your browser cache.  You’ve fixed the problem, and your browser is still serving up the old, broken bits.

 

You’re welcome. :)   [Credit to coworker Jesse for finally finding the solution…]

Tuesday, January 20, 2009

CentOS Installation Help : Rails OpenSSL-dev Zlib-dev etc…

This might not be a universal rule, but thus far it seems to hold true for me.  When installing development libraries on an Ubuntu/Debian machine, you tend to use “dev”, as in “sudo apt-get zlib-dev”.  When you are on a Centos/Redhat (RPM) machine, you tend to use “devel” as in “yum install zlib-devel”.

This caused me no small amount of annoyance as I was installing Rails on CentOS today, getting all sorts of zlib and openssl errors, and whenever I did a”yum install zlib-dev” it would just say “Nothing to do”, which stupid me was taking to mean “This library is already installed.”

No, apparently it means “That’s not the name of a package I recognize.”  When I did “yum install zlib-devel” it came right up and solved all my problems.

[Off-topic?] Where Were You?

Today, as you may have noticed, is a pretty big day here in the United States.  It’s a day that many people thought would never come, at least not in their lifetimes.  It’s a day that I remember hearing about in school as a sort of “Maybe one day…” thing, something in the future, not the present.  I’m speaking, of course, about the swearing in of our first Hawaiian president.

As I tried to explain to my 6yr old this morning, “There are times in your life when people will ask ‘Where were you?’  Where were you when we landed on the moon, where were you when 9/11 happened?”

“I wasn’t alive for either of those things, Daddy.”

“I know, sweetie.  But you know what?  Years from now, when you’re Daddy’s age and you have kids your age, people are going to ask you Where were you when they swore in the first Hawaiian president.”

So, I’m asking all my readers, on all my blogs:  Where were you?

Me, personally, I’m at work.  My kids are at their grandmother’s house, because the power went out at about 6:30am.  Which stinks, because there’s pretty much no way I will be able to DVR the ceremonies on television if I have no television :).  But I will be watching on line as best I can.

Where are you?

How optimistic are you about our new president, as far as technology goes?  We’re talking about a man who fights with the Secret Service over whether he has to give up his Blackberry, whose weekly speeches go out on YouTube, who has had the Change.Gov website up since pretty much the day he got elected.  A site, mind you, that actively solicits input from the people, and doesn’t just make a bunch of bland statements buried in documents 1000 pages deep just because the rules say they have to.  Are you optimistic for our lives as geeks?  Or pessimistic that he can’t live up to the hype?

Friday, January 16, 2009

The Evolution of Brand

photo  I thought this was funny.  Pepsi’s high caffeine product, Max, was originally introduced only in diet form – Diet Pepsi Max.  Recently it appears that they’ve dropped the “diet”, just calling it Pepsi Max – but it clearly says “0 Calorie soda” right on the side.

Right away, this confused people.  The office admin who filled our refrigerator today, when told this, said, “Wait…so that’s diet?  I totally didn’t mean to get that, we already have too much diet soda on the list, I have to get more regular for the people who don’t drink that stuff.”

A coworker in the next cube chimed in with, “You’re right, I saw that and wouldn’t touch it.”

But…look closely at the box.  That can came from that box, I did not set that up. The box still stays Diet Pepsi Max, while the can does not.  So literally we hit it at exactly the point in time where you could say “The machine that makes the cans has been updated with the new graphics, but the machine that makes the boxes has not.”

It also looks like they’ve gone more black in the coloring, and possibly got rid of (or at least downplay) the ginseng.  They changed the swooshy logo, and went with lowercase on the “pepsi”.  All subtle things, until you look at them next to each other.

Flight 1549 : Ummm….found a bug

http://flightaware.com/live/flight/USA1549

While Googling for news on Flight 1549 which went down this afternoon (apparently everyone is fine and no terrorism is suspected), I first found FlightAware.com linked above.  Note some of the…ummm…uncomfortable parts of the UI?

* Duration of flight:  6 minutes

* Status:  Arrived over an hour ago!  (I assume this is dynamically updating so your mileage may vary)

* In the upper right corner it clearly says, “News: Flight 1549 Crashes Into Hudson River.”

I worked at TripAdvisor, a hotel booking site, when New Orleans flooded.  It was crucial to us, a production bug, to get hotels out of the database that, you know, weren’t in business anymore.  It seems that perhaps somebody at FlightAware needs a similar job.  “Arrived” ends up looking pretty tacky.

Thursday, January 15, 2009

Rails : Internationalizing Views

I’m not an expert in i18n, but there seem to be two somewhat separate strategies for how to tackle the issue of translating your content into different languages.  First is the idea of externalizing your strings.  So for example say you have this content:

<h1>Welcome to the home page!</h1>

Well what you do is name it:

<h1><%= :homepage_welcome %></h1>

And then you define that resource someplace that it can be swapped out dynamically.  Rails 2.2.2 has some great support for this (I am using the karmi demo if you want to follow along), then in config/locales you can have a file en.yml (for English):

en:
  homepage_welcome:  “Welcome to the home page!”

and fr.yml (for French):

fr:
  homepage_welcome: “Bienvenue à la page d'accueil!”

Back in your code you invoke the translator:

<h1><%= t(:homepage_welcome) %></h1>

And with a little I18N magic (again, see Karmi for what’s really going on), you have multi language support.

 

Well, the problem with this is that on content of a meaningful size you’re going to start running into trouble breaking it into named pieces.  You’re either going to break it into such small pieces that you lose the context in which it was used, or else you name it too generically and your translators no longer give you the optimal translation because you’re using the word in different ways, or you just plain have to translate pages full of content all at the same time.  Worse, what happens if you’ve got graphics that need to change with the translation?  How do you externalize that?  I’ve got an icon that says “New!” in a little star shape, how do I use I18N to translate *that*?

Here’s something I’m experimenting with to do the entire view pretty quick.  I haven’t gotten enough feedback yet for whether it’s a good idea, but hey.

You’ve got a controller, home, and an action, index.  As we all know, Rails will then make some assumptions that at the end of method index, it’ll render the file in app/views/home/index.rhtml (or .html.erb if you want to do it the new way).  Well, I thought, maybe that’s a good place to sneak in my locales?

So I created app/views/home/en and app/views/home/fr and copied index.rhtml to both these directories.  In the fr/ version, you make any and all changes you have to make – including changing image paths, etc…  Change it right there in the code.

Then, back in the controller, we do this:

def index
   …
   render :action=>”#{current_locale}/index”
end

And you know what?  It actually worked.  I swapped out my locale to French and I get my fr/ page instead.

THIS IS VERY BASIC.  Among other things, you’d want to make sure that the content exists for the locale you’re looking at, and have some default to fall back on.  The t() method described above actually does this, allowing you to say stuff like this:   t(:homepage_welcome, :default=>”Welcome to the homepage”). 

Also, this implies that whoever is doing your translation is going to be comfortable getting raw HTML pages.  That’s not ideal.  You really do, if possible, want to separate out the content.

Lastly, you’re repeating yourself.  That’s not great.  So before tackling this you should do your best to get the logic out of the page (and into the controller), and really only use this technique on pages that are almost entirely content.

Like I said, I’m still working on it.  Maybe I’ve got enough Rails traffic on this blog that I can get some discussion going about how to improve the strategy.

Zebra Debugging

You know the old saying, when you hear hoofbeats think horses, not zebras.  This is an example of almost that, but not quite.  I’d rather call it zebra debugging than call myself an idiot. :)

Context: We have Verizon FIOS in the house, with the DVR sharing option.  This means that there is a box in the living room that does all the recording, and a television upstairs where we can either watch live tv directly, or else watch recorded programs streamed from that box.  In the morning, my wife and I record the news that starts at 5am so we can fast forward through the commercials and just see the important bits while getting ready for the day.

Well this morning we woke up to a “Currently unavailable” message.  Hmmm, maybe that’s what happens in FIOS land when the “cable” is out.  Weather problems?  Nope, no snow yet, although there is supposed to be a little bit.

I try putting on the channel 7 news directly.  Nope – unavailable.  I bring up the DVR function (which refused to give me the news 2 minutes ago) and call up something that was recorded last night.  Works fine.  So I’ve learned that the box is in fact connected to the network and can get content.  Check.

I call support, to see if there is an outage.  I realize after a moment that Verizon has got an entirely automated system – the thing is going to walk me through rebooting boxes and all kinds of different things, which is actually fairly impressive, technologically.  It said, “State your problem”, I said, “Currently unavailable.”  It said, “Ok, you’re saying that one or more of your televisions is currently showing a Currently Unavailable screen, is that right?” and then walked me through detailed questions – all televisions?  all channels?  Good questions, and I had to say “Not sure”, because I wasn’t.  Hadn’t checked yet.

It then goes through some basic steps which were so painfully basic I had to give up on them. When I realized it was asking me slowly…very slowly….whether the television was actually turned on, I said “Operator” and started waiting in line for a human :).  I’m not kidding, it really did say things like “Walk over to the box.  Now, when you are there, say Next Step.  Or say, Repeat that instruction” and “Once you are at the box, look for the yellow power light.  If you do not see it, press the power button.  Say Next Step when you are done…”

Anyway, back to the timeline.  The automated system did reboot the boxes for me. Still nothing.

So I go downstairs and check the base station, the one that does the recording.  Works fine, and comes up on some Blues Clues or something (Nick Jr, maybe?) that it was recording for the kids.  I check the kids room, and their tv also comes up fine on Sprout, the channel they live for.  So it’s localized to just the television upstairs, that’s weird.

So now I’m on hold, trying to figure this thing out myself.  Something about this specific box.  I cold boot the box by yanking the power cord….nothing.  I run through the checklist in my head – box works because it brings up guides and menus and all the usual things, it gets content that was previously recorded.  I also note that my phone and internet have not gone out.  So literally the problem is that this box is not receiving a live television signal.

It dawns on me that I’ve been messing with the router.  I have two in the house, the FIOS one and my original internal network.  Because of problems with some machines I had started recently using them to back each other up wirelessly, so some of my machines are connected directly to the FIOS router.  Could there be an IP clash?  I start checking the System Info on the cable boxes and comparing it to the config information on my laptop….netbook….iPhone.  Looks like there might be, there seems to be no clear designation where this router serves up wireless addresses in the 100+ block or some such like other routers do.

At this point the rep comes on the phone and tells me, ready for this?  “It’s a local outage.  Just local channels.”

Pause.

Oh.

My upstairs television was tuned to channel 7, a local channel.  When I rebooted it, it came back up on channel 2, a local channel.  My two televisions downstairs were both on cable channels, and after seeing a live signal I never thought to try different channels.  I put my upstairs television on the Sprout channel.  Works fine.

I say, “You know, given that you have my phone number and address, perhaps an automated message right up front would have saved me all this time?”

“Yes, sir,” she responds, “We did just update that message.”

“So you’re telling me that if I’d called 10 minutes later I would have known this and not have had to sit and wait for you to tell me?”

“Sorry about that.”

Thursday, January 08, 2009

There Can Be Only One…..Database.

Ok, here’s the premise.  You build web apps for a living.  In general, a web app needs a database.  But should it ever have or need more than one?

You’ve got one web app, Primary, that uses PrimaryDB.  PrimaryDB has tables First, Second, … and so on, up to let’s say Tenth.  With me?

You also have a web app, Secondary, using SecondaryDB with tables Blue, Green and Red.  Yes I deliberately switched conventions to make it a little easier to understand.

So, new project comes along, and it turns out that Secondary needs access to tables First through Ninth.

What do you do?  Some options:

* Copy the tables from PrimaryDB to SecondaryDB and maintain two copies.

* If your database supports it, create “synonyms” on Secondary for the Primary tables.

* Configure the Secondary application to enable access to both PrimaryDB and SecondaryDB.

* Split First through Ninth into a new database, CommonDB, and put CommonService in front of it.  Tell Primary and Secondary that this is the new way to access that resource.  (In a pinch this can also be simulated by putting a special page/interface inside of Primary that exposes just those parts of PrimaryDB to be shared, and let Secondary hit that as a web service.  Not optimal, as  you can’t independently scale that service based on need, but if you had limited operational resources for bringing up new production servers you could go that way.)

 

Thoughts?  At one time or another I’ve done all of the above. I’m a fan of the last one, if you can reasonably assume that this is not the last time you’ll be asked to do this.  Maybe instead of nine tables it’s 90 tables, and maybe instead of just Secondary needing access to the data, you can envision Tertiary and Quarternary and a whole bunch more apps to come, all of which are going to need access to those tables as well?

[Since technology matters, I’ll point out that the database in question here is MySQL. The actual technology for the webapps now is PHP, although for the solution we’d be open to Rails or .Net as well.]