Tag Archives: google

Ubuntu 13.04 on Lenovo Thinkpad X60

Hardware Spec

  • 4GB RAM
  • 120 GB Samsung SSD 830 (AHCI Mode)
  • Dual Core L7500 @ 1.6 Ghz

Used Distro

Ubuntu 13.04 x64 Desktop Edition

Installation

Download the iso file and use unetbootin to install on a usb stick. Leave the stick in the laptop. Reboot. Go into bios by pressing ThinkVantage button and then F1. Choose Startup -> Boot If the usb hdd is excluded then include them with x button and move up with F6. Press F10 to save and exit. Power on the laptop and choose “Install ubuntu” to start installation process.

After installation

recommended additional software (install with “apt-get install <name>”)

  • ntp (for correct date and time)
  • xournal (tablet programm for writing combined with stylus notes)
  • libxss1 (prerequisites for google chrome)
  • lingconf2-4 (prerequisites for google chrome)

Google Chrome

Open Download page and click on chrome download button. Choose “64bit .deb” and click on “accept and install” button

Get rid of anoying shopping hints in unity

apt-get remove unity-lens-shopping

Click on the amazon icon in the unity starter with right click and choose remove from starter

Getting special Hardware to work

Hibernate on closing laptop

Test if it works by running

pm-hibernate

If the laptop suspend to disk and start at the current state after reboot everything is fine to go on.

Edit file /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

[Re-enable hibernate by default]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

Reboot machine and open Energy menu (click on the battery in the top bar and choose energy settings) to define the hibernate state if the laptop cover is closed.

Gnome Buttons on the left side

gsettings set org.gnome.desktop.wm.preferences button-layout ‘:minimize,maximize,close’

Fingerprint Sensor

sudo apt-add-repository ppa:fingerprint/fingerprint-gui && sudo apt-get update

sudo apt-get install libbsapi policykit-1-fingerprint-gui fingerprint-gui

run the fingerprint.gui:

  1. Show Vendor => Choose STMicroelectronics and click next
  2. Choose a finger and click next
  3. Repeat five times to scan and click next
  4. Click on the test button and see if it works

Now you can login or authenticate for sudo with your fingerprint

Source:

 

Spring 3.0 RC 2 and JSR-330 (Dependency Injection for Java)

SpringSource has published release candidate 2 of the upcoming 3.0 release of their Spring Framework. New Feature is the compliance with JSR-330 (“Dependency Injection for Java”). 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 develop services with interfaces and implementations without dependencies to Spring Framework or Google Guice:

The Maven pom.xml


	4.0.0
	de.schaeftlein.dev
	jsr330-sample
	jar
	jsr330-sample
	0.0.1-SNAPSHOT
	Sample App with Spring 3.0 RC 2 and JSR330
	
		3.0.0.RC2
	

	
		
			org.springframework
			spring-core
			${springVersion}
		
		
			org.springframework
			spring-beans
			${springVersion}
		
		
			org.springframework
			spring-context
			${springVersion}
		
		
			org.springframework
			spring-asm
			${springVersion}
		
		
			org.springframework
			spring-expression
			${springVersion}
		
		
			junit
			junit
			4.7
			test
		
		
			javax.inject
			javax.inject
			1
		
	
	
		jsr330-sample
		src/main/java
		${basedir}/src/test/java

		
		
			
				src/main/resources
				
					**/.svn
					**/.svn/**
					**/_svn
					_svn
					**/_svn/**
				
			
		
		
			
				src/test/resources
				
					**/.svn
					**/.svn/**
					**/_svn
					_svn
					**/_svn/**
				
			
		
		
			
				org.apache.maven.plugins
				maven-compiler-plugin
				
					1.6
					1.6
				
			
			
				org.apache.maven.plugins
				maven-eclipse-plugin
				
					true
					true
					
						_svn
						.svn
					
				
			
			
				org.apache.maven.plugins
				maven-jar-plugin
				
					
						
							true
						
					
				
			
			
			
				org.apache.maven.plugins
				maven-source-plugin
				
					
						attach-sources
						verify
						
							jar
						
					
				
			
		
	

a simple encode/decode interface

package de.schaeftlein.dev.spring;

public interface Encryption
{
  String encode(String value);
  String decode(String value);
}

a simple implementation for Encryption

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
    }
  }

}

a more secure implementation for Encryption

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;
  }

}

a small interface for a service

package de.schaeftlein.dev.spring;

public interface SecureUtil
{
  void compareEncryption(String input);
}

a implementation for our service

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));
  }
}

finally a main class for testing

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");
  }

}

output of our Main class

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 
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

Chrome OS 0.4.237 beta under vmware server 2.x

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

  1. Download VMDK image
  2. Extract tar.gz File to standard folder of vmware
  3. Start vmware server
  4. Choose from “Virtual machine” menu “add Virtual machine to inventory”
  5. Choose VMX file inside extracted image of chrome os
  6. Upgrade Virtual machine to newest “hardware” by choosing link on right side from the vm summary page
  7. Remove Network Connection from VM and Add new one with “Add Hardware” and type “Network Adapter” with “Nat” mode
  8. Boot VM and cornfirm warning about IDE geometry and scsi controller
  9. Click on “Make Goggle chrome default browser” and confirm dialog
  10. Click on computer button (down left side) and click under status on network connection
  11. Enter root password: root
  12. confirm warning about network manager with ok
  13. Choose under “Global Options” network setup method “traditional method with ifup”
  14. Go to “Overview” tab and click on “edit” button below
  15. click on “next” button
  16. go back to “global options” and change back to “user controlled with networkmanager”
  17. Reboot machine by clicking on computer and shutdown with type reboot
  18. After reboot you can surf with google chrome without any problem

chrome_os

google that…

More often i heard someone saying “google that” (or in german “google das mal…”). 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’t need a drivers license to start using. Normally i would say it’s not necessary, but today i get an reason to have such a entry access check.

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… 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.

Hoax are spam, not more or less.

To have a PC, a DSL connection and a browser does not mean that you are fully prepared for surfing the net. It’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 “ask someone who knows it” or google that…