Filed under: General
Oh no. I really want to like the new Transformers movie. But I saw this trailer on Digg and Optimus Prime has lips. I watched it a bunch of times, and he has lips…and they look awful. Silly even.
Filed under: physics
I’m always excited to hear news from my old haunt Fermilab. The latest is a terrific new result on neutrinos from the MiniBooNE experiment. There’s a terrific explanation on Cosmic Variance by Heather Ray. The new results move us closer to ruling out neutrino oscillation as the cause of the very strange results from LSND, a prior neutrino experiment which appeared to poke holes in the standard model.
Today’s fun was trying to figure out what the ‘==’ operator does in Python…and whether it’s in fact being used to implement the ‘in’ operator (i.e. if a in [1,2,3,4]). Seems like good stuff to know, but go try and find docs.
So we started with
>>> a = range(5)
[0, 1, 2, 3, 4]
>>> b = [a,a,a,a]
[[0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4], [0, 1, 2, 3, 4]]
>>> c = a
>>> a == c
>>> c = a[:]
>>> a == c
Which seems like we’re checking for value equality. But wait…
>>> class MyInt:
... def __init__(self, i):
... self.i = i
>>> a = MyInt(5)
>>> b = MyInt(5)
>>> a == b
>>> a == a
How odd. When I made my own class, it used pointer equality to implement ‘==’. I should mention here that I verified that I can define MyInt.__eq__(self,other) to do the right (
return(self.i == other.i) ) thing. But the default checks pointers.
So I thought about it, and no matter how I slice it, the pointer equality check is wrong behaviour, which is to say that it is not what I want in the majority of cases. The C++ compiler also generates the ‘==’ operator if you don’t define it, but there the default is the sensible answer…member by member equality over all member variables. So why did the Guido in the Basement make this choice?
Well, in python I can add and delete instance attributes (or whatever made up terminology the pythonistas are using today) willy nilly. So it’s impossible for the runtime to deliver any sensible == operator based on the attributes, unless I explicitly tell it which ones to use by defining the operator myself. Guido was backed into a corner by his own free and easy, batteries included lifestyle. So he did what any sensible benevolent dictator would — he punted, and let me pay the debugging price once again.
So my laptop is a Dell XPS M170. It’s not my favorite thing, but it gets the job done. Gets very hot though, and kind of exudes a certain cheapness which you wouldn’t expect from something which cost so much money.
One problem with the box is that the battery has been recalled as part of the kind of giant program which Dell would only engage in if people’s laptops were actually exploding; which they were. I thought it would be a good idea to participate, so I ordered my new battery on the web like a good customer should.
Soon enough, a battery came to my house. The address on the box even said it was for my house. The name it was sent to was not mine though, and the battery did not fit in my laptop.
That was last August.
I admit that I should maybe have been more proactive. Proactive in this case means sitting in the help center down the hall waiting on hold because my office doesn’t have a phone (‘nother story). Didn’t really seem like fun.
Anyway, the battery subsequently died. Really dead. When the plug falls out of the computer it turns off like a light bulb. Data loss often ensues. Bad. Worse is that the plug is actualy designed to fall out. Good design — probably keeps lots of laptops on tables which would have otherwise been on the floor after someone trips on the power cord.
So today I was fed up, and figured I’d do the phone/help center/endless hold thing and try to get it sorted out. My first call was to the recall people who noted thatthe stutus of my request was listed as “processing”. Well that was good to know. I also obtained the “request number” for my new battery. Also good to know. Finally, the man told me he’d be sure to expedite the request so that the battery would “get out the door”.
I hate to say it, but none of it seemed all that promising, so I thought I’d give the express service people a whirl — seeing as I’m paying for the express service.
One thing about the express service people is that that they take forever to answer the phone. The battery people are much faster, but weren’t helpful. So I went ahead and spend 90 minutes on hold scribbling in a notebook down the hall. I talked to a gentleman who was able to look up my recall account. I told him that the battery was now dead, and suggested that he put in a service request for a new battery, bypassing the recall madness. He complied by putting me on hold for another 10 minutes. Then he came back with the news that Dell’s policy is not to provide any service requests on recalled batteries. He pointed me to a web page where I could follow the status of my recall request. I mentioned that this tracking page didn’t work for me before, but he assured me that now that the tracking was straightened out everything would be fine. He left me with the advice — “Just keep checking that page, and we’ll get the battery to you”
Downtrodden I walked back to my desk. First thing, checked the page. Still didn’t work. Still no battery. Try again in another 6 months.