I started this project and this description December 28 of last year. It was completed a few days later yet nothing has happened with either the compiled code nor this posting. Changing jobs soon after and the workload that went along with that move just pushed stuff like this far into the background. Why would I be messing about with my contest log database when I don’t even have the time to actually do a contest? A related post on the N1MM+ reflector today made me pick it up again. It seems the code is 100% functional. However there are some weird things in it and I don’t remember why ☺ ☺
I have a PC in the shack that I use exclusively for logging. It runs only N1MMLogger+ and a browser. And of course the microHAM USB stuff and Elecraft software tools to access the rigs and amp. All other computer jobs and internet access is done with my laptop in the living room. That includes keeping track of logs, TQSL / LotW, eQSL, submitting logs to the contest sponsors, backup logs to my web space etc. This means that after every contest I need to copy my log database from the shack PC to the laptop in the living room. For years since the Win XP era I used a shared folder for this. Even the arrival of a Vista laptop didn’t stop the fun. It took some more studying to get it done with Win7. What homegroup? I don’t need no stinking homegroup putting all my files on display. I just want to expose this particular folder over the LAN! I didn’t bother to search for a solution on the Win7 side in the shack. The folder was already exposed on the Vista machine so it was one way traffic from the shack to the laptop.
This way of doing things causes another problem. Both machines need to run at the same time. After a contest I usually want to go to bed or rest in any other way ASAP. So I shut down the shack. The day after I boot the shack PC, go downstairs to do the log business and just forget that the shack PC is still on. Since I almost never go into the shack and the new PC is rather quiet, I sometimes just forget that this machine is still running. As result of this and to bypass the folder sharing woes I just zipped and mailed my database to myself. That way I could shut down the computer in the shack right away and get hold of the database in the living room or even the day after at work. Sharing the folder on Win7 or Win8.1 probably isn’t hard but I don’t feel like investing time in that right now. It’s not very rewarding to me.
So why not just automate the ZIP and mail process? This is a very simple program to write and one click would zip and mail the file straight into my inbox. I already know how to send mails and attachments. I’m sure ZIPing a file won’t be hard either. And I like writing this dumb little tools.
Google told me that the .Net Framework version 4.5 comes with a ZipArchive class. But it was nowhere to be found in my Visual Studio 2010. Of course: it’s only accessible from VS2012 on. But I didn’t want to upgrade yet. On the other hand, the compressing algorithm that is used by 7-ZIP is much stronger. It reduces the original database to a much smaller file than the compressing method that comes with windows. So I thought of a way to use 7-ZIP in my own program. The use of the DLL seemed the way to go but in the end I opted for the command line interface. That took some trial and error to get it to work. I made a batch file and if you know what a batch file is, you’re probably older than 20. Much trial and more error. It didn’t work. Some old post on some forum gave me a clue. If a file path includes a space, you need to put it between double quotes. The folder called ‘N1MM Logger+’ contains a space. Adding quotes solved the problem. Now it was just a matter of running the batch file from my program which is very easy.
At first I decided not to add a GUI and hardcode all filenames and email addresses. After all it will only run for me on my own machine. If a parameter changes it’s a matter of changing the code and then recompile. But in the end I decided to add a basic interface that allows me to paste the score summary in a textbox and then put it in the email body. That way I can post to 3830 from the office PC at work the day after during my lunch break. I also made a very basic INI file that remembers the last used values. And of course if I provide a way to change the files, I also need to update the batch file. So I added code that writes a new batch file based on the current file before it is executed.
There was still one pitfall. My code launches the batch file and the actual archiving of the database takes a few seconds. However the next line in my code is to send the ZIP file. So I added a waiting loop that exits as soon as the archiving is done. I could have used the FileSystemWatcher but
And this is where the draft of this post abruptly came to an end. Why didn’t I use the FileSystemWatcher class? My guess is that it probably acted too fast or so. That it detected the creating of the ZIP file to be sent before it was actually finished. Oh well, it works and I might as well finally put it on the shack PC and start using it.
2 replies on “Homebrewed software for the lazy ham”
Or you could use the synch feature of one of the cloud storage services like Box or DropBox or iCloud. They even have free options.
Your way was more educational.
Hi Randy
I’m not a fan of clouds. I rather stay in control myself. Yes you can argue that a POP3 or SMTP server is also a cloud.
Educational: yes! I have learned all I know by programming silly little programs. There are a few good sources of information out there, with lots of adaptable examples.
73!