Navigation

Stats

Blogs: 938
Comments: 21944
Screen names: 6922
Podcasts: 23

Archives

Mostly Firefox Users here

Fri - Jul 03, 2009 - 08:39 AM

According to Google Analytics:

56.87% of kennypyatt.com viewers use Firefox!

Here is the breakdown.
56.87% - Firefox
19.3% - Chrome
16.77% - IE

There were also Mozilla, Konqueror, Opera, Opera Mini, Safari, Playstation Portable and Playstation 3.


[Comments (2)] [Post Comment]


Moron Daily News

Tue - Jun 30, 2009 - 06:26 PM

I am now maintaining MoronDailyNews.com. The goal of the site is to waste your time. I don't write every post but I do occasionally put a story up.

There are a few funny ones up there now. Our goal is 4 stories a day. So check often.

[Post Comment]


Python datetime.strptime()

Tue - Jun 30, 2009 - 12:21 PM

If you need to reformat a date string in python from one format to another you can use datetime.strptime() to set a format and then strftime() to convert it into almost anything.

Here is an example from Apache's common log format (CLF)

Apache gives the time as 29/Jun/2009:23:42:50
MySQL wants the time as 2009-06-30 06:19:18


from datetime import datetime
d = datetime.strptime(apache_date, '%d/%b/%Y:%H:%M:%S')
mysql_date = d.strftime('%Y-%m-%d %H:%M:%S')


This makes converting time strings pretty easy. Not sure about the speed of this but I will be shortly since I am using it to parse apache access logs into a mysql database.

[Comments (2)] [Post Comment]


Zero Point Energy

Mon - Jun 29, 2009 - 10:46 PM

If you can stay awake it is awesome

[Post Comment]


Formatting Currency

Tue - Jun 23, 2009 - 07:19 PM

Python and MySQL offer two ways to format currency. I am blogging this more for my memory than to help but hey... you never know.


MySQL


# SELECT FORMAT(money, 2) as money;


Python

# Set it to US Currency
locale.setlocale( locale.LC_ALL, 'en_US' )
money = locale.currency(value, grouping=True)


The grouping=True puts in commas.

[Comments (3)] [Post Comment]


All Material © Copyright 2005 by RogueFalcon. All Rights Reserved.

 π