For a few days now, my Mac has been asking me to give permission to Google Chrome to use the passwords in my Keychain. I couldn’t figure it out until I realised Chrome was updated to 6.0.472.33 (beta, of course). Now it makes sense. Kudos to Google for keeping security in mind.
Posts Tagged ‘software’
Now it all makes sense
Sunday, August 15th, 2010Why not to overthink a problem
Thursday, July 15th, 2010I’ve recently become the proud owner of a 27″ iMac, with the i5 quad core processor and 8GB RAM. It’s faster than stink, and I love it.
Unfortunately, my background does not permit me a full move to Mac OS X, because I have written several applications for Windows, and I must support SQL Server databases for several customers.
So … laziness dictated (it’s a known fact that all software developers are lazy, otherwise they wouldn’t spend so much time trying to do so much with so little code) that instead of installing a brand new virtual machine running Windows XP Professional, I would simply reuse the one from my Windows 7 install (Virtual XP), and do an in-place upgrade using my Action Pack licence to get around the licencing issues.
In other words, I wouldn’t have to reinstall SQL Server and Visual Studio, and copy over all my files and code.
It worked beautifully. Except, for some reason, my virtual machine seemed to be shutting itself down every night around the same time. At first I thought it might be the Windows Activation thing getting confused, because I was doing something unusual.
But, after rerunning the in-place upgrade with an XP SP3-streamed install last night, and reactivating my OS, the machine shut down all by itself tonight at 11:17pm. I know, because last night I checked when it happened, and tonight I made a special note to see if it happened again at the same time.
Sure as bears in woods and Catholic Popes, it was a definite recurring problem. Was the OS infected? I checked. Was the activation a problem? I couldn’t think why it would be, and I reactivated to make sure.
So I went onto Google, my saviour. I call it that because Google has saved my job many times. Tonight, I searched for “XP shutting down same time every day”. The first few pages were garbage, but then … oh yes, then …
“Check if you have any scheduled tasks that might be shutting down your computer” in some or other forum.
*Click* goes the brain, and let me explain why.
I wrote a little application called ShutOff 2000. For the past few years, I’ve been working here and there on its replacement, ShutOff 2010. One of the new features of ShutOff 2010 is its integration into the Windows Task Scheduler for all versions of Windows, from lowly XP up to 2008 R2.
And because I do my best work at night, I had tested it to shut down every night at 11:17pm, just to see if it was saving the scheduled task correctly.
And then I forgot about it.
Until tonight.
Yes, you may laugh at me.
Ok, I lied
Saturday, May 22nd, 2010So I lied. A few other things have happened in the last couple of months.
I’ve released a third beta for ShutOff 2010, and new versions of the Password Generator 2010, Simple Lotto Number Generator 2010, and the ShutOff 20×0 registry cleaner.
Simple HexConverter 2010 is also almost ready for release.
Yes, I sold out with the names of those products. I decided to plug in “2010″ and “Simple” in as many places as possible. No, I will not apologise.
You can find these new products at http://itsol.co.za/.
What else? Ah yes, a complete stranger told me of changes to the WordPress table structure which necessitated changes to the SimplePHPBlogToWordPressConverter (another name I shall not apologise for, despite it being a bugger to type). Since my involvement in said project is now over, I made him a project lead and he committed some code changes. Thanks, Hans! (I think his name is Hans.)
Not much else. Promise!
ShutOff 2010
Friday, January 15th, 2010It’s 2010, and has been for two weeks. I have not made much progress since I last checked in on this. Perhaps I can use some of this weekend to catch up.
The snag I ran into in December, which is holding up the release, relates to a Microsoft DLL change between Windows XP and Vista. This wouldn’t be so much of a problem if the XP version worked in Windows 7. It doesn’t. I don’t know if it’s my fault or Microsoft’s. Yet. (I am big enough to admit if it’s my fault, once I find the problem.)
The funny thing is, I’m *this* close to just open-sourcing the damn project like I was going to do with ShutOff 2000 anyway, unfinished as it is.
Thoughts?
Another Simple PHP Blog converted
Friday, January 15th, 2010Tonight, I completed a second conversion of someone else’s Simple PHP Blog to WordPress.
As regular readers know, I developed a C# Windows app to do this for myself, last year. However it is certainly not production-ready, so two separate websites had to be assisted manually with the conversion. Their common issue is that they were combining more than one Simple PHP Blog directory into a single WordPress instance.
The trickiest part of doing this is the category list, and internal links.
With the category list, as in this recent conversion, the two source directories had the same categories between them, but in a slightly different hierarchy. That means manually merging the generated SQL scripts into one file, renumbering the category IDs in the second dataset, and removing the truncate statements.
With internal links, the problem is simple, but the resolution is awful: a blog will point to earlier posts, but when generating the SQL script, I don’t know what the new IDs will be for those posts, plus the permalinks may be changed at some stage by the blog owner. In other words, I need to know a URL that doesn’t exist yet.
Currently, I find all occurrences of internal site links (manually, using a SELECT … LIKE query), generate the new WordPress blog by executing the generated SQL script, manually update the script with the new IDs by searching for them through WordPress’s built-in search, and then re-running the modified script. I really need to find a better way, because this last blog had nearly 100 internal links, and my search and replace is slow.
How do I fix this in code? Well, I have a pretty good idea, but I think it may be error-prone. Simple PHP Blog creates static files and names them whatever the timestamp is. I use this time stamp in the course of generating the script, but I noticed tonight that sometimes the filename and the modified date don’t match up, especially if you’re not using GMT (UTC) date stamps. So if the timezone is screwy, the filename might be wrong.
If I can crack the timezone problem, I might be able to resolve matching the internal links via their timestamps. While this isn’t perfect (multiple posts with the same timestamp, for example), it’s a start. Then I can guess what the URL will be.
Unfortunately, this means having to assign static IDs in the SQL script, which I’m trying to avoid, but is there a better way?
I’ll look at this when I get a chance. Comments and suggestions are welcome.
Coming soon: ShutOff 2000’s replacement
Sunday, October 4th, 2009Work has been continuing apace on the all-new ShutOff. Featuring a console application at its core, ITS ShutOff is built on the Microsoft .NET framework. My language of choice is, of course, C#.
What I’m really excited about is the modular way it is built. The console application is fully featured, which means that absolutely all functionality is available there. This is vastly different to ShutOff 2000, which is a GUI-only application. It was impossible to build scripts around it.
The new user interface is also a lot more powerful than the one in ShutOff 2000, and all features from the console application are available, if power users do not want to use the command-line switches.
What’s especially exciting is how I’ve overcome the need to have ShutOff running when you want to perform a shutdown. Once I figured that out, the rest was very easy.
And in other good news, some code that originally was lost when I accidentally deleted a snapshot on my development VM, was reconstituted using a copy of the assemblies and the brilliant .NET Reflector.
Here’s an amusing story about the ShutOff 2000 key generator, and I’m comfortable telling it. I wrote the original algorithm in December of 1999, on paper. I used a combination of Caesar-cipher and ASCII to Hex conversion. I was very proud of this algorithm. In fact, as a one-way hashing algorithm, it’s not bad. I’ll publish it here when the new ShutOff comes out (I’m planning on making the VB 6 code open-source).
So there I was, just turned 23, having written a great piece of computer science geekery. I ported the algorithm into VB 6, and lo, it was good.
Core, one of the more notorious “computer security” groups of that period, cracked the key generator pretty quickly. I think it was a matter of days. What was amusing is how their key generator (also written in VB 6) was more user-friendly than the one I cooked up. It actually generated the key on the fly, whereas with my own personal one, I had to click the “Generate” button.
Then it was time for porting to .NET. I decided a long time ago to utilise the features in C# for encryption, so this was for backward compatibility (another place I’m doing this is by moving the app settings from the Windows Registry into a SQLite database file).
So I ported the code, line by line, into C#. My first challenge was that C# doesn’t have the same functions as VB 6, so I had to work around that. This included beauties like Convert.ToChar() and string.Format("{0:X}"). Eventually it was complete, and then I wrote a test to check if it was generating the same registration keys.
.NET (thankfully) is a lot less forgiving with casting integers, and I had a bug in my VB code, where an int loop counter was implicitly casting to a floating point number when multiplying with a character position, and in 1 or 2 characters in the 20-character registration key, the value was different to the C# version.
So here’s the funny bit: I had to replicate the bug in my brand new application to allow for the key generator to create the same strings as the old application, even though it’s wrong.
So that’s the current status. Because the Windows platform has changed so much in the last ten years, I’ve also had to rethink certain features. Some have been dropped, others enhanced, and of course the whole codebase is entirely new.
ShutOff 2000 is a labour of love. I don’t make much money out of it, despite the tens of thousands of downloads over the years. What I get out of it is the chance to play with new technology, revisit old technology, and realise how far I’ve come as a software developer.
What makes ITS ShutOff different, then, is that I’ve had to be more professional in its development. I’ve had to do a feature list, I’ve had to plan my time, and just like other dev shops, I threw away my code and started again several times. I think this incarnation, despite being called version 3.0.0, is actually number ten or eleven.
When it is finally done, I’ll know I’ve achieved something great. Along with NCANE.COM, I’m proud of my achievement. It has proved to me, if no one else, that a simple idea can go places, with no money and weekends to work on them.
Thanks for the use of your eyeballs.
What I’ve learned from my Windows 7 upgrade
Thursday, September 3rd, 2009Vista sucks. I believe that strongly. We’ve just recently got our Enterprise copy of Windows 7 so I started my upgrade yesterday. After the first reboot during installation, I was told I had a missing operating system. Damn, I forgot to decrypt the TrueCrypt system partition!
Did that (back in Vista), restarted installation, and now I’m almost done. Yay!
Windows 7 is what Vista should have been.
On ShutOff 2000 (a.k.a. The Customer Is Always Right)
Tuesday, August 18th, 2009I am a software developer, amongst other things. Software development can be a lonely activity. Sometimes it can be painful. Selling software over the Internet for a few dollars at a time is as potentially rewarding as it can be soul-destroying.
On 30 July 2009, the second person to purchase a licence for ShutOff 2000 this year made his payment over PayPal. As you can probably work out, the registration key business is a manual process, because with two to three purchases a year, I’m not killing myself to automate it with a fancy web service. $10 to $15 a year (less 10% for PayPal) doesn’t warrant the effort.
Not a few minutes after sending the registration key, the customer declared that the software didn’t work. I’ve had ShutOff 2000 for sale in its various incarnations since 1999. My company’s name has changed several times, the bugs have been ironed out, and apart from a stupid hack that limited the product’s life to 31 December 2007, it was rock-solid. After all, it has been on the market for almost 10 years.
I told the customer that he was mistaken, because this is software that has been around since Windows 98 and NT 4.0. It runs on Windows 9x, NT and everything after that (yes, even on Millennium Edition). I’ve been given superb ratings by advert-driven software portals. I’ve had it reviewed in magazines that no longer exist, it’s that old. But in the interest of Doing The Right Thing (TM), I told Bob (for that is his name) to send me a screen shot, and that it was a problem with his regional settings. Yes, I was that arrogant.
Bob sent me a screen shot. He was telling the truth.
I immediately started up my Windows XP virtual machine. You see, I’m running on Windows 7 Ultimate (64-bit) and Visual Basic *does* work, but I wouldn’t advise it.
I then looked for the source code for version 2.8.3, being the last version I’d looked at, in December 2007.
After finding out that Sun’s VirtualBox and my bridged network corrupted the files when I tried to copy them to the VM, I tried zipping the files first.
The reason I’m telling you all of this is to point out how utterly silly I thought Bob was being, and how much effort I was going to, to prove him wrong. Yes, I was that arrogant.
I eventually got Visual Basic to open the project. My idea of version control is copy the folder, replace the path names in certain files, and search and replace the version number in the VB code. No, I’ll never learn.
Then I started rooting around in the code. Keep in mind the version history now: lots of activity between 1999 and 2001. We went from 1.0 to 2.5 in that period. Then over the next SIX YEARS I only managed a couple of point releases and minor bug fixes. I didn’t touch it in 2006. I looked at it once in 2007, and once more in 2008. It’s as though someone else wrote it. Heck, I get upset with my code after a three-week period, so you can imagine how I feel about ten years. Also, I managed to LOSE the source code for 2.8.2, so I literally had to re-engineer the bug fixes that were introduced in that version.
Now it gets interesting. More than eleven months after fixing a date-related bug to do with regional settings in January of 2007, I decided to redo those fixes on 2.8.1 code, plus a couple of new features, to make it 2.8.3. You see, I had hard-coded a time limit into the code to expire ShutOff 2000 from active duty on 31 December 2007. The .NET version was supposed to be out by then. In that 2.8.3 release, I also decided to change the timer to include seconds in the time-based calculations, because it would be more accurate, and computers are faster now.
So I added this new functionality, as well as retro-fitting a bug fix I don’t remember doing in the first place, on code I hadn’t looked at in over two years (2.8.1 to 2.8.3). What could possibly go wrong with refactoring all that Date-related code in Visual Basic 6?
Bob found out.
Bob was upset with me. He had spent $5.00 on a product that didn’t work. So while emailing him updates on 30 July 2009, I released an update, version 2.8.4, which included a tiny bit of code that took seconds into account on a date string. Problem solved! The tests ran successfully. The Timer events were firing correctly, and all was well with the world.
Unfortunately, Bob wasn’t around to confirm my tests, so I updated the website, released the new build, and promptly forgot about it.
Last night, Bob got back from wherever work had taken him. He wrote to say that he couldn’t get it installed, and was being told to pay for the software again. I didn’t understand, so I sent him a 6-point list of how to remove the old version and install the new one.
He wrote back saying “it doesn’t work”. I got annoyed, because he wasn’t being helpful, and I told him as much. He wrote back to ask for his money back. I replied saying his seven day return policy had expired. His terse reply made it clear he wasn’t happy. I told him to take it up with PayPal, and find tech support in the meantime. He lodged a claim on PayPal, and I went to close the call so that it could be escalated. I wasn’t having any of this nonsense.
And then this morning, he wrote back. He told me he had managed to get the new version installed, and that it wasn’t fixed. Now I was convinced he was lying, because I tested it, for goodness sake. To be sure, I downloaded 2.8.4 off the website, like a normal person would, installed it, filled in my registration details, and performed a timed shutdown. It worked. I tried a timed logoff. That also worked. I tried a timed lock workstation. That worked too.
I told Bob that it was working on my side, and something else must be wrong. Then it was home time. I came home tonight, deciding to work on the .NET version. I got a heck of a lot done (truth be told, I’m very close to finishing, but there are rough edges that can hurt you, so it’s not ready). Then Bob wrote to me again and sent me a screen shot.
Bob was having the SAME problem as before. His screen shot clearly shows the real-time clock over a minute past the shutdown timer. Even in worst-case scenario, it will take 30 seconds to shut down. This is because the polling timer checks the clock every ten seconds, and then there’s an extra 20 seconds where the “Are you sure?” message box stays before it goes away if you don’t click anything. But Bob’s screen shot was showing over a minute.
I then decided to fire up the old Windows XP virtual machine again, and take a poke around. I implemented my version control system, changed the version number, folder names and all that, and went in. I figured the only difference between Bob (not working) and my (working) 2.8.4 was the regional settings. I changed my XP’s regional settings to US and got to work.
The first thing I did was to change the way the Date Picker DISPLAYS the date:
> DTPicker.Format = dtpCustom
> DTPicker.CustomFormat = “yyyy/MM/dd”
Now at least it would LOOK the same regardless of what country you’re in.
Then I went to the Timer method to see what that was doing. Don’t laugh.
Old Code (see the & “:00″ at the end I put in to fix 2.8.4?):
> ValDate = Date & ” ” & NewHour & “:” & NewMin & “:00″
New Code (that made Bob happy again):
> ValDate = Format(Date, “yyyy/MM/dd”) & ” ” & NewHour & “:” & NewMin & “:00″
See what I did there? I made it the same. You know, for when you want to compare apples with apples.
Sorry Bob. You were right. I’m glad I didn’t refund you, because I wouldn’t have found this problem otherwise.
The moral of the story: my first instinct on 30 July was to refund him and ignore the problem. Although he put me through a lot of effort (ok, two hours tops), it was worth it. He got his $5.00 worth of software. I fixed two bugs. I had a beta tester who was as in-your-face as me, and we both came out wiser.
I’ve offered Bob a second licence (free of charge) for a friend or colleague. Hopefully he takes me up on it. And as we .NET developers know, the Date format problem is a non-issue now, especially if you store everything as UTC. I am doing that in the new version, I promise!