Sunday, November 6, 2011

I am keeping get this error while using google api:

"hostname in certificate didn't match: != <*.googleapis.com> OR OR <*.googleapis.com>"

so I googled and here is the answer:
http://forum.springsource.org/showthread.php?114685-Samples-OpenId-Google-Login-Hostname-in-Certificate-didn-t-match

basically do not use httpclient:4.1.2 for this kind of operations

Wednesday, October 19, 2011

Both java 6 and 7 got updated

Java 6 is on update 29 and java 7 is on update 1. enjoy!

Update:
since it was said that the crash bug fixed from dzone http://java.dzone.com/news/java-7-and-lucene-bug-saga so I moved my major dev point to the java7u1

But imediately i got this from my js script engine related code, sure there was no issues on java6 before:
sun.org.mozilla.javascript.internal.InterpretedFunction cannot be cast to java.lang.Double

So I have to comment out all my script engine related test out to be quick and dirty.

UPDATE 2: I got stuck again, this time on
aspectj-maven-plugin
looks like it cannot handle 1.7 compiliance level.

So I have to set this to 1.6 for aspectJ

Update 3 (10/25/11) I have to move back to 1.6 due to some
java.lang.VerifyError: Expecting a stackmap frame at branch target 25.

Spring 3.x and Cassandra using Hector

To config Spring with Cassandra, you can use the HectorTemplate class in the Hector core. the configuration is something like this:

[sourcecode language="xml"]
<bean id="hectorTemplate"
class="me.prettyprint.cassandra.service.spring.HectorTemplateImpl"
init-method="init">
<property name="cluster">
<bean class="me.prettyprint.cassandra.service.ThriftCluster">
<constructor-arg value="${cassandra.clustername}" />
<constructor-arg>
<bean
class="me.prettyprint.cassandra.service.CassandraHostConfigurator">
<constructor-arg value="${cassandra.dburl}" />
</bean>
</constructor-arg>
</bean>
</property>
<property name="keyspaceName" value="${cassandra.keyspace}" />
<property name="replicationStrategyClass"
value="org.apache.cassandra.locator.SimpleStrategy" />
<property name="replicationFactor" value="${cassandra.replicationfactor}" />
</bean>
[/sourcecode]


please note that I am using Cassandra 1.0 and hect 1.0 now. if you are using some other versions, you might need to make sure all the referred classes are in the package.

After you have the template then you can use it as other spring template.

Sunday, April 3, 2011

Useful ubuntu mail setup with gmail

http://prantran.blogspot.com/2007/01/getting-postfix-to-work-on-ubuntu-with.html

Tuesday, January 12, 2010

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.