intepid

with cheese

My pretty boring city

I don't actually live in Sydney anymore, but I still think of it as where I live. That said, I have never really appreciated it all that much, because I find any place boring if I a) have no money to spend, and b) have no one interesting to hang out with. Going somewhere pretty does nothing for me if I'm on my own... I'd generally rather be napping or watching TV in my own house. This is probably why I have travelled so little.

Anyway, today I had several hours to kill while my car was getting a scheduled service, and thought since it was such a nice day I'd go wander the legendary Sydney foreshore with the tourists. And I took a bunch of photos around the Opera House, since I don't think I've ever really looked at it closely before.

It really is quite a striking building up close. Still, I would rather have been napping.

The reason I like Sydney is not the sunshine or the atmosphere; it's mainly that it has people in it who I like... and everything else is window-dressing. As rents continue to rise to stupid levels I start to see the appeal of starting a commune in the middle of nowhere (but I also recognize the hideousness of that idea, see Sartre et al).

PS: Anyone who has read this blog for long has probably worked this out already, but in case it wasn't abundantly clear I'm not much of a 'going out' person. I much prefer home. I like my bed, my bath, my stuff.

Renewing the Compact

More than a year ago I decided to try a sort of Ulysses pact to give up smoking, and it was technically a success. I did not violate the terms I set out, which specified that I must not purchase tobacco within the subsequent 12 months. Unfortunately it didn't actually make me a non-smoker, instead turning me into an opportunistic smoker– ie I was able to go long periods without smoking, but would still take the opportunity when cigarettes were offered. The deal expired at the end of March 2012, and sure enough my willpower has since crumbled without the threat of an immediate penalty hanging over me.

So as of today I'm renewing it, because it seems for now I still need that external consequence to keep me straight:

 

COMMITMENT


I hereby commit to not purchasing any products containing tobacco for one year, covering the period from UTC 12PM, 1st May, 2012 to UTC 12PM, 1st May 2013.


PENALTY FOR NON-COMPLIANCE


Should I break the Commitment within the designated time period, I hereby promise to publicly acknowledge this lapse and donate AU$1000 to the Liberal Party of Australia* within 48 hours, after which the Commitment will be terminated or renewed at my discretion.


 

Part of last year's compact was that upon success I would donate US$500 to a secular charity of my choosing. To be honest I was thinking of delaying this, since I didn't specify a particular time-frame for that outcome and my cash-flow isn't exactly awesome right now. But for these things to mean anything it's important to hold to the original intention. So now I'm looking for a secular charity deserving of funds, but have't decided on one yet. Please chime in in the comments if you know of one that is recognized for its good works and efficacy.

* In Australia the Liberal Party are the conservative jerkwads who court the reactionary bigot vote. We Australians are terrified of refugees on boats and gay marriage apparently, although you wouldn't know it if you asked the average person on the street. They're not as bat-shit crazy as the GOP in the US but who the hell is? It's unfortunate in that I would otherwise describe myself as a liberal but it's not worth it here because you have to explain you mean "small el" rather than "large el"

Back on Facebook, again

It's one thing to decide you don't need Facebook personally, but then there's the problem of working on a web app that needs to play as nice as possible with existing networks, the largest of which is of course Facebook. So once again I exist on this network, because basically you have to in order to get by online.

And not only have I signed up once again, but this time I might need to grovel to get my app privileges reinstated, since they seem to have decided I am not worthy:

You can no longer create apps because our systems indicated that your account may not be authentic. Facebook requires users to provide their real first and last names, and fake accounts are a violation of our Statement of Rights and Responsibilities (SRR 4.1), even when used to host or test apps.

Oh what fun!

Pro(crastination) tip: Make a personalized QR code

The fact that almost everyone has a smart phone now means that QR codes are not actually a terrible idea, even on a website (eg a lot of apps show QR codes on their websites so you can take a picture of the screen with a smart phone to go directly to the app store and install).

The codes become a lot cuter when you customize them, as this overly complicated tutorial shows you. In a nutshell you can just plonk an image in the middle as long as it isn't too big, because QR codes (can) exploit a high level of redundancy for error correction.

If I needed to make a business card I would definitely use this technique.

Pro(crastination) tip: Paint your workspace

This is a great way to avoid getting anything done because you have to clear everything out in order to do the job, removing the option of even sitting at a computer for a day or two while you're prepping and painting.

I'm quite pleased with the cosy-neat look, so I'm totally ready to get loads of work done now!

BTW this is an old photo showing the grim blue-grey that I had before (above the picture rail it is still that color but I'm leaving it to avoid orange overload).

The Political Compass needs another overhaul

There's this thing you've probably seen online many times before, where you answer a bunch of questions and get as a result a position on a two-dimensional graph representing your political outlook.

The website explains how awesome this is by pointing out that the traditional left-right spectrum is woefully inadequate and that we therefore require the autho/liber Y-axis to better describe a person's worldview. I basically agree with this as far as it goes, but the problem is that it still utterly fails to meaningfully capture a person's position and especially the overall likelihood of them being a total douche you'd like to punch in the face.

This is best exemplified by the site's own projected plots of existing US presidential candidates:

There's me for reference down in the bottom left. And look up there clustered together are Romney, Obama, Gingrich and Santorum. Even assuming that their answers on the idiotically worded questions are correctly interpolated– and that may be a long shot– the fact that they appear to be so close together shows that just one extra dimension isn't enough to be truly meaningful.

After answering the questions I can think of two addtional axes that would easily distinguish these candidates from each other.


  1. Something like pragmatic/flexible <--> idealistic/stubborn, ie how much you see the world as you think it should be versus how much you see things as they are. In this sense Romney and Obama would still be close, but Santorum and Gingrich would be off the chart in the other direction. I would probably be near the middle for that one.

  2. reality-based  <--> faith-based, in which Obama would be squarely based in the former and the Republicans would again be off the chart in the latter. I would be heavily in the former there obviously....


For the sake of convenience these two additional axes might be able to be combined, as they're not exactly orthogonal to each other, so we could perhaps settle for just one which might be labelled something like rationalist <--> idealogue.

So I think the political compass needs to be replaced by a political orrery or something, where at minimum we be able to plot people within a three dimensional domain, and while it would still be only a rough guide it would add a dimension that is fast becoming one of the most relevant in the upcoming US presidential election.

* Note that I actually agree with the relative position between myself and Ron Paul, he represents the kind of free-market libertarian I am always bitching about. It's an interesting linguistic irony that he occupies a spot that might be labelled economic-neo-liberalist but would identify as libertarian, whereas I show up in the social-libertarian quarter but am much more comfortable self-identifying as a liberal. Political terminology can be such a goddamn pain sometimes.

TV and my opinion of some things on it

Downton Abbey - For a period drama this show rips along at a cracking pace. It's all manners and intrigue but beautifully put together, with some truly nasty people you wish would hurry up and die of syphilis. It took me ages to give it a go, but I'm glad I finally did.

Archer - A few wobbly episodes this season but still a great show. Worth catching up on if you've not given it a go.

New Girl - Occasionally a bit stupid but often charming and at least the writers have finally realized that Schmidt is far more entertaining than Zooey Deschanel's schtick. I think the show never really recovered from the clumsy black guy hot-swap (Damon Wayans Jr was great in the pilot, only to have to back out for other commitments).

Awake - This show has a simple but far-fetched premise which manages to hide its absurdity through engaging procedural detective show stuff and pretty decent acting (unlike Alcatraz). Although it too will probably be a bit anticlimactic once it has to reveal what the hell is actually going on, it offers a fascinating setup with parallel realities and handles it reasonably well. Jason Isaacs carries it by underplaying almost every scene.

Justified - Seriously brilliant. I can't really compare this show to anything, it is just awesome and full of people trying to kill each other for all sorts of complicated reasons. I've never seen a tv show handle character arcs and shifting alliances better than this one does.

Revenge - this started well but seems to have morphed into a tedious soap opera/melodrama with people constantly talking to each other over the shoulder and casting evil menacing glances to the side. Especially annoying is the Tyler character who was obviously loathesome from the moment he arrived but we are supposed to believe he is some kind of smooth-talking hustler. Almost as bad is the dumbass little brother character from the bar, who has a massive chip on his shoulder even though he owns half a bar. I think he exists only to keep the idiot plots moving along.

Luck - This expensive looking production might be more interesting if I could understand a  single word of what anyone is saying.

Fringe - Why did I get stuck on this show– it gets stupider by the episode. John Noble's Walter is the only thing worth watching here.

Alcatraz - Holy crap this is a dumb-ass premise, and feels like one of the later seasons of Lost for the sense that there is absolutely no plan for how this idiotic show will explain all of the unbelievably stupid shit that happens in it. Like if you were in a maximum security prison and suddenly got zapped 50 years into the future– do you think you would be so blindingly stupid as to rush straight out and start committing the same violent crimes you were incarcerated for? Yeah yeah I know it's all going to be explained that there's some kind of mind control thing happening.... but if you think for one second that there will be a satisfying motive driving whoever is behind it all, you WILL be sorely disappointed.

Useful tip about gmail addresses

I'd suspected this was the case but it's nice to see it clearly confirmed here

Gmail doesn't recognize dots as characters within usernames, you can add or remove the dots from a Gmail address without changing the actual destination address; they'll all go to your inbox, and only yours. In short:


  • homerjsimpson@gmail.com = hom.er.j.sim.ps.on@gmail.com

  • homerjsimpson@gmail.com = HOMERJSIMPSON@gmail.com

  • homerjsimpson@gmail.com = Homer.J.Simpson@gmail.com

Mike Daisey's Agony and Ecstasy

Just listened to This American Life's unprecedented retraction of Mike Daisey's story about Foxconn (Apple's primary manufacturer in China). I hope it gets at least the attention that the original show did.

Basically it turns out that every element in the story with an emotional punch was either definitely bullshit or very probably bullshit. And once these are removed, all you have is a guy speaking annoyingly slowly telling you the same shit everyone already knew about Apple's supply chain.

Of course when faced with the mounting evidence that he was full of crap, Daisey attempted to justify his work by going for the 'it's true in spirit' defence; an attitude for which I have virtually no sympathy. It reminded me a piece from On The Media last month titled Lifespan of a Fact, in which essayist John D’Agata defends his art on the basis that people have been making shit up and serving it as Truth for thousands of years– and why should we let facts get in the way of a good story? Honestly, when such writers pat themselves on the back for ignoring mundane evidence-based truth for something that just feels true, I want to spit. It takes a whole lot more talent to weave a good story around the facts than it does to massage the facts to fit a ready-made story.

Mike Daisey will go on insisting that his work has been instrumental in increasing the pressure on Apple to do more to reform its suppliers, and therefore he is still the good guy. Never mind that the whole story was serving him very well indeed and raising his profile considerably (even now it's unclear whether he's better or worse off than before the original story aired - here's his most recent blog post about it all).

For my part, thanks to the disingenuous Mike Daisey, I now feel less guilty for liking and buying Apple products than I have for years, because in order to make me feel more guilty in the first place he had to make shit up.

In a fact-based followup, a comparison was drawn between factory conditions in China today vs the US early last century, which were of course terrible. In America, decent people worked and fought to institute fairer labor laws as well as health and safety conditions that made life better for everyone. No American worker today would tolerate the conditions and pay of a Chinese factory, so maybe we in the west should feel bad that shitty factory conditions have merely been exported...

The thing is, Apple doesn't have the power to enact Chinese labor laws. And most people accept that it doesn't have the option of taking its business elsewhere. It is likely they could push harder and see some positive results in the conditions at Foxconn. But last I checked, China wasn't some shitty little third world country under the thumb of the west... it was a terrifyingly huge emerging world power. Is it so strange to imagine that ultimately it's the Chinese people who might win for themselves better working conditions, to be codified in law? There's a lot of socio-economic change going on there right now, with a rapidly growing middle class, and I can't help thinking that working conditions are going to be changing a lot more due to this than any outside pressure.

The best way to get rid of a sweatshop is to make it illegal to run a sweatshop, and Apple simply doesn't have that power. What they're doing right now... I think it might actually be enough for my conscience to bear.

Also, I really wanted Ira to ask Daisey to 'field-strip' his Macbook right there, as he claimed he liked to do in the original monologue.

Counterpoint: Mike Elk sees things rather differently and applauds Daisey's passion.

The iPad doesn't want your crap

It's remarkable that even at 20 times normal speed the movement is only barely perceptible.

I first noticed the effect when the mini-microscope I was using to check out the tiny RGB pixel elements started wandering across the screen of its own accord. Turns out it's not unique to this model, and likely is common to most modern touch screens– it's just something I never noticed until now.

Note that this does not mean that the screen is frictionless; merely that the coefficient of static friction is negligible– static friction is the effect that (normally) allows us to place one thing on top of another and find it where we left it the following day. By nearly eliminating static friction these screens avoid the problem of sticking/jarring motions as you drag your fingertip across the glass.

Why I'm buying "the new iPad" ASAP

It's all about the pixels :)

Here's a screen shot of my (plenty large) 27" iMac screen, with a resolution of 2560 x 1440, overlayed with a red rectangle representing the pixels in the new iPad's 2048 x 1536 display. Hard to believe but a screen capture from a new iPad won't even fit on a screen that people generally see as 'huge'.

Of course the new display is only 10" diagonal as opposed to 27", so those pixels are less than half the size of those of my iMac, resulting in a pixel density around 260ppi. This will make for a rather splendiferous reading/browsing experience, and also bodes well for future Mac releases.

UPDATE: I bought one! Just the base 16GB Wifi, because it will rarely be needed outside the house and I am not interested in keeping movies on it. Click on the image to see a full resolution screen grab of this blog entry as viewed on the new iPad, in all it's megapixelly glory.

Microsoft ? Chopra

This does nothing to improve my respect for Microsoft as a company
Dear Mark,

Prepare to hear new perspectives and develop insights. Are you ready to share in the experience and learn from the best? Deepak Chopra, MD, FACP, the internationally renowned physician and author, and thought leader of the mind-body-spirit movement will be the Microsoft Worldwide Partner Conference 2012 guest speaker! The Wall Street Journal called his business book, The Soul of Leadership, one of the five best business titles of 2011. Hear this speaker live and in-person.


This is not the first time he's been involved with the company, so this isn't just an isolated decision by some misguided conference organizer.

Now I hate Javascript too!

This is some code I wrote to evaluate a form with structured data in it on the client side, attempting to build the same object heirarchy Ruby on Rails would build once the form is submitted.

Unfortunately I got stuck for ages getting this right thanks to 2 very very stupid Javascript quirks.


  1. at line 10 I was previously using for (var n in names), and this actually caused the code in line 21 to fail unexpectedly with the array lookup always returning null. The fact using the for...in construct on an array does not give you the value but does not give you an incrementable index either was something I had no reason to anticipate.

  2. A well known type checking error I had forgotten about since last time it bit me: typeof Array returns 'object' and not 'array'. Unbelievably dumb. Hence my use of the helper function is_array in line 14.


That both these problems were occurring at the same time made it very very difficult for me to see why the code was failing, until I had added debug trace messages to practically every line to try to work out what was going wrong.

It doesn't help that I am also quite sleepy and haven't washed in a few days since my hot water system failed on the weekend– It's now fixed and I am about to enjoy a good long shower.

What is wrong with (database) programmers?

I am a programmer. I am currently working on an enterprise web application which means I am also working a lot with databases. In the course of my work this means I am often making major changes to databases, including radical alterations of the schema.

When I want to remove everything from a database and replace it with backup data... well you'd think there'd be a simple way to do that. But according to the internets, that's something I shouldn't need to do ever! Let me point out that the one apparently acceptable way of doing it – deleting the database itself and creating a new one – is actually a real pain because it means first shutting down any processes that might have a connection to the database, then restarting them afterwards, and this can take a while.

So, in SQL, there is this command: DROP TABLE. This removes an entire table from a database. This can cause terrible problems because there might be other tables using the data in that table. And yet the command is there, and no one disputes that it's really necessary.

And yet, there is no DROP ALL TABLES command. Such a command would be very useful, because you don't have to know the name of each and every table you want to drop. This is particularly great if you are going to be loading up the database with a bunch of differently named tables, because it requires zero knowledge of what's already in there. It's as obvious a requirement as the ability to delete all files in a directory without enumerating them first.

So here is an actual conversation from a forum where some poor sap obviously had the same idea I did, and the responses are really indicative of the sort of helpful advice you usually get in programming forums:


Saravanan.R
Hi All,
How can i delete all the tables in a DATABASE with a single shot!!
Thanx in advance

bennydubai
Well...what i do is may not be the right way)
Just delete the database.......and create a new database........else it will start asking for so many dependencies)
cheers!

Saravanan.R
Benny,
In a database TABLES, VIEWS, FUNCTIONS, PROCEDURES, TRIGGERS, etc. are there! So I have to delete only TABLES. If I drop the database means I want to recreated all those objects.
I need to delete TABLES alone.
Thanx in advance

upalsen
another simple way
generate SQL script of the database, select "all tables", select "generate drop command for each object" check box only (not the create one). you should have a script with all drop commands. run it

Saravanan.R
Hi
Its not a appropriate way to drop! plz..

TALAT
DELETE FROM sysobjects WHERE xtype='U'
Need to check the option "update system catalogs" for the server properties prior to execute the statement.

derrickleggett
DO NOT delete anything from sysobjects. That's insane.
If you want to delete the tables (in SQL Server lingo, this just means delete the data out of all of them).

DECLARE
@sql VARCHAR(4000),
@int_counter INT,
@int_max INT

DECLARE @tables TABLE(
ident INT IDENTITY(1,1) PRIMARY KEY,
table VARCHAR(256))

INSERT @tables(table)
SELECT name FROM sysobjects WHERE xtype = 'U'

SELECT
@int_counter = 1,
@int_max = (SELECT MAX(ident) FROM @tables))

WHILE @int_counter <= @int_max
BEGIN

SELECT @sql = 'DELETE ' + table
FROM @tables WHERE ident = @int_counter

SELECT @int_counter = @int_counter + 1
END

This will only work if you don't have foreign keys though, so you would have to make a similar procedure to drop and recreate those. You can find one on SQLServerCentral.com though.
If you really want to just drop all the tables, change the DELETE to DROP TABLE, and you are good to go. NEVER edit the system tables as a shortcut. It's dangerous; and there are too many good scripts someone else has already written to be doing that.

blindman
"Its not a appropriate way to drop!"???????
What they heck WOULD be an appropriate way to drop all the tables in a database with dependent procedures, views, functions, and perhaps even triggers?
I have trouble believing what you are doing is appropriate or necessary in the first place!

derrickleggett
If he's dropping the tables to just recreate them, the biggest problem will be the foreign keys if he has them.

TALAT
He is just askin to delete ALL tables. Why r u scared of the foreign keys, obviously he would have the script for recreating the tables which would include the relationships too.

blindman
Again, What For???
If he can run a script to restore them, presumably he could run upalsen's script solution to drop them...

TALAT
He says that he wanna delete all tables in one shot, just for fun i guess, therefore one delete query in sysobjects would satiate his desires rather to select all tables and then choosing include drop tables statement and then running the drop table commands for each table.
However, it's clear that playin with system catalogs is not so wise. U r right indeed.

Ruprect
why do you want to do this
it may be that we may have an alternate solution for your problem other than deleting all of your tables
for example if you want to just remove all of the data from your tables without dropping them, then try the truncate table statement.
[Books Online] Truncate Table
ps if you ever directly modify a system table, we will run you out of town and burn your castle like a group of villagers chasing the frankestein monter

Saravanan.R
Hi All,
Sorry I have to DELETE (DROP ALL TABLES) in a single shot!

blindman
You think he wants to drop all the tables in his database "just for fun"?
What the heck are YOUR hobbies?


etc etc...

Note particularly the emphasis on Why when people can't provide a decent answer to How. This is super common with nerdly types, and it makes me want to scream. In real life if you don't know the answer to a question you should have the courtesy to say "I don't know" before asking why. On the internet you should simply STFU.

btw I did finally find something that did exactly what I wanted (for PostGreSQL at least):

DROP SCHEMA public CASCADE;
CREATE SCHEMA public;

Touch


TV writer/producer Tim Kring moments before proposing Touch, an awesome new show combining the warmth and credibility of Touched by an Angel with the fast-paced excitement of Numbers.

Kiefer Sutherland grimaces through the role of long suffering dad who's never been able to hug his 12 year old son, until the end of the very first episode at least. The boy suffers from a form of autism/mutism/intolerable smugness, which is a source of constant pain... until half-way through the episode when his dad googles "mutism" and clicks on the first link to find the website of Danny Glover, a magical old black man who immediately explains the entire supernatural premise of the show so the viewers don't get too upset about not having everything immediately explained to them. There's also a sexy case worker from child services, who plays the antagonist for all of 40 minutes before she too is utterly convinced that the child has special powers and so by the end of the episode absolutely everyone is on the same page and there is nothing left to do but prepare for a series of Littlest Hobo style journeys to help random people solve random problems in the most convoluted way possible.

Also, people are all connected (like wow! you know) and somehow a call center worker talks an involuntary suicide bomber out of his mission in such a way that there are no bad consequences for him or his family.

Tim Kring's previous work Heroes totally sucked, but at least it didn't totally suck right out of the gate. Touch is the worst big new show I have seen in a long time. I think I'd rather watch Game of Thrones, and that's saying something.

Wide awake since 5AM

I awoke a couple of hours ago with the sensation that the sort-order of my teeth had been changed and now they were all in the wrong place. Also molars on both side were aching; I think I must have been clenching them in my sleep.

I've been working hard lately on the secret webby cloudy appy thing, and good progress is being made. So much so that I might actually do a blurb on it here in the next week or two, especially since it's not actually supposed to be secret and we really want to be setting up trials.

Ruby on Rails is just a thing I accept now, and I'm familiar enough with it to hack around the bits I really don't like.

Also, Facebook WTF? A hundred bucks per user sounds like a bit of a crazy over-valuation to me. I am trying not to pay too much attention to the IPO, because every time I think about the fact that more than 10% of the entire world's population are using a proprietary service which is so obnoxiously walled off from the rest of the web... well let's just say the red mist descends.

Next Page...