Update to quick one-liner Windows unzips

So this one is taken from https://blogs.msdn.microsoft.com/daiken/2007/02/12/compress-files-with-windows-powershell-then-package-a-windows-vista-sidebar-gadget/

echo $zipfilename=$args[0]; $destination=$args[1];if(test-path($zipfilename)) {$shellApplication = new-object -com shell.application;$zipPackage = $shellApplication.NameSpace($zipfilename);$destinationFolder = $shellApplication.NameSpace($destination); $destinationFolder.CopyHere($zipPackage.Items()); };>unzip.ps1

powershell.exe -ExecutionPolicy Bypass -NoLogo -NonInteractive -NoProfile -File unzip.ps1 %FullPathToZip% %FullPathToTarget%

This was tested on PSv2.

Buildforge CRRBF1253I Process for id [] [B] died unexpectedly.

I kept getting Completed — Failed — Died and
CRRBF1253I Build Forge: Process for id [] [B] died unexpectedly.

After checking out http://www.ibm.com/support/docview.wss?uid=swg21634022 and
http://www.ibm.com/support/docview.wss?uid=swg21634022 there was still no solution in sight.

Finally I was able to solve the issue in my buildforge instance by disabling *sticky* in my inline libraries. I was also using .bset server and .bset buildserver. My theory is that some interaction between the sticky and the bset were conflicting.

Build Forge Agent Troubleshooting

Just in case some poor sap like me gets stuck with errors
connecting to Build Forge Agents:

320 AUTH AuthFail[*AuthUnknownUser,"username"]
CRRBF0158I: Unable to set user account to unknown account (builder)
at com.ibm.jas.mjc.server.refresh.AgentServerTestFiber.checkAuth(AgentServerTestFiber.java:431)

Some fixes..

sudo cp /etc/pam.d/login /etc/pam.d/bfagent
sudo /usr/local/bin/bfagent -s

Scrabble Problem

If I give you scrabble tiles and a dictionary, determine the valid words
from your collection of tiles.

package joshho;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.Arrays;
public class Runner {
	ScrabbleSet set ;
	private class ScrabbleSet {
		char[] chars;
		public ScrabbleSet(String[] orig){
			chars = new char[orig.length];
			for(int i=0;i<orig.length;i++) 
				chars[i] = orig[i].charAt(0);
		public boolean checkWord(char[] find){
			if(find.length > chars.length) return false;
			int s=0;
			for(int i=0;i<find.length;i++){
				for(int j=s;j<chars.length;j++){
					if(find[i] > chars[j]) continue;
					if(find[i] == chars[j]){
					return false;
			return true;
	public void load(String y){
		set = new ScrabbleSet(y.split(" "));
	public static void main(String[] args) throws IOException {
		args = new String[]{"Scrabble\\data\\english4000.dic",
				"g w x b d u t z q m o i e p o"};
		FileReader fr =  new FileReader(args[0]);
		BufferedReader br = new BufferedReader(fr);
		Runner r = new Runner();
		String line;
		while((line = br.readLine()) != null) {
			System.out.print(line+" ");

There’s probably a better way to do this, I am interested
to see what other solutions there are.

Zip with ANT on Windows command line

Short two liner for ANT zipping on Windows.


>build.xml echo ^<project^>^<zip destfile=^"zipFile.zip^" basedir=^"toBeZipped^" /^>^</project^>

Because Windows doesn’t apparently have a zip command line.

Updated here for Windows without ANT.

Working with genrb and ICU4J

Wanting to use the messages in ICU4J, I was lead to believe one needed to run the command:

genrb root.txt

This produces root.res.
However using the following snippet results in the error message below:

UResourceBundle urb = UResourceBundle.getBundleInstance("Your package path","root");

>Data file yourPackagePath/root.res is corrupt - ICU data file error: Header authentication failed, please check if you have a valid ICU data file

Continued reading >

Cookie cannot be resolved to a type

“Cookie cannot be resolved to a type”

I swear I’ve seen this error like 5 times in eclipse now, and I have yet to learn my lesson.
If this error originates from a jsp file, your project doesn’t have a valid target webserver (in my case – tomcat).

So just make sure it’s configured correctly.

Thought I’d just leave this here,
because almost all top searches in google were useless to me.


Bash Pitfalls

I was on IRC.. and noticed this link.. http://mywiki.wooledge.org/BashPitfalls,
if I had only known earlier…

Tons of useful information on Bash Pitfalls… as well as tons of habits to change… :/

My error was specifically #22,
cmd1 && cmd2 || cmd3 where I had assumed cmd2 is going to exit 0.

In most of my usecases… my command is in the form of cmd1 || sleep # && cmd3, I just naturally assume sleep is going to return 0.

Well, luckily for me, it has worked for the most part… but definitely need to change a number of my scripting habits…

Been a little busy…

With my new job, I haven’t had much time to add much to this website.

So here’s this small perl script I wrote that sends a summary of the weather in SMS format from my iPhone daily.
There was a need, so I figured why not help out those who need the weather forecast =].

use LWP::Simple;
use JSON qw( decode_json );
my $lastRun = 0;
open (MYFILE, 'weatherSMS_LastRun');
while (<MYFILE>) {
        $lastRun = $_;
close (MYFILE);
my ($S,$M,$H,$d,$m,$Y) = localtime($lastRun);
my ($S2,$M2,$H2,$d2,$m2,$Y2) = localtime(time);
if ( $Y2 == $Y && $m2 == $m  && $d2 == $d ){
	exit 0;
$json = get("https://api.forecast.io/forecast/APIKEY/LATITUDE,LONGITUDE?units=ca&exclude=currently,minutely,hourly,flags");
my $decoded = decode_json($json);
#ensure we can write the file
open(F,'>weatherSMS_LastRun') || die "Could not open file to mark execution";
print F time;
my @timeslot = @{ $decoded->{'daily'}{'data'} };
my $forcast = "";
foreach my $f ( @timeslot ) {
	my ($S,$M,$H,$d,$m,$Y) = localtime($f->{"time"});
	$m = $m + 1;
	$forcast .= "$m/$d: ".sprintf("%.3f",$f->{"temperatureMin"})."-".sprintf("%.3f",$f->{"temperatureMax"})."C ".$f->{"summary"}."\n";
`/Applications/biteSMS.app/biteSMS -send -carrier PHONENUMBER "$forcast"`;

In order to execute this daily, the following plist was used:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
		<string>/location to perlscript/weatherSMS.pl</string>

Submit it to be executed hourly by running `launchctl load [path to plist]`

Edits were made to cover the fact that your phone may not always have internet.
(It may be locked/sleeping – which may turn off the wifi?)

Website Maintenance (done)

With the change of my webhost, all my php scripts were moved up from 5.2 to a newer version.

Who knew PHP introduced a ton of changes that practically broke a large number of my apps.
Absolutely ridiculous, but nevertheless, an experience.

I would say all but One app is working just fine.
The app in question works 99% of the time fortunately.

Oh the woes of maintenance of program code.
Wouldn’t it be nice to write it once, and never having to look at it again?

Continued reading >