2007-04-30

 

Solar Power - a possible solution for SA?


I have just read the interesting article about a new solar plant approved in Canada. Now I'm wondering - if they can do it before 2010, should South Africa not aim for the same strategy? For those who don't know yet - we are struggling with power shortages that really started to show it's ugly head in 2006. I don't think we will ever know the real truth about who's to blame, but to solve the short term problems, it seems there are various options - one being solar.

Unfortunately it is expensive - in financial value at least. The article does mention however that "cheap" energy is relative, as we often exclude the impact to the environment in our cost analysis. So, in the very long term, the solar (and other similar solutions) might prove cheaper.

Now here is my other observations summarized:

Well - I hope somebody takes notice.

For now, I have bought my 6KVA petrol generator as a standby. More people in my area are investing in "backup" generators. If I could get my hands on a diesel generator in the same price region, I would definitely also gone the Biodiesel route - which I also think is a great alternative especially for DYI people like myself. I friend of mine calculated that after paying for the initial equipment (roughly ZAR5500 for a "starter" kit - produces 100l per day), the biodiesel will cost about 1/4 of the price compared to regular diesel. Unfortunately, diesel generators are still more then 10 times as expensive as petrol generators, and they are also more aimed toward industrial use.

Hey - maybe there's a new market here... Wish I had the time to investigate it :)

2007-04-16

 

Eclipse Database Integration

Well, so I have added a bit of database support to my Eclipse installation as well. I opted for Quantum, which in turn has a dependency on GEF.

The only problem was that I could not get Quantum > 3.0.3 working on Eclipse 3.2.2. It does seem however that 3.0.3 works without a hitch. I also needed to use the MySQL JDBC driver, which you can obtain from MySQL.

I now have almost everything I need. What would be interesting for me going forward is to see if I can deploy my projects to a remote server via SSH (scp). I also wonder what build tools would work? Anyway - there seems to be endless possibility on the Eclipse platform, and I am very impressed so far.

 

My initial Eclipse experiences...

The short version: I like it :)

I have not done any real Java development yet, but instead I am now using it for my Perl and Bash scripting requirements.

First of all, I just have to very shortly explain why the switch. I came across the Epic project page a couple of days ago. It was a pure change thing. Anyway, I got interested, and decided to give Eclipse with the Epic plug-in a go. I used the IBM documentation from the site as a guideline for getting going.

Now, I am not yet that good with the editor, and there are still a lot of stuff that freaks me out (like perspectives), but it is growing on me. I especially like what the Epic plug in can do, and I am busy learning how to get Perl code executed on remote systems.

Finally, I also got hold of 'shelled' - a plug in that adds syntax highlighting and other goodies for shell script editing.

So, from today I am officially using Eclipse as my Perl and Shell script editor of choice. There are still a heck of a lot of things about Eclipse I need to learn, like how to use CVS. I suspect all the efforts will be wort it in the end, as the Eclipse platform is a truly cross platform power development environment.

hopefully I can post some updates from time to time here.

Other resources: Eclipse home page

2007-04-08

 

Perl Encryption

I discovered that the Perl Crypt::Blowfish library could only encrypt 8-byte long strings. This is obviously not good in any practical way. So, I experimented, and came up with the following concept program. At the end, it also uses MIME::Base64::URLSafe to make the encrypted string portable - especially for the web.



#!/usr/bin/perl

use strict;

use MIME::Base64::URLSafe; # Used to encode our parameter string
use Crypt::Blowfish; # All our parameters and cookies will be blowfish encrypted


my $crypt_key = pack("H16", "1234567890ABCDEF"); # min. 8 bytes
my $str = $ARGV[0]; # Get out str to encrypt and encode


my $encoded_str = encrypt_long_str( $crypt_key, $str );
print "\n-----------------------------------------------\n$encoded_str\n-----------------------------------------------\n\n";


my $decoded_str = decrypt_long_str( $crypt_key, $encoded_str );
print "\n-----------------------------------------------\n$decoded_str\n-----------------------------------------------\n\n";


exit;

#######################################
#
# S U B S
#
#######################################

sub encrypt_long_str {

my( $key, $str ) = @_;

my $strlen = length( $str );
my $encrypted = "";
my $encoded = "";
my $parts = 0;

my $cipher = new Crypt::Blowfish $key;

# calculate the parts
while( length( $str ) ) {

if( length( $str ) < style="color: rgb(68, 68, 255);">) {

while( length( $str ) < style="color: rgb(68, 68, 255);">) {

$str .= " ";

}

my $raw = $cipher->encrypt( $str );
my $encoded1 = urlsafe_b64encode( $raw );

print STDERR "\tdebug: encrypt_long_str(): encoded_part=$encoded1\n";

$encoded .= $encoded1;

$str = "";
$parts++;

} else {

my $tstr = substr( $str, 0, 8 );
my $raw = $cipher->encrypt( $tstr );
my $encoded1 = urlsafe_b64encode( $raw );

print STDERR "\tdebug: encrypt_long_str(): encoded_part=$encoded1\n";

$encoded .= $encoded1;

$str =~ s/^$tstr//;
$parts++;

}

}

if( $parts < 10 ) { $encoded = "000" . $parts . $encoded; }

elsif( $parts > 9 && $parts < 100 ) { $encoded = "00" . $parts . $encoded; }

elsif( $parts > 99 && $parts < 1000 ) { $encoded = "0" . $parts . $encoded; }

else { $encoded = $parts . $encoded; }

return $encoded;


}

sub decrypt_long_str {

my( $key, $str ) = @_;
my $cipher = new Crypt::Blowfish $key;

my $retval = "";

$str =~ s/^(\d\d\d\d)//;
my $parts = $1;
$parts =~ s/^0+//;

print STDERR "\tdebug: decrypt_long_str(): parts=$parts\n";

my $steps = length( $str ) / $parts;

print STDERR "\tdebug: decrypt_long_str(): steps_length=$steps\n";

for( my $step = 0; $step < $parts; $step++ ) {

my $substr = substr( $str, ( $step * $steps ), $steps );
my $dec = urlsafe_b64decode( $substr );

print STDERR "\tdebug: decrypt_long_str(): substr=$substr\n";

my $dstr = $cipher->decrypt( $dec );

$retval .= $dstr;

print STDERR "\tdebug: decrypt_long_str(): decrypted part $step :: $dstr\n";

}

# Remove any trailing spaces
$retval =~ s/\s+$//;

return $retval;

}


I hope you find it usefull


2007-04-05

 

eBucks going open-source

Johannesburg - eBucks, the rewards programme offered by First National Bank (FNB), is the latest South African business to turn its back on traditional software platforms such as Microsoft in favour of an open-source platform.

SOURCE: News24.co.za

This page is powered by Blogger. Isn't yours?