iDatamining.org

I am looking for projects to work on
Please contact with me at yiyu.jia@BostonInfoPro.com!

Saturday, February 25, 2012

install phpMyAdmin on Fedora or CentOS

  1. Install HTTPD, PHP, MySQL first.
  2. Download phpMyAdmin
  3. unzip phpMyAdmin under directory /var/www/html/
  4. make sure your mysql server and httpd are running: service mysqld start and service httpd start
  5. if you have not set root password for new installed MySQL, running the following command to set a password to avoid error message "fedora Login without a password is forbidden by configuration (see AllowNoPassword)": $ mysqladmin -u root password NEWPASSWORD
  6. running command system-config-services and system-config-firewall to doulbe check your httpd and mysqld is enabled and running

Friday, February 10, 2012

Spring singleton and singleton design pattern vs Ext JS 4 singleton and JavaScript Singleton

I discussed "Implementing Singleton object in JavaScript" and "Implementing Singleton pattern in Java and PHP shows different "static" modifers between Java and PHP". Today, I am going to compare the similarity between difference between Java Singleton pattern and Spring singleton and difference between Javascript singleton pattern and Ext JS 4 singleton object.

As described in Spring document, Spring's concept of a singleton bean is different from the Singleton patter, which could be called GoF (Gang of Four) Singleton. As discussed in my post "Java Class loader and static variable and JVM memory management", the GoF Singleton implements one and only one instance of a particular class will ever be created per ClassLoader. Meanwhile, the singleton object defined in Spring framework is single/unique object managed in Spring container. So, Spring singleton needs to be carefully used in multithread environment. Normally, we should use Spring prototype instead of singleton as service that will be requested by multi threads.

Now let's look at Ext JS 4 singleton. I will say it has similar implementation as Spring singleton. That is, Ext JS 4 develops a container to hold all Ext JS 4 class/object. JavaScript's multi-task programming is not popular yet. However, how about testing this through two tab in same browser?

This discussion reveals how Ext JS 4 implements singleton. It is pretty similar as the way Spring does. In Ext JS 4, a singleton is an object instead a class. It's not the same with GoF Singleton just like Spring singleton is not same with GoF Singleton. I think this is an interesting investigation.

http://stackoverflow.com/questions/3920689/plain-old-singleton-or-spring-singleton-bean http://www.bleext.com/blog/configurations-statics-and-singleton-in-ext-js-4/ http://www.sencha.com/forum/showthread.php?128646-Singleton-vs-class-with-all-static-members

Thursday, February 2, 2012

reset linux password for a forgot user account

It is funny that I forgot both user name and password for an OpenSuse virtual machine, which I created and had not used it. Fortunately, I remembered I can boot linux in single user mode to reset password. I write it down here in case i forget password for other copy of linux again.

1) When boot linux with GRUB, press key "e" or move cursor up/down to see boot option editing line.

2) add "single init=/bin/bash" at the end of boot option line

3) once booting up linux, type "passwd root" to reset root password.

4) For my case, I even forgot the user name I created before. So, I go to "/home" and list sub directory there. I saw a folder called "yiyu" there. So, I know the user account I created before is "yiyu".

5) type "passwd yiyu" to reset my user account password.