Friday, February 27, 2009

Log SQL statements for Hibernate

if you ever want to see the actual SQL that any hibernate call makes you can add the following line to your log4j file

log4j.logger.org.hibernate.SQL=DEBUG, console

Naming a for loop in java

for(int i = 0; i<10; i++)
{
loopName: for(Organization org: organizations)
{
if(org.getId() .equals( new Long("5")))
break loopName;
}
//do other stuff

}


http://www.informit.com/library/content.aspx?b=STY_Java2_24hours&seqNum=96

Thursday, February 26, 2009

MYSQL: Restoring DB from .sql backup

To restore a mysql database from Unix shell
mysql -u my_user_name -p db_name < my_sql_file.sql

Tuesday, February 24, 2009

IE CSS

internet explorer can only handle 32 css files, with each file < 288 kb.

http://acidmartin.wordpress.com/2008/11/25/the-32-external-css-files-limitation-of-internet-explorer-and-more/

http://joshua.perina.com/africa/gambia/fajara/post/2008/1/25/internet-explorer-css-file-size-limit

Thursday, February 19, 2009

NoSuchBeanDefinitionException

It is common to get similar error:

org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'photoUserTag' is defined

The solution is:
Verify that bean name matches with the bean definition.  


Wednesday, February 18, 2009

iPhone Safari CSS tips

http://www.evotech.net/blog/2007/07/web-development-for-the-iphone/

Thursday, February 12, 2009

HTML IMAGE MAP AREA


Thursday, February 5, 2009

Location by IP address

http://www.find-ip-address.org/

Location by Zip code

http://www.phpfever.com/soap-zip-code-web-service.html

Mac: how to show/hide hidden files

To display hidden files in your Mac that start with ".fileName":

- Open terminal
- Execute
defaults write com.apple.finder AppleShowAllFiles TRUE
killall Finder

To hide hidden files in your Mac that start with ".fileName":

- Open terminal
- Execute:
defaults write com.apple.finder AppleShowAllFiles FALSE
killall Finder

Wednesday, February 4, 2009

RSS Syntax

<?xml version="1.0" encoding="ISO-8859-1" ?>
<rss version="2.0">

<channel>
<title> <!---Channel Title---> </title>
<link> <!---Channel's Link---> </link>
<description> <!---Brief Description---> </description>

<item>
<title> <!---Item Title 1---> </title>
<link> <!---Item Link 1---> </link>
<description> <!---Brief Description 1---> </description>
</item>

<item>
<title> <!---Item Title 2---> </title>
<link> <!---Item Link 2---> </link>
<description> <!---Brief Description 2---> </description>
</item>

</channel>

</rss>

Tuesday, February 3, 2009

SQL: joint statment on 3 different tables

select distinct u.email from user u join season_roster sr on u.id=sr.user_id join team t on t.id=sr.team_id where t.league_id in (3, 13) and u.email like '%@%'  and u.email not like '%test.com';