Posts

Showing posts from 2013

JQuery attr function to replace image src not working in browsers except Chrome

Hi all, As per title, I believe there are a lot people who face this problem when want to dynamically update an image using JQuery. Once there is a requirement for this, the first thing come out in mind is the .attr() function provided by JQuery. The code roughly will be like this: $('#<image element id>').attr('src',<new image source>); Logically this should be done the job. However, after a test in several browsers, one will find out that this only working in Chrome. Internet Explorer, Firefox and Safari do not perform as expected. Why will this happen? It is due to cache issue. The solution for this issue is very simple. It is just needed to append a timestamp behind the new image source to trick the browser that the image is a new one for each time the function is triggered. It is as below: $('#<image element id>').attr('src', <new image source> ?' + new Date().getTime() ); * the part highlighted in yellow is ...

How to enter single user mode in CentOS

I'm facing this issue where I forgot about my root password in CentOS. Hence after look around, I found out that entering single user mode able to let me login as root user and then change the password for it. :) The step is very easy, Press any key when booting up CentOS to enter interactive mode Instead of choosing any of the bootable OS, type 'a' Go to the end of line, put a 'space' and then enter 'single' then press enter Now you will login as root user :) Enjoy

Line height not working for text in button (only in Firefox)

Found this interesting bug when I was trying to position a text inside a button or input submit. This only happen in Firefox browser. After searching online, found the solution from below website, http://www.cssnewbie.com/input-button-line-height-bug/#.US7N129BMQ4 (credit to Rob Glazebrook for the clear explanation and workaround ). Hope the findings can help others who face the same problem. :)

FTP BAT Script Doesn't work. Goes in a LOOP by itself

There is time where bat file created and when run, it keep looping the command inside. After a while, found out that, the file name is the problem. Never ever create a .bat file with the following name: ftp.bat Happy coding. :)