Sunday, February 23, 2014

Several common used virtual effects to prettify your Ubuntu

First you need to install compiz.
Then open CompizConfig Settings Manager to enjoy your works.

1.Windows Shadow




2.Top Panel Transparency&Launcher Panel Transparency





'Experimental' Tab --> 'Panel Opacity' item. The value is from 0 to 1.
'Experimental' Tab --> 'Launcher Opacity' item. The value is from 0 to 1.

You can get effects:





















3.Menu Transparency&Windows Transparency







On 'Opacity Tab' --> Click 'New' button and add "DropDownMenu", "PopupMenu" and "ToolTip" and adjust corresponding value to an integer below 100,  its range from 0 to 100.


This function is very powerful. You can try clicking plus sign button, add more things for it and explore.
Commons windows transparency are also configured here. It provides several ways to specify which windows are transparent. I used to set windows transparency, but later I removed it. I found that was simply test my eyesight.

4.Title Bar Transparency

Open 'Configuration Editor', find directory '/apps/gwd', edit two keys 'metacity_theme_active_opacity' and 'metacity_theme_shade_opacity'.

 See the title of terminal window


Friday, February 21, 2014

Install compiz on Ubuntu 12.04LTS

Just one line stuff...

~$ sudo apt-get install compiz compizconfig-settings-manager compiz-fusion-plugins-extra compiz-fusion-plugins-main compiz-plugins

Monday, February 10, 2014

How to ssh/sftp/scp a remote server without password prompt?

Without password prompt when you access a remote server, transfer files to or from a remote server or copy files to a remote server is very meaningful to execute some tasks over a shell script between several servers.
Assuming you want A to access B
1. Using ssh-keygen to generate public and private keys

NAME
     ssh-keygen — authentication key generation, management and conversion.

Don't put pass-phrase, just type an enter when it asks you "Enter pass-phrase" otherwise it will still prompt you to key in pass-phrase when it connects.

2. Using ssh-copy-id to install your public key to remote server

NAME
       ssh-copy-id - install your public key in a remote machine's authorized_keys.

Type
~$ ssh-copy-id -i ~/.ssh/id_rsa.pub <username>@<host_ip>

Then test ssh, sftp and scp.



Sunday, February 9, 2014

How to install rpm file on Ubuntu?

A file with extension .rpm is generated by RPM Package Manager or Redhat Package Manager.
How to install this kind of file on your Ubuntu? It need alien's help.

NAME
       alien - Convert or install an alien binary package

SYNOPSIS
        alien [--to-deb] [--to-rpm] [--to-tgz] [--to-slp] [options] file [...]

DESCRIPTION
       alien is a program that converts between Red Hat rpm, Debian deb, Stampede slp, Slackware
       tgz, and Solaris pkg file formats. If you want to use a package from another linux
       distribution than the one you have installed on your system, you can use alien to convert
       it to your preferred package format and install it. It also supports LSB packages.

First check if alien has been installed on your Ubuntu. It need dpkg command (dpkg - package manager for Debian) or Ubuntu Software Center.

I installed once. Have you installed? If not please run
~$sudo apt-get install alien
Now I can start installing my rpm file. For example, sqldeveloper-4.0.0.13.80-1.noarch.rpm

~$sudo alien sqldeveloper-4.0.0.13.80-1.noarch.rpm

It will generate a sqldeveloper_4.0.0.13.80-2_all.deb file. Now you can use command line

~$sudo dpkg -i sqldeveloper_4.0.0.13.80-2_all.deb

or right click it to open with Ubuntu Software Center.



 

Thursday, February 6, 2014

Why it is called bash?

The name bash is an acronym for “Bourne Again SHell”. It is a shell program from the GNU project and was developed by Stephen Richard (SteveBourne. It is an enhanced replacement for sh (Bourne Shell), the original Unix shell program also written by Steve Bourne. The Bourne Shell was the default shell of Unix version 7.

Sunday, November 4, 2012

GWT Project Development Environment - 2. maven + eclipse + tomcat

This is a complete solution about how to set up a practical development environment with maven, eclipse and tomcat.
Before start you need to take some time to check if your system environment meet below system environmental requirements for windows if you use window.

Environmental requirements (Windows):

  • JDK
  • Ant (if you don't want to use ant command to run or build project not required)
  • Maven
  • gwt sdk
  • eclipse with plugins, m2e, maven integration forWTP, google plugin and sysdeo tomcat launcher.
  • Tomcat
  • Add directories of ant, maven and gwt sdk into path environment variable.

1. Create a gwt maven project

1.1 Approaches

There are two effective approaches to create a gwt maven project, by gwt maven plugin and gwt command line. I tried both approaches and chose the latter. Because the pom file generated by the latter is quite reasonable than the former. You don't need to make any change on pom.xml you can import it into eclipse directly without any error.
We need use gwt command line command webAppCreator. Before run this command you need to make sure you have added gwt sdk into your environment variable PATH.

1.2 webAppCreator

Use webAppCreater -help, you can get all the paramters which you can use.

WebAppCreator [-overwrite] [-ignore] [-templates template1,template2,...] [-out dir] [-junit pathToJUnitJar] [-maven] [-noant] moduleName

where
  -overwrite    Overwrite any existing files
  -ignore       Ignore any existing files; do not overwrite
  -templates    Specifies the template(s) to use (comma separeted). Defaults to 'sample,ant,eclipse,readme'
  -out          The directory to write output files into (defaults to current)
  -junit        Specifies the path to your junit.jar (optional)
  -maven        Deprecated. Create a maven2 project structure and pom file (default disabled). Equivalent to specifying 'maven' in the list of templates.
  -noant        Deprecated. Do not create an ant configuration file. Equivalent to not specifying 'ant' in the list of templates.
and
  moduleName  The name of the module to create (e.g. com.example.myapp.MyApp)
-maven parameter is the key for generating gwt maven project.

1.3 Execute command 

Run
webAppCreator -maven com.martian.gwtmavenproject.MainPanel
com.gwtmavenproject.MainPanel is module name of this gwt project.

After execution you can get a standard maven project. There are only src folder, pom file and readme.txt under project root folder.
You may want to change the artifactId and groupId of this project.

2. Import into eclipse as maven project

Without any problem. Nothing can be accountable.

3. Use your own Tomcat in development mode instead of Jetty

3.1 Deploy project to your own Tomcat

Three methods, the latter two also can be applied to other types of application servers:
  • Use sysdeo Tomcat launcher plugin.
  • Use server tool of WTP. Just like a ordinary java web application, but don't forget to add the generated web sources to Deployment Assembly of the project if you want to run at product mode.
In fact, in this way you can use other sorts of web application server, such as some J2EE container.
  • Use an external Tomcat Server directly. If in this way you want to debug the server side code you   have to use remote debug.
The same principle of the two methods. The former may be more convenient when multiple applications share one tomcat server and you can start or stop in eclipse.
Now assume that you have successfully deployed gwt project to your Tomcat server.

3.2 Launch project in development mode

The principle will be used latter references Compile & Debug of gwt application.

a. Right click project in project explorer --> Debug As --> Web Application (running on an external server)



b. Specify external server URL and launch development mode

    You can access your application with http://localhost:8080/gwtmavenproject/. So
Click ok to development mode.

c. Start your Tomcat

If you use sysdeo up Tomcat
you have to change the output console manually in eclipse for seeing them.

d. Enjoy your development time!

It is powerful in that we can debug client-side code.

e. Edit debug configuration

If you still have something to change you can access
Find the configuration just created.
You can change some start arguments like -logLevel, change it from INFO to DEBUG.

Sysdeo Eclipse Tomcat Launcher plugin

It support start and stop tomcat in eclipse and also serve up convenience to change tomcat configure file all in eclipse.

Sysdeo Eclipse Tomcat Launcher plugin

1. Install eclipse plugin by .link

Unzip it and put into your eclipse's plugins folder. Restart your eclipse.
But if you want to manage the plugins installed by yourself clearly you can adopt another way. Link plugin to you eclipse.
Take my own eclipse as an example.

a. Get eclipse install directory: C:\JavaIDE\eclipse-jee-juno

b. Create a folder for sysdeo: C:\JavaIDE\eclipse-plugins\sysdeo\eclipse\plugins

c. Put decompressed result into this folder

d. Create sysdeo.link file

    Content of this file:
     path=C:/JavaIDE/eclipse-plugins/sysdeo  

e. Put .link file into C:\JavaIDE\eclipse-jee-juno\links

f. Launch your eclipse

    Seeing these icons on tool bar proves you have been success.

If you want to remove this plugin just remove corresponding .link file. 
In fact, .link file can contain multiple plugins' path like below
path=C:/JavaIDE/eclipse-plugins/sysdeo path=C:/JavaIDE/eclipse-plugins/plugin2 ......
If you remove plugin instead of removing .link file remove the right line.

2. Set tomcat server

Access eclipse's Window --> References, you can find a new item "Tomcat" in left panel.


There are 5 places to change:
  • Tomcat version, which version is your tomcat?
  • Tomcat home, where is your tomcat installed?
  • Context declaration mode, server.xml or context files? The former means configuration will be stored in <Tomcat home>\conf\server.xml file, but if several applications share this tomcat there may be problem because they share this configuration file.Context files means plugin will create a special context xml for each web project. I choose the latter.
  • Tomcat base, where all tomcat configuration files are saved. This fold need to be created. Its location is without restriction. Usually there is a Servers folder under your eclipse workspace if you alreadt have set certain kind of application server in your eclipse. If you have not it doesn't matter just create a new one. Under Servers folder I created a new folder named Tomcat v7.0 Server for my tomcat 7.0. Then I copied conf folder of my tomcat 7.0 into Tomcat v7.0 Server folder. So now Tomcat base is <workspace_dir>\Servers\Tomcat v7.0 Server.
  • Context directory, where the context files are stored? In the current case context directory should be <workspace>\Servers\Tomcat v7.0 Server\conf\Catalina\localhost.
In order to faster future editing server config you can import the Tomcat base as File System in eclipse. Or just refresh Servers folder in Project Explorer if you put Tomcat base inside it.

3. Set web maven project

I will take a maven project as an example to illustrate.

a. Right click your web project --> Properties --> Tomcat


First figure out a few things:
  • Is a Tomcat Project, of course yes unless you don't want tomcat to launch this project.
  • Context name, what name do you want to use to access this project? If you name it gwtmavenapp latter you can access this project by http://localhost:8080/gwtmavenapp. After you do all the settings you can find a new file named gwtmavenapp.xml under <workspace>\Servers\Tomcat v7.0 Server\conf\Catalina\localhost
  • Subdirectory to set as web application root (optional), set as the directory which holds the build result of a java web application. To a standard maven layout there's a folder named <artifactId>-<version> in target folder after build. In this case this is the web application root.

b. Set it as a Tomcat 

c. Apply and OK

d. Click little pussy