Showing posts with label Zippy. Show all posts
Showing posts with label Zippy. Show all posts

Monday, September 25, 2023

Clarion Build Events

SoftVelocity Clarion

Often when I am busy on a Clarion project, I notice something I want to fix or change, and dive straight into the code, forgetting to close the application that is still running. This causes a problem when I try to do a new build, because it can't create the new .exe file while the old one is still in use.
Clarion Enterprise Edition (EE) users have an option to deal with this (see update below), but I have the Professional Edition (PE) and the option isn't available. Microsoft SysInternals to the rescue! In particular, their PsKill and PSList utilities. I made a batch file with the following commands:
@echo off
pskill -t project.exe
pskill -t Debug++.exe
pslist > nul
Replace "project.exe" with the name of the actual exe you are working on. Save the file as project-old.bat or something similar. Theoretically, only PsKill would be required, but if the project.exe isn't running, PsKill will return an error message and the build will fail. PsList solves this by listing the running tasks, and doesn't return an error, so the build will continue.
From the menu, choose "Project", then "Project Options", "Build Events" and type in the name of your project-old.bat file.
Wondering what the Post-build event command line is all about? It's explained in the article: "Backing up your Clarion projects".

Update: The EE option is "Tools" -> "Options" -> "IDE" -> "Projects and Solutions" -> "Kill running process before build".

Update Tesday 2 Otcober 2023: I have updated Zippy.exe to be able to automatically launch the DebugView++.exe program, and project-old.bat now includes a line to close DebugView++.exe if it is running. So you get a fresh debug window when you build a new app.



Saturday, April 03, 2021

Backing up your Clarion projects

SoftVelocity Clarion

Whenever you start work on a new project, it's too easy to forget to make backups. Even if you save your work often, what do you do if Clarion crashes, or you break something and need to go back to the previous version of the project? For US$99 DeveloperTeam has a nifty template you can use for automatic backups every time you do a compile. It's pretty automatic once you set it up, but it doesn't back up everything, just the really important bits (app file as txa, dictionary file as dctx) so it is very fast.
Another option is to use Zippy Backup Assist, a free utility I wrote for my Access97 development work after I threw away a whole day's work by mistake. You copy the Zippy.exe program into your project folder, as well as zip.bat, which does most of the work. Then you edit the zip.bat file and assign a name for the project. In this case, the name is "learn" and the project is called "Learning Clarion".
Zippy.exe calls the zip.bat file in the same folder as it is running from, and passes it a parameter, comprising the project name (set this using the ZIPPY= command in zip.bat) plus today's date (and time). It's written in Visual Basic 6, and runs fine in Windows 10 and 11.

Installation

Please download ZippySetup.exe which will also install the command line version of PKZIP called PKZIPC. (My installer and Zippy.exe is not signed. Sorry! But you can upload it to VirusTotal to check for malicious code.) There are two versions of the zip.bat file available:
  • zip-daily.bat, which creates a new file for each day it is run; and
  • zip-hourly.bat, which creates a new file for each (even numbered) hour of the day it is run. Use "Zippy.exe HOURLY" in the command line when you use this file.
Whichever one you choose, rename it to zip.bat, or it won't work. The backup files are stored in a "zip" folder
Update: I discovered that Clarion has installed 7z.exe in the Clarion\bin folder, so instead of using pkzipc.exe you can use 7z instead. I have updated the batch files to reflect this.

Backup with every build

If you want to make a backup after every successful build, then there is an additional step you should take:
From the "Project" menu, select "Project Options..." and go to the "Build Events" tab. Use the Ellipsis button to select the Zippy.exe in the same folder as your project. Make sure the post-build event is set to "On Successful Build" so you don't back up a bad set of data. If you do a lot of builds in a day, then it may be a backup too often. The Developer Team template makes a backup before the build, and it gives each backup a sequential number, so you can work backwards if needed. Or you can do both.

Another Option: Batch file

Carl Barnes told me of his solution: a single batch file that you copy and modify for each project. It uses RoboCopy and PowerShell to do some of the heavy lifting. These are included in Windows, so no extra installation required. He has shared it on GitHub. He offers various options, including a batch file that copies all your stuff to another drive. Worth checking out.
He also includes another batch file contributed by Rich Fulham during a ClarionLive webinar, which uses 7-Zip. So there are plenty of options.

Backup to the Cloud or another PC

Making zip copies of the project is a good way to keep a timeline, but if your hard drive crashes, you don't have a backup. A backup is only a backup if you have two other copies of the file, one on another media like a CD ROM or external hard drive (try SyncTrayzor or FreeFileSync), and one in the cloud or offline storage somewhere. Something like Google Drive, Dropbox, iDrive, Carbonite, etc.



Update Tuesday 2 October 2023: Newer version of Zippy.exe which allows you to kill or run applications using a file called zippy.ini in the same folder as zippy.exe. The file structure is simple. Each program you may want to run starts on a line by itself:
run="C:\Program Files (x86)\DebugView++\DebugView++.exe"
and each program/process to kill is just on a line without anything further:
iexplorer.exe
Use this in conjunction with the Clarion Build Events technique. You can automatically stop and start the debug program when you build your app.

Thursday, March 11, 2010

Backups? Who needs backups?

I make backups. Regularly. I have learnt the hard way, and rescued years of data as a result, in spite of two laptop hard drive failures. I have all my emails going back to 2001. Still, in the last two years I have wasted two weeks of valuable programming time as a result of bad backups. Ten years ago I threw away an entire day's worth of intensive programming by overwriting a file. That's when I developed Zippy. It has saved me from countless disasters simply by creating zip file backups on my hard drive. I also use an external hard drive to archive copies of important files, using SyncToy. And I have purchased Acronis TrueImage Home. But what happens if/when this drive dies or gets stolen? It sits next to my desk so it's not exactly a secure backup. Fortunately I am also a regular listener of the Security Now! podcast. So I started hearing about Carbonite, and after my last fiasco I decided to splash out and spend $54.95 (ZAR 431.77) for Carbonite's backup service for a year. And because I used the offer code in the podcast adverts, my subscription is renewable in May 2011. And If I install it on my wife's machine as well I get 50% off by using a link in the purchase receipt. South African readers will probably drool at the screen shot above. So far I have backed up nearly 6GB of data, with another 7GB to go. For most "broadband" users in South Africa that's double their monthly 3GB cap, and wireless/3G users are lucky to have a 1GB cap. Fortunately I have a bigger cap, and it is possible to manage the backup process better to restrict the size of the backup. If you have an "unlimited" data connection, consider yourself extremely lucky. You have no excuse for not doing backups. Carbonite is simple to install, easy to set up and works quietly in the background. It just gets on with the job, without interfering with normal work. You can pause it or stop it completely for a while, and restrict the hours when the backup runs. I haven't figured out whether it makes incremental backups of my Outlook data files, but I suspect that it does. Now I can sleep better, knowing that my most important files are also backed up automatically "in the cloud".
Update: M-Web has introduced "uncapped" shaped ADSL, so on Saturday I upgraded my R299 5GB account to a cheaper R129 uncapped 384kbps account. Finally SA enters the 21st century. Update 4 April: All the files are now backed up. It took a while but there were some big ones to do, particularly Outlook email archives and database files.

Thursday, June 14, 2007

Zippy gets cleverer

Zippy Backup Assist is a utility that I use regularly to save development work into zip files, where the zip file name includes the date. It also gets used to repair and compact Access databases before making the backup, to keep the zip files small and the Access files manageable. Now I have added another feature: a second parameter that is passed to the zip.bat batch file when Zippy quits. This second parameter contains another date, usually one day behind the first one, but it can be any number of days. The new version includes an Inno Setup-generated setup file, and can optionally install the PkZipC software as well. Update: I have made some more improvements to make a backup copy of any mdb file name ending with the word "data", and the "pause" time is less CPU-intensive. It also has a MSG= keyword, and the PAUSE= function works a bit better. Get version 1.0081.

Sunday, July 16, 2006

Zippy Improved

Zippy Backup Assist is a great way to back up your Access data files and keep them in good shape. I use it to do this and then run DataMover to transfer clinic data to the Men's Clinic head office with DataMover.
It's freeware, and this weekend it got a facelift: a stop button to cancel the process, and a check to make sure it doesn't run a second copy if its already busy. This is particularly helpful when you accidentally get carried away and double-click a bit too much. I also tested it using Access 2000 and Access 2002 files, and it works fine.