October 17, 2009
Non-blocking raw_input for Python
[Edited Aug. 30, 2010 to fix a typo in the function name and generally improve formatting]
I needed a way to allow a raw_input() call to time out. In case it's useful to anyone, I wrote this solution which works under Unix-like OS's.
import signal class AlarmException(Exception): pass def alarmHandler(signum, frame): raise AlarmException def nonBlockingRawInput(prompt='', timeout=20): signal.signal(signal.SIGALRM, alarmHandler) signal.alarm(timeout) try: text = raw_input(prompt) signal.alarm(0) return text except AlarmException: print '\nPrompt timeout. Continuing...' signal.signal(signal.SIGALRM, signal.SIG_IGN) return ''
October 12, 2009
Snow Leopard Guest User data loss bug
I've seen a number of mentions today of a bug that can cause a Snow Leopard user to lose all their data:
One user reports a way to recover the lost data. Since it's buried in a discussion thread, I'm reproducing it here (also fixing a typo pointed out by a reader of this blog):
The problem appears to manifest itself on machines which had the Guest account option enabled under Leopard and were subsequently upgraded to Snow Leopard. Users booting their machines have reported that upon start-up, they have been logged into the Guest account. Upon switching to their regular account, the affected users have been finding all of their user data missing and unrecoverable except from a backup. [MacRumors.]
The files were still in /Users,
recovery was not too difficult.
1) su in terminal
2) mv username username.old
3) create account username
4) mv username username.new
5) mv username.old username
6) chown -R username username
I don't know whether it's a general fix. If you run into the bug and decide to try this solution, feel free to post your experience in the comments section!
September 11, 2009
We've made a substantial upgrade to the look and feel of our Flyfi.com web site. The site does a lot, and this release has been geared toward making the functionality more readily apparent and easier to use.
August 02, 2009
FlyFi Community Playlist
If you're a Facebook user, you might want to check out my company's FlyFi Community Playlist app which lets a Facebook community collaborate on a playlist... but it's more than a playlist because it also provides tracks related to the manually entered ones.
A fair number of the tracks are legally downladable free MP3's, from superb artists like Randy Newman (one of my personal top 5 artists), Ani DiFranco, Suzanne Vega, Dar Williams, and many others.
July 29, 2009
Correction re singletons
The source code link presented at the main post for my singleton mixin classes was bad until now. It pointed to an earlier version that didn't have thread safety or various other improvements. Sorry.
July 28, 2009
Even more singleton improvements
singletonmixin now deals with cases where you want to be able to include args in calls to S.getInstance() even after the initial instantiation.
July 27, 2009
More singleton improvements
Based on internal work and feedback appearing in comments on this blog, I've updated the Python singleton class I posted way back in 2004. That earlier post remains the place to get the code and place any further comments.
It now handles keyword arguments, and is threadsafe for singleton creation.
June 15, 2009
If you've been following developments in Iran, and particularly the Internet's essential role in reporting (and supporting) events, I don't have much to add.
If you haven't, I strongly suggest you go to Andrew Sullivan's blog and starting following him now -- as well taking a bit of time to look through his posts from the last couple of days. He's been doing a wonderful job. Far better than any mainstream news outlet, with the possible exception of the NY Times' Lede. (Although the Lede doesn't present as much detail and analysis as Sullivan does -- with the help of his readers and well-chosen links to other sources.)
One of Sullivan's readers sums up the key role Twitter is coming to play:
Ahmadinejad's and Khamenei's websites were taken down yesterday - I saw the latter go down within a couple of minutes because of a DDOS attack organised via Twitter. @StopAhmadi is a good source for tweets on this. The other important use of Twitter has been distribution of proxy addresses via Twitter. This would be how most video and pictures of today's rally have gotten out.
One amazing thing is that it seems at least conceivable that the protests would not have been as successful as they currently appear to be if Twitter didn't exist.
Sullivan suggests wearing green in support of the protesters. I think that's a great idea.
June 09, 2009
Most people reading this blog will know that I am a founder of the company that makes Flyfi.com (basically a vastly improved reboot of the old Goombah site).
In the last couple of weeks we have added enormously to the site, including improved recommendations. If you haven't checked it out, please do!
Here's a note I wrote to introduce it to some high school friends who I recently reconnected with on Facebook:
Hi Everyone. You may remember me playing my guitar in the hallowed halls of B.H.S. In college I became interested in math & computer technology, and in recent years, I've come full-circle by finally merging my interests. I've co-founded a music-oriented Internet startup. Our product is FlyFi.
Our VP/Industry Relations who, in a former life, earned 10 Grammy nominations as a producer, is now dedicated to using his industry connections for getting us the highest quality free music collection on the Internet. We've got great indie artists like Ani DiFranco, some well-known, others up-and-coming. Unlike some of our competing services you don't just hear the music for free -- you can also download many tracks as free legal MP3's.
My area of focus is our music recommendation technology, which lets you type in artists you like and get music out that you'll probably also like. I love music from many genres, from the Beatles to Beethoven to John Coltrane to Leonard Cohen. But I think there are underlying commonalities in the music I most love, regardless of genre. So we have statistical algorithms that try to find music that has those commonalities for each person's tastes.
Over the last 6 weeks or so, I've been completely wrapped up in putting the finishing touches on the first full release of FlyFi (which is why some of you may have noticed that my Facebook communication flow has dropped pretty much to zero). It's out now, ready for your perusal.
So, if you love music, go check out FlyFi.com!
May 03, 2009
Einstein and this blog
Er, no actual relationship there. But
a) This is one of the most wonderful short articles I have ever read. It's about one journalist's brief but enormously rich encounter with Einstein.
b) My hypothesis in my previous post has turned out to be correct; when I type my name into Google, I am the top hit again.