xkcd reference
I'm not really writing any Python, but I've been having a similar feeling lately about an old nemesis: Java.
There's been some Android talk around the office lately, and while I did do an Android port of one of our games, it wasn't the best experience. That's not Java's fault, it's the fault of the original programmers, who apparently thought that C++ was the only language they - and everybody else here - would ever need. People who aren't well-versed in all the languages that you might use in-house shouldn't write libraries, or at least they shouldn't design them. But I digress.
As I mentioned, there has been talk. We have partners (who can't be named) that are interested in publishing on Android, so I've been doing some light R&D. No porting, no real direction, just checking the lie of the land. I have to say, I'm rather enjoying it. I still have plenty of legitimate concerns - they're legitimate in my head at least - but I'd forgotten how many wonderful high-level constructs are pretty much built right into the language.
Need threads? Have your class extend Thread. Most concurrency issues can be addressed with synchronized blocks, no need for mutexes. Ah, you say, but I don't want to have to create a whole bunch of threads all the time, that's expensive. That's ok, Java has ThreadPoolExecutor. You want fries with those worker threads?
We use a lot of JSON round here - XML is so last decade - and it turns out there's a parser built in. Tick that box. Oh, and we use http as a transport for that, and of course that's been present for years, thanks to Apache. Redirects are handled automatically, and all the compression/encryption functions are also in there, and they "just work". If you just need to show the user a web page, they've got a webkit and you can just slap a browser window right there on your view.
All the usual hardware geegaws are exposed for you - USB, BlueTooth, Wifi, accelerometer, audio. And you're not left just sitting there having to figure those out, there's high-level classes to assist you - gestures, audio fx, sip, telephony, the list goes on.
I've also discovered all sorts of nifty things that have been in Java practically from the start, but was too green (or too stubborn) to use. Container classes out the ying-yang. Object serialization. Reflection - are you kidding me? I still struggle with the I/O stream hierarchy pretty much every session (what do I need here? a BufferedArrayInputSequenceFileStreamReader? what does that even mean?), but the docs are almost always helpful, and eventually I figure out the right thing.
I guess the bottom line is that the honeymoon period for me and programming is over, and I'm finding myself seduced by the higher level concepts that come with Java, and not with C. It might be all the PHP I've been writing for the last year and a half, but the appeal of the low level isn't what it used to be.
Thursday, 22 September 2011
Saturday, 7 August 2010
Quit screwing around... you screw around too much
A word of advice. Don't screw around with /etc/sudoers unless you have a root shell open. Shouldn't need to be said, but I just did it, so clearly somebody should have said it to me.
Wednesday, 4 August 2010
The best defense... is a good defense
We moved offices recently, and in every sense of the word it was a good move. The office is closer to the Skytrain (that's good and bad - sometimes I like the walk), the HVAC system is 100 times better, and we switched ISPs. This is all to the good.
One sort of bad thing came out of it: our trusty server box really didn't like being shut down. When we set it up at the new place, it didn't POST the first time we turned it on. But did we panic? We did not. Hit the reset button and try again. Ah there, it's fine. We shifted it a week later because its location was less than optimal, pretty much the same story. Again, we're not worry warts, we just hit reset until it booted.
That was stupid move #1.
Stupid move #2. The unit was giving off some sort of high-pitched whine - I have to take everybody's word for it, because I lost that range a long time ago. Anyhow, to combat the noise, we put the box in a cabinet. The cabinet isn't hermetically sealed or anything, but there was only about 5 or 6 inches of space at most around the unit, and I expect there wasn't a great deal of circulation happening in there.
Stupid move #3. SVN started acting funky. People would check stuff in, and the next time somebody updated, they'd get various error messages and the update invariably failed. Huh. So my partner in crime/sysadmin and I went to work on the SVN revisions with a pair of pliers and a blow torch. We restored what we could from the backups, and found some scripts that were known to fix symptoms of this kind for the newer revisions.
After 11 hours of this, we had a kernel oops. For those who have not yet experienced an oops, think of it as a not-quite-panic. The system definitely freaks out, but the kernel doesn't lock it up; it carries on and hopes for the best. The best was not our lot that evening, and a lot of zombie processes starting showing up. Fine.
Now. After 3 weeks of being cooped up in a hot cabinet, the system decided that I should serve as the example to others. Wouldn't POST. I thought perhaps if I could bring up the BIOS setup, maybe I could figure out what was up. The setup screen froze after about 10 seconds. 3 times in a row. Suck. So I waited 15 minutes and tried again. No dice. 30 minutes. Fuck you, Jack. Gave it an hour, the thing finally POSTs. I have 15 minutes to spare before I'd miss my last bus. Not happy, but at least everything's working and I can go home.
I vowed to get the boss to buy us new hardware the very next day. He wasn't planning on replacing it until the end of the year, but he's a technical person too, so he understands this needs to be done now. He commits to getting the hardware next week (this is now Friday) and starts speccing new gear. Great.
However, the cosmos had other plans for me. Over the long weekend, unbeknownst to me, the SVN is still acting up and the system gets 2 or 3 more hard reboots. I come in on Tuesday to find the RAID on which the repositories live is dead. D-E-A-D. As a fucking doornail. Neat.
I have a Linux box under my desk that I was using as a test bed for MySQL cluster. That testing's all done now, and except for the database, everything else is basically a stock install. I installed what I needed to get SVN working more or less as it did on the old box, and copied the (week-old) backups over. Took a little while because our repos are huge - well over half my day is eaten up by copying, exporting, reloading, verifying.
But now it's all done, and with a little care we managed to save all the history minus the past week, and no data was lost because of course everybody has the files they worked on still sitting on their own desktops.
So what's the moral of the story? If it looks like a duck, walks like a duck, and quacks like a duck - it's probably a duck. Pretending that a dying system isn't really dying is probably not the best strategy for data integrity.
One sort of bad thing came out of it: our trusty server box really didn't like being shut down. When we set it up at the new place, it didn't POST the first time we turned it on. But did we panic? We did not. Hit the reset button and try again. Ah there, it's fine. We shifted it a week later because its location was less than optimal, pretty much the same story. Again, we're not worry warts, we just hit reset until it booted.
That was stupid move #1.
Stupid move #2. The unit was giving off some sort of high-pitched whine - I have to take everybody's word for it, because I lost that range a long time ago. Anyhow, to combat the noise, we put the box in a cabinet. The cabinet isn't hermetically sealed or anything, but there was only about 5 or 6 inches of space at most around the unit, and I expect there wasn't a great deal of circulation happening in there.
Stupid move #3. SVN started acting funky. People would check stuff in, and the next time somebody updated, they'd get various error messages and the update invariably failed. Huh. So my partner in crime/sysadmin and I went to work on the SVN revisions with a pair of pliers and a blow torch. We restored what we could from the backups, and found some scripts that were known to fix symptoms of this kind for the newer revisions.
After 11 hours of this, we had a kernel oops. For those who have not yet experienced an oops, think of it as a not-quite-panic. The system definitely freaks out, but the kernel doesn't lock it up; it carries on and hopes for the best. The best was not our lot that evening, and a lot of zombie processes starting showing up. Fine.
shutdown -r now. Except that didn't work either - shutdown was zombifying (if I may coin that term). Sigh. Hard boot.Now. After 3 weeks of being cooped up in a hot cabinet, the system decided that I should serve as the example to others. Wouldn't POST. I thought perhaps if I could bring up the BIOS setup, maybe I could figure out what was up. The setup screen froze after about 10 seconds. 3 times in a row. Suck. So I waited 15 minutes and tried again. No dice. 30 minutes. Fuck you, Jack. Gave it an hour, the thing finally POSTs. I have 15 minutes to spare before I'd miss my last bus. Not happy, but at least everything's working and I can go home.
I vowed to get the boss to buy us new hardware the very next day. He wasn't planning on replacing it until the end of the year, but he's a technical person too, so he understands this needs to be done now. He commits to getting the hardware next week (this is now Friday) and starts speccing new gear. Great.
However, the cosmos had other plans for me. Over the long weekend, unbeknownst to me, the SVN is still acting up and the system gets 2 or 3 more hard reboots. I come in on Tuesday to find the RAID on which the repositories live is dead. D-E-A-D. As a fucking doornail. Neat.
I have a Linux box under my desk that I was using as a test bed for MySQL cluster. That testing's all done now, and except for the database, everything else is basically a stock install. I installed what I needed to get SVN working more or less as it did on the old box, and copied the (week-old) backups over. Took a little while because our repos are huge - well over half my day is eaten up by copying, exporting, reloading, verifying.
But now it's all done, and with a little care we managed to save all the history minus the past week, and no data was lost because of course everybody has the files they worked on still sitting on their own desktops.
So what's the moral of the story? If it looks like a duck, walks like a duck, and quacks like a duck - it's probably a duck. Pretending that a dying system isn't really dying is probably not the best strategy for data integrity.
Subscribe to:
Posts (Atom)