-
WordPress + Nginx + Permalinks Rewrite rules
The following works for me: I have my blog here: http://www.trk7.com/blog/and my permalink structure is: /%postname%/
-
Bella donna
Bella donna won’t be tamed Belluci, however, is unconcerned about what her children might think of her movies. ”If you are scared about what people think or what you represent or what your image can be, then you are not free any more in your choices. That can be dangerous for your art. I think…
-
Backgrounded PHP jobs in ‘STOPPED’ state
This could be specific to the PHP package from Ubuntu. Please consider the following a disclaimer. $ php -v PHP 5.3.5-1ubuntu7.2 with Suhosin-Patch (cli) (built: May 2 2011 23:00:17) Copyright (c) 1997-2009 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Xdebug v2.1.0, Copyright (c) 2002-2010, by Derick Rethans $ cat /etc/lsb-release…
-
Parrallel processing from the bash commandline
for i in `seq 1 40`; do echo $i; /tmp/script.sh >> /tmp/script.out 2>&1 & done Note the lack of ‘;’ before ‘done’. The ‘&’ indicates the end of the statement.
-
Checking for the existence of domains from commandline in Bash
while read line; do wget –quiet –spider –timeout=10 $line; if [ $? -ne 0 ]; then echo $line; fi; done < "/tmp/domains.txt" /tmp/domains.txt would hold the list of domain names separated by newline. Note this is just a quick hack and not entirely reliable.
-
myisamcheck running out of tmp space
Recently I was running myisamcheck on an entire database housed inside a vserver. And, by default vserver mounts a 16MB ramfs on /tmp. This obviously is not an ideal solution when you are running a DB server that has a few tables that are around 20GB. So I had to specify a different directory for…
-
gzip/bzip2 taking too long to compress large files
Use pbzip2. I have noticed significant reduction in time while compressing files larger than 1GB.
-
Getting rid of MySQL Warning: Truncated incorrect DOUBLE value
If you come across a cryptic warning like this: | Warning | 1292 | Truncated incorrect DOUBLE value: ‘xxxxxxx’ on running a MySQL query, it could be caused by using a numeric value against a CHAR/VARCHAR column. —assuming `name` is a CHAR/VARCHAR column —the following query might cause warnings SELECT * FROM `t1` where `name`…
-
PHP as a replacement for sed/awk
I had gotten sick of not being able to do what I wanted to do with sed/awk – partly because I am not too familiar with those – and, was investigating replacements for those. Many people seem to be using perl and since I wasn’t too familiar with Perl as well, I started thinking about…
-
Regular Expression to check for comma separated list of Integers
//get rid of all kinds of spaces $IDs = preg_replace(‘/s+/’, ”, $inputIDs); if(!preg_match(”/^\d+$|^(\d+,)+\d+$/”, $IDs)) { echo “Invalid Input”; } You could use the validated IDs above in a SQL like the this: SELECT * FROM t1 WHERE id IN($IDs) Disclaimer: I am not going to be responsible for any kind of SQL injection resulting from…