The second option is to use the zip repair option with the -F or –fix argument. Example:

zip --fix myzipfile.zip --output mybigzipfile.zip

And then you unzip the mybigzipfile.zip file.

If the -F or –fix option doesn’t work, try again with the -FF or –fixfix argument.

]]>http://koenaerts.ca/unzip-multi-part-archives-in-linux/feed/0Oracle 10g XE on Ubuntu/Debian Linuxhttp://koenaerts.ca/oracle-10g-xe-linux/
http://koenaerts.ca/oracle-10g-xe-linux/#commentsWed, 03 Sep 2014 15:08:13 +0000http://koenaerts.ca/?p=702Continue reading →]]>Some time ago, Oracle removed the download links to Oracle 10g Express Edition (XE). If you need to do a new install of the Oracle XE database on your Linux platform, you can download Oracle 11g XE from the Oracle web site. However, Oracle 11g XE is only available for 64 bit architectures. If you are stuck with a 32 bit version of Linux, find out if you can upgrade to a 64 bit version by checking whether or not your workstation architecture (CPU) is 64 bit. If your CPU is 32 bit, then you will have no choice but to install the 32 bit version of Oracle 10g XE.

If you don’t have a copy of the original Oracle 10g XE installer, you will have to find it elsewhere. A deb file can still be found on Oracle’s repository: https://oss.oracle.com/debian/. This will work on Debian and Ubuntu. Another source can be found on the Me and My Ubuntu blog.

A couple of reminders for installing Oracle 10g XE:
– You may need to install the libaio1 package first.
– If your swap is less than 1024MB, you may have to temporarily increase it for the installer to work.
– If you get “ORA-27101: shared memory realm does not exist” when starting or stopping the DB, check your Oracle environment variables.

]]>http://koenaerts.ca/oracle-10g-xe-linux/feed/0Schedule cron Job on First Sunday of the Monthhttp://koenaerts.ca/schedule-cron-first-sunday-of-month/
http://koenaerts.ca/schedule-cron-first-sunday-of-month/#commentsWed, 04 Jun 2014 02:21:27 +0000http://koenaerts.ca/?p=693Continue reading →]]>When you need to schedule a Unix or Linux job in crontab to run on the first Sunday of the month, or any other weekday for that matter, your first instinct may be to write your cron entry to look like this:

0 22 1-7 * 0 /home/user/myscript.sh

However, you will find that the job will be executed every day for the first 7 days of the month, as well as each Sunday thereafter. The following paragraph from the crontab man page explains it all.

The day of a command’s execution can be specified by two fields — day of month, and day of week. If both fields are restricted, the command will be run when either field matches the current time.

By adding a weekday check in the command section of your cron entry, you can create a condition to execute your job if the cron entry is executed on the desired weekday, in this case Sunday:

0 22 1-7 * * [ "$(date '+\%a')" == "Sun" ] && /home/user/myscript.sh

]]>http://koenaerts.ca/schedule-cron-first-sunday-of-month/feed/0Firefox OS – A simple No Nonsense Calculatorhttp://koenaerts.ca/no-nonsense-calculator/
http://koenaerts.ca/no-nonsense-calculator/#commentsFri, 11 Apr 2014 16:43:32 +0000http://koenaerts.ca/?p=685Continue reading →]]>When I received my Geeksphone Keon last year (2013), I searched the Firefox Marketplace for a simple calculator, similar to the Calculator that comes with Windows. At the time I couldn’t find anything I liked so I wrote my own, which I named NNCalc, short for No Nonsense Calculator.

One of the things I noticed with many of the calculators on the Firefox Marketplace was that they were not entirely accurate due to normal floating point rounding issues. One way to find out if a calculator has the rounding problem is by doing a couple of simple multiplications where the rounding issues may become apparent. For instance if 0.2 * 6 = 1.2000000000000002 instead of 1.2, or 1.2 * 6 = 7.199999999999999 instead of 7.2 then obviously the calculator has the rounding error.

]]>http://koenaerts.ca/no-nonsense-calculator/feed/0How to achieve the LIKE IN effect in SQL Serverhttp://koenaerts.ca/like-in-effect-in-sql-server/
http://koenaerts.ca/like-in-effect-in-sql-server/#commentsMon, 20 Jan 2014 14:37:55 +0000http://koenaerts.ca/?p=675Continue reading →]]>SQL Server does not natively support a “LIKE IN” clause. For instance the following example is not valid:

SELECT t.*
FROM MyTable t
WHERE t.Description like in ('%word1%', '%word2%');

Luckily there is a way to achieve this effect.

First imagine that you have a stored procedure or function that searches for a specified word that appears anywhere within a Description column. If you had to search for only one string within the description, your query is simple and would look like this:

If you have to search for the occurrence of ‘apple’ then the variable @MyDescription would have to be set to ‘apple’.

If, instead, you were given a list of strings and you need to find all Descriptions that contain at least one of those words in the list, the above query would not work. The example below shows how the above query needs to be modified in order to achieve this.

If you have to search for the occurrence of at least one of the words in ‘apple,pear,peach’ then the variable @MyDescription would have to be set to ‘apple,pear,peach’. Note the words are comma separated in this example, but you could use any other character as a separator, if needed.

For non-Micro DD-WRT versions the ad blocking hosts file on the router can be updated automatically by a custom shell script that you then execute as a cron job, all on the router itself. However, the Micro editions of DD-WRT are too limited and the only way to update the router’s hosts file is by manually copying it to the router via a telnet session, where you basically copy/paste the entire hosts file contents in the telnet screen. However, after each router reboot you will need to repeat the whole process.

So since you can’t automate this process on the router, it has to be done somewhere else. For instance if you have a Linux/UNIX server on your network, you could write a shell script that downloads the ad blocking hosts file and then uploads it to the router. You can then add this script to a cron job, for instance to run every day at 1am like this:

]]>http://koenaerts.ca/automate_ad_blocking_hosts_file_on_ddwrt_micro_router/feed/0Merge vmdk files in VMWare Playerhttp://koenaerts.ca/merge-vmdk-files-in-vmware-player/
http://koenaerts.ca/merge-vmdk-files-in-vmware-player/#commentsSat, 08 Dec 2012 16:14:26 +0000http://koenaerts.ca/?p=644Continue reading →]]>In order to merge split vmdk files into one, you need to use the vmware-vdiskmanager command. However, this is only available if you have VMware Fusion or VMware Workstation installed. VMware Player doesn’t have this.

Luckily this little utility can be downloaded separately from the VMware site. It is the 1023856-vdiskmanager-windows-7.0.1.exe.zip attachment that you will need.

Once downloaded, extract and rename 1023856-vdiskmanager-windows-7.0.1.exe to vmware-vdiskmanager.exe and copy or move to the directory where VMware Player is installed. For instance C:\Program Files (x86)\VMware\VMware Player

In order to merge vmdk files, open a Command Prompt and CD to the directory where the vmdk files are located. For instance CD \VMWareImages\MyImage

The new vmdk file will then be created:Creating disk 'MyNewImage.vmdk'
Convert: 41% done.

Once done, either rename the original vmdk files or move them to a different directory. Finally rename MyNewImage.vmdk to MyImage.vmdk and you’re all set.

]]>http://koenaerts.ca/merge-vmdk-files-in-vmware-player/feed/4Remove leading zeroes from varcharhttp://koenaerts.ca/remove-leading-zeroes-from-varchar/
http://koenaerts.ca/remove-leading-zeroes-from-varchar/#commentsFri, 30 Nov 2012 16:04:06 +0000http://koenaerts.ca/?p=632The following example shows one way how you can remove leading zeroes from a varchar column in SQL Server:

]]>http://koenaerts.ca/remove-leading-zeroes-from-varchar/feed/0In Progress Dialoghttp://koenaerts.ca/in-progress-dialog/
http://koenaerts.ca/in-progress-dialog/#commentsSat, 27 Oct 2012 04:08:51 +0000http://koenaerts.ca/?p=622Continue reading →]]>The following C# code shows how to make a Progress Bar in a dialog window that can be shown for tasks that run for an undetermined amount of time.

Instead of a regular progress bar that progresses from 0 to 100%, this one shows a little indicator that scrolls back and forth, while in the background the time consuming task does its work. Once the task has completed, the dialog window with the progress bar closes automatically.

The dialog with the progress bar is contained in a class file called WaitDialog.cs, for which the source code is shown further below. Here is an example of how WaitDialog can be used:

One way to handle this is by extending from the grid control and overriding the OnPaint event so that any exceptions can be handled. Of course, the best solution is to try and prevent such exceptions from happening in the first place.