Tatva-Artha

meaning of "it"

Archive for May, 2009

Voting fixtures in jQuery – Thumbs Up, Thumbs Down

without comments

Recently I had to implement voting system for one of my projects. In summary, the system had to allow user to easily vote Yay or Nay for a given item. I implemented this using thumbs-up thumbs-down images in jQuery/Ajax.

voting-in-jquery.png

Read the rest of this entry »

Written by admin

May 3rd, 2009 at 6:57 pm

jQuery template

without comments

All jQuery code code inside this template:


<script type="text/javascript">
(function($) {
$(document).ready(function(){
# ... custom code here ...
});
}(jQuery));
</script>

Written by admin

May 3rd, 2009 at 3:00 pm

Posted in All,Technology

How to enable remote connection to mysql server

without comments

The default configuration in mysql only allows “root” to connect from local machine. In order to enable root (bad idea!) or any other user to connect from remote machine(s), here is what you need to do:

- Locate your mysql config file. For ubuntu, this could be /etc/mysql/my.cnf. To confirm, you can look inside your mysql startup script /etc/init.d/mysql or /etc/init.d/mysqld.
- In my.cnf file, comment out the following 2 configuration options
#skip-networking=…
#bind-address=127.0.0.1

The skip-networking option is old and may not be present in newer versions.

This enables mysql to listen for connection from any machine.

- Next we have to enable a few users to connection to database on this mysql servers. For this, log into the mysql server (locally) and execute grant command:
$ mysql -u root -p
mysql> GRANT ALL ON *.* TO root@’%’ IDENTIFIED BY ‘pass’;

And finally ensure that port 3306 is allowed on this machine. This can be found under your iptables firewall config. If not, execute the following command to allow port 3306:

$ /sbin/iptables -A INPUT -i eth0 [ -s 192.168.1.0/24 ] -p tcp –destination-port 3306 -j ACCEPT

In above command, subnet option -s is optional but is a good idea to include if you only want to connect from your local subnet.

# Don’t forget to save the newly modified iptables rules using following command
$ sudo /sbin/service iptables save
# OR (following command also saves)
$ sudo /sbin/iptables-save
# And, don’t forget to restart the iptables service after changing rules
$ sudo /sbin/service iptables restart

Written by admin

May 2nd, 2009 at 6:11 pm

Posted in All,Technology

Fix file encoding on cygwin

without comments

On Cygwin, we can easily convert file format from LF to CR/LF or reverse using unix2dos.exe and dos2unix.exe commands.

How to convert the file encoding … say from UTF-8 to ASCII?

Well, here’s a way:

$ iconv -f UTF-8 -t ISO-8859-15 in.txt > out.txt

Written by admin

May 1st, 2009 at 7:05 pm

Posted in All,Technology