Added something else to the programming section. I want to write more about it, but I don’t really feel like it right now. So check it out. If you have ever done categorization with a DB, this should be of interest.
Added a new example to the Programming page. It’s a short, short file that is a pretty decent example of Python Metaclass usage.
I was, at one point, a big fan of the Visual Studio Environment. Yesterday, my appreciation of it was crushed — perhaps permanently.
See, every once in a while, I’ll get the urge to program something. Yesterday, I went to start up a new WPF project in C# Express. I wanted to code myself a little forecast/weather grabber from the NOAA NDFD Forecast Soap Service which I had experimented with before. So I added the service to the project and had Visual C# generate the code, as has been the way for a long time.
Lo’ and behold: it didn’t work.
Turns out that the service didn’t specify an encoding or didn’t encode properly. C# wants everything to be UTF-8 or UTF-16, and dies thusly. It wasn’t dying or throwing a warning about the encoding while generating the code, or even instantiating the service, but only when data was recieved after the method call. Turns out, the way to handle encodings other than UTF-* is so unbelivably complicated that I don’t care to do it, especially when specifying the encoding could easily be an option when generating the code.
So while I’m debugging this project and trying to get it to work, a “Help Update” dialog pops up and prevents me from doing anything. I try to stop the debugger at least, so this update can complete and VS tells me that it’s waiting for the update to complete. Ok… so I wait. And wait…wait and wait and wait… nothing. According to Task Manager, this update is burning up 100% of my cpu, so I get mad and terminate the process. It takes me two or three times of terminating the process before I can actually get it to die and get control of VS back. As I stop the debugger and prepare to close the IDE, the update dialog comes back, continues to burn up my cpu and my patience.
“Something must be messed up,” I think. So I repair the MSDN install. It comes back. I repair C# Express. It comes back. I uninstall MSDN, effectively removing what needed the update (or so I thought), and it COMES BACK! I uninstall C# Express and the problem goes away :)
So I’m done with Visual C# Express for a while and my high opinion of the MS development tools is shattered. It’s a shame too — I had high hopes for XNA.
Oh yeah, my computer at home is kind of shot and I can’t afford to get a new one. So this site will probably go unmaintained for a bit.
I decided to try my hand at writing an RIA using Ajax again. It didn’t take long before I realized stuff wasn’t working or wasn’t going to work and I changed the architecture.
Then changed it again…
…and again…
…and again…
I must be doing something wrong, right? There’s no way it should be this hard in this day and age to write a really simple Ajax-app. Why can’t I wrap my head around the design phase. I get my plan in motion, then I just realize, “Oh that’s not going to work.”
Yesterday, I downloaded the free Adobe Flex SDK to give it a shot.
I must say, it’s very impressive. I felt like I was doing real programming and not just hacks upon hacks. MXML is a bit like XUL, based on my very limited XUL experience.
XUL was another candidate but, running XUL stuff isn’t as easy. There’s no guarantee that my target user will be using Firefox. Nearly everyone has Flash. The downside to Flex is that it’s probably a good deal slower than XUL would be. But that’s ok too — I’m not going for performance here, it’s more about cutting development time.
More to come later…
So today, I had to comment out a bunch of links on a static website. It was only linked from 10 or so pages, so I thought writing a regex to comment out just that link would be too bothersome. I decided to just use VIM. Here’s how easy it was:
<Enter> -- Open the file in WinSCP :41 -- go to the line number of the tag to comment out vat -- select all of the tag <Alt-X> -- Comment out the selection with the EnhancedCommentify plugin ZZ -- save and close <Down-Arrow> -- go to the next file in WinSCP
That’s all. If I had more commands to do, I could record a macro and get everything down to around 6 keystrokes. Can’t beat that.
Qt 4.5 has been released. What’s that you say? Why does it matter?
This is the first release that includes an LGPL licensing option. This means you can use Qt in anything provided you distribute any customizations made to the Qt Libraries. For those uninitiated in the world of cross-platform gui development toolkits — Qt is, in my humble opinion, better than life itself.
I will download it tonight when I get home. While I’m at work today, I will daydream of all the applications I can write and distribute under a BSD license. :)
Hopefully, PyQt will follow suit and also create an LGPL license, even though event handling in PyQt is kinda crummy. Kinda really crummy.
So in a recent project, I had to handle some formatted dates. Piece of cake right? Date handling in PHP is a snap with date() and strtotime(). In fact, I’ve often said that the date functions are the best part of PHP, so I’ll have this knocked out in no time.
Well, maybe not.
I’m handling credit card expiration dates specifically in this case. Usually, the user is given a choice of months and years in a drop-down list. “That’s too annoying,” I thought, “It’s much faster to just type it in and let PHP handle the date formatting.” The expected input format is mm/yy so, of course I proceed with something like this for storage:
date("m/Y", strtotime($ccexpr));
Done and done! Hmm…until I tested it.
Turns out that strtotime() doesn’t like the format mm/yy. So maybe if I enter it as mm/yyyy it’ll be ok. No, not ok there either. “That’s kind of odd,” I thought. So I head to the function’s page to see if there are any user comments on it and I see this:
strtotime returns time() for any string that begins with “eat” (case insensitive)
Hrm? What sense does that make? It could be an abbreviation, but what does EAT stand for? Well, I’m getting off point by now, so I set up some tests to see what I could figure out with strtotime():
strtotime(): 2/8/2010 => 02/2010 2.8.2010 => 08/2010 2010-2-8 => 02/2010 2/8/10 => 02/2010 2.8.10 => 02/2009 10-2-8 => 02/2010 2/10 => 02/2009 2/2010 => false 2010-02 => 02/2010
Weird huh? 2/8/10 gives the correct year, but 2.8.10 doesn’t? 2/10 gives the wrong year (because it’s assuming the date given is 2/10/current_year), but 2/2010 fails? Yet, 2010-02 works. I’m kinda baffled by this, but I’m sure there are some eccentricities to this function since it handles stuff like “tomorrow +20 years.”
So, since I’m asking for a specific format, I decide to switch to strptime(). As with all PHP functions I seldom use, I check to make sure it’s available in the version I’m using. Since 5.1? Ok, whew! Wait…really? This is a pretty basic date function that’s provided in the C run-time. Why did it take so long to get in to PHP? Ok that’s beside the point — but I look a little down the page and see:
Note: This function is not implemented on Windows platforms.
What? Why? It’s like I’m in bizarro world or something. Am I crazy?
Ok — it still doesn’t matter, there are still things here that need to be done, I just can’t test it on my machine at work. No biggie. So I check strftime() to see about the formatting codes. Hmm. Wait a second…again… strftime() has been available since PHP 4? Why it — what — not — both — ? Arghhh!
I must be crazy. I must be. If I’m not, PHP will surely drive me there.