for all mac ruby devloper outside: http://www.macruby.org any opinions about it so far?
Month: March 2009
Wuala and Nexenta…
… just works!
Just download wuala from their homepage.
I just copied the contents of the archive to my NAS, started with ./wualacmd and… thats it.
Imagine: a NAS System with perfekt online mirroring … like a charme ;-).
BTW:
I just changed some folders within the original Nexenta system.
Because i am using a 4GB Flash Drive as my boot drive, but a 2TB Pool as my file Storage, i made some hard-links:
/home/ -> /tank/home
/opt/ -> /tank/opt
where /tank is the mount point of my zfs-pool.
Preparation for counter update
So after a long time i plan to give my counter-engine (^^) an update.
The main Problem is, that the counter itself was perfect for ~2000 counts. But now with 5000 count, the presentation of the results is just not readable anymore.
So i plan the following things to do during the next days (i hope i will finish this during tomorrow):
- using a new drawing method: instead of drawing the whole graph, i will draw just time-slices of a particular periode. So e.g. if you want to plot the current graph with this method, it would be necessary to draw 24 slices with a month periode.
- to get read of lots of code within the counter/presentation script, i want to use the build-in date-calculation functions of mysql.
So e.g.
SELECT something FROM `counts` WHERE DATE_SUB(CURDATE(),INTERVAL 30 DAY) <= date_col; Should be perfect :-). - To use this functions, i have to use the build-in datetime Datatype. At the moment i am storring all counts with a unix timestamp. To make the move, i have to do three steps:
- creating a new field: ALTER TABLE `counts` ADD `created` DATETIME NOT NULL;
- migrate the old dates: UPDATE `counts` SET created = from_unixtime(unixtime);
- finally i had to change to insert statement within the counter script:
“INSERT INTO `counts` ( … user_string, created) VALUES … ‘”.$user_string.”‘, NOW()) “;
More next time…
http://askaninja.com/piratebay…
http://askaninja.com/piratebay great show.
GnuPG Java Wrapper API
Yaniv Yemini wrote a small GnuPG Java Wrapper API.
Just had a small look over it.
So to get it your version from here
Here is just a small demo:
import javax.swing.JOptionPane; import org.gpg.java.GnuPG; public class Loader { public static void main (String args[]){ GnuPG pgp = new GnuPG (); String toolChain[] = {"sign", "clearsign", "signAndEncrypt", "encrypt", "decrypt"}; String message = JOptionPane.showInputDialog(null, "Message you want to encrypt?", "Enter your message", JOptionPane.QUESTION_MESSAGE); String keyID = "0x56B69D6B"; System.out.println("using message: "+message); System.out.println("using key ID: "+keyID); for(String tool : toolChain){ System.out.println("running: "+tool); if(tool.equals("sign")){ String passPhrase = enterPassPhrase(tool); pgp.sign (message, passPhrase); } if(tool.equals("clearsign")){ String passPhrase = enterPassPhrase(tool); pgp.clearSign (message, passPhrase); } if(tool.equals("signAndEncrypt")){ String passPhrase = enterPassPhrase(tool); pgp.signAndEncrypt (message, keyID, passPhrase); } if(tool.equals("encrypt")){ pgp.encrypt (message, keyID); } if(tool.equals("decrypt")){ String passPhrase = enterPassPhrase(tool); pgp.decrypt (message, passPhrase); } System.out.println("result: " + pgp.getGpg_result() + "nn"); System.out.println("error: " + pgp.getGpg_err() + "nn"); System.out.println("exit: " + pgp.getGpg_exitCode() + "nn"); } } public static String enterPassPhrase(String usage){ return JOptionPane.showInputDialog(null, "Please enter the Passphrase of your private Key for "+usage, "Passphrase", JOptionPane.QUESTION_MESSAGE); } }
Unforntunetally there is a Problem with decrypting a message. It is possible to decrypt the String with the gpg CI Version, but within Java it does not work. So maybe the error is on my site :-).
SortedProperties
Angenommen, man braucht für ein Java Property Set ein geordnete Ausgabe – zum Beispiel um einem Übersetzer eine sortierte Liste mit zu übersetzenden String zu liefern.
Man erstellt eine Klasse (zum Beispiel SortedProperties) und lässt diese von Properties erben.
Bedingt durch die Kapselung ist es notwendig, dass die Methoden
private static char toHex(int nibble) ;
private String saveConvert(String theString, boolean escapeSpace);
private static void writeln(BufferedWriter bw, String s);
und Attribute
private static final char[] hexDigit;
in die neue Klasse kopiert werden müssen.
Wir überschreiben die Methode
public synchronized void store(OutputStream out, String comments)
Diese Methode ist für das eigentliche Speichern in eine Datei verantwortlich.
Der neue Inhalt entspricht bist auf eine zusätzliche Sortierung dem alten:
public synchronized void store(OutputStream out, String comments) throws IOException { TreeMap propTree = new TreeMap(); for (Enumeration e = keys(); e.hasMoreElements();) { String key = (String) e.nextElement(); String value = (String) get(key); key = saveConvert(key, true); value = saveConvert(value, false); propTree.put(key, value); } BufferedWriter awriter; awriter = new BufferedWriter(new OutputStreamWriter(out, "8859_1")); if (comments != null) writeln(awriter, "#" + comments); writeln(awriter, "#" + new Date().toString()); Set keys = propTree.keySet(); for (Iterator iterator = keys.iterator(); iterator.hasNext();) { String key = (String) iterator.next(); writeln(awriter, key + "=" + propTree.get(key)); } awriter.flush(); }
Dies ist tatsächlich ein sehr einfacher Weg, um vorhandene Java-Methoden für eigene Zwecke anzupassen.
Nexenta CP 2 RC1 & Java 6
root@sunny:/tank/home# apt-get install sun-java6-jre
root@sunny:/tank/home# java -version
dl failure on line 685Error: failed /usr/lib/jvm/java-6-sun-1.6.0.10/jre/lib/i386/client/libjvm.so, because ld.so.1: java: fatal: libCrun.so.1: open failed: No such file or directory
root@sunny:/tank/home# apt-get install sunwlibc
root@sunny:/tank/home# java -version
java version “1.6.0_10”
Java(TM) SE Runtime Environment (build 1.6.0_10-b33)
Java HotSpot(TM) Client VM (build 11.0-b15, mixed mode)
Good signature, but could not determine key fingerprint?!
root@sunny:/tank/home# apt-get update
Get:1 http://apt.nexenta.org hardy-unstable Release.gpg [185B]
Hit http://apt.nexenta.org hardy-unstable Release
Ign http://apt.nexenta.org hardy-unstable Release
Hit http://apt.nexenta.org hardy-unstable/main Packages
Hit http://apt.nexenta.org hardy-unstable/contrib Packages
Hit http://apt.nexenta.org hardy-unstable/non-free Packages
Hit http://apt.nexenta.org hardy-unstable/main Sources
Hit http://apt.nexenta.org hardy-unstable/contrib Sources
Hit http://apt.nexenta.org hardy-unstable/non-free Sources
Fetched 185B in 1s (151B/s)
Reading package lists… Done
W: GPG error: http://apt.nexenta.org hardy-unstable Release: Internal error: Good signature, but could not determine key fingerprint?!
W: You may want to run apt-get update to correct these problems
root@sunny:/tank/home# apt-get install gnupg add-apt-key
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
gpgv makedev
Suggested packages:
gnupg-doc xloadimage
The following NEW packages will be installed:
gpgv makedev
The following packages will be upgraded:
gnupg add-apt-key
1 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 1957kB of archives.
After this operation, 5050kB of additional disk space will be used.
Do you want to continue [Y/n]? y
WARNING: The following packages cannot be authenticated!
gpgv makedev gnupg
Install these packages without verification [y/N]? y
root@sunny:/tank/home# apt-get update
Hit http://apt.nexenta.org hardy-unstable Release.gpg
Hit http://apt.nexenta.org hardy-unstable Release
Hit http://apt.nexenta.org hardy-unstable/main Packages
Hit http://apt.nexenta.org hardy-unstable/contrib Packages
Hit http://apt.nexenta.org hardy-unstable/non-free Packages
Hit http://apt.nexenta.org hardy-unstable/main Sources
Hit http://apt.nexenta.org hardy-unstable/contrib Sources
Hit http://apt.nexenta.org hardy-unstable/non-free Sources
Reading package lists… Done
XING Group about a Solaris based Home-NAS
I just created a Usergroup for experience exchange using Solaris as a Home-NAS System.
We have currently only a few users, but maybe the number will grow by time.
You can find the group here: https://www.xing.com/net/zfs-nas
“When you innovate, you’ve got…
“When you innovate, you’ve got to be prepared for everyone telling you you’re nuts.”
Larry Ellison via http://tinyurl.com/dzerzs