-
Why oh why? or What was I thinking?
I was profiling some code today and saw a blip when a startup window closes. For some reason that I have yet to explain, I struggled with the code. What I ended up putting in was something like this:
[self performSelectorInBackground:@selector(closeStartupWindowInBackground) withObject:nil];
with closeStartupWindowInBackground defined as:
- (void) closeStartupWindowInBackground { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; [NSThread sleepForTimeInterval:1.5]; [self performSelector:@selector(closeStartupWindow)]; [pool drain]; }
Now, anyone that has done Objective-C for awhile knows that this is utter crap. Why spawn a new thread to simply do something after a delay? The correct way to do this is:
[NSTimer scheduledTimerWithTimeInterval:1.5 target:self selector:@selector(closeStartupWindow) userInfo:nil repeats:NO];
or
[self performSelector:@selector(closeStartupWindow) withObject:nil afterDelay:1.5]
In addition to spawning the thread, the original code closed the window on a background thread. Many parts of AppKit are not thread safe, so doing that could potentially crash.
Does anyone know why I'd do something so stupid as write that original code?
[Update: this gets worse, going back 9 months to my original code before I touched it, I had the performSelector code in there to begin with, but for some reason though that it would block the main thread. Granted it does block the main thread briefly while executing the close method, but that's fine.]
-
I'm a (weather) wimp
I've lived in Southern California for about the last 19 years with a short stint in Portland, OR. Before that I lived outside of Boston and a few other places, so I've had the opportunity to experience various types of weather including cold, rain and snow. The weather in San Diego has been quite chilly lately with day time highs in the upper 50's. The other morning, my neighbors had frost on their lawns (since I no longer have a front lawn and my back lawn is synthetic, I didn't have frost). To me, that is beyond cold.
I can't remember when in my life that I've been so consistently cold! I've heard people say that your blood thins (which obviously isn't the case), but the consistently moderate weather here in San Diego has spoiled me to the point that anything below 65 is getting cold. I'm still trying to run, but if the temperature outside is below about 60, it takes me about half my run to warm up and that just isn't fun. 65-70 is my ideal temperature for running; any colder and I feel like I'm going to get frost bite!
By now, people are probably laughing at me as they're digging out from another snowstorm or scraping ice off of the windshield in order to get to work. A few weeks ago I was in Portland, OR for work and I was wearing a long sleeved shirt, a sweatshirt, a jacket, and then a light rain coat on top of that. My co-workers were just about laughing at me. I decided to suck it up and stop complaining; when one of my co-workers suggested eating lunch outside, I kept my mouth shut and went with the flow. OK, it was quite cold out, but with the sun shining, it wasn't that bad. I'm sure I could get used to the cold again, but why should I?
-
Mmmm, those words are tasty
This past year has brought some big changes to my career and I've written in the past that I didn't want to work for a large company again and that I really enjoyed being self employed. A few weeks ago, my main client, Critical Path Software, was acquired by eBay. As part of the acquisition, I was offered a full time, employee position at eBay. After a little bit of weighing some options, I decided to accept the position. So not only will I no longer be self employed, but I'll be working for a very large company! I still get to work from home, so that's great news.
My attitude has changed a lot since I worked for a large company, so I think that this will be a good move.
A year ago I would never have imagined quitting my job, being happily self-employed and then being happy about accepting a job with a large company!
-
Facebook as a news source
My wife is so addicted to Facebook that I always ask her what is happening in the world after she checks Facebook. She actually does find out stuff on Facebook about the world which I have also learned from more reputable sources. Last night when we were watching the local news, they had a story on the Mountain High Ski Resort where the newscaster said that the Mountain High Facebook page said that people started lining up at 6 a.m. That struck me as odd to use Facebook as a source for a news story. I would have expected them to at least call Mountain High and either get a quote or verify the information, but relying on a post on a Facebook page seems like poor journalism.
Maybe this is what journalism is in the future; get facts from potentially unreliable sources, don't verify them, and then report them. Then the game of telephone starts where the unverified facts get distorted on and on. I think I'm living in the past where I trusted journalists.