Browsed by
Month: April 2008

Quotes

Quotes

Mark Twain:
“Don’t go around saying the world owes you a living. The world owes you nothing. It was here first.”
“Why do you sit there looking like an envelope without any address on it?”

Plato:
“One of the penalties for refusing to participate in politics is that you end up being governed by your inferiors.”
“This city is what it is because our citizens are what they are.”
“The measure of a man is what he does with power”

Nifty links

Nifty links

Sub-pixel rendering on LCD displays:

VI color scheme tester/downloader – test out and download from a whole library of color schemes that some nerds hacked on for months…

Slyfex – auxMod. This little gadget plugs into the head unit inside your Mazda radio and turns the ‘media’ button into what it should have been – not XM satelite, but an aux-in line input. It’s all internal and you pick where you’d like the cable routed. Mine’ll be going to the center console box.

Your car is now in: Frankfort, Illinois

Your car is now in: Frankfort, Illinois

So far so good with DAS – Dependable Auto Shippers. They’ve gone about 340 of the 2400 miles.

They are who are bringing my car out, and are one of 4 shippers recommended by ebay motors. In talking to a few folks about auto shippers, here’s what I learned:

  • Happy Bob drives it: Never NEVER use the services where someone drives it out to you unless you don’t care about the car. They pay some kid/person with a license (hopefully) to just drive your car. One friend had their car totaled when the driver got t-boned just a few blocks from the destination. Another friend said he got his car – and it was full of wrappers, McDonalds bags, and other filth, etc. The guy had probably been sleeping in the car most of the way, and smoked about 10 cigars a day. He never did get the smells/cigar smoke out – not to mention the new ‘mystery stains’. And when he complained, nothing ever came of it. The guys that do this are usually the kind of folks who would have taken Greyhound, but found a way to do the drive and make a bit of cash while doing it. They may not have even had to pass a background screen.
    • Good: super-cheap
    • Bad:
      • You add all the mileage and wear/tear of the trip
      • No tracking – it’ll arrive when they feel like it’ll arrive.
      • Don’t know if the person driving will treat your car with any more respect than a rental – odds aren’t good if they’re doing this for a living…
      • God only knows how/where it’ll be driven and what will happen in your car along the way.
  • Generic car carriers: Most of these car carrier companies will quote you based on mileage because they don’t transport the car themselves. They just call up the pool of truck drivers and find anyone to carry your car. These are the most cost-effective way, but you don’t know who will be carrying it.
    • Good:
      • car is carried – no mileage or wear/tear added
      • Usually fully insured against damage/collision
    • Bad:
      • The guy that transports your car is the one who would take the least amount of money. Nuff said.
      • You have no clue who has got your car at any time – and the carrier usually has no idea where it is since they’re pairing out the work to whomever. One coworker thought they lost his car when it didn’t arrive and no call came 5 days after expected delivery date. (the company just kept saying ‘It’s in transit’). His car showed up weeks late – and no explanation of where it had been.
      • It might be sitting in the parking lot in downtown Detroit all night if that’s where the driver parked it to swap off with another guy.
      • Getting damage claims may be a nightmare, as they’ll need to track down the guy that had the car during the damage – and everyone can circle point or never respond until you give up.
  • DAS or owner/carriers – these guys own the trucks and the distribution centers.
    • Good:
      • no mileage/wear/tear – nobody driving it around.
      • carried by guys with good insurance – and since they had it the whole time – no way to back out.
      • Written inspection before acceptance and sign-off required after delievery.
      • You could pay a bit more for a top-load or even closed sides to avoid road debris (I went top load for $150 more)
      • Cars kept at their distribution centers between hauls – so they aren’t just sitting out somewhere.
      • online tracking
    • Bad:
      • not always the cheapest, but mine was within 10% of regular carrier
      • Seems to take a bit longer – 3-4 weeks estimated for me.
Your lockless future!

Your lockless future!

Queue grainy PSA video: “Here at the Intel Bit labs, we’re working on some exciting new things…”

Sufficed to say, multi-core programming is getting bigger and bigger – and is here to stay for the foreseeable future. We started back in the day with a single monolithic compute engine that people queued up jobs for. In the 60’s and 70’s, those big monolithic servers got many cores/threads – but you still queued up your individual jobs to run on them. Then, in the 80’s – single core computers caught on. Now, in the 2000’s, we bring many cores to the desktop masses. Now nVidia and ATI have graphics cards with hundreds of programmable ‘stream’ processors with massive floating point math support (dot products, 4×4 matrix multiplication, etc). And I’ll wager this is likely to be the direction for the next 10+ years. Gone are the halcyonic days of yore when one could write monolithic code for a single processor. And with multiple cores, comes multiple new challenges.

The first is algorithms and data structures. I just finished writing my first lock-less, thread-safe data structure. Granted, it was a simple lockless stack, but lockless and thread-safe none-the-less and was used to feed jobs to several cores. Seeing it in action is quite impressive. I had multiple producer threads filling it, while multiple consumer threads tried to empty it. Consumer/producer threads could switch back and forth being producers if the job queue emptied out too fast, or switch over and become a consumer if the stack was filling up too fast. All without loss of a single data element, and all without a single semaphore.

If you’re a computer programmer, you owe it to yourself to start thinking and writing in a thread-safe manners from here on out – and learning when you can ply your trade – and where you can’t. I know in my time, parallel algorithms were kind of a ho-hum addition towards the end of your algorithms courses. The 90’s was when all the big super-computer companies were going belly up. A lot of the research had already been done, and the basic take-away was that for some operations, parallel algorithms scale by the number of cores nicely, others stubbornly don’t scale at all. Best crack that old book and get yourself familiar with which ones do/don’t again.

There are two ways to go about thread safety – using the inherent structures of an API/system (SQL or other systems that inherently are built to handle multiple requests in a threadsafe way), or using hardware intrinsics down at the core. You should learn them both. Knowledge of high-level system abstractions is good, but when you find that suddenly your getting the same element twice, or one dissappears, or you get garbage at random intervals – you need to know how it works underneath – in spades.

Debugging parallel algorithms and data structures can be very painful. A very brilliant guy here worked for several weeks on a lock-based queue with memory/node reuse. The bugs were tenacious and very hard to duplicate. Some took a week or better to show up. The simplest change would fix or completely destroy the system. Memory allocation was something of voodoo art (anyone want to become way famous by writing up memory allocation routines for parallel/lock-less algorithms??). You think malloc/free bugs were hard to find before…

At least familiarize yourself with these topics:

  • New atomic hardware instructions – atomic increment/decrement, compare-and-swap, etc.  There are new commands coming out with each new processor – go find out what they are.
  • What new services are provided by my OS/language for synchronization?  I actually have had to use inline assembly for new hw intrinsics because many compilers don’t expose the new commands just yet but certain lock-less data structures and algorithms can’t be written without them.
  • What API’s/OS calls are thread safe at the app level, the thread level, and/or the os level?
  • Learn how to debug a multi-threaded app
  • What algorithms (searching, sorting, counting, etc) parallelize nicely, which do not
  • What kinds of data structures can be lockless? Which can’t?
  • In what novel ways can I combine lower-level atomic operations to build new atomic instructions (such as using atomic INC and CAS to build an n-way CAS)
  • How do I handle allocation/deallocation in a multi-threaded app?

Got more?

April fools

April fools

How’s this for fun. I went in this morning to sign the auto loan for my car. I then arrived at work and told everyone I bought a car. They laughed, and said, “Yeah right – April fools isn’t it?”. But no, I really did buy a car “yeah really – show us”…but I can’t…it’s in Indiana right now…but it’ll be here in a couple weeks… “Oh yeah – suuurrrreeee you did…”

Doh. Nobody believes me. 🙂

Finally

Finally

I finally bought my ‘new’ used car today. It’s back in Indiana at the moment, so it’s getting shipped out this way. Funny enough, it was still considerably cheaper to buy it in Indiana and have it shipped than it was to keep digging around the used market out here in Oregon and Washington. I had a terrible time finding what I wanted out this way – the used market for these cars is pretty small – and the ones I found were pretty run-out. Overall, I saved about $2000 by doing it this way based on craigslist/dealer postings – even after the hefty $700 shipping fee. Was a little tricky getting around sales tax in Indiana (they tightened the reigns); but a few calls to the state department of revenue found the answer. So, it’s a pretty much loaded 2004 Mazda 6 and comes with a 2 year/60k warranty. Here are some pictures of my new friend:

w2189_005.jpg w2189_012.jpg w2189_014.jpg

All factory: moonroof, black leather, v6 (wanted the 4, but oh well), dark grey exterior, bose sound.

It should be arriving towards the end of April.

Vista waking randomly? Try ehSched…

Vista waking randomly? Try ehSched…

This was the LAMEST thing I’ve run into as of yet in Vista. I installed Vista Ultimate on my new E6850 proc + DP35DP motherboard and for the most part it was running as flawlessly as on the E6600 with the 965OT motherboard I had previously (simply swapped mb+proc). The thing I loved most was sleep mode. Sleep in vista rocks when your devices support it – which mine do.  I can sleep and wake from S3 sleep mode for weeks without a reboot. I loved it. But on the new motherboard/proc I was having a colossally annoying problem. Every day around 10am, my machine would turn on by itself from sleep mode. I’d put the machine to sleep at night, then while I was at work it would wake up and I’d come home to it sitting there on. Wasting power is one thing, but if I left my outlook open, it would automatically download my email and gmail would move new messages so I wouldn’t get notifications of new mail at work. Annoying. But what came next was even more annoying.

I file a help request on the Microsoft tech help site and he gave me some good advice on trying to find out what service was starting my machine. I updated the bios, made sure there were no power-on-lan events going in bios/net driver, etc. The event logs list tons of startup events every time the power comes on. Lan drivers get IP addresses, sound cards initialize, about a dozen services kick off – there was almost no way to know what started the chain of events since they would start in different orders each time. You can normally see what turned your machine on by using:

powercfg -lastwake

but when I ran it – it listed NO EVENT as having woke the machine. Nada – zip. It just magically was awake. If I used my mouse/keyboard, it would list that.  So, I tried using

taskschd.msc

And finding all events running at 10am, but you know what – there is NO way to list events by time – you must dig through all the dialogs for each service to find the start times for each event. And then you have the joy of events that run “Every X hours from first run”, or “Runs when event X happens” – so you have little idea when they’ll run next (outside of looking up in the log when they ran last, etc). It was a royal pain.

I finally found some guys here that were having similar trouble and traced it back to Windows Media player and having a TV tuner card installed (which I have one). It turns out the ehSched service will run to get the latest tv channel listings if you set that up in windows media player. Well, the service doesn’t say when it runs – and the event to trigger isn’t listed anywhere I could find it.  My guess is since it’s a service, not a scheduled task. Some folks had this think kicking their PC on at 3am and waking them up. There was no way in Media center of turning off the auto tv program guide getter after you turned in on.  That was annoying – so I figured some registery hacking was in order.  Turns out – it uses a complex formula that must be decyphered to get the wake/service run time. I JOKE YOU NOT. Look at this thing:

Media Center stores the last time the download ran and the next time it will run in the registry.
The 2 entries in the registry that contain these values are respectively:
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionMedia CenterServiceEPGdlLastTime
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionMedia CenterServiceEPGdlRegTime

The value is dllasttime is a6 4f 6c b6 70 dd c4 01, so enter 1c4dd70b66c4fa6 into the calculator. Click decimal and you will get 127470165639843750. At the command prompt run w32tm /ntte 127470165639843750 and you will get:

C:Documents and SettingsUserName>w32tm /ntte 127470165639843
147534 21:56:03.9843750 – 12/8/2004 14:56:03 (local time)

NUTS! Anyway, the guys on the forum wrote up a program to decypher then change the start time – but many found that it would drift after a few days and end up waking you up at 3am again. So, I went in to services.msc and disabled the service. But it didn’t work the first day.  I looked again, and thanks to the new features of vista – there are now retry events associated with your services.

So, to shut this off you must:

1. Start services.msc at the command prompt
2. Scroll down to “Windows Media Center Scheduler Service”
3. Select that service, and in the “General” tab, stop the service, and set the startup type to “disabled”
4. Then, select the “Recovery” tab, and for first, second, and subsequent failures, select “Take No Action”

Now my machine stays asleep all day. Thanks Windows Vista – for making my life easier!