Even Mo’ Math…

So Beckley got a hold of the MetroCard Math site and built on top of David’s fantastic work to build even more prettiness, neat-workingness, and general niftitude into the site.

We also put in a thingee – well, by ‘we’ I mean ‘he’ – he put in a thingee that lets you see how the new price changes will affect you. For me, I definitely will be sticking with the pay-per-ride.

And another thing – I actually tested the new (divisible-by-a-nickel) magic number, and it *does* work. My MetroCard has an exactly even number of rides on it. Cool. Now I just have to do something with all these MetroCards that have 10 or 20 cents on them – perhaps a new part of the site that lets you put in how much money is on your cards, and then it tells you how much more to put on to get it ‘even’? Not a bad idea…

Gory Details: so, talk to any computer sciencey person and they will always tell you that Floating Point Math is Hard. I have only rarely run into this, but the rounding algorithms are very specific when you buy stuff, and if you’re off by a penny, then, well, you’re off by a penny, and things stop working. We found a couple of minor (off-by-one) bugs here and there, and every time it seems like I fixed one, the rest of the results would start to go haywire. The real problem is that I am trying to ‘move’ the rounding around the formula:

round_for_money($x * 1.15) = n * $2.25

Now solve for ‘x’, and let ‘n’ be any integer – well, that pesky ’round()’ is in the way, and if you just try to move it to the other side, or round at some random and/or inopportune time, then when you get back to the original equation, sometimes the numbers don’t work out anymore. It sucks.

So I racked and racked my brain trying to figure out a way to do my simple solve-for-x routine. I really just want to try different integers for ‘n’ until I find an answer that’s “acceptable.” But that doesn’t work. At all. Or at least, I don’t know what mathematical operation I can do to move that round() function off the left side so I can try to have a formula that points to ‘x’.

What did I do finally? I gave up. I left the formula as it is above, and just run ‘x’ from 0 to “a lot” (a thousand bucks or a hundred bucks I think?). The answer I get is going to be completely accurate, but it wastes computing power. Well, too bad, your browser has to do a little bit of multiplication in a loop. My condolences. But! The result is, I’m pretty convinced my answers are to-the-penny accurate now. We’ll see when the big price change kicks in.

Thanks again to David Dominguez for the initial switch to jQuery-powered MetroCard Math, and thanks to Beckley for the full re-skinning he pulled off.

More Metrocard Math…

So I’ve updated my Metrocard Math site.

First, my friend David Dominguez helped out to make it much, much prettier. He also added some jQuery magic, and changed up a significant amount of how the site is structured. I was trying a weird idea – where I would strip the markup down to its most basic elements, and style it from there using cleverly-constructed css selectors, but I don’t think it worked out. My friend Bryan tried to restyle it as well, and the rigidity of the markup basically stopped him in his tracks. So, anyways, now it looks prettier and is definitely more usable on my phone.

I also had tried to buy a metrocard for one of the Magic Number amounts the other day at a vending machine, and it was rejected due to “invalid amount.” Stupid. It had worked before. I tried the small number. I tried the big number. Nothing worked. On a hunch, I tried $11.75 instead of $11.74. Success. And of course, I will eventually have a metrocard with a penny on it. So apparently, the number has to be divisible by 5? So I’ve added that to the site, and we’ll see when I next buy a metrocard if the new system actually works. I hope they don’t make it where it has to be divisible by $0.25, that would really sting.

I still want to do something where you can toggle between the current prices and the newly announced ones. But right now you can just type in the new numbers – Here’s what they are according to the Queens Chronicle (which I used to consult for a million years ago!) $104 is the new 30-day, $2.50 is the new single ride, and $29 is the new 7-day. The one-day funpass is going to be eliminated and so will the 14-day unlimited. Oh, and I hadn’t seen this before – there’s now going to be a $1 surcharge every time you pick up a new metrocard (though that doesn’t start till some time in 2011) OUCH. That means when you leave your metrocard at home and have to buy another one it’s *really* going to sting. One more extra buck. Damn. I mean, you can still use the lastest magic number ($15.65 I believe? Though I worry my rounding might not match the MTA’s…), but you definitely will not want to be throwing out your metrocards anymore.

Metrocards and Math

I work from home, mostly, so I don’t usually need an unlimited metrocard. Every time the MTA changes the prices on evertyhing I have to go through and write another stupid spreadsheet to figure out what costs what. And I hate the fact that when you buy a 10$ or 20$ or 8$ metrocard, you get a number of rides and some stupid amount of money left over. I was actually juggling 5 different metrocards a few weeks back, each with slightly different amounts on them. Just stupid.

So I finally gave in and made a Web site about Metrocard Math. It has a thing where you can experiment with what-if scenarios about fare hikes and stuff (it’s kinda like a javascript spreadsheet). The interesting thing I found was this: $9.78. Buy a metrocard for that much and you will have exactly 5 rides, with no money left over. Of course, if you’re buying your metrocard via Credit Card, they won’t let you use an amount less than 10$, so you have to use the next magic number: $11.74.

I was thinking I might put in something about the proposed ‘cap’ that the MTA is talking about doing for their unlimiteds, I just don’t know what to do with it. I guess “maximal theoretical value” I can do? Or you can just look at the number and compare to ‘rides needed to beat pay-per-ride’…

As an aside, the site looks like absolute shit. I still am the worst web designer in the known universe. But I don’t mind much, the only thing I do mind is that it is hard to read on an iPhone. And that’s usually when I want the damned site – when I’m trying to get on the N train, my metrocard has run out, and I forgot the Magic Number. Anyways, I experimented with keeping the presentation, content, and behavior all separate (and yet all inline on the page). If I ever get to styling it, it’ll be interesting to see how I can do that. For instance, especially on the iPhone, the disabled fields don’t look very different from the enabled ones. I don’t remember if in CSS3 though you can specify a style of a disabled field – but I would have to imagine that you can, right? Well, when I next feel like poking at it, maybe if I add in ‘swipe-cap’ support like the MTA is proposing, I might try and throw some iphone-specific styling on there to make it useful for me (the only time I actually use it, in fact).

Blogspot and Tumblr

Well, for those of you sick of hearing the trivial minutiae about how nifty LightDesktop is, never fear! Your prayers have been answered. I made a Tumblr Blog thingee just for LightDesktop stuff, so I can yammer on endlessly about file system optimizations and other such crap.

So now when I talk about LD here – it will hopefully be coming from a more personal perspective. In that vein, a few things to mention – one is that LightDesktop got mentioned on DistroWatch. It was just a little teensy one-sentence blurb, but I wasn’t quite ready for this. Whoops! I did send an email to the distrowatch people saying, “Hey guys, probably a bit early to mention me anywhere on your site or anything, but just wanted to let you know I’m around…” and I expected they might ask me a question, send some generic message that was like, “Hey, sounds good, good luck, let us know when you’re ready” or anything like that.

And I was troubleshooting something the next day or two and tailing the server logs…strangely enough I kept finding new people hitting the informational web site. I looked into the referer tags, and lo and behold, they’re clicking over from the DW article. Awesome!

So I went from getting one hit a day, up to 60, up to 800 the next day. So I’ve had to go run around and make sure my Google Analytics tags and such are working, and I realized the worst thing – actual downloads weren’t being tracked at all. So I had to build a little downloader script so I could track that, too. Hopefully, I got it. We’ll see.

And there have been a couple of little tiny things I wanted to mention here or there about LD, but I felt like I might be spamming to put them here. So, the Tumblr thing. First off, I have to say – man, coming back here to Blogger feels like going back in time 10 years. Tumblr has their shit together. It has nice, big pretty fields, beautiful stuff everywhere, insanely easy. It feels a little sluggish here and there, and feels all railsey all over the place – even though it may or may not be built on that. So I pop back in here to my old Blogger thing to check out what’s up – and wow. It feels old.

So within half an hour of setting up on Tumblr, I found a theme just makes me happy every time I look at it. Gotta have it. Knocks it out of the park (well, for me). Gotta get comments going, so I’m signing up for a Disqus account and trying to hook that in. Generally it’s working pretty well. One thing I didn’t like was when you look at a list of posts, it didn’t show anything about comments – and I wanted a comment-count to be listed there – I’m hoping to have people comment all the time. So now I have to customize my theme. And I’ve gotta say, not all that hard. A little poking around, a little documentation, and I’m done.

I can definitely say that if I were starting up a new Blog or whatever, I would, 100%, do it on Tumblr. This Blogger thing has been pretty good to me, but it’s definitely got its problems. And they’ve been the same problems for years and years and years. If I could find a nice way of exporting/importing articles…who knows, I might do it?

Food. I have made a really concerted effort to make sure to eat my full three meals a day today – I’ve been busy lately so I’ve been skipping quite a few meals. And I’m embarassed at the improvement to my mood and my energy levels from this relatively simple source. I’ve been plowing through feeling hungry, and smashing over actually feeling down and slightly depressed from not having eaten enough. Man, if I just ate normally, imagine what I could accomplish? I’m going to make a real concerted effort.

Lightdesktop now self-hosting (ish!)

So my nifty LightDesktop project has (almost, kinda, sorta) hit a new milestone – I’m writing you this blog post from it right now!

I have officially transferred all the development files into the filesystem (in Rackspace Cloud Files), and should be able to develop it…from it. I will be getting a ‘dev’ version vs. a ‘prod’ version distinction going so I don’t destroy the filesystem for everyone when I botch something (usually the CREST-fs filesystem) and post it up. Considering my development environment is it, itself – that makes sense.

So no more CentOS box (or VM, actually) for a while. And, man, does dogfooding pop all kinds of bugs that I want fixed ASAP. Window management is pretty horrible.

I am REALLY impressed with the browser. It has been able to handle nasty Javascript-heavy sites with relative ease. AOL – not usually a company I associate with doing things right – has some kind of insane Web 2.0 AIM client hooked in to their webmail that works suprisingly well. I’m shocked they made it so well, and even more shocked that it runs in my slightly janky browser. But that’s all due to the WebKit people, and, indirectly at least, Apple.

One thing that I’ve really enjoyed is how lightning-quick everything is. When you make something as super minimalistic as this thing is, there’s not a lot of stuff going on to slow things down. I have done enough testing (though not quite ‘living’) in the new system that when I get back to using my Mac normally, it feels sluggish. And that thing has 4 gigs of RAM and a core 2 duo and whatnot! This thing has – crap, I don’t even know (poking through /proc…)…a 2.2GHz Celeron, single core. 2 Gigs of RAM though. And I bought it at Best Buy for $300 or $400 dollars! They of course didn’t want to sell it to me – I had to go to a second Best Buy to find one where they would. Must’ve been set up as a bait-n-switch or something. Or maybe they were legitimately out of stock, who knows.

Oh, another fun anecdote – I have Windows (Vista, ugh) installed on here too. And at one point I inadvertently let it reboot into Windows. I figured, well, let me grab all my software updates and stuff….nope! Didn’t work. The wireless had mysteriously stopped working for no discernable reason. I wondered if the hardware was broken. Rebooted into Lightdesktop, and the wireless came right up. Love it!

A new LightDesktop Release

So my evil ploy of tricking myself into playing with LightDesktop a few weeks back worked like magic. I’ve been hard at work since then and I think I’ve got some good stuff –

  • Lots of optimization work in the CREST-fs filesystem. It’s getting faster and faster. It’s still much slower than a raw hard drive though, but there are quite a few optimizations yet to be done.
  • New Signup and Server side architecture (based on Rackspace Cloud and Cloud Files. Infinite Storage! So awesome.)
  • A GUI logger-inner-thing. Feels more ‘pro’ to me, for some reason.
  • I’ve yanked the old DAV-fs fallback – it just sucked too much, and made things complicated. And I like things uncomplicated. If someone were dying for this I could put it back. I think 99.999% of the users of this thing will use the server-based storage.

Numbers:

The system, when full installed, boots in 15 seconds on my eeePC. No joke.

The install CD is around 26MB in size.

As a test, I timed myself doing a real-world install – I downloaded the ISO, created a VM in virtualBox, had it boot up, logged in as me – and had my files sitting in my home directory in 3 minutes 48.5 seconds.

Again, the premise here is: all your data lives in the cloud, the OS does too (or is hosted from it) so you get automatic updates and everything. There’s no such thing as ‘installing’ an application, you should just be able to use one. It’s alpha, blah blah blah, will delete your data, will destroy your computers, drink your beer, and insult your mother. Caveat Download-or.

The Files

CDROM ISO
USB disk image

How long to install your OS?

So I was thinking that I wanted to play with something on Ubuntu yesterday. I wasn’t sure that I necessarily wanted OpenOffice and all kinds of other crap that just come with a standard distro/download, so I went for a minimalist install, and figured I could just grab the various little bits that I needed to upgrade the system to a point where it did what I needed.

I spent about an hour and change (including download time) getting it to work, and it never really did what I wanted it to. Kinda disappointing. But what I thought was strange was how looooong everything took. I mean, literally, we’re talking like 60, 90 minutes? That’s serious.

So out of curiousity today, and as a deliberate way of easing my way back into lightdesktop development, to bench how long it would take to download and install LightDesktop onto a VirtualBox VM.

My timing included creating the VM, and downloading the image to work from.

3 minutes 48.5 seconds.

That’s getting from nothing to having my crap sitting in the home directory in less than 4 minutes.

Damn! I gotta get back into this stuff. I like it when it works.

Time Warner is a bunch of poopfaces, especially “DP Loss Prevention”

So this is one of those blog posts where I rant and whine and complain about how some service provider done me wrong. If you dislike those posts, feel free to wait for the next one. This one will come off as extremely whiny. You have been warned.

Fucking Time Warner. You assholes. Especially Dawn, from DP Loss Prevention. I hate you. You suck.

So, I work for me. I need internet to do what I do. I just moved to Astoria from my old place in Jamaica. So I cancelled my old cable internet service, turned in the modem thingee. Like a good little boy. They asked for no money from me, and said I could call them and they would tell me if I owed them anything. Fine. I of course immediately disregarded that advice – if I owed them something they’d tell me and I’d pay it. I’m not chasing them down to ask them how much I owe.

So after a week and a half of no internet, Time Warner finally shows up to install it on a Friday. Guy is nice, jams it right out in no time. Even knew his way around a Mac, had me go into the Advanced tab thing to do “renew DHCP lease” – I didn’t know that was there! Up and running. Fast, low-latency, happy times.

So, I’m literally sitting on the toilet end of day Friday, and my phone rings. I consider it rude to talk whilst I am…in such a situation, so I decline to answer. Time is now 5:31pm. I finish my business. I go listen to my voicemail. “<<remnants of talk with co-worker>>Hi <<mispronunciation of my first name>>…Uhm….<<horrific mispronunciation of my last name>>, this is Dawn from Time Warner. Please give us a call back regarding your account. 718-888-4393”. Fine. I’m an upstanding citizen, maybe I owed them something from where I was living before? Better give a call back. I do. Generic-sounding voicemail for “DP Loss Prevention” in a computerized voice. Oh well, if it’s important they’ll call me back. I ain’t leavin’ no message for some weird generic voicemail box at a random 718 number.

Saturday morning rolls around and I flip on the iPad. No internet. Hrm. Maybe a remnant from the install? Power-cycle my modem. No internet. Okay, time to call tech support. I call. The automated system picks up my phone number and says “it seems your account has been disconnected. I’ll forward you to a representative.” The rep is nice, and says I need to talk to the 718 number that was left on my phone before. Crap. I guess I better. I call back and leave a message with my phone number and explaining that if I indeed owe anything, I’d be happy to pay it.

Nothing happens. I call the main tech support number – they again explain that I need to talk to that one department. I explain that I’d love to – and pay them anything they want – but no one’s there. I discover they only work regular business days, and I’m screwed till Monday. Awesome.

Monday rolls in and out. Nothing changes. I call them again, I beg to pay them. I call DP Loss prevention and leave another message. Note that I am restraining myself from freaking the fuck out on the voicemail because I want them to fix it.

Tuesday. Nothing. I call, another voicemail left to the generic voicemail box. I call tech support, a ‘message passed to the supervisor’. I ask to speak to a supervisor, I’m told I will get a call back. At this point, I am freaking out. Did I leave my phone number correctly? Is my phone broken? Do I keep missing the call? What’s happening? I go onto a forum and ask for help, they say that there will be an escalation if nothing happens. Great. In the meanwhile, at NO POINT WHATSOEVER has ANYONE told me what the hell is going on. I guessed I must have owed them money – and it must have been quite a bit.

At 4:01pm Tuesday a familiar 718 number shows up on my phone, and behind that number is a familiar voice. My old friend, Dawn. “I understand you want to make a payment?” she asks. You shithead. I answered, “well, assuming that’s why you turned me off, if I do owe you money, yes.” I’m prepared to shell out $300 on the spot. I need my internet. Must have it.

The bombshell hits. “You owe……….$32.17.” I couldn’t help myself, I laughed. Relayed my credit card info, and my internet came up after a quick power-cycle of the modem. Unbelievable. Time Warner put me through all of this hell – well, to me it was hell – for thirty bucks. You fucking dickweeds.

So of course during this whole debacle I’ve been looking at alternatives, and those alternatives made Time Warner’s behavior completely obvious – there are none. I can pay roughly the same amount to have 1/10 the bandwidth within 2-3 weeks from Verizon? No good. I was surviving, only barely, using 3G service and that was definitely not going to be a long-term way for me to get by. RCN didn’t service my area. There was nothing I could do.

And my feeling of powerlessness might be some of the reason I wigged out so badly – I thought long and hard about telling Time Warner that, no, I’m not going to pay you anything, you pissed me off, and I want to cancel, I’m not paying anything at all. But I couldn’t – I’m stuck, needed the connection. I had all kinds of wonderful imaginary conversations, escalating until I could talk to someone’s supervisor, getting Dawn fired and permanently making changes to Time Warner’s policies…getting them to comp me all kinds of things, making a big stink. I can’t though. There’s one place I can get a usable connection from, and they are it. So I made a decision, a very very difficult one, to accept the treatment and just get the connection working.

So, in summary, this is what happened. Time Warner called me end of day Friday, left a botched and meaningless message, turned off my service late Friday night (probably early Saturday Morning), never told me why, wasn’t even around to turn it on for the next two days, and kept me down for 4 days total….over $30.

I will be happy, happy, happy to get rid of them, as soon as anything even remotely good gets available. I can easily guess what Time Warner’s thinking was when they created this group or department or whatever – “Hey, we lost $x in people moving – I want that to be <less than x>! Let’s empower this raging horrible monster woman, Dawn, and put her in a department of Pure Evil to torture our own clients!” And $x goes to less-than-x. I hate them so much I’d be happy to pay twice as much for half the service. If they had any competition at all, they would not ever dare. Is that worth $30, Time Warner? I think not.

OK. End rant. Feel much better now. Sorry about that.

iPad

My fast review:

  • The screen is MASSIVE. 1024×768, but feels even larger. Because you tend to hold it naturally closer to your face. It feels completely huge, and like it extends into your peripheral vision. It feels more expansive than my MacBook Pro display, and that is 1440×900.
  • It is FAST as SHIT. Crap. Damn. Wow.
  • A lot of the apps you have are no longer necessary. For example, Facebook. Not needed any more. Just use the full website, it’s fine!
  • It’s heavier than I expected. That’s a little problematic when you need to hold it up the same way you hold a book. It’s heavier than a book.
  • Synchronization is a bitch. Do I have that note on my iphone, ipad, or my MacBook? Or is it synced? This really really sucks.
  • How do I carry this thing? If I have to carry my laptop bag, I’ll have my laptop. This is totally unanswered and makes it hard for me to figure out how to integrate this into my life. So far, I carry both. This is a shitty solution. And although I’m very comfortable with my sexuality, I don’t think I can swing carrying a man-bag.
  • It’s much, much better for cuddling up on the couch or on the bed. I think I may not carry my laptop to the couch when I’m trying to go ‘off duty’. Instead, I’ll just walk over with my iPad.
  • The drawing app I got – trying to replace my paper notebook – would work better with a stylus. Swiping your finger around the screen tends to have a lot of ‘drag’, and it doesn’t feel right, and it feels like it obscures too much of the display.
  • I can’t speak to the 3G part because I haven’t activated it yet. We’ll see. It kept pestering me every half hour or so to activate my 3G until I found out the control to turn it off.

LightDesktop Valentine’s Day Release – now Self-Hosting (ish)!

So – biggest thing is that I’ve replaced the horribly-performing WebDAV with a CREST-fs derived writable filesystem. It’s nice, writing both the server and client sides of a remote filesystem setup. I’m enjoying it, when I am not feeling like tearing my hair out. Because I am a fearful little wretch of a man, I did not write the ‘DELETE’ method yet. I’ll get there, just have to build up the courage. I think I wrote the client side, I just want to do something super wussy on the server end where I don’t delete it ‘just in case’…The new filesystem should have several attributes the old one did not have – it should work disconnectedly, it should be cache-aggressive, it should use the cache when disconnected, it should perform well, and it should have some support for symlinks.

I also modified the ‘root window manager’ thing – it has a sorta taskbar style doodad, with a wireless strength meter and a battery power meter, and some little quicklaunchey button things. Not configurable yet, but that’s probably one of the things that’s next.

I started by making it so that I’m able to compile a relatively simple project, with the storage all living in the Cloud. That compile was actually the root window manager/launcher thing for LightDesktop. Then I moved my LightDesktop dev directory over to a separate filesystem. And then booted up into LightDesktop, with that filesystem available as a secondary FS. Took me a while, but I got to where I can do a full compile, rsync, upload – everything – all from LD itself. I’m a little too afraid to put the entire compile for LD into the cloud itself – lots of stat() calls on lots of files causes lots of traffic, and the performance hit is a bit rough right now. But I’m inching my way there!

So, performance still is a little rocky – there are optimizations to be made on my end in plenty of places, I’m sure. I every now and then run into a weird problem where the system hangs on boot at some point after mounting CREST-fs. And lots of networking changes will occasionally confuse the filesystem to the point where it doesn’t work. I really want it to fail over to the cache when it can’t read something, but the allegedly time-out’ed recv/send calls seem to sometimes not work that way. Or maybe it’s my DNS stuff. If you’ve ever done any Unix network programming, I can assure you it is unnecessarily unpleasant, almost all the time. Just going from name to IP is like a page of code, it’s horrible. I see why every reasonably-sized app builds its own DNS cache every time, you can get stuck in DNS lookup hell real quick.

So at this point you could theoretically grab a copy of this thing, boot from it, and develop up a storm on it, building apps for it. I guess I’m kinda doing that now – though my source code is not on the Cloudy CREST-fs filesystem due to my fear of somehow blowing up all of my data (not completely unfounded of course…). But at least from here on out when I’m developing LightDesktop, I’ll at least be running it. That’s a start. I’m not at the point where I can ‘develop from anywhere’ until I can get the source into the cloud too – but that’s not far off. That will be pretty cool – I’ll sit on a VM on my Mac, or on Craptop, or maybe some new Desktop machine I get…or booted off a thumbdrive somewhere. And coding. How cool would that be?