4/24/2009

Common Select usage:Where condation of datatime format for query rows

There are 8 different ways for select rows form table by filed formated as datatime

1. where date like '2005-01-%'
2. where DATE_FORMAT(date,'%Y-%m')='2005-01'
3. where EXTRACT(YEAR_MONTH FROM date)='200501'
4. where YEAR(date)='2005' and MONTH(date)='1'
5. where substring(date,1,7)='2005-01'
6. where date between '2005-01-01' and '2005-01-31'
7. where date >= '2005-01-01' and date <= '2005-01-31'
8. where date IN('2005-01-01', '2005-01-02', '2005-01-03', '2005-01-04', '2005-01-05', '2005-01-06', '2005-01-07', '2005-01-08', '2005-01-09', '2005-01-10', '2005-01-11', '2005-01-12', '2005-01-13', '2005-01-14', '2005-01-15', '2005-01-16', '2005-01-17', '2005-01-18', '2005-01-19', '2005-01-20', '2005-01-21', '2005-01-22', '2005-01-23', '2005-01-24', '2005-01-25', '2005-01-26', '2005-01-27', '2005-01-28', '2005-01-29', '2005-01-30', '2005-01-31')

4/20/2009

Install javaDocs and setup in eclipse on Ubuntu

The default installation of Eclipse did not include Javadoc,so here's how to get Javadoc installed and working.


First, enter


sudo apt-get install sun-java6-doc


The installer will prompt you to download a zip file containing the documentation from Sun. Bring up Firefox and head to Sun's website. Click the zip file to download the documentation(only english version enough, never japs).

When the download finishes, in another terminal, enter


sudo cp /path/to/zip/file/documentation.zip /tmp


Enter
sudo chown root:root /tmp/documentation.zip


to change the file permissions.

Back in the first terminal, hit enter, and the installer should continue. When it finishes, in Eclipse,


click Window -> Preferences -> Java -> Installed JREs, and click the JRE . Click Edit, and use Shift+Click to select all the JRE system libraries. Click Javadoc Location, and enter


file:/usr/lib/jvm/java-6-sun/docs/api/

in the box. Click Validate to test it (you can open it in your browser to double check), and click OK out of all the dialogs. Javadoc should now be working!

4/07/2009

Add tpl to HTML content type on Zend Studio Form Eclipse

The smarty deafult tempalte file type named "tpl" hasn't been supported by Zend Studio for Eclipse 6.1. So, you need to setup this content type to html. the solution is the following:

1 Open Preferences
2 Click HTML in General->Appearance->Content Type
3 Add "*.tpl" to File associations
4 Clink OK

Install Zend Server on Ubuntu 8.10

1 Add Zend server source list


deb http://repos.zend.com/deb/pe pe non-free

get public key and import it by sofware management editor

wget http://repos.zend.com/deb/zend.key


2 Set apache2's config to your workspace

The apache used by Zend Server is apache2,the config file locates in /etc/apache/
2.1 edit "/etc/apache2/sites-available/default"

<VirtualHost *:80>
ServerName localhost
ServerAdmin webmaster@localhost

DocumentRoot /home/edwin/Zend/workspaces/Odour-main/Public/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /home/edwin/Zend/workspaces/Odour-main/Public/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory "/usr/lib/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
</Directory>

ErrorLog /var/log/apache2/error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

</VirtualHost>

2.2 edit first virtualHost (IP:192.168.6.1)


<VirtualHost 192.168.6.1:80>
ServerName ComServer
ServerAdmin webmaster@localhost

DocumentRoot /home/edwin/Zend/comWorkspace/Public/
<Directory /home/edwin/Zend/comWorkspace/Public/>

Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>

ErrorLog /var/log/apache2/192.168.6.1.error.log

# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn

CustomLog /var/log/apache2/192.168.6.1.access.log combined
</VirtualHost>



3 enable virturalHost


sudo a2ensite 192.168.6.1


4 restart the apache

4/03/2009

Resolution of No Sound in Wine On Ubuntu 8.10

I have used Wine successfully with Pulseaudio via padsp!!

First you have to run
Code:


padsp winecfg

and select the OSS output under Audio. The other outputs should be toggled off.Then you can use any program via "padsp wine yourprogram.exe".For example:running diablo 2 in wine

padsp wine diablo.exe

4/02/2009

installing Mysql with YUM in CentOs

1 install application
yum install mysql
yum install mysql-server
yum install mysql-devel
service mysqld start



2 Set the passwords for your root account like so

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h hostname password 'new-password'

3 config iptables for accessing by local network
#vi /etc/sysconfig/iptables
add "-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT"
# service iptables restart

3/31/2009

Set Docbook edtiing environment in Ubuntu 8.10

1、init compile environment


  $sudo apt-get install xsltproc
  $sudo apt-get install docbook-xsl

  
2、install docbook editor named XMLmind XML Editor
and build a test docbook xml

3、Generating a html
$xsltproc -o test.html /usr/share/xml/docbook/stylesheet/nwalsh/xhtml/docbook.xsl test.xml

3/27/2009

Mouse-less Firefox

Navigation from the toolbar

  • Select location bar: Ctrl+L or Alt+D
  • Select search bar: Ctrl+K
  • Back: Backspace or Alt+Left
  • Forward: Alt+Right or Shift+Backspace

Searching pages

The find-as-you-type feature was an epiphany. While Google is great at getting you to the right web page, Firefox's find-as-you-type feature gets you the rest of the way.

  • Find as you type text: /
  • Find as you type link: '
  • Regular old find: Ctrl+F

The link search is very useful, especially when used in conjunction with...

Opening pages

Unless you do all of your browsing in one page, these shortcuts are huge when you don't want to go running for your mouse.

  • Open link in new window: Shift+Enter
  • Open link in new tab: Ctrl+Enter
  • Open address/search in new tab: Alt+Enter

Used together with their respective shortcuts (address and search bar shortcuts and the find-as-you-type link shortcut), the page opening shortcuts go a long way toward mouse-less browsing.

Grab bag

The following shortcuts fall into a more general grab bag of useful shortcuts.

  • Caret browsing: F7
  • Refresh: Ctrl+R or F5
  • Refresh (override cache): Ctrl+F5 or Ctrl+Shift+R
  • Switch tabs: Ctrl+Tab
  • Select tab (1-9): Ctrl+[1-9]

If you're looking to change your default mail program (e.g. to Gmail, etc.) to best utilize the Compose email shortcut, check out these tips for setting your default mail program.

Wweb writer