Archive for December 2004

 
 

parsetime update

I’ve just got done with a large refactoring of my time parsing code. I’ve moved all of the routines into a class (currently named Calendar for lack of a better name) and also moved all of the constants into their own class. The idea is that the CalendarConstants class can be derived from for different translations and then passed to the init method of the Calendar class.

I’ve also added an Inc(date, day, month, year) function that takes the given date (or the current day if None) and adds onto it the given days, months and/or years. It adjusts the number of days to handle the different days in each month and also handles leap years.

I really need to find some sample Python code to compare how I’ve done certain class implementation details to make sure I’m not really borking something.

This is the output from the latest testing run – I have to find out why “next wednesday” has started failing :(

True 5 minutes from now
True 5 min from now
True 5m from now
True in 5 minutes
True 5 min
True 5 min before now
True 5 min before next week
True 5 hours from noon
True 5 hours before noon
True in 2 weeks
True 7 days before now
True next day
True next week
True last week
False next wednesday
(2004, 12, 15, 3, 15, 47, 2, 350, 0)
(2004, 12, 14, 3, 15, 48, 1, 349, 0)
True next friday
True Inc(month=4) from Jan 1, 2004
True Inc(month=12) from Jan 1, 2004
True Inc(month=14) from Jan 1, 2004

“parsetime.py”:http://code-bear.com:4200/svn/codebear/timeparse/branches/parsetime.py
“parsetime_consts.py”:http://code-bear.com:4200/svn/codebear/timeparse/branches/parsetime_consts.py

pretty nifty stuff if I do say so myself

hitting a wall

One of the benefits that comes with experience (that sounds so much better than “with age” :) is that you start to realize that when you are banging your head against a wall trying to solve a problem, maybe it’s time to step back and realize why the wall is there. It could be there for a good reason and instead of beating on it, figure out how to either go around or build on top of it.

My recent “wall” was generating an RPM .spec file for Chandler. I kept running into the issue that RPM’s are really designed for system or daemon installations and as such, are supposed to be run silent. Another issue was that the target directory for installation is very limited — basically the valid binary directories that the LSB defines. I was finding solutions to one of the issues but never both — blech!

After chewing on that for a while I remembered something one of my friends always tells me: realize why something is the way it is and then move on. Now that had absolutely no impact on my immediate problem ;) but it did change my mindset just enough to realize that I was trying to solve the wrong problem (or I think I am.)

The problem that I should be solving is how to make Chandler have sane defaults and give the user/admin a way to adjust those defaults if need be. That will mean that the startup routine in Chandler will have to make some decisions based on operating system and user priviledges but that does allow the installation tool to be as simple as possible while still offering some flexibility in where the binaries are installed.

busy busy busy

The holiday season is upon us – bah!

Since the majority of my customers are all in the restaurant business, this is normally one of the busiest times of the year – *everyone* wants to install or update their systems before the big gift rush. It’s also busy because a lot of businesses are preparing for end-of-year fiscal reports and now is the time they start finding out that their old system hasn’t been as good as they thought. So they call us to get them out of the jam :) since we pretty much store a ton of data even if it’s not immediately needed.

It’s also been busy for good reasons: I started working on installation tools for OSAF – wooo! I’ve been trying to find something that I could be helpful with and this is it – a good match I think since install and build tools are one of my specialties.

The end of November also makes me think of the usual age related things (not much mind you as I really don’t walk around worrying about my age) since the 23rd is my birthday – yea me! Now to get out the calculator to find out how old I am :)

anyway, just wanted to make a quick update – now if only I could find that damn document where I’ve been putting the “things I could blog about” list ;)


Creative Commons Attribution-ShareAlike 3.0 United States
This work by Mike Taylor is licensed under a Creative Commons Attribution-ShareAlike 3.0 United States.