encode and decode Base64 with scala

März 11, 2011

Download and install scala

start scala console

C:\scala-2.8.1.final\bin>scala
Welcome to Scala version 2.8.1.final (Java HotSpot(TM) Client VM, Java 1.6.0_24).
Type in expressions to have them evaluated.
Type :help for more information.

encode

scala> new sun.misc.BASE64Encoder().encode( "myClearTextPW".getBytes())
res0: java.lang.String = bXlDbGVhclRleHRQVw==

decode

scala> new String(new sun.misc.BASE64Decoder().decodeBuffer("bXlDbGVhclRleHRQVw=="))
res1: java.lang.String = myClearTextPW

HTTP-Basic Authentification

März 22, 2010

The following code-snippet is doing an HTTP-Basic authentification in Java

URLConnection connection = new URL("http://mySite.dt").openConnection();
connection.setRequestProperty("Authorization",
    "Basic "+(new sun.misc.BASE64Encoder().
    encode((user+":"+password).getBytes())));

Windows 7 on Dell Inspiron 8600

Dezember 5, 2009

The first installation result was a little dissapointing, because of two points:

  1. there is only a standard video driver for my ati radeon graphic with a limited support for resolution options
  2. the sounds did not work

Point 2. is working now. I downloaded the old audio-sigmatel-driver from dell-support (for win XP). Cancel the Installation when it is extracted on disk. Go to the device Manager. Select the audio question mark and choose „install driver from disk“ and point to the extracted files.

Systables in Oracle

April 11, 2008

In Informix-Databases they are called Systables, where i get the Meta-Info about tables and columns. In oracle i get this basic infos with the following sqls:

select * from ALL_TABLES where TABLE_NAME = ‘<TABLENAME>‘;
select * from ALL_TAB_COLUMNS where TABLE_NAME = ‘<TABLENAME>

Accessing Excel with Java

Dezember 26, 2006

Excel is Microsoft. Java is not. Nevertheless there are ways to manipulate the XLS-format from Java.

Some Open Source solutions are listed here:

„Handle Excel files“ by Réal Gagnon

I tested two of them:

  1. JXL
  2. POI

Jxl is straightforward and easy to use. POI is for all kind of Mircosoft formats, not only for Excel. IMHO it is a little more tricky to use.

Coding by Convention with Grails

November 13, 2006

Not so long ago the 0.3-Version of grails was released. A good reason for me to check what this coding-by-convention is all about.

An it seem to be all great! The opposite is the application i am working with. And with our app all came up with good intentions for the following reasons:

  • being flexible: The cutomers/users dont have to decide what they want or what they need, we can configure this later…
  • being different: the different companies dont want to adjust their internal workflows and they dont have to. we can configure all the differences

This is becoming more and more configuration with every new implemented feature. In the end your are not a developer any more, your are a configurer. –> Configuration Hell!

Coding-by-convention must be precise. You must exactly know whats best, what you need or how to name something. No more maybies.

Ressources for grails:

My mule impression

Oktober 12, 2006

mule.JPG This week I run into Mule. This is an open source ESB (Enterprise Service Bus) and is all about integration. In one article it is described as a kind of Leatherman of integration tools.

Here the best examples I have found so far:

Another ESB open source implementation is part of the JBoss tool collection. Is a comparison out there?

The unix find command…

September 3, 2006

…beyond the man-pages:

find

  • by text in file’s name
    find . -name "my.file" -print
  • by text in file’s content
    find . -exec grep "4therecord" '{}' \; -print

A detailed explanation and more examples here.

Misc Java Notes

Juli 26, 2006
  • Intelligent WEB-GUI-Components (kind of Ajax):
  • New eclipse version: What’s new in Eclipse 3.2?
  • Java-classpath-configuring in Windows: with the following two Batch-Files it is possible to add all the files of a directory to the classpath. (Copied from here)
    build.bat
    ---------
    set CP=
    
    for %%i in (lib*.jar) do call cp.bat %%i
    cp.bat
    ------
    set CP=%CP%;%1
  • how to let tomcat destroy a session. Two options: in the web.xml-configuration or in ur application.

Free Download of JavaOne Sessions (2005,2006)

Juli 9, 2006

Here you can find all the JavaOne Session of 2005 and 2006. The PPT-PDFs (or maybe star-office slides) are downloadable directly, for the Multimedia-Version you have to register.


Follow

Get every new post delivered to your Inbox.