The HTML checkbox does not support readonly property. I had to lock down behavior on a check-box but wasn’t able to do so. But then I came across this useful property that disables user to modify the default value on the checkbox.
<input type=checkbox onclick="return false;" onkeydown="return false;" />
Importing mySQL Dump file is as easy as creating one. Execute the following line in the command prompt where the dump_file.sql is present:
mysql -h localhost -uusername -pDb-Password DATA-BASE-NAME < dump_file.sql
I was expecting my data to only have lower case chars and therefore, any records with upper case entries would be errors that I need to fix. I found this simple solution to find records with Upper Case chars. I compared the lower case value with the real value and found the discrepancies.
SELECT id, name FROM records WHERE name != lower(name);
Just follow these instructions to install VMware tools on a Debian machine.
* apt-get upgrade
* apt-get update
* VSphere: Edit the settings of the VM and click on “CD/DVD drive 1″. Click the “Connected” box at the top of the window and say OK. Then return to the SSH session.
* which gcc
* which make
NOTE: If you don’t get a path to gcc & make back when you invoke the “which” commands, those tools are not installed and must be:
* apt-get install make gcc
* Determine what kernel you’re using: uname -r
* apt-get install linux-headers (I’m not specifying a version of linux-headers because by leaving it off, apt-get will return a list of linux-kernel packages):
NOTE: This will give you a list of packages to install. Look for one that has your kernel version in
it (i.e.: I chose linux-headers-2.6.32-5-686 because both the kernel version AND architecture matched).
* Install the matching version: apt-get install linux-headers-2.6.32-5-686
* cd /usr/local/src
* wget http://ftp.us.debian.org/debian/pool/main/b/build-essential/build-essential_11.6_i386.deb
NOTE: If you get an error “wget” doesn’t exist, install it: “apt-get install wget”
* apt-get -f install dpkg-dev
* dpkg -i build-essential_11.6_i386.deb (this replaces build-essential 11.5 with 11.6)
* VSphere: Right-click on the VM, go to Guest -> Install/Upgrade VMWare Tools
* mount /dev/cdrom /media/cdrom0 (/dev/cdrom points to /dev/sr0)
* cd /media/cdrom0
* cp VMwareTools-8.6.0-425873.tar.gz /tmp
* cd /tmp
* tar -zxvf VMwareTools-8.6.0-425873.tar.gz
* cd /tmp/vmware-tools-distrib
* perl vmware-install.pl
NOTE: Follow all the prompts. I have went through this entire procedure twice now on brand-spanking new Debian machines and just accepting all defaults has worked each time.
* Remove the VMWare Tools tar-ball and un-packed files.
* cd /tmp
* rm -rf VMwareTools* vmware-tools-distrib (this removes the tar-ball and un-packed files – no need for them any longer).
NOTE: The installation script automatically un-mounts the virtual CDROM/DVD drive.
I use SmartGIT for source control. I link the GIT repository directly to my source repository locally. As a result, the compiled source files also get tracked within GIT. e.g. the python compiled files (.pyc) also add up in the GIT tracker. In order to ignore file types being tracked within GIT, navigate to the local source repository linked to GIT. There must be a hidden directory named .git. Navigate to .git/info/ and look for a file called exclude (without any extensions). If the file doesn’t exist, create one. Add the file types that you would like GIT to ignore tracking. e.g. here’s the content of the file where I would like to exclude .pyc files from tracking
# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
I had a lot of trouble decoding a json object that had all kind of special characters, nextline characters (\n), carriage returns (\r). On doing some initial search, I saw solutions where people recommended replacing \n with \\n, etc. I started with that and it worked, but down the path I found that there were many more characters that I had to now replace manually. Then one of my colleague recommended to use a specific JSON decoder with strict=False option. I tried that and it did what I was looking for. Wondering why this method is not recommended on the other blogs, stackoverflow over json.loads.
dictData = json.JSONDecoder(strict=False).decode(jsonData)
I wanted to add some php code to an existing static html page. But I noticed that the PHP content didn’t render on the browser in the first place. It would only work if I renamed the file extension from .html to .PHP.
In order to have the php content work in an HTML file extension, the following piece of configuration is required within the .htaccess file on your server. This can be created on the site’s root directory and the properties are inherited by all the sub-directories.
AddType application/x-httpd-php .html