Monday, 5 November 2012

How to use VBoxManage ?

Here is some examples (assuming the GuestAdditions has already been installed):
---------------------------------------
VBoxManage import Win7Ent32.ova
VBoxManage list vms
VBoxManage showvminfo "Win7Ent32"
VBoxManage startvm "Win7Ent32" --type headless
VBoxManage controlvm "Win7Ent32" poweroff

VBoxManage modifyvm Win7Ent32 --vrde on
VBoxManage modifyvm Win7Ent32 --vrdeport 3389

VBoxManage sharedfolder add "Win7Ent32" --name vboxshared --hostpath /tmp --transient
VBoxManage sharedfolder remove "Win7Ent32" --name vboxshared --transient
VBoxManage export "Win7Ent32" -o Win7Ent32.ova
VBoxManage unregistervm "Win7Ent32" --delete


How to use screen command?


screen is a useful command that allows a process keeping running after you exit/detach from ssh prompt, e.g.
-------------------------
create/enter a new screen: screen
start a process in the screen: lftp -u 'username,password' -e 'set ftp:ssl-force true;set ftp:ssl-protect-data true;get filename;bye' server_ip
detach from the screen: Ctrl-A, d
list current screens: screen -ls
attach to screen 8584.pts-2.dmzsrv: screen -r 8584.pts-2.dmzsrv

Wednesday, 3 October 2012

Thursday, 3 May 2012

How to change keyboard layout for login windows?

on Windows
-------------------------
set HKEY_USERS\.DEFAULT\Keyboard Layout\Preload to
409: US
809: UK

on RHEL
-------------------------
run setup to make the change
then reboot the machine

Wednesday, 11 April 2012

How to install OWB on Win7 (64bit)?

<1> download OWB2.0 from http://www.itdesign.de/en/support-downloads/downloads.html

<2> install JRE1.6 (32bit)

<3> install OWB2.0 using above JRE (Note: it doesn't work with 64bit JRE.)

Saturday, 17 March 2012

How to send scheduled JavaMail from EJB3?

Assuming GlassFish3.1.2 is your server.

<1> add a JavaMail session in the Admin Console with following settings:

JNDI Name: myJavaMailSession
Mail Host: 127.0.0.1
Default User: me
Default Sender Address: me@any.net

<2> create a timer bean with following content:

@Stateless
public class MyBean {

    @Resource(mappedName = "myJavaMailSession")
    private javax.mail.Session session;

    @Schedule(minute = "*", second = "*/10", hour = "*", persistent = false)
    public void myTimer() {
        email("she@any.net", "mySubject", "myText");
    }

    private void email(String recipient, String subject, String text) throws MessagingException {
        MimeMessage message = new MimeMessage(session);
        message.addRecipient(Message.RecipientType.TO, new InternetAddress(recipient));
        message.setSubject(subject);
        message.setText(text);
        Transport.send(message);
    }
}

<3> allow outbound mails as following if you use iptables:

-A OUTPUT -p tcp --dport 25 -j ACCEPT
-A INPUT -p tcp --sport 25 -m state --state ESTABLISHED,RELATED -j ACCEPT

Saturday, 18 February 2012

How to build JTrac from sources?

assuming jdk1.6.0 and Glassfish3.1.1 and NetBeans6.9.1 have been installed and your PC is online.

download JTrac2.1.0 source file jtrac-src-2.1.0.zip and unzip it;

open jtrac project within NetBeans;

delete jtrac project from NetBeans (don't delete it from disk);

re-open jtrac project within NetBeans;

resolve problem (most dependencies jars will be downloaded);

download following unresolved jars from website:
selenium-server-0.9.0.jar
selenium-java-client-driver-0.9.0.jar

manually install above artifscts in 'Test Libraries';

'Add Dependency'commons-logging into 'Libraries';
GroupId=commons-logging
ArtifactId=commons-logging
Version=1.0.3

excuting 'test' target should be fine now.

in the project property, add property 'maven.test.skip=true' to 'Run Project' action;

set GF3 as the server to run;

excuting 'test' target should be fine now.