Friday, March 28, 2014

JavaScript hype, code ninjas and why does it hurt

After watching some young IT guys in the office, spending the last weeks in jQuery hell, and reading Lincoln Baxter III's article on JS vs Perl and talking to some similar-aged guys, I think I'm starting to understand that this is a generational thing really. Mind you, I'll only turn 31 in a few weeks...

The problem is, JavaScript ain't bad, it's just not good. And it fully supports making it worse. It's been almost 20 years that it popped up us a good idea, needing a lot of refinement, but it managed to stick around. It would be okay to write some small functions in it, but writing full-blown applications like Google Docs or Facebook in a high-level script language? There's a reason we never did that in .bat files either...

On the other hand, as Lincoln points out, JavaScript is superior to any other clientside languages by the virtue of existence. There's nothing else out there: VBScript died, Flash is going away fast, the new things are in development. Normally, high level languages don't really survive 20+ years, or at least not without major refactoring.

It doesn't really help that our new startup-hype culture now worships programmers as code ninjas and other ridiculous names: it's getting into the heads of these cool kids. It seems like a good idea to name their function a dollar sign, or their method an underscore, because it's short and cool. I'm kinda thankful that the full UTF32 set or Wingdings is not permitted for use...

Why might this be a problem? I'm a sysadmin and as such, I'm trying my best to make things work: debug stuff, help developers deploy their apps, the works. I need to debug all kinds of languages, which isn't really a problem, as there's a few control structures and functions to any language, mostly in English. Debug PHP, Perl, Python, even Ruby? Sure, can do, worst case I read the manual a bit. Enter JavaScript: with vanilla, it's actually pretty okay:

var myElement = getElementById("navdiv");

I expect that it'll get, an element, by its ID. See, I know this, a bit of html: things will be fine.
Cool kid notation:

tmpl: _.template($('a').html()),

Say what...? There's more special characters in there than letters... I'm used to that if I read kernel C code, or a Perl regex, but not on some little validation function or something. If I don't have a fairly intimate knowledge about underscore.js and jQuery, which I won't necessarily have, don't expect me to help you out there if it breaks during deployment...

Or declaring a function inside a function call, that in turn calls a function, just because we can:

Todos.each(function (todo) { todo.save({'done': done}); })

Sure, we've saved 2-4 newlines. Who's going to maintain this code 5 years later? Or startup-land really only thinks in the first 3 years and 2 whiz-kids and they don't believe in this enterprise scale thing? If you really are the next Zuckerberg: he needs to maintain stuff after the IPO too.

The moral of the story? No such thing this time, we'll see what'll happen with the new tech bubble, the code ninjas and JavaScript. I still don't really like them and possibly never will.

Wednesday, March 5, 2014

Using an Android tablet as a desktop workstation - the diary of a day

I'm considering to replace my 10" work netbook with a tablet, to increase portability and decrease weight. Normally I'm using my netbook with a 21" TFT, keyboard and mouse, with wired networking.

After ordering all the necessary gadgets for my 7" Nextbook tablet, today I tested a full day with it:

The tab has a mini-HDMI output, in the office we only have DVI monitors. The ordered miniHDMI-HDMI and HDMI-DVI cables didn't work with my usual Dell monitor, but did with a Samsung I borrowed. USB OTG connectivity to a USB-PS2 adapter to my keyboard/mouse works perfect. Happy so far, let's start the day. Output is actually 720p, and not perfectly full screen on the Samsung. Displays are cloned, so I pretty much waste the 7" extra realestate there, but that's okay for now.

The stock Android email client could be better, I might install K9 on the tablet too. Still, an issue: not sure if I can move emails between my 3 accounts. As I receive ebay/paypal stuff for company purchases in my Gmail, this is a problem for me, but we'll see.

Chrome and Firefox work as expected, OTRS and the UniFi controller interface are just fine, with the exception of Flash parts. LinkedIn doesn't want to present me the desktop site, even if I request it.

Linux commandline: I'm spoiled with options. Connectbot works okay, I still prefer the Android terminal emulator. SSH would work okay, but it lags on the public wifi, so I set up a temporary wifi for it. Few character issues with a remote MC session, but nothing I can't live with. Trying to SCP a file locally is a problem: SCP segfaults and dies with permission issues. No root on the tab, no fixing that for now. Workaround with some SSH tricks, but this could be a problem.

Remote desktop: official Microsoft RDP client, connects to 2003 and 2008 fine, but can't set the resolution. I get some 1400x1200 desktop, zoomed down so I can barely make out the fonts. Took me 5 mins to find the zoom button, which blows it up to 200%, so the scrolling game begins. This'll need some work, possibly another client.

Just as I was trying to size up the internal storage (5GB free, okay for now), the next package from China arrives: the powered USB hub. This would be for connectivity with pendrives and HDDs. Plug, plug, no joy: nothing's working through the hub. Tested the hub with a Linux PC, works perfect. Tested 2 unpowered hubs with the tablet, same thing: no support at all.

Next up: I'll need to print an Excel sheet. Let's not even go there, 15 minutes with the netbook as a break...

Editing an XLS from Dropbox with Quickoffice has some issues, it can't save transparently back to Dropbox, I'll need to download-edit-upload. It would be seemless with Google Drive. Copy-pasting from a Word dock in Quickoffice into Google Drive fails bad: copy-paste doesn't work and I can't go back to the docx, I'll have to open it again every time.

Wrapping up the day with emails and light browsing works fine, no issues.

Verdict: I won't be taking the laptop to holiday in the future, but Android is not desktop ready just yet. Emails are kinda okay, the hub is a problem, rooting might make things better, printing might be a brave adventure, window switching can be painful. I might actually try a Win8 tablet if I have a chance.