LASIK Part I.

Last Friday, I had LASIK surgery (today is Sunday evening). The past two days I’ve been functioning in a relatively normal manner, sans glasses. My eyesight so far is somewhere between good and excellent, disregarding some minor halos around lights at night. It varies a little, but otherwise is everything I could expect. I can drive at night with no issues. I hope things continue on this track, because seeing without corrective lenses is quite nice.

I’m not really up to writing a full description of the process right now, but suffice it to say I’m happy with the results so far. The biggest irritation so far has been a fair number of subconjunctival hemorrhages (warning, creepy image) in my left eye and a little bit in my right. It’s pretty harmless, but looks absolutely creepy. Some people I’ve been around have also commented on how often I’ve been going through eye drops as something that would be annoying to them, but thus far it hasn’t bothered me much. The drops do a lot to promote the healing process, maintain comfort, and ensure that there aren’t complications, so I’m quite happy to use them as much as the doctor recommends.

24

Trying out Twitter.

The iPhone Twitter app finally tipped the scales and got me curious, so I registered.

Maybe this will keep a lot of one line observations of mine off IRC.

http://twitter.com/sklnd

Unintended consequences.

I recently purchased a certain popular phone to replace my flaky blackberry. I have more Gs now. This device has a Assisted GPS functionality.  The first time I tried this feature out, it told me I was located somewhere near Dallas North Tollway and Keller Springs in Dallas, Texas.

This phone has never been to that location.

I used to live at that location a number of months ago.

Why does my magic phone know where I used to live before I owned it?

There must be something in common with my current location and my previous location. Hmm. My old apartment, despite being in a gated community, was situated rather close to Knoll Trail Drive, just north of Keller Springs. The location on the map pinpoints me to right about there. What sort of data could Apple be using to locate me when GPS doesn’t work (like now, when I’m indoors?)

In addition to A-GPS, iPhone 3G uses signals from GPS satellites, Wi-Fi hot spots, and cellular towers to get the most accurate location fast. If GPS is available, iPhone displays a blue GPS indicator. But if you’re inside — without a clear line of sight to a GPS satellite — iPhone finds you via Wi-Fi. If you’re not in range of a Wi-Fi hot spot, iPhone finds you using cellular towers.

I’m indoors, so GPS isn’t terribly useful. There’s a gazillion wifi beacons buzzing around me right now, so why would…. OH. Hey. Someone surveyed MY access point, with its old location south of here, as it was located maybe 20 feet from a public roadway. Then, I moved to an area far enough back from a road to not get surveyed, and all of the sudden when GPS fails the only AP providing them with a location cross-reference is the one on my desk, and it “reports” incorrectly.

So, Apple’s superphone relies on data to divine location in certain situations that’s inaccurate and more awesomely exploitable. Sweet. Now I just need a list of AP names or (more likely) MAC addresses, and I could simulate being located in just about anywhere that has been surveyed when I’m indoors.

Some notes on C# and P/Invoke

I’ve spent the afternoon (slowly) trying to wrap up enough of libbluetooth to be able to use a bluetooth HID from a C# library. I’m not too far along, but here’s just a few basic things I’ve noticed while doing the data marshaling.

  • C# 2.0 has a fixed keyword so you can define a struct containing a fixed size array to match that being done in a c struct. This is handy when your fixed size array is not at the end of the struct, in which case you could just set StructLayoutAttribute Size field to include the extra bytes necessary for your array. Before 2.0 the solution was to declare int arrayItem1; int arrayItem2; ... int arrayItemN; in the struct to pad out the structure size appropriately. That works, but is irritating for accessing the array without using pointer arithmetic. Using the fixed keyword lets you access the data as an array after sending it through Marhsal.PtrToStructure(), which is great. An annoying side effect of this is that the array has a null size attribute, so you can’t foreach() over it.
  • Marhsal.PtrToStructure() is pretty nice for getting a blob of unmanaged memory back into a usable structure. I’ve never really gone this far into using P/Invoke, and so I’m having to learn how to use the interop parts of the (.NET | Mono) framework and move control and data between managed and unmanaged code and memory. The routine seems to be allocate a buffer of unmanaged memory with Marhsal.AllocHGlobal(), P/Invoke to an unmanaged library, passing the buffer along as an IntPtr by ref, pull the data into a managed struct from the unmanaged buffer when it comes back with PtrToStructure(), then free the buffer with Marshal.FreeHGlobal().

I’ll probably run into more stuff that is a little tough for me to wrap my head around bouncing from managed land to unmanaged, but this is a pretty good start. :)

Awesome customer service.

The battery in my laptop (Thinkpad X60) stopped working around 9pm Monday evening.

Timeline goes like this:

  • Sometime in March 2007: I bought a Thinkpad X60 from Lenovo, with the 9 cell battery.
  • Monday, October 15th, 9 PM: Battery stops working, AC power still works, battery light won’t stop flashing when on AC. ACPI reports battery is full.
  • Tuesday, October 16th, 9 AM: I tell IBM customer service person what happened, and give him my laptop’s type number, serial number, and my home address
  • Wednesday, October 17th, 12 PM: A new battery has been delivered to my apartment complex’s leasing office.
  • Wednesday, October 17th, 6 PM: New battery is plugged in and my laptop works again.

There were no questions asked, no mucking about with warranty information, and I had to spend very little time talking to IBM people to get my problem fixed.

It sucks that my battery broke, but I can’t ask for better service from IBM. Also, it’s pretty cool that I get a new battery, as my old one was starting to have a fair drop in charge level. Additionally, I’m really happy it came in just in time, as I’m leaving town for a couple of days tomorrow. :)

23

Only five easy steps.

  1. Get job
  2. Set up a wiki for team information sharing on your machine
  3. Have the people above you find out about it through word-of-mouth
  4. ???
  5. Profit! Get your workplace using a wiki for collaboration

It, too, can work for you!