Sunday, May 11, 2008

Upgrade to spring 2.5.4

This weekend I am upgrading my pet project to use spring 2.5.4. During the same time I am also get rid of the spring.jar and try to use the separated packages. it takes sometime to figure out the new package layout. Lucky I finally googled and looks like Eric did some good job outlined the packages and jar files here: http://erics-notes.blogspot.com/2007_12_01_archive.html. Thanks.

Saturday, March 8, 2008

Port 25 blocked on dynmic ip from ATT/SBC

I installed linux sendmail at home and find it is not working. but it works on my another location with static IPs. so i do not know what is going on and thought must be some configuration. got nowhere after consulting friends and played with Postfix. after some googling I find that this is due to the blocking of ISp on the port 25. I am not sure how to solve this. I need to talk to the ISP tomorrow to see if they can unblock this.

Friday, February 15, 2008

Mounting a new hardsikd to linux

Last night I mounted a new disk to the Ubuntu system I am using and here were the steps:
  • using fdisk -l to find out the list of hard drives installed on you computer. then you should get something like the following:
Disk /dev/sda: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000080

Device Boot Start End Blocks Id System
/dev/sda1 * 1 29637 238059171 83 Linux
/dev/sda2 29638 30394 6080602+ 5 Extended
/dev/sda5 29638 30394 6080571 82 Linux swap / Solaris

Disk /dev/sdb: 250.0 GB, 250000000000 bytes
255 heads, 63 sectors/track, 30394 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000081

Device Boot Start End Blocks Id System
Apparently, the /dev/sdb is not mounted and also not formated.
  • if your hard disk is not formated, you need an extra formating step, I usually just do:
mkfs.ext3 /dev/sdb
  • Create a mount point. I usually load the 2nd driver as the data drive and this command will work
mkdir /data
chmod 777 /data
  • If you want to mount your drive right away( this will not mounted automatically every time you reboot )

mount /dev/sdb /data

  • if you want to mount automatically, you need to add an entry in the /etc/fstab file.
/dev/sdb /data ext3 defaults 0 0
To mount the usb external drive you need to use this:

mount -t vfat /dev/sdc1 /backup
Please note you need to specify the type here as fat. for auto mounting, add this to /etc/fstab
/dev/sdc1 /backup vfat auto,users,rw,umask=0 0 0

Pretty simple!


Tuesday, February 12, 2008

Useful apt-* commands

apt-cache for searching
apt-cache search keyword
will give you a list of all packages contain the keyword.
apt-cache show package_name
will give you a lot detail about the package
apt-cache depends package_name
will give you what packages it depends on.


Tips on removing the annoying Ubuntu cdrom needed action in apt-get

When you install any new packages using apt-get, some of the packages will be considered as "Media changes" and need you to put the OS CD into the physical machine. like this
Get:1 http://us.archive.ubuntu.com gutsy/universe python-genshi 0.4.3-1 [271kB]
Media change: please insert the disc labeled
'Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)'
in the drive '/cdrom/' and press enter


What if you are unable to do this? or tired of running from room to room? there is a little change to do to save the labor.

Just comment out the line referring cdrom in /etc/apt/sources.list. In my system this is the line you need to be commented out.
deb cdrom:[Ubuntu-Server 7.10 _Gutsy Gibbon_ - Release i386 (20071016)]/ gutsy main restricted


There is a complete doc on the apt-* commands in
http://www.debian.org/doc/manuals/apt-howto/index.en.html
and will find it useful on and off.

Monday, February 11, 2008

tips on configuring MySql

It was pretty a turn-key to install and run MySQL on Ubuntu. but there are several tricks you might need to know:

1) if you want to access the database from you localhost, you definitely need to grant privileges to the specified user @localhost. otherwise, mysql will always check anonymous user at locahost and most likely you will be returned with "cannot access"
2) when you are in a remote machine and you have no connection to mysql. try to use ''telnet sqlhost 3306". if this fails. the mysql server might be deny all access since the default is binding to localhost (127.0.0.1) only, this means it will only accept connections from localhost applications to avoid security hits.
To change that, edit /etc/mysql/my.cnf and comment out the line bind-address = 127.0.0.1:
and restart the mysql server with:
/etc/init.d/mysql restart

Saturday, February 9, 2008

Idea 6.0.6 and Idea-spring

I installed the idea-spring package last week and today I found out that my IDEA does not work anymore, The error message is that "License is not valid" and stop right after that. since I do not believe the License is an issue here, I did a browsing of the idea log file and found out screams of the common logging classes. so I went to newly installed plugin directories and deleted the idea-spring since I saw the old version of comm-logging was there.

After this deletion, everyhting back to normal now.

Looks like this plugin needs to be updated.

Also I was thinkingof upgrading Idea to 7.0.x and after reading this blog. I am hesitating now. It says:
IDEA is pretty much a yearly subscription service.

Setup hylafax server on Ubuntu

I am starting to setup the fax server on my new Dell system with OS Ubuntu 7.10. this is not very smooth so I am trying to document what I did here.

The sites I found most useful are:

Pre-requisites
apt-get install hylafax-server hylafax-client cu setserial sendmail wvdial

please make sure that you have the OS cd/dvd avaialable since this is considered as media change.

Following commands might be useful for you:

find the serial port that modem is installed:
dmesg | grep tty
in this case I assume the modem is on ttyS0.

You might need to manually set the serial like this
setserial /dev/ttyS0 irq 4 port 0xc800 uart 16550


if setserial /dev/ttyS? is not working please see the dmesg for the parameters.

or you might find that lspci command useful to find all the pci installed.
Test your modem:
echo atdt3333333 > /dev/ttyS0

if you hear signal you should use the following command to stop it.
echo ath > /dev/ttyS0
Please be aware that if you setup is not finished correctly, the lock file in /var/lock/LCK..ttyS0
is not removed, you might need to manually remove it to be able to move forward for another setup.

Run faxsetup and following the above site #2 for line by line instructions.

if you run faxstat and get the following
Can not reach server at host "localhost", port 4559.

than the fax server is not started, you should run something like this:
/etc/init.d/hylafax start


Saturday, January 26, 2008

Hibernate Bugs

When I was working with my pet project using hibernate JPA (core 3.2.5 GA) and found that a bug in the following function

public void validateColumns(Dialect dialect, Mapping mapping, TableMetadata tableInfo) {
Iterator iter = getColumnIterator();
while ( iter.hasNext() ) {
Column col = (Column) iter.next();

ColumnMetadata columnInfo = tableInfo.getColumnMetadata( col.getName() );

if ( columnInfo == null ) {
throw new HibernateException( "Missing column: " + col.getName() + " in " + Table.qualify( tableInfo.getCatalog(), tableInfo.getSchema(), tableInfo.getName()));
}
else {
final boolean typesMatch = col.getSqlType( dialect, mapping )
.startsWith( columnInfo.getTypeName().toLowerCase() )
|| columnInfo.getTypeCode() == col.getSqlTypeCode( mapping );
if ( !typesMatch ) {
throw new HibernateException(
"Wrong column type: " + col.getName() +
", expected: " + col.getSqlType( dialect, mapping )
);
}
}
}

}
Basicallly, when you use columnDefinition you have to use the lowercase, as following:
@Column(name = "xxxx", columnDefinition = "text", nullable = false)


and this won't work
@Column(name = "request_url", columnDefinition = "TEXT", nullable = false)
The bug is in the red line that one part converted to lowercase, not another.

Just to be clkear, I have tried to post this on the hibernate forum but cannot register since I got all the code errors and timed out. so I gave up.

Monday, January 21, 2008

Opensource GWT sites

Infoq has listed some of the open source gwt extensions and application in http://www.infoq.com/news/2008/01/gwt-frameworks. Some of them I have played with. Good to know if you are using GWT.

Some usefule Flex links

Here lists some of the sites that I go once for a while:

Saturday, January 19, 2008

Upgrade to Spring-security 2.0.m1

Last night I upgraded my pet project ot using the latest milestone of Spring-security. This is smoothier than I thought. I only need to make two global changes to make it work.
  • change all aceigsecurity to springframework.security in all java/xml/properties files;
  • change all ACEGI_SECURITY to SPRING_SECURITY in all these constants you possibly used.
After that, it is working again. the next step would be to simplify the xml configuration and use new feature provided.

Of course, if you are using Maven2 like I do, you might need to exclude several dependencies since it is still on spring 2.0.6 and I am already on 2.5.1.

How iPhone developed

This is an interesting story to read.

Tuesday, January 15, 2008

A GWT site for you

I just browsed the site http://www.gwtsite.com/ . it has lots of useful information and links to GWT. Great site if you are a GWT lover.

BTW, there is a GWT presentation at Google today. More info can be found here.

Edward Tufte come to town on data visualization

Edward Tufte has written a few classic books on data visualization and teaches a course around once a year in the Bay Area. I just got the info from a co-worker and registered for the 1/31/08 training. I was told that the training class already has 200 people registered! More info at http://www.edwardtufte.com/tufte/courses.

Sunday, January 13, 2008

Hibernate Mapping Cheat Sheet

There is a Cheat sheet for Hibernate at here. good thing is that it is organized pretty nicely. The bad thing is that this is not updated for a while and some of the new stuff is not there yet, like annotation etc.

Xml input and output

What libarary are you using for sererlizing object to and from XML? I use to use the plain XPP3 and Castor

Recently I found that Xstream is pretty neat and simple to use. Anyone has some comments on this since I am going to migrate from Castor to Xstream?

Free IT books

Thanks for this post, I found that this site, scribd, might be a place to go if you want to read some free books online. Just type in the name or keyword and you will think you are lucky.

Saturday, January 12, 2008

JDK 6 update 4 finally comes to my computer

Since I read this post, I was keep pinging Sun for the download page and looks like they only changed it today to make the update 4 available here.

Maven2 Dependency plugin is cool

I got some dependency issues that certain jars got included and I need to find out where the dependencies come from. After downloading the maven-dependency-plugin of version 2.0-alpha-5-SNAPSHOT, just running:
mvn dependency:tree
then you will know which jars are pulled in by which.

Pretty coll and thanks for the good work. Hope you can release a new version early-:)

Friday, January 11, 2008

Bitemporal entity model

Erwin Vervaet gave an interesting presentation and example implementation using the Hibernate3 entity xml. very interesting to read if you have to deal with issues in temporal entity. see this for detail.

some background can also be found from

Some good Java videos

Please see
javalobby

and

Parley

I did not see all of them, but the ones I saw are very good. Educational and informational. enjoy them.