Friday, September 21, 2007

Moving to Tokyo

If anyone reads my blog, they would have noticed that I haven't posted any good programming tidbits here in a while. The reason is that I've been busy making arrangements for my move to Japan.

Next month (October 16th to be exact), my wife and I are moving to Tokyo where I will start my new job at NTT Communications' headquarters in Hibiya. My last day here at NTT MCL will be October 5th.

I've worked at NTT MCL for over 5 and half years, making it the longest I have ever worked at a single company. I've really enjoyed working at NTT MCL, so I'm a bit sad to leave. Luckily, my job at NTT Communications will entail further development and maintenance of the servers we developed at NTT MCL for the HOTSPOT wireless network, so it looks like I'll keep in regular contact with my current co-workers. By the way, if you find yourself in Tokyo, or just about any major city in Japan, you should purchase a 1-day pass for HOTSPOT. You get wireless Internet access at a huge number of locations for just 500 yen (about 4 dollars). Having worked on HOTSPOT for over 5 years, I was shocked when I discovered T-Mobile charges $10/day for a similar service in the U.S.

Also, I can't stress enough how nice of a place NTT MCL is to work at. There are lots of positions open, the work environment is relaxed and relatively low-stress, and you'll get to work on a variety of different projects. I know I am going to miss working here, but I simply cannot pass up this opportunity to work abroad for a few years. Hopefully, they'll take me back when I return to the U.S.

Monday, September 17, 2007

Sony getting out of Cell production

According to Asahi Shinbun, Sony will be selling their semiconductor production facilities, including those for the production of their Cell processor, to Toshiba for approximately 100 billion yen (~870 million dollars). The sale is expected to happen next spring. There is speculation that Sony does not foresee new applications for their Cell processor and is seeking to reclaim a large amount of their investment capital.

Sony's semiconductor subsidiary, Sony Semiconductor, is selling the LSI (Large Scale Integration) facilities in their Nagasaki Technology Center on the island of Kyushu. Besides being the production facilities for the Cell processor, the plant also makes image processing chips for game devices.

Sony will continue to develop the Cell processor, but they are reconsidering producing the chips themselves. Instead, the will be putting their effort into next generation audio/video devices. In particularly, they intend to put emphasis on the production of CMOS sensors like those used to record images in digital cameras.

Monday, September 3, 2007


I saw this last night on a Japanese TV show. Apparently, a U.S. and Japanese researcher have been working on a little robot called "keepon", experimenting with human interaction. Here is a short movie demonstrating some basic emotive interaction:

The American researcher filmed a demo video of the little robot responding to a song by a L.A. band called "Spoon" and uploaded it to YouTube:

Apparently, the video was so popular that the band caught notice and contacted the researchers about using the robot in one of their official music videos. The Japanese researcher appears in the video with the robot (the video was filmed in Tokyo):

Like probably just about everyone else who has seen the video, I checked to see if I could buy one. You can't.

Update 2007/09/04 1:30am (JST):
As with everything else you can think of, Wikipedia already has an entry about Keepon. Sometimes I wonder why I bother writing anything. You could replace my entire blog with nothing but links to Wikipedia articles. :)

Sunday, September 2, 2007

Python: Reconstructing datetimes from strings

Previously, I posted a small snippet for converting the str() representation of a python timedelta object back to its equivalent object. This time I'm going to address doing the same for datetime objects:

def parseDateTime(s):
"""Create datetime object representing date/time
expressed in a string

Takes a string in the format produced by calling str()
on a python datetime object and returns a datetime
instance that would produce that string.

Acceptable formats are: "YYYY-MM-DD HH:MM:SS.ssssss+HH:MM",
"YYYY-MM-DD HH:MM:SS.ssssss",
Where ssssss represents fractional seconds. The timezone
is optional and may be either positive or negative
hours/minutes east of UTC.
if s is None:
return None
# Split string in the form 2007-06-18 19:39:25.3300-07:00
# into its constituent date/time, microseconds, and
# timezone fields where microseconds and timezone are
# optional.
m = re.match(r'(.*?)(?:\.(\d+))?(([-+]\d{1,2}):(\d{2}))?$',
datestr, fractional, tzname, tzhour, tzmin = m.groups()

# Create tzinfo object representing the timezone
# expressed in the input string. The names we give
# for the timezones are lame: they are just the offset
# from UTC (as it appeared in the input string). We
# handle UTC specially since it is a very common case
# and we know its name.
if tzname is None:
tz = None
tzhour, tzmin = int(tzhour), int(tzmin)
if tzhour == tzmin == 0:
tzname = 'UTC'
tz = FixedOffset(timedelta(hours=tzhour,
minutes=tzmin), tzname)

# Convert the date/time field into a python datetime
# object.
x = datetime.strptime(datestr, "%Y-%m-%d %H:%M:%S")

# Convert the fractional second portion into a count
# of microseconds.
if fractional is None:
fractional = '0'
fracpower = 6 - len(fractional)
fractional = float(fractional) * (10 ** fracpower)

# Return updated datetime object with microseconds and
# timezone information.
return x.replace(microsecond=int(fractional), tzinfo=tz)

Last time Lawrence Oluyede was kind enough to point out that the dateutil module can likely do this and a lot more. However, I'm trying to stick to modules in the base library. Of course, it wouldn't be a bad thing if dateutil were to make it into the base library....

Speaking of which, the snipped above relies on the FixedOffset tzinfo object described in the documentation for the datetime.tzinfo module. Being that the documentation is part of the standard python distribution, I guess you could call that code part of the base library, even if you can't import it. :|

Update 2007/09/03 1:39pm (JST):
Fix example format examples in doc-string per comment from David Goodger.