Thursday, December 16, 2010

create forum_openidnonce and forum_openidassociation

easy_install python-openid
Searching for python-openid
Reading http://pypi.python.org/simple/python-openid/
Reading http://www.openidenabled.com/openid/libraries/python/
Reading http://github.com/openid/python-openid
Download error: unknown url type: https -- Some packages may not be found!
Reading http://github.com/openid/python-openid/tarball/2.2.5
Download error: unknown url type: https -- Some packages may not be found!
Reading http://openidenabled.com/python-openid/
Reading http://github.com/openid/python-openid/tarball/2.2.4
Download error: unknown url type: https -- Some packages may not be found!
Best match: python-openid 2.2.5
Downloading http://pypi.python.org/packages/source/p/python-openid/python-openid-2.2.5.zip#md5=f89d9d4f4dccfd33b5ce34eb4725f751
Processing python-openid-2.2.5.zip
Running python-openid-2.2.5/setup.py -q bdist_egg --dist-dir /tmp/easy_install-8UpKN5/python-openid-2.2.5/egg-dist-tmp-GI5CT1
warning: no files found matching 'CHANGELOG'
warning: no files found matching '*.css' under directory 'doc'
warning: no files found matching '*.html' under directory 'doc'
zip_safe flag not set; analyzing archive contents...
Adding python-openid 2.2.5 to easy-install.pth file

Installed /usr/local/lib/python2.7/site-packages/python_openid-2.2.5-py2.7.egg
Processing dependencies for python-openid
Finished processing dependencies for python-openid
/home/osqa/osqa-server# python manage.py syncdb --all
Syncing...
Creating table forum_openidnonce
Creating table forum_openidassociation
No fixtures found.

Synced:
> django.contrib.auth
> django.contrib.contenttypes
> django.contrib.sessions
> django.contrib.sites
> django.contrib.admin
> django.contrib.markup
> forum
> south

Tuesday, December 14, 2010

Errors were encountered while processing: procps

There seems to be problem with installing procps.

dpkg -i --force-all /var/cache/apt/archives/procps_1%3a3.2.8-9ubuntu3_amd64.deb
(Reading database ... 30892 files and directories currently installed.)
Preparing to replace procps 1:3.2.8-9ubuntu3 (using .../procps_1%3a3.2.8-9ubuntu3_amd64.deb) ...
Unpacking replacement procps ...
Setting up procps (1:3.2.8-9ubuntu3) ...
start: Job failed to start
dpkg: error processing procps (--install):
subprocess installed post-installation script returned error exit status 1
Processing triggers for man-db ...
Errors were encountered while processing:
procps

The solution for me is to remove the package from /var/cache/apt/archives/procps_1%3a3.2.8-9ubuntu3_amd64.deb
and downloaded a newer verion from http://debomatic64.debian.net/natty/aptcache/procps_1%253a3.2.8-9ubuntu5_amd64.deb

then dpkg -i procps_1%3a3.2.8-9ubuntu3_amd64.deb installation was successful.

Friday, December 3, 2010

JNDI datasource

The following resource need to put into an context element. The default Tomcat has $CATALINA-HOME/conf/context.xml, so the resource can be put into that file.



< resource auth="Container" driverclassname="com.mysql.jdbc.Driver" maxactive="100" maxidle="30" maxwait="10000" name="jdbc/TestDB" password="testTwo" type="javax.sql.DataSource" url="jdbc:mysql://localhost:3306/testDb/testTable" username="testTwo">

And in web.xml:

Tuesday, November 30, 2010

ivy target depends on target from a different project

As the value of  depends attribute. it can be composed from project name and target name.


eg:
\
 



In your-project.xml

 

tomcat on vps

1 GB memory is needed to smoothly run an app on Tomcat.

/var/tomcat/bin# ./shutdown.sh
Using CATALINA_BASE:   /var/tomcat
Using CATALINA_HOME:   /var/tomcat
Using CATALINA_TMPDIR: /var/tomcat/temp
Using JRE_HOME:        /usr/java/jdk1.6.0_21/jre
Using CLASSPATH:       /var/tomcat/bin/bootstrap.jar
Error occurred during initialization of VM
Could not reserve enough space for code cache

http://stackoverflow.com/questions/286007/how-to-tune-tomcat-5-5-jvm-memory-settings-without-using-the-configuration-progra

$CATALINA_HOME/bin/export JAVA_OPTS="-XX:MaxPermSize=64m -Xms16M -Xmx64m"


Saturday, October 9, 2010

find ANT_HOME on ubuntu

Similar to JAVA_HOME, ant home can be found:



/usr/share/ant is my ANT_HOME
In case of using Ivy, ivy.jar can copied into /usr/bin/share/ant/lib

set JAVA_HOME for ant on ubuntu

To file java home(where jre/jdk) is installed on ubuntu:


 Then you add to
/etc/environment
the following line
JAVA_HOME="usr/lib/jvm/java-6-sun/jre"


ant JAVA_HOME is not defined correctly:






now Ant finds the java home

Thursday, October 7, 2010

Find that process running at a port and kill it

In Windows (7), You can list all the processes and the port it is running at by:
netstat -ano

To kill a process, replace pid with process id from previous step

taskkill /pid 5844  /F


In Ubuntu, You can find the process running at a port using grep

netsat -ano --program |grep 8080

and
kill porcessNumber

eg.



11814 is process running at port 8080.

Friday, September 24, 2010

how to find router ip address for any router of any OS

type tracert google.com from commandline

For example as in Ubuntu:

The first IP address is your computer's IP. 10.1.1.1 is the router's IP

Saturday, September 18, 2010

/etc/hosts file format

The format of /etc/hosts is:

How to find out the format?
type man 5 hosts in terminal

why 5?
5 is the section number of a man page, it means file formats
ref:http://en.wikipedia.org/wiki/Man_page



Extra:

The etc/hosts file specifies the hostname or computer name your current shell is running.
In my case, my computer name is zhang-laptop and my login name is zhang, so my bash looks like:

zhang@zhang-laptop:~$

And my etc/host file is:
zhang@zhang-laptop:~$ cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 zhang-laptop
    #added
    #127.0.0.2    domainhound
    #127.0.0.2    zhangmichael.com

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

how do you file the hosts file format?


Ref:
http://www.freebsd.org/doc/handbook/configtuning-configfiles.html
http://www.freebsd.org/cgi/man.cgi?query=hosts&sektion=5

Friday, August 13, 2010

/etc/alternatives/-->Debian alternatives system

Where is location of java on ubuntu?
Finding out the answer is not just use "whereis java" or "which java":

The alternatives directory lead to the alternative concept. when you type java, it could refer to a different real java location if a new version has just installed.
Eg. I was using java 5, typing java would start JVM 5; after installing java 6, type java would start JVM6.

Intuitively, I think having this extra level of indirection is useless...

Saturday, August 7, 2010

burst.net vps outrage counter

I have purchased the cheapest VPS from burst.net and I think it is the cheapest around.
However, there had been at least three outrages during the last three month. When I say at least three outrages. Because each time I type top, the uptime is different, there had been three occasions.

Now I am going to keep a record of outrages, every time when i type top, if system had been done, i would put a record here.

08/Aug/10 top - 04:42:16 up 3 days,

swap on VPS(OpenVS)

I have problem starting java virtual machine on my VPS. The cause is there is not enough heap to be allocated for JVM.

$ java
Error occurred during initialization of VM
Could not reserve enough space for object heap
Could not create the Java virtual machine.
The fix for me is that my java is OpenJDK, so I uninstalled it and reinstalled the Sun implementation and fixed the problem.



Related stuff:
This came down to my VPS has only 500mb memory. I want to try if adding more swap can solve the problem. And ended up finding out Swap is not allowed on OpenVS. from this link. http://forums.vpslink.com/linux/1567-how-create-swapfile-your-vps.html

When I tried to create swap file according to https://help.ubuntu.com/community/SwapFaq  I get:

   swapon failed: Operation not permitted
Burstnet suggested me to increase my memory.
I would want to if there are other solutions..

Friday, July 23, 2010

hulu

Monday, June 21, 2010

Clang to analyze IPhone Project

After learned how to use xcodebuild from previous post then using scan-build is easy

Just append scan-build in front of "xcodebuild command " eg

for me the command is:

~/Desktop/Application/checker-234/scan-build xcodebuild -configuration Debug -sdk iphonesimulator4.0

And you can view the output as it instruct:

Now, I have 21 bugs need to be fixed.
Publish Post

xcodebuild

To build using xcodebuild, you need to run xcodebuild from the directory containing your project (i.e. the directory containing the projectname.xcodeproj)

then type:
xcodebuild -configiuration Debug/Release -sdk iphonesdk
the example used
xcodebuild -configuration Debug -sdk iphonesimulator4.0

Nagvigate Man Page

After type "man find" on bash:
you can type:
h -help
up - go up one line
down - go down one line
f -forward one window
b -backward one window
/pattern -search for pattern
n -next match for the  searched pattern
N -previous match for the searched pattern

Conversation with Marc

Marc' suggestion is:
Do not sell at $10 for each report, sell for $150
It is hard to market, get myob to put it on your website.
Smartreports are based in Australia, if there is one company in NZ. He would have bought locally.
Installation was a hack, 3 to 4 hours to install. Have to close it very time.
Greentree is another one, but costs about 20k to install.
 MYOB can do 99% of job for myob. Report is not used by small businesses, has to be used by big business.
He purchased 8 IPads for the company.
The palm software from sales link costs 3k.
He has 40 sales order from two companies.

Saturday, June 19, 2010

Add external Jar file

 Right click on the ProjectName then add external library.
Or right click on the Refereced Libraries->build Path-> Configure Build Path->Add external Library



reference
http://www.wikihow.com/Add-JARs-to-Project-Build-Paths-in-Eclipse-(Java)

Friday, June 18, 2010

advanced google search: How to search content inside and outside a webiste?

Search content inside website can be done using:
freepastry site:*.edu

Sometimes one wants exclude contents from a web domain, in the above example the top 6 out 8 search results are from:https://mailman.rice.edu/mailman
To exclude the results from mailman.rice.edu , one can use:
-site:mailman.rice.edu







Here are the results of
freepastry site:*.edu -site:mailman.rice.edu


as shown in the picture, results from mail.rice.edu are excluded

Monday, June 14, 2010

Smallest possible match

Regular expression smallest match.
I need one regular expression to extract all the opening tag, closing tag and all the strings in between opening and closing tag. eg:

Is this all there anything can be here, \n
[]+*403<>??!@#$%^&*()adsfadsf





By default the regular expression [\w|\W] would give the whole string above. To get the three pairs of open and close tag. You do [\w|\W]+?

Reference:
http://www.unagibay.com/DesktopDefault.aspx?tabindex=1&tabid=100&itemid=1826
http://www.regextester.com/

Friday, June 4, 2010

How to find processor types on Windows, Ubuntu/Linux, and Macbook

 Here I give examples of finding the OS and processor types of a PC,Mac and Ubuntu:

OS Processor type OS type
Windows 64 bit 32 bit
Mac OS X 64 bit: Intel Core 2 Duo 32 bit
Ubuntu 64 bit 32 bit

On windows
open cmd and type systeminfo
In the output:
System Type: X86-base PC  says the operating system is 32 bit.
Processors: X64 Family Model tells you the processor is 64 bit






On Mac:




Then compare your processor with the chart below:



On Ubuntu:
type lshw | -class processor outputs the cpu width 64 bits 
type uname -a output i686


 

Tuesday, March 16, 2010

why / as sysdba

to start up oracle:
->su -l oracle //login as oracle, password
->sqlplus //start sqlplus
->/ as sysdba //?? see below
->startup //start oracle
->exit //quit sqlplus


http://download.oracle.com/docs/cd/B10501_01/server.920/a90842/ch4.htm#1006252

The AS clause allows privileged connections by users who have been granted SYSOPER or SYSDBA system privileges. You can also use either of these privileged connections with / and /NOLOG.

If you use this option, you need to quote the command arguments on many operating systems, for example:

SQLPLUS "/ AS SYSDBA" SQLPLUS "SYSTEM/your_password AS SYSOPER"


http://ugweb.cs.ualberta.ca/~c391/manual/chapt4.html

Enter the command ``sqlplus /''.
Note: This example assumes that you have been given the same ORACLE user ID as your login. If you forget to add the ``/'' you will be asked to enter your name and password for your ORACLE user ID, in which case you should press $\wedge C$ (cntrl-C) and start over. Entering your system user ID and password will not get you access to SQL*Plus. If your ORACLE user ID differs from your system ID refer to the ``SQL*Plus User's Guide and Reference''.