Sunday, 29 April 2012

Android Camera & Video, OpenGL

Ahh, somehow I ended up hacking most of the Saturday rather than taking advantage of the relatively pleasant weather to do something better. Addicted I guess. If the weather holds today ... maybe i'll get out.

I was just going to have a quick look at android camera operation, but one thing lead to another ...

After I got a basic camera view working, I wanted to work out how to present it in opengl. So I got pretty side-tracked trying to work out some opengles2 stuff - the examples and suggestions on the net were usually small fragments or for opengl1 - until I found the android sdk sample they all came from which had everything I needed (GL2CameraEyes or somesuch, my workstation is off now). GLES2 is a bit of a pain and requires a lot of scaffolding to get started, but I guess it is what it is.

So yeah, camera to texture, texture to display, etc.

Also checked out taking photos, and recording videos - although the latter requires a preview view, and wouldn't work with a GL 'preview' window so I gave up on that in this context.

The basic objects are a bit bare, but they provide enough functionality to be usable, and are generally fairly simple to use once you know how.

"Broadcast Quality"

One thing that is a bit disappointing is the frame rate achievable. Even with a simple GL render loop it doesn't match the frame-rate properly and you get skips and drops. It's almost like the screen and GL are refreshing at different rates. I tried a dirty-refresh-on-camera-frame, as well as update-continuously-refresh-texture-when-camera-frame, but both ways were simply not smooth.

For fucks sake even a fucking Commodore 64 could generate video-rate-smooth graphics.

(Even something like GL gears, a simple demo which should easily manage a solid and smooth 60fps, is not properly smooth, although it might be the internal animation calculations that are out).

Because of this, and the stupid choice to use a 60hz panel (my laptops run at 50hz for this very reason), one of the few things that might actually be useful on a tablet - watching recorded tv shows or movies - is actually a pretty crappy experience (if you can even get it to work in the first place). Movies on a 50hz display running at 25fps look a LOT LOT better than telecined crap on a 60hz one.

People are so used to totally woeful 'pc graphics' these days nobody even notices or cares (horrah: at least there's no bloody tearing!).

Even tv stations no longer seem to care about 'broadcast quality' any more - I guess the old guard engineers who knew the difference are being replaced by kids who spent more time on youtube than watching broadcast tv). Sport looks like it's been shot with a pocket camera and run through a single-pass of ffmpeg encoding at middling settings - severely blocky from lack of bandwidth and just not very good. And we're often getting American version of movies now - i.e. which have been fucked up by being telecined to 60fps to start with - and here they are just blasted out at 50fps using simple nearest-frame or sometimes average frame 5+6 output both of which looks totally totally shithouse (9, 7, and 10, i'm looking at you). And even when they do have PAL source, sometimes the interlaced frames are flattened to 25fps(AND THEN SCALED!!!), and encoded at 25fps progressive: which is astoundingly bad.

So why did I buy that giant TV for again? Well at least I can read the current score or the news ticker from the couch ...

Friday, 27 April 2012

JJPlayer

Although I'm pretty knackered after a week of hacking on android user interface and REST stuff, a few things fell together near the end of today so I felt like I had a bit more energy to poke around jjmpeg on android.

I converted most of the rest of the binding to use integers as a pointer rather than bytebuffer's and after a bit of debugging managed to read a frame in ok. I'm still holding out on the AVIOContext stuff as it's a bit of a mess.

Using integers and looking up the value as a member variable on the lowest concrete class works pretty well. In some cases it even simplifies the binding as for example I don't need special 'object holder' classes for in/out parameters. I got sick of trying to get the horrid mess of a binding generator to work for all cases and hand-coded these in/out functions as well: it's only 3 calls and a lot less work just doing it by hand than making the generator handle all cases.

Performance doesn't seem terribly hot, but then i'm not au fait on the myriad of ARM compiler options in gcc. And in any event it looks like my build script had a bug and only built using the defaults anyway (ok, so i fixed that whilst typing this and it's a bit faster, but well who cares anyway, it's not the goal to beat the hardware decoder at mp4).

I noticed that I branched for 0.10 before i'd finished off some of the api, so I will have to back-port a bunch of stuff to make it more usable.

I'm also considering simplifying the object model significantly: at the moment 4 (6, if i want transparent 64 bit/32 bit support) classes go together to make 2 objects for each C object; which allows for automatic garbage collection so make the api more java-friendly. It works quite well at least on the oracle and openjdk jvm's, but adds a bit of extra crap to the binding. I could simplify it down to 2 (4) classes and 1 object if I force the developer to manage memory explicitly. But what I have works, so I am in no rush on that one. One doesn't need to create very many objects to decode a video, so it's hardly a big overhead. And although freeing them explicitly isn't that much of an effort either: it's still nice to have it work automatically.

My local code-base is a bit of a mess - I couldn't get netbeans to open the android project as an android project properly until I created a new directory, created another blank project with the android tool, and then copied the source around till it worked. So it might be a bit of hassle copying this all back to a versioned tree and checking it in.

Sunday, 22 April 2012

android hacking, jjmpeg

So winter has sort of started here - although we had a it of sun today with a bit of heat in it. It tends to stick from about ANZAC day - the 25th, and we're only a few days early.

Which means: I don't have much to do apart from cook and hack. Still a bit tired from the previous week so I didn't get into much but I had enough time between drinks to have a look.

RTFM

Yesterday I spent a few hours playing around with the Manpages source. I seemed to get a lot done but after looking at what I came up with, it didn't seem to amount to much ... just a bit of GUI re-arrangement to make it take advantage of a tablet. I don't need man pages on a tablet, but I am thinking of how to do a nice interface for accessing documentation as it does seem something the tablet form-factor might actually be useful for. Starting with Manpages just saved me a bit of faffing about.

I first started playing around with the search function: making it use a searchview, and changing it to filter the list of man-pages rather than coming up with a redundant 'shortlist' completion list. And voice search, although it really just doesn't work well for unix commands (grep == brett, great, grit, etc). Probably the stuff that took me the most time was working out how to get the search box to work nicely - getting rid of the onscreen keyboard when it isn't needed and so on. But eventually I have that behaving quite nicely.

The filter stuff isn't very well documented, but it wasn't too difficult to work out. The built-in list filtering has a silly stylistic choice of overlaying the list with a very large label of the filtering string, but it was only a couple of lines of code to remove it by doing it manually. I implemented it using a tree, so an interactive prefix search runs in real-time with no trouble at all.

I'm still only experimenting but if it goes somewhere this might end up another project to divide my time (an android version of 'ReaderZ'?).

jjmpeg

Today I thought i'd instead have a poke at jjmpeg. I'd already had FFmpeg building from source using the NDK, but not gone anywhere with the jjmpeg stuff.

I'm in two minds over this - I don't really need it, and am not particularly interested in writing a video player, although the free ones on the market are pretty crap (and they expect me to pay for ffmpeg? I don't think so tim ...). But it might be useful for work and it's a good opportunity for some self education on mobile hardware, opengles, and so on.

So i've branched jjmpeg, and started work on an android specific port: things are different enough that at the moment that branch will only build the android code. For example I am linking directly to ffmpeg's libraries so I've removed all the dynamic loader stuff.

But anyway, don't expect rapid progress.

GPL3

I've also decided the whole library will be GPL3 - for a couple of reasons.

First, since I have to distribute FFmpeg in the binary, I have to distribute the source now too. If I have to deal with that crap I may as well ask for reciprocation.

Secondly, many android developers seem to be utter leech-tards, and don't mind wrapping anything they can get hold of in a new name and trying to make money off it. I don't really need to contribute to that in any way - after-all I didn't do all the hard work which makes jjmpeg work.

And finally, and related to the previous: the LGPL requires that all the LGPL code be replaceable by the user. But with android this is quite a difficult process which prejudices the user. It's not like GPL will make building with the NDK any easier; but at least it means those capable of doing so end up with more than just a new makefile for ffmpeg which is about all the LGPL requires.

Friday, 20 April 2012

A week of the android sdk

Well, a work-week.

It's a pretty crap api. All that really nasty XML and pre-compiled resources: maybe it makes sense if you're really resource constrained, but I can't see how that's an issue for the future. The whole XML stuff is a pretty annoying too: it's a horrible language and its hard to write and harder to debug. Repeatedly I see claims that it's all about 'good practice to separate view from logic'. Sure it is, but you don't need to learn some fucked up shitty language to do that, you can just do it in programming language too. And I can't see how XML is any easier to learn than the tiny bit of code you need to do it programatically. If you dig hard enough you can work out how to avoid it, but it's a constant battle with the documentation.

I think XML is only popular because many people have only learned how to use a rock as a tool and to them every problem looks like a nut that needs smashing.

A lot of the api is similarly infused with short-sighted decisions [such as the pre-compiled resource id stuff].

Which means ... the api's are constantly changing to cover up earlier mistakes. I'm not sure exactly what the fragment stuff is about for example; it seems to be important for a reason but i'm not sure what yet (but such things are usually the way when encountering a new toolkit). It also means the documentation is a bit over the place and old api's aren't clearly marked as deprecated even if 'the new way is not to use them' as are any third party resources. Stack overflow has been invaluable to sort the chaff from the wheat.

Still, even with the weird api's and broken cut-down Java runtime, it's pretty easy to create fairly slick responsive applications. They've gone some way of hiding the 'complexity' of multi-threaded applications (which is needed to make this a reality) and introduced it to neophyte programmers who probably would have shied away from it - even though all modern toolkits provide similar levels of support. I always preferred threading vs callbacks (it's a lot easier to maintain state in local variables and for loops vs callbacks and callback 'user data'), and the fact it scales cleanly on multi-core hardware is just a bonus.

HTML5

Compared to HTML5 that looked like arse (we hadn't even thought about styling it yet), limited user interaction, and all sorts of platform problems. In android we had a slicker interface with less time. It took a bit more code but not much (and it was simple java) - and it already had decent styling and proper user interaction. And well, in HTML5 it was still just a web page ...

One just has to compare 'youtube' from the browser (any browser) and the android youtube application. It's like comparing apples and oranges, it really is. And if that's all google can come up with - with all the experience and almost almost infinite resources - what hope does anyone else have?

If I was mozilla i'd be shaking in my boots - i'm surprised google haven't come out with a browser plugin or standalone 'ARE' (android runtime environment) yet. As a TV/flat surface toolkit/runtime, it's strides ahead of HTML5. Strides.

I'm also surprised mozilla (or ms) hasn't come up with a really solid, high quality javascript extension library (which must be cross platform, but they would bundle) to turn what is a simple low-level scripting language runtime environment - totally inadequate and utterly woeful for desktop application production - into a usable platform. Right now, using half-arsed, poorly designed third party libraries is really a struggle. You have to learn their strange 'flavour of the week' api conventions, and then all you've learnt to use is a crappy toolkit which doesn't work very well.

The only thing programming in HTML5 gives you is ubiquity - or at least the hope that most people on most hardware will be able to run some version of your application. It's still just a hope.

If only ...

The real pity with android that it isn't using a proper JVM and a full Java SE environment (minus the toolkit). I guess when it was conceived the hardware was pretty minimal but that isn't the case now let alone in the future.

The other pity is that many of the applications are using the same web model for revenue - i.e. spying on users for fun and profit. I wonder how sustainable this revenue model really is globally: developers get a pittance and most of the money goes to a handful of giant multi-national corporations who siphon it away from the country and avoid paying their fair share of taxes.

Sure a few 'hit the jackpot' and make a good living, but that sounds too much like everyone is playing a casino. And clearly casino's are really just a tax on stupid people - the house is the only real winner. Always.

What now?

Well i'm still not sure what I will hack on now I have an android machine. I might look at porting jjmpeg or something, but probably only do it properly if I will use it for work. The utter shit-house video players available on the android market (based on FFmpeg clearly for the most part, usually without source) could be a driving factor, but I don't personally need another video player and doing it alone would only be for the novelty value and to learn about the problems one faces in such environments.

I've also been keeping an eye out on the rhombus tech/all-winner A10 stuff. And thinking about getting one of these to play with. I have some other motives for that too - I bought a cheap Kogan dual-tuner DVR, but it's been a pretty crappy experience - the software is shit, the remote stops working if it gets humid, and it keeps rebooting itself (I did find out about getting an RMA but just couldn't be fagged with all the hassles of having to ship it back with the proviso 'you have to pay for it if we can't find a fault' - at the time the faults were intermittent, then the remote didn't work for a couple of months, now it's working again but it's rebooting with a hdd plugged in). For 100$ I may as well just throw it in the bin, or open it up and poke at it for some entertainment. I don't use it myself, but it was a present and i'm a bit pissed off that it's just such junk (what I should have expected I guess).

But for now it's a wonderfully warm autumn day, I need to mow the lawn, and there's cold beer in the fridge. Hacking can wait.

Sunday, 15 April 2012

The Android

Well I've become a member of the 'exclusive' club of owners of android tablets, although I only got one for work.

The story so far ...

I finally got hold of the ipad the project manager had assigned to the project, and to cut a long story short: I missed a meeting because I was on leave, bad decisions were made that I didn't have enough background to question, things need to be decided. Getting a mac/learning objective C is really out of the question (for political, personal, and time reasons), so the only other option is android.

Even though I don't really see the point of them I just went out and got one from a local retailer because we don't have the time to muck around and I realised I needed to get more familiar with one. I grabbed a keyboard-less asus transformer prime - there just weren't that many options available and I didn't see the point in saving a couple hundred $ for the sake of an unknown (I wont state the price because we get totally shafted on electronics like this in Australia, but suffice to say it wasn't much more than a single day's net pay, so who cares really).

The prime

So the device itself seems fairly solidly put together, quite thin (thinnest apparently), a bit heavier than i'd like, and I can feel the smooth aluminium back easily slipping from ones hand: but a slick hardware package. The edges do have a slightly harsh finish, but it's not going to cut your hand either.

But the charger and connecting cable is probably the cheapest bit of electronics i've ever seen. Real trash that feels like it'll fall out or break at any time.

I don't like the power button - it's hard to know if you've pressed it, and I find I have to use a finger-nail to make sure, and it waits just that few 100ms too long to activate: where you're starting to doubt you've pressed it at all. Being on the bottom of a curving surface also just makes it hard to get to when you're holding it from the front.

So as I said it's a bit heavier than i'd like - it makes it a bit awkward to hold. Although one can certainly hold it in one hand in the air, it would give you a sore wrist.

The Market

Or google-play or wtf it's called this week. Pretty underwhelmed so far. Ok it's great saying you have 100K 'apps', but if they're mostly shit and the good ones impossible to find amongst all the chaff then what's the point. Most of the free ones seem to be advertising supported (advertising on software you're using? wtf? just not something i'm used to outside of a browser - and i barely see that anymore). Which means you have to sell your soul to download them: access to identity, access to your exact location, access to phone owner and state, etc etc. Another big class of applications are tons of 'my first android app' experiments which should be hidden away in a 'beta corner' or something and not clutter the general application lists.

It's like the bad old days of early 90s shareware all over again: hobbyist programmers thinking they can make a buck writing shit software full of utterly foetid secret-sauce. A few do, but the rest are wasting their own and everyone else's time. Having got used to Free Software I kind of forgot about all that although it's still around in the windows/mac worlds. Free software is quite different: the better stuff is driven by professional programmers solving problems usually orthogonal to their main job, and then sharing the maintenance burden and reducing the cost to everyone by publishing it freely.

I've only downloaded (and removed half of them) less than a dozen 'apps', but already i've had plenty of crashes doing simple things.

I'm sure as I find the gems (which I don't really want to have to spend the time doing) my opinion will lift, depending on the SNR (it could just as easily decline). e.g. I eventually found a free DLNA frontend that at least is written by a professional outfit (proprietary alas), before I realised it has one bundled (although that only plays the os supported formats). Pity mythtv is being cranky and it didn't work too well.

They might also be outside of the store - e.g. mupdf is by far and away way better than the pdf viewers bundled - who both take ages to render a page, and also render in 3 stages of blurriness (which is very very unpleasant to read), although that also seems to do the blurry thing when you pan around. And it doesn't ask for ANY permissions.

So, I will probably just have to write my own stuff again ...

Media

Video playback in the bundled player is pretty decent: but it has very limited format support. The other (free) players range from crap to awful, and even though most are obviously based on ffmpeg none of the authors seem to understand the license. I spent a bit of time trying to get internet radio working (my isp mirrors a large number of stations with no bandwidth charges) until after I succeeded I realised I would never listen to music this way - I have a beagleboard plugged into my hi-fi receiver and don't need to wear headphones to listen to whatever crap music I want at whatever volume I want in my own house! Might be handy to write a remote control for it though, although 'ssh' works pretty good so far.

Interface

Well it's snappy and flashy. The 'home screen' just seems pointless, but then again an alphabetically sorted list of all applications (with cut-down text) isn't much chop either. I'd rather Amiga's Workbench (with a few tweaks).

The Browser

The android browser is ok enough, but without being able to block adds pages are filled with animated stuff which distracts annoyingly and quickly drains the battery. The only option is to disable javascript but that is a web killer.

Firefox is a bit poor. Once rendered it's kind of ok, but otherwise it's slow and clunky to use. Why they waste a good chunk of screen down the side when you're in landscape mode is anyone's guess. Still needs work. I'd hate to see it on a 'lesser' tablet.

Even on this machine, using a browser is pretty damn clunky anyway. My browsing often consists of running searches, and typing on that on-screen keyboard just sucks. It might be ok if you're coming from a two-finger typing background but i've been using a keyboard for over 20 years and could touch-type over 15 years ago - it will never catch up. Reading long articles just doesn't feel that comfortable for some reason: I really wish we could override the bright white backgrounds, and it's a bit annoying having to drag/zoom every page to fit the readable area or to find navigation links.

And not being able to hide the animated advertising whilst trying to read an article on the net is pretty much a deal-breaker for me. I would rather use a laptop (even with it plugged in - required as the battery is long dead).

I tried the voice search a couple of times, but my accent throws it out. And try saying 'waikerie' and getting anything remotely close. The closest I got in a google maps search was some utterly unknown spot in the middle of New South Wales when I tried 'waikerie south australia'.

Flash actually works quite well - ABC's iview can only be accessed via flash, and it runs better than the flash on the ps3 and is a hell of a lot easier to use (joysticks suck as a mouse). On the other hand, it's nothing compared to the youtube app.

Coder's crouch

I've already got enough of a hunch-back from looking down at laptop screens for half of the day. And now one has to go another 60 degrees all the way down to flat? Either that or get a sore arm from holding the screen up at an acceptable angle.

For watching passive content it's a bit of a hassle as you need to hold it upright somehow, and for interacting you either need to lean over it or use two hands sometimes awkwardly.

I'm already thinking of making a stand for it ...

The rest

Given all the popular press I seem to see about them, I was actually surprised the lack of options in all the retailers (I just went to the city) - almost all had ithingys but most only had 1-2 models of 1-2 makes of tablet. They all had many more laptops. Which suggests to me that these things aren't really selling that well.

And what the fuck is this crap that ASUS thinks they can get away with people giving up their rights to a warranty on hardware just because you get a root login? What next - if we charge you $50 less you lose your warranty? Somehow I don't think either would mesh with the statutory warranty required from the retailer. I'm afraid I didn't research this as closely as I should have, but what can you do eh? I have the tool downloaded but I haven't used it, although eventually it will be running linux in some form or another.

So anyway in conclusion: all the arguments I had for myself against tablets still hold, and i'm not sure exactly what problem they're solving. Perhaps if you're sitting in a meeting looking down at agenda notes they are an effective paper replacement. But for reading a web page or a book - not terribly great. For watching video (when you have a 46" tv?) ok, but you have to prop it up somehow. For games? I have a ps3 and a touch screen is a pretty shitful interface compared to a controller (and for that matter, I haven't played any games there in months). Tilt isn't much better.

And modern casual games are an embarrassment to our civilisation. Games are for learning useful life skills. Things like chess are about strategy. Learning to click a coloured box for a virtual reward is not learning, it's a mental deficiency.

I think the smaller devices will have a better future. They have much more portability and the screen is big enough to be useful. And they are (or eventually will be) real pocket computers, not just small tvs.

So I guess now I have one, and i'll quite likely be coding on it for work (if not in the next few weeks, eventually), I guess I will do some free software on it too ... ahh more projects to distract me.

Thursday, 12 April 2012

Worn out dealing with crap

Boy dealing with JavaScript on browsers is quite soul destroying.

If you could just stick with one environment it would probably be bearable to some extent, but even then you just have to add all this crap and worry about tedious details that just aren't required for local applications.

The other guy on the project has so far seemed pretty lost in the whole thing too, as all he has ever programmed in is some micky-soft visual something. Like, ever. And he's been coding just as long as I have.

So i've been dragged in trying to help, or at least occupied trying to keep him focussed. It doesn't help that he's off making sure it runs on IE and fucking around with junk toy web servers and visual studio even though it's far removed from what we actually need. Somehow he's managed to pull in 5+ javascript libraries and is doing stuff that could be done with a few dozen lines of plain code. Seems obsessed with using jQuery even though he is using it in strange ways and doesn't even need it to start with.

I'm kind of not sure exactly that problem that jQuery is trying to solve to start with: trying to make javascript easier for non-programmers familiar with CSS and XSLT perhaps? i.e. certainly not me. It just seems to add more work for a little gain in typed characters. It talks about separating logic from presentation but in reality it's all about manipulating the DOM: i.e. something I would imagine you would generally want to stay away from, as it's a really shit data structure to navigate, and it's all about the presentation layer.

I guess I have to keep reminding myself, most javascript is authored by people who are not programmers by trade.

This is one reason I haven't been hacking much lately.

Oh fun, so now blogger wants to pop up windows to allow a preview does it? I don't think so tim. How strange, it worked ok a couple of days ago.

Thursday, 5 April 2012

On green fruit.

I've noticed a trend lately in retail fruit: it's just not ripe when picked.

It's obvious with tomatoes, because despite the bright red colour (easily changed using ethylene, which is how they naturally redden themselves when picked so i'm not too fussed bout that) have absolutely no flavour and the texture is unpleasantly foul. This year I performed a test on a green tomato I knocked off the plant - I put it in a bowl with red ones and waited until it went fully red (about a week - it was a pretty hard green). Even that one, which I knocked of incredibly green, tasted far better than the bought ones, so god knows how green they pick them or how long they keep them before we see them.

For limes (even lemons), tahitian limes should be light green/even turning yellow, smooth skin, soft and full of tart but not bitter juice, not dark green, rough skin, hard, with difficult to extract bitter juice - that means it wasn't ripe when picked. Most of the time they've been picked so green they have barely a couple of teaspoons of bland juice in them. Even kaffir limes - which you don't normally use the juice for - I knocked a few off my plant today which are nicely ripe - more juice in these than the tahitian limes I bought last time (although the taste is a bit unpleasant for me so I don't use it for eating, or haven't found a way to yet).

Cucumbers - they're so green they don't even have seeds yet. And as a result the texture is too hard, the skin too soft, and the taste too bitter - and they spoil very quickly. Last year I picked some old cucumbers that I kept growing for seeds. A fairly thick skinned variety. I kind of forgot about them even though they were sitting on the kitchen counter next to a rice cooker (in the sun most of the hours of winter) - about 6 months later one started to rot and I chucked it in the ground where it grew.

The same for button squash. A couple of years ago I had a ton of them, and when picked just as the skin loses its rubbery feel they tasted a lot better, were a lot bigger (above tennis ball sized) and lasted much longer when picked. They were nice enough just to eat fresh. Yet the ones in the shops are picked about a 4 days too early (which makes them super-green as they ripen quickly), are overpriced, wont keep and taste so bitter you need to cook them to make them palatable.

Seedless watermelon? They've just been picked before they're even ripe so the seeds (and sugars) haven't developed yet (sister was told this by a watermelon grower): i.e. bland tasteless textureless crap.

It's obvious some of this is to try to keep the product looking good for market, particularly when it's then kept for months in cold storage. Some of it is for pest control. But the weird ones is where it is for customer expectations: e.g. the button squash, limes, seedless watermelon, and cucumbers.

And then there's the other extreme which are to cater to market desires - over-sweet varieties of fruit that just don't taste very nice and can't keep because they don't have enough acid in them. e.g. strawberries - usually giant, bland hollow things that simply taste like shit. I have some strawberries growing and they're not much better either - usually tiny, and as soon as they get ripe something eats them or they seem to just dissolve into nothingness.

Or mandarines - giant floppy skinned fruit that's easy to peel, seedless, but quickly starts to taste bad because the fruit doesn't have enough acid to keep it fresh. My mandarine tree has a huge crop again this year after a couple of years of sfa - fairly small, smooth very thin skinned fruit. But it's fantastically tart, loaded with sugar, and juicy - almost like a valencia orange, and last forever on the tree. Something I can definitely put up with a few seeds for.

About the only thing still reliably good is a nice big granny smith apple - good flavour, texture, and they last really well. Pity even eating small amounts of fresh apples just gives me a belly-ache and nausea (I don't know whether it's psychosomatic or because of the acid: when I was staying in Mexico city with Federico they didn't seem to eat anything until mid-afternoon, one day I was so hungry I had an apple on an empty stomach and felt very unpleasantly nauseous for the rest of the day - and I haven't been able to eat apples without a similar reaction since).

Wow, javascript sux.

So I had to dirty myself and work on a bit of javascript myself. I needed to find out what communication protocols and techniques are available to me, and how the jax-rs implementation handles various things.

e.g. I needed to pass the parameters derived from a dynamically created user interface, plus some other structures such as an array of objects to the server.

I went with a form as then I don't need custom marshalling code on the browser end, but then I needed to manually encode/decode the array. It didn't take too many LOC to do it in the end, but it took a long time to find out what those LOCs were (albeit most of the time trying to work out how to access the app server jaxb context and how to use it to decode some json embedded in a form field).

But what surprises me about 'javascript' is just how un-script like it is. i.e. it only provides fairly low level of functionality and one has to code a lot of stuff directly. And that's before you get to some of the nasty per-browser differences. So because of both you end up with a pile of half-arsed helper api's which should really be part of the browser - and would be if the vendors could stop stabbing themselves in the back at every turn.

e.g. although you can submit a form, if you want to submit it silently you need to manually create the HTTP data packet yourself ... which is something you don't even get close to having to worry about at the server end anymore and haven't had to for years.

And the other problem is that clearly most people who author javascript just aren't coders, or aren't very good ones. So many of the solutions one finds on the net are full of bad advice, misinformation, or are just pretty much crap examples as a direct result of the blind leading the blind. So perhaps my previous issue is just a matter of finding the wrong blog post or stack overflow question ... but who can tell? (On stack overflow, it seems to be starting to suffer from the wiki-disease a bit, anal 'save the children' do-gooder watch-dogs who want to get thingy about asking precisely the right type of question in precisely the right location: I hope this attitude gets killed quickly as such crap can rapidly deteriorate).

The language itself is ok enough I guess - although anyone wedded to IDE auto-completion (like my work-mate) is lost due to it's dynamic nature, but the browser supplied run-time platform is a total joke. This is pretty much what I suspected and wrote about previously but to have it confirmed is no point of joy.

I'm still left convinced that Apple's embrace of 'HTML5 will save the world' for example is just a cynical part of their marketing campaign against Adobe, and additionally an avenue for people to buy their hardware, realise it just isn't up to the job, and force them to write custom applications then tied exclusively to their proprietary platform. The greedy pig-fuckers.

The weekly ups and downs

So I noticed in the analytics graphs an obvious pattern emerge on my google code pages, which is probably due to the hit-rate getting high enough to rise above the noise (the point of which incidentally coincides with when I put up a test release of jjmpeg).

(the numbers have been truncated)

The pattern seems to have been there before, but now it's glaringly obvious. And that is that people are hitting the site only on during working days in the USA (there aren't enough hits yet to determine if there is a trend in the hours too).

So I wonder what that means; it is just working people looking for some free code? Students doing class-work? It seems to suggest that hobby programmers are probably not that interested in it; or that the vast majority only hack during the week-days (which i don't think likely, not to this extent). The only communications i've received have been from cost-free-code snarfers and students, so at least that data point correlates - although the sample is so small it doesn't amount to hard data.

Well whilst i'm on statistics of the site I'll dump a few other observations:

  • Rather modest numbers for a-hackers-craic: I broke 2K posts/month for the first time last month, and also broke 20K for its lifetime.
  • I always find it pretty funny how many people searching for an image of 'g-spot' end up loading the picture on one of my rant posts. It's a photo of an ibm keyboard. It's usually in the top-10 searches for the month!
  • Java FFT is still high on the search hit-rate.
  • Beagleboard/XBMC still gets plenty of hits even though I haven't worked on it or posted about it for over a year. The XBMC wrap-up post is usually in the top 10 for the month
  • Together the java fft and beagleboard xbmc wrap-up post are over 10% of all hits of the life-time of the blog.
  • More direct searches either for my name, the blog or the projects i have on google code. jjmpeg being fairly useful is an obvious reason, but also from more activity in various forums (e.g. opencl), and more consistently using my URL or google login for drive-by commenting elsewhere.
  • My google code projects are now my top referrers, although having a link off the Aparapi project added a good number of hits.
  • I get a lot of hits on rambling mind-dump posts which don't contain particularly useful information: like `opencl images and arrays', or 'sse gcc and amd'.
  • Quite a few people seem to be interested in 'kobo hacking'. But going by the lack of interest on the forums for anything other than a plugin to enable a few simple features, and no communications on my efforts, I would presume they're more interested in removing the advertising from the advertising-subsidised version, or cracking the drm.

Wednesday, 4 April 2012

The new blogger

So just this minute I was fortunate enough to have the obviously-ever-increasingly-evil google force me to use the new blogger interface as they've been threatening to do for a few months.

One side effect is that if you visit the blogger dashboard with javascript disabled you get a completely blank screen. Nice one fellas.

Other than that, it's mostly a pointless bit of re-learning that I could have done without. The old blogger GUI was pretty fugly but the new one is hardly the madonna's tit either. The way the 'Save' button changes whilst it auto-saves is surprisingly distracting and very annoying.

Oh and I forgot about that really tedious two-step extra-tab preview. Because I unfortunately had 'convert newlines to <br>' set when I created the blog (or maybe that was the only option back then update now it seems to strip <br> tags and convert to newline, so maybe i can change it now without screwing up all the old posts) I have to check newlines around every image or list or pre-formatted block all the time. Having a tab switch and a re-load makes the preview feature harder to use (i really couldn't give a flying fuck about the actual style-sheet used, I force fonts and sizes so I know nobody else sees what I see anyway).

Only plus is that the 'edit' button is back when i read the blog - that vanished a few months ago for no apparent reason.

Might be time to revisit 'wanki-ee' - maybe all that JavaEE stuff came at a fortuitous juncture after-all. Well, maybe if i had "another day every day" at any rate, as it is there is just not enough time to fix everything wrong in this world.

Web N Shit ... N Stuff.

Hmm, so i've been poking away at webifiying[sic] our client's application.

Overall i'm making pretty good progress: worked out the async ajax stuff / XMLHttpRequest, 'hidden' form submission, RESTful resource mapping, handling long-running tasks and so on. The Enterprise bean stuff is pretty good, and particularly things like JMS, all the bean types, jax-rs, and jaxb. The latter two helping to hide some of the horrible shit going on under the bonnet.

But I dunno ... it's just boring. I probably would've found this stuff neat 5 years ago, and had a puppy over it 15 years ago, but now it's still enough of a pain in the arse having to deal with that given a choice I wouldn't be doing it.

Probably help if i'd had more than 4 hours sleep each day this week ...

Tuesday, 3 April 2012

Kobo

So i've mostly just been using my kobo for reading lately (not a lot, but i'm usually so tired I cna barely go 5 pages before i fall asleep) - and it's crappy software is giving me the shits, particularly when reading text files. I'm not sure I could do much better, but at least I could try ...

It even got me riled up enough to have another go at working out suspend: but again I had no luck. I just can't tell how it's going into suspend mode. If I could work out that I would have enough to keep me happy and I would do some more work on ReaderZ.

But without it i'm just stuck and it just pisses me off.

Update So it occurred to me later that the problem might be more related to the wifi adaptor since I'm always doing this stuff from telnet. If I try to suspend using /sys/ it never recovers and I need to reset the machine.

Monday, 2 April 2012

Easy Burmese 'tofu'

So yesterday I managed to get away from the machine for most of the day. Actually I got a bit sunburnt pulling out weeds and doing some gardening. Also mowed the lawn and did some work on the compost pile. And planted some winter vegetable seeds in pots: I have never had any luck whatsoever with winter vegetables (if I ever get the seeds to germinate they struggle and usually get eaten to death by bugs), but maybe this time ...

Well, I've been watching SBS's latest food show lately - Luke Nguyen's Greater Meekong - with all the advertising they fill each half hour slot with now it really needs to be a full 1 hour show - but Luke is a good presenter and although the editing could be a bit better he always finds interesting food and people who want to share it.

This week he had some chick-pea 'tofu' soup thing from Burma. The soup itself looked a bit heavy for my liking but although i'm no vegetarian I'm partial to some of the fare they like. I also like to learn about ethnically or geographically important staple grains. Actually it's a bit of a bummer looking for recipes with such ingredients because all you come across is vegatarian and vegan nutters who are looking for a filling main meal - not a tasty snack or accompaniment. It also involved a great deal of work - from a stone grinder, to muslin cloths to a giant stirred pot.

Because i'm lazy, the overnight soaking of the chick-peas seemed enough work for me, so instead I just blended the fuck out of them. I first tried topping up with water but that wasn't enough and I lost track of just how much I added. But I blended for at least 10 minutes and ended up with something akin to cream at the end of it. Enough blending that you could barely taste the fibrous material you otherwise end up with.


Then I cooked it on low with a good dose of salt and a bit of tumeric (as recipe I found suggested). At this point it was pretty much just making polenta. The old man used to make that and toast it on the AGA (which doubled as our only source of hot water as kids) all the time, and we all used to turn our noses up at it; and unfortunately I never learnt to make it before he died, so I had to learn how to make it by trial and error. It's also not something I make very often so I usually forget the finer details ... but I guess 'stir constantly until you're sick of it' pretty much sums it up. It didn't go quite as hard as the polenta i've made, but then again maybe it had more water in it. By the time it turned into a bubbling lava-pit my arms were tired so I decanted it into a cotton-lined dish and let it cool.

It looks and smells like polenta but tastes a lot better. Texturally it was fine: soft and creamy with no hint of fibrousness, I'm sure not straining it affected the result but what I ended up with was quite ok.

I diced and fried some up and it was pretty much like tofu in texture on the outside, moist on the inside, and tasted ok just on it's own (closest flavour I know would probably something like a papadum). Tofu isn't something i'd normally buy since it's pretty bland and I just don't know how to select it. The pre-cooked stuff is dry in addition to bland.

Since I also made up some hummus with some of the chick peas, I had a bit of a anti-pasto arvo snack. Some olives, hummus, biscuits, fried tofu, chilli sauces, and some fresh chillies as well (and beer and wine of course).


Amongst the chillies I picked I scored a triple-habanero from the garden ... I get doubles fairly often but this is the first triple. Unfortunately my habanero crop isn't so great this year, but I noticed I still have a few hundred (~5litres) in the freezer from last year so i've started trying to use them more often - but as they are so potent, I'm sure I will still end up with more than a winter's supply worth!