Tuesday, December 30, 2014

ARCH Linux on a WM8850-based mini laptop

One of my purchases earlier this year was a mini laptop, powered by a Wondermedia WM8850 chip.

It's kinda handy: runs Android/Linux selectively, has a HDMI interface, wired Ethernet and fullsize USB 2.0 ports. Also, it can be charged from USB, tablet style.

Quirks include no HDMI on Linux (yet), and it takes a bit of effort to turn on the wireless. Missing the gpio binary, you can get there by using the sysfs interface:

echo 6 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio6/direction
echo 1 > /sys/class/gpio/gpio6/value

Just echo 0 there to turn it off again.

Compiling a kernel needed some scraping on the web, but can be done like this:

cd linux-3.16
nice make ARCH=arm menuconfig
nice make ARCH=arm zImage
cat arch/arm/boot/zImage arch/arm/boot/dts/wm8850-w70v2.dtb > arch/arm/boot/zImage_w_dtb
mkimage -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n "My Linux" -d arch/arm/boot/zImage_w_dtb ~/uzImage.bin
make ARCH=arm modules
sudo make ARCH=arm modules_install

The kernel config is online here.

It works happy with a 8GB SD card and adding a bit of swap can't hurt as the 512MB of RAM is not that much.

Thanks for the vt8500 developers!

Monday, December 29, 2014

HTML5 video live streaming with ffmpeg and mediaelement.js, Round 2

Follow-up from this summer to the original post.

So, after not rolling out our HTML5 player last year, we've decided to give it a go again this year.
What we've learned: things have changed in Internet-land.

IE no longer requests or supports WMV anymore, which is weird but actually correct. It takes mp4 now as default.

Chrome was still ticking along happy.

Firefox was a big surprise: between version 19 and 20 they've reworked the HTTP engine, so it's a bit quirky now:
  • It fetches the first 8k for metadata in a request
  • It uses HTTP 206 Partial content requests now
  • If it doesn't get an X-Content-Duration, it'll send a new partial request for the end of the file. As it's transcoded on the fly, this is bad for us.
So, we need to give it:
  • HTTP 206 headers
  • Range headers
  • X-Content-Duration headers (in seconds)
This can be done with something like this:

# match Firefox 1-19
if ( preg_match('/Gecko.20.*Firefox.(1){0,1}[0-9]\./', $ua) ) {
# match all Firefox
if ( preg_match('/Gecko\/.*Firefox.[1-9]/', $ua) ) {
# if Firefox 20-
if ($firefox && !$firefox19) {

# generic headers
if ($useragent=='generic') {
#header("HTTP/1.1 200 OK");
#header('Content-Disposition: attachment; filename=' . basename($file));

# firefox 20+ headers
#   firefox 20 wants partial content with code 206, and likes X-Content-Duration
if ($useragent=='ff20') {
header("HTTP/1.1 206 Partial Content");
header("Range: bytes=0-");
header("X-Content-Duration: $totduration");

I couldn't get the Flash fallback of mediaelement.js working and Silverlight was killed by Microsoft, so mediaelement.js was taken out from our setup, with a manual Flash fallback link.
We've also noticed A-V sync issues with ffmpeg, so deployment was pulled again, but we're making progress.

Thanks to Browserstack, for making life easier while testing.

Sunday, December 28, 2014

Linux, Network and Datacenter contractor/freelance engineer in Dublin

New year, new-old adventures:

I'm moving back to the contract/freelance market, this time in Ireland. I'll be available as a Linux, networking and datacenter engineer in Dublin and Shannon (as necessary).

Certified to work on the following kit (the list is not exhaustive):
- Cisco
- Juniper
- Brocade
- HP
- D-Link
- Zyxel

For the full list and to contact, please check out my LinkedIn profile.
I'm happy to work through Elance, as it provides protection to all parties.
I have a nice Experts-Exchange profile as well.


Now we do Facebook as well!


The website is live: d8ns.com.

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.

Monday, February 24, 2014

Privacy and service: Dropbox vs. your NAS (OwnCloud)

Just some rambling after reading through the comments on the Dropbox blog, after the change in the Terms of service:

I don't really like the idea of the NSA/CIA/ABC peeking at my family photos, but I decided that I can live with it. A good point in the posts was that it's everybody's own decision if this is something they can live with, or it's too much for them, in which case they should just stop using the service.

But I think two things were mixed together in the conversation, which are actually separate: the 'important' and the 'private' part. Both of these are up for individual choice, but they might (based on decision, again) get different treatment.
Example: my family photos are important to me; those moments can't be re-created. I want them to be safe. But they aren't really private (no nude shots of me, etc.), so no need to encrypt them, Uncle Sam can watch them for all I care. On the other hand, my bank/tax statements: they are decidedly less important to me, on a nice-to-have level, but I do consider them private: I encrypt them before storing them in the cloud.
Classifying every piece of your data is up to you: everything can be important and everything can be considered private. It's up to you how you deal with these cases technologically.

One of the arguments is that instead of using Dropbox/Google Drive/SkyDrive, people fire up their own NAS at home (there's this nice new product called OwnCloud, or you can go with good ol' FreeNAS). That's perfectly fine, we've loved NAS systems for the past 20 years, just 2 tiny issues:
- Just because it's your own computer on the Net, it's not a 100% secure. If Big Brother wants to, they'll find a way to break it;
- A NAS at home is not cloud. You are doing apples and oranges here, when you compare the services provided by them.

A bit detail on the second one:
If you go with the actual meaning of Cloud computing, not just calling everything cloud that's connected to the Net, you have a few important characteristics:
- Reliability: If it's your NAS box in your home with a one or two ISP uplinks, with or without a UPS to power it, it might not provide 99.999% uptime. Also, do you have an enterprise grade point-in-time backup system for it? Harddrives will fail, be ready. Somebody might break into your house (not a conspiracy, just a regular Joe) and take it.
- Maintenance: Don't forget to keep the firmware up to date, keep it dust free, replace harddrives as they fail.
- Security: let's not even go there.
- Scalability: you'll have a nice up front cost, and you might have to pay up to replace the harddrives with bigger ones again.
- Cost: economy of scale. Although storage is the worst use for cloud in this sense. With European energy prices, it costs a conservative $5 a month to run 30W of electric load. If harddrives fail every 5 years and they cost $120, that's $2.4 a month. I assume your NAS has at least 2 of them (you really don't want to run without RAID mirroring at least), that's $4.8. That's $9.8 a month total, with very basic maths, not calculating with time-value of money, ISP costs, etc.
- Device and location independence: with the new generation NAS software on the market, this is doable.
- Performance: minor issue, you might not want to host your NAS on a dialup or DSL connection, but otherwise it's okay.
- Agility: you most likely won't ever reprovision your NAS, so it's okay.

Bottom line: your data should be yours, classify it as you wish, choose the technology accordingly, but know what you're getting in each case.

Saturday, February 8, 2014

Contacts from Android to Nokia Symbian

After getting a bit fed up with Android again on my secondary phone, I decided to move back to my trusty old Nokia 3110c, as it just f--_finely works. So I had to copy my contacts back.
The online Google Contacts page lets you export in CSV or vCard. CSV doesn't work with Nokia PC Suite (it might with some Excel magic), so I went with vCard. Problem is, PC Suite only imports 1 vCard/file, and Google exports all-in-one. After a quick unhappy Google, I came up with the following PHP commandline script to chop it up. It's ugly, but works... It takes the input from STDIN, and outputs to the folder specified in the code.

while ($SOR=fgets(STDIN)) {
 if (strstr($SOR,"BEGIN:VCARD")) {
     echo $filenum."\n";
 if (strstr($SOR,"END:VCARD")) {
$ cat downloaded.csv | php vcardchop.php

Wednesday, January 29, 2014

Installing a new Windows 2000 box in 2014

Sometimes, you just have to do it. You know that upstanding citizens would frown upon you. Your friends tell you it's not worth the risk. Your spouse looks at you in horror. But you still can't escape, you have to do it. You have to do a fresh install of Windows 2000, even in 2014.

In my case, it was a legacy printing system which doesn't even play ball with XP. The SP4 installation went fine onto a HP dc5100 SFF, drivers loaded okay, the printers and the print software installed without problems. Test pages were printed, but Windows 7 clients couldn't access the box. My guess was the lack of NTLMv2 support, or possibly outdated CA certs. No problem, Windows Update to the rescue.

Or not, as Windows Update does not work on a fresh install of Windows 2000, which comes with IE 5.0. Explorer 5 only supports DES encryption, which is kinda obsolete, I'm not sure if you can even access the Windows Update website with it anymore. The order of the day was the following:

Google for a full installer of IE 6.0 (not SP1); I found one on oldapps.com:
-rw-r--r-- 1 user staff  77M 2014-01-15 11:25 ie60.exe

The small web installer on the MS download site will fail, so you'll need the full installer. It should install fine, reboot.
The downloads from now on mostly came from download.microsoft.com. First off a root CA pack from 2009:
-rw-r--r-- 1 user staff 312K 2014-01-15 11:25 rootsupd.exe

Next off was an update rollup, just to cut back on the downloads:
-rw-r--r-- 1 user staff  32M 2014-01-15 11:25 Windows2000-KB891861-v2-x86-ENU.EXE

And finally the Windows Update client 3.0 update:
-rw-r--r-- 1 user staff 5.9M 2014-01-15 11:25 Windowsupdateagent30-x86.exe

A few reboots later you should be able to access the Windows Update site and download about a 100 updates, more if you installed .net and/or Office.

As for modern browsers: IE6 SP1 is the max, forget Chrome, and Firefox can go up to version 12.
On the bright side: Windows 2000 is seriously fast on modern hardware...