<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Ralf Schäftlein&#039;s Blog &#187; google</title>
	<atom:link href="http://ralf.schaeftlein.de/tag/google/feed/" rel="self" type="application/rss+xml" />
	<link>http://ralf.schaeftlein.de</link>
	<description>tech stuff, talk,...</description>
	<lastBuildDate>Sat, 27 Mar 2010 11:24:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Spring 3.0 RC 2 and JSR-330 (Dependency Injection for Java)</title>
		<link>http://ralf.schaeftlein.de/2009/11/19/spring-3-0-rc-2-and-jsr-330-dependency-injection-for-java/</link>
		<comments>http://ralf.schaeftlein.de/2009/11/19/spring-3-0-rc-2-and-jsr-330-dependency-injection-for-java/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 18:03:59 +0000</pubDate>
		<dc:creator>ralf</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[guice]]></category>
		<category><![CDATA[spring]]></category>

		<guid isPermaLink="false">http://ralf.schaeftlein.de/?p=159</guid>
		<description><![CDATA[SpringSource has published release candidate 2 of the upcoming 3.0 release of their Spring Framework. New Feature is the compliance with JSR-330 (&#8220;Dependency Injection for Java&#8221;). The JSR was developed together by Google (for their Guice Framework and SpringSource (for their Spring Framework) and is finally approved since 14.10.2009. A little example shows how to [...]]]></description>
			<content:encoded><![CDATA[<p>SpringSource has <a href="http://blog.springsource.com/2009/11/13/spring-framework-3-0-rc2-released/">published</a> release candidate 2 of the upcoming 3.0 release of their Spring Framework. New Feature is the compliance with <a href="http://jcp.org/en/jsr/detail?id=330">JSR-330</a> (&#8220;Dependency Injection for Java&#8221;). The JSR was developed together by Google (for their <a href="http://code.google.com/p/google-guice/">Guice</a> Framework and SpringSource (for their <a href="http://www.springsource.org/documentation">Spring Framework</a>) and is finally approved since 14.10.2009.</p>
<p>A little example shows how to develop services with interfaces and implementations without dependencies to Spring Framework or Google Guice: </p>
<p>
The Maven pom.xml</p>
<pre name="code" class='xml'>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>de.schaeftlein.dev</groupId>
	<artifactId>jsr330-sample</artifactId>
<packaging>jar</packaging>
	<name>jsr330-sample</name>
	<version>0.0.1-SNAPSHOT</version>
	<description>Sample App with Spring 3.0 RC 2 and JSR330</description>
<properties>
		<springVersion>3.0.0.RC2</springVersion>
	</properties>

	<dependencies>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-core</artifactId>
			<version>${springVersion}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-beans</artifactId>
			<version>${springVersion}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-context</artifactId>
			<version>${springVersion}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-asm</artifactId>
			<version>${springVersion}</version>
		</dependency>
		<dependency>
			<groupId>org.springframework</groupId>
			<artifactId>spring-expression</artifactId>
			<version>${springVersion}</version>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.7</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
			<version>1</version>
		</dependency>
	</dependencies>
	<build>
		<finalName>jsr330-sample</finalName>
		<sourceDirectory>src/main/java</sourceDirectory>
		<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>

		<!-- we must exclude the svn folders -->
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<excludes>
					<exclude>**/.svn</exclude>
					<exclude>**/.svn/**</exclude>
					<exclude>**/_svn</exclude>
					<exclude>_svn</exclude>
					<exclude>**/_svn/**</exclude>
				</excludes>
			</resource>
		</resources>
		<testResources>
			<testResource>
				<directory>src/test/resources</directory>
				<excludes>
					<exclude>**/.svn</exclude>
					<exclude>**/.svn/**</exclude>
					<exclude>**/_svn</exclude>
					<exclude>_svn</exclude>
					<exclude>**/_svn/**</exclude>
				</excludes>
			</testResource>
		</testResources>
<plugins>
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.6</source>
					<target>1.6</target>
				</configuration>
			</plugin>
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-eclipse-plugin</artifactId>
				<configuration>
					<downloadJavadocs>true</downloadJavadocs>
					<downloadSources>true</downloadSources>
					<excludes>
						<exclude>_svn</exclude>
						<exclude>.svn</exclude>
					</excludes>
				</configuration>
			</plugin>
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
						</manifest>
					</archive>
				</configuration>
			</plugin>
			<!-- if you build jars a source file will be built as well -->
<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-sources</id>
<phase>verify</phase>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>
</pre>
<p>
a simple encode/decode interface<br />
<P></p>
<pre name="code" class='java'>
package de.schaeftlein.dev.spring;

public interface Encryption
{
  String encode(String value);
  String decode(String value);
}
</pre>
<p>
a simple implementation for Encryption</p>
<p><pre name="code" class='java'>
package de.schaeftlein.dev.spring;

import java.io.UnsupportedEncodingException;
import java.net.URLDecoder;
import java.net.URLEncoder;

import javax.inject.Named;

@Named // service name is the name of the class
public class URLEncoderEncyrption implements Encryption
{

  @Override
  public String decode(String value)
  {
    try
    {
      return URLDecoder.decode(value, "UTF-8");
    }
    catch (UnsupportedEncodingException e)
    {
      return null; // never happen
    }
  }

  @Override
  public String encode(String value)
  {
    try
    {
      return URLEncoder.encode(value, "UTF-8");
    }
    catch (UnsupportedEncodingException e)
    {
      return null; // never happen
    }
  }

}
</pre>
<p>
a more secure implementation for Encryption</p>
<p><pre name="code" class='java'>
package de.schaeftlein.dev.spring;

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import javax.inject.Named;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;

import com.sun.org.apache.xml.internal.security.utils.Base64;

@Named("secure") // named service bean
public class Base64Encyption implements Encryption
{
  private sun.misc.BASE64Encoder base64encoder;
  private SecretKey key;

  public Base64Encyption()
  {
    try
    {
      DESKeySpec keySpec = new DESKeySpec("Your secret Key phrase".getBytes("UTF8"));
      SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
      key = keyFactory.generateSecret(keySpec);
      base64encoder = new BASE64Encoder();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
  }

  @Override
  public String decode(String input)
  {
    try
    {
      Cipher cipher = Cipher.getInstance("DES"); // cipher is not thread safe
      cipher.init(Cipher.DECRYPT_MODE, key);
      byte[] bOut = cipher.doFinal(Base64.decode(input.getBytes("UTF-8")));
      return new String(bOut, "UTF-8");
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    return null;
  }

  @Override
  public String encode(String plainTextPassword)
  {
    try
    {
      byte[] cleartext = plainTextPassword.getBytes("UTF8");

      Cipher cipher = Cipher.getInstance("DES"); // cipher is not thread safe
      cipher.init(Cipher.ENCRYPT_MODE, key);
      return base64encoder.encode(cipher.doFinal(cleartext));
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }
    return null;
  }

}
</pre>
<p>
a small interface for a service</p>
<p><pre name="code" class='java'>
package de.schaeftlein.dev.spring;

public interface SecureUtil
{
  void compareEncryption(String input);
}
</pre>
<p>
a implementation for our service</p>
<p><pre name="code" class='java'>
package de.schaeftlein.dev.spring;

import javax.inject.Inject;
import javax.inject.Named;

@Named("SecureUtil")
public class SecureUtilImpl implements SecureUtil
{
  @Inject // automatically set by DI framework
  @Named("secure") // get the namend bean
  private Encryption secureEncryption;

  @Inject // automatically set by DI framework
  @Named("URLEncoderEncyrption") // get the bean by its classname
  private Encryption unsecureEncryption;

  public void compareEncryption(String input){

    String encodedSecure = secureEncryption.encode(input);
    System.out.println("Secure encoded: "+encodedSecure);
    String encodeUnsecure = unsecureEncryption.encode(input);
    System.out.println("Unsecure encoded: "+encodeUnsecure);
    System.out.println("Secure decoded: "+secureEncryption.decode(encodedSecure));
    System.out.println("Unsecure decoded: "+unsecureEncryption.decode(encodeUnsecure));
  }
}
</pre>
<p>
finally a main class for testing</p>
<p><pre name="code" class='java'>
package de.schaeftlein.dev.spring;

import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main
{

  /**
   * main method
   */
  public static void main(String[] args)
  {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(Main.class.getPackage().getName()); // new way to get Application context without applicationContext.xml available
    SecureUtil util = ctx.getBean("SecureUtil", SecureUtil.class); // get bean with new generics method
    util.compareEncryption("an sample input string 1234567890");
  }

}
</pre>
<p>
output of our Main class</p>
<p><pre name="code" class='java'>
19.11.2009 18:56:03 org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing org.springframework.context.annotation.AnnotationConfigApplicationContext@c1b531: startup date [Thu Nov 19 18:56:03 CET 2009]; root of context hierarchy
19.11.2009 18:56:03 org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor <init>
INFO: JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
19.11.2009 18:56:03 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@a83b8a: defining beans [org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,secure,SecureUtil,URLEncoderEncyrption]; root of factory hierarchy
Secure encoded: QDQvd4uK14YNUQ4uoqhqsZEMDDxUqJAMyisvZr2wsA2GyMC5tSEIiw==
Unsecure encoded: an+sample+input+string+1234567890
Secure decoded: an sample input string 1234567890
Unsecure decoded: an sample input string 1234567890
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ralf.schaeftlein.de/2009/11/19/spring-3-0-rc-2-and-jsr-330-dependency-injection-for-java/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Chrome OS 0.4.237 beta under vmware server 2.x</title>
		<link>http://ralf.schaeftlein.de/2009/11/17/chrome-os-0-4-237-beta-under-vmware-server-2-x/</link>
		<comments>http://ralf.schaeftlein.de/2009/11/17/chrome-os-0-4-237-beta-under-vmware-server-2-x/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 12:12:56 +0000</pubDate>
		<dc:creator>ralf</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[os]]></category>
		<category><![CDATA[chromeos]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[vmware]]></category>

		<guid isPermaLink="false">http://ralf.schaeftlein.de/?p=145</guid>
		<description><![CDATA[A beta version of Chrome OS is available as VMX/VMDK image for vmware or virtualbox and live cd. Chrome OS is a OpenSuSe based operating system around the Google Chrome browser. Steps to test VM image of chrome os beta Download VMDK image Extract tar.gz File to standard folder of vmware Start vmware server Choose [...]]]></description>
			<content:encoded><![CDATA[<p>A beta version of Chrome OS is <a href="http://getchrome.eu/download.php">available</a> as VMX/VMDK image for vmware or virtualbox and live cd. Chrome OS is a OpenSuSe based operating system around the Google <a href="http://www.google.com/chrome">Chrome</a> browser. </p>
<p>Steps to test VM image of chrome os beta</p>
<ol>
<li>Download VMDK image</li>
<li>Extract tar.gz File to standard folder of vmware</li>
<li>Start vmware server</li>
<li>Choose from &#8220;Virtual machine&#8221; menu &#8220;add Virtual machine to inventory&#8221;</li>
<li>Choose VMX file inside extracted image of chrome os</li>
<li>Upgrade Virtual machine to newest &#8220;hardware&#8221; by choosing link on right side from the vm summary page</li>
<li>Remove Network Connection from VM and Add new one with &#8220;Add Hardware&#8221; and type &#8220;Network Adapter&#8221; with &#8220;Nat&#8221; mode</li>
<li>Boot VM and cornfirm warning about IDE geometry and scsi controller</li>
<li>Click on &#8220;Make Goggle chrome default browser&#8221; and confirm dialog</li>
<li>Click on computer button (down left side) and click under status on network connection</li>
<li>Enter root password: <strong>root</strong></li>
<li>confirm warning about network manager with ok</li>
<li>Choose under &#8220;Global Options&#8221; network setup method &#8220;traditional method with ifup&#8221;</li>
<li>Go to &#8220;Overview&#8221; tab and click on &#8220;edit&#8221; button below</li>
<li>click on &#8220;next&#8221; button</li>
<li>go back to &#8220;global options&#8221; and change back to &#8220;user controlled with networkmanager&#8221;</li>
<li>Reboot machine by clicking on computer and shutdown with type reboot</li>
<li>After reboot you can surf with google chrome without any problem</li>
</ol>
<p><img src="http://ralf.schaeftlein.de/wp-content/uploads/2009/11/chrome_os1-300x241.jpg" alt="chrome_os" title="chrome_os" width="300" height="241" class="aligncenter size-medium wp-image-152" /></p>
]]></content:encoded>
			<wfw:commentRss>http://ralf.schaeftlein.de/2009/11/17/chrome-os-0-4-237-beta-under-vmware-server-2-x/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>google that&#8230;</title>
		<link>http://ralf.schaeftlein.de/2008/04/25/google-that/</link>
		<comments>http://ralf.schaeftlein.de/2008/04/25/google-that/#comments</comments>
		<pubDate>Fri, 25 Apr 2008 09:59:38 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[internet]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[hoax]]></category>

		<guid isPermaLink="false">http://ralf.schaeftlein.de/?p=10</guid>
		<description><![CDATA[More often i heard someone saying &#8220;google that&#8221; (or in german &#8220;google das mal&#8230;&#8221;). Not that problem with current smart phones or iphone and a mobile flatrate. Short look with opera mini or opera mobile and the discussion can go on. In the IT world is it more important to know where the details are [...]]]></description>
			<content:encoded><![CDATA[<p>More often i heard someone saying &#8220;google that&#8221; (or in german &#8220;google das mal&#8230;&#8221;). Not that problem with current smart phones or iphone and a mobile flatrate. Short look with opera mini or opera mobile and the discussion can go on. In the IT world is it more important to know where the details are written then to know everything in mind. Everyday start more people surfing the net. You don&#8217;t need a drivers license to start using. Normally i would say it&#8217;s not necessary, but today i get an reason to have such a entry access check.</p>
<p>Hoax are really old and comes mostly in conjunction with chain mails. On the first look it sounds like good behaviour to forward such help requests. Looking deeper shows trojaner, virus, and other crap contained in that email or in links inside.  Not really difficult to determine if a email is a hoax. Just take the subject of the email and google that&#8230; Mostly you get in the first ten hits pages about current hoax floating around. The evil does not sleep so these hoax mails become more professional. You get emails about a cancer case with a complete patient address. These address may exists because the writers took the original hoax, translate them in good native language and insert real people. Not a problem to get such data. Not only head hunter use the net to retrieve private information about real people.</p>
<p>Hoax are spam, not more or less.</p>
<p>To have a PC, a DSL connection and a browser does not mean that you are fully prepared for surfing the net. It&#8217;s like having a drill machine and you want to make a hole for a screw. You can have luck and hit no cable or pipe. But it can happen to hit. As mention in the adverts &#8220;ask someone who knows it&#8221; or google that&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://ralf.schaeftlein.de/2008/04/25/google-that/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
