10 Million hits a day with WordPress using a $15 server
via 10 Million hits a day with WordPress using a $15 server | Ewan's Blog on IT and stuff like it.
March 31st, 2012 Alex Posted in programming Comments Off
10 Million hits a day with WordPress using a $15 server
via 10 Million hits a day with WordPress using a $15 server | Ewan's Blog on IT and stuff like it.
October 18th, 2010 Alex Posted in excel, programming, web Comments Off
Although you should not use tables for layouts (CSS should be used for this purpose), you should definitely use tables if you need to display tabular data (Excel file data, database data or CSV file for example).
Concrete example:
| Mon | Tue | Wed | Thu | Fri | |
|---|---|---|---|---|---|
| 8:00-9:00 | Meet Sam | ||||
| 9:00-10:00 | Dr Williams | Sam again | Leave for CA |
July 17th, 2010 Alex Posted in pictures, programming, video Comments Off
July 1st, 2010 Alex Posted in excel, perl, programming, windows Comments Off
If you want Excel to keep a field’s leading zeros when opening a CSV file using Excel, you can change it to =”value”.
For example, if you have a row with 4 values that looks like this:
test,00016102,test,test
Just change it to:
test,="00016102",test,test
June 23rd, 2010 Alex Posted in electronics, programming Comments Off
July 20th, 2009 Alex Posted in linux, programming, windows Comments Off
I was getting this error:
[Mon Jul 20 12:32:05 2009] [error] [client 192.168.241.233] Premature end of script headers: elite_inventory.pl
[Mon Jul 20 12:32:05 2009] [error] [client 192.168.241.233] DBI connect('my_database','my_user',...) failed: [INTERSOLV][ODBC Informix driver][Informix]Unable to load locale categories. (SQL-HY000) at C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/script.pl line 37
The fix involved modifying Apache’s environment variables using SetEnv in httpd.conf:
SetEnv INFORMIXDIR "C:/informix32"
SetEnv INFORMIXSERVER "isaac_net"
SetEnv DELIMIDENT n
SetEnv DBANSIWARN n
SetEnv CLIENT_LOCAL "en_US.CP1252"
SetEnv DB_LOCAL "en_US.CP1252"
This is because even if the variables are set in the registries in Windows (they are environment variables in Linux), the web server doesn’t use them.
Reference #1 and Reference #2.
You might need to use a different locale under Linux or Unix.
July 6th, 2009 Alex Posted in perl, programming Comments Off
The Ternary Operator
The ternary is actually a sequence of operators. The operator is used like this:
CONDITION-PART ? TRUE-PART : FALSE-PART
which is shorthand for the following statement:
if (CONDITION-PART) {
TRUE-PART
} else {
FALSE-PART
}
Example: If $firstVar is zero, then assign $secondVar a value of zero. Otherwise, assign $secondVar the value in the first element in the array @array.
$secondVar = ($firstVar == 0) ? 0 : $array[0];
via Perl 5 By Example.
November 1st, 2008 Alex Posted in perl, programming Comments Off
if ( $string =~ /[[:^ascii:]]/ ) {
print "String contains characters that are NOT pure ASCII";
}
else {
print "Everything is good, string/pure is valid ASCII.";
}
E.G.: If it contains bytes > 127, it’s not valid ASCII.
August 6th, 2008 Alex Posted in perl, programming, slackware Comments Off
It allows you to get Perl pre-compiled packages. You can avoid installing a C compiler which is needed for some packages (KinoSearch for example).
http://aspn.activestate.com/ASPN/Downloads/ActivePerl/PPM/
Alternate packages repositories:
http://cpan.uwinnipeg.ca/PPMPackages/10xx/
July 17th, 2008 Alex Posted in linux, perl, programming, windows Comments Off
The following perl scripts index *.txt in the current folder and search for “TEST”. The first one is using Perl’s KinoSearch module and the other one is using Plucene. KinoSearch is alot faster then Plucene and also gives better results.
(right click to download)
September 25th, 2007 Alex Posted in perl Comments Off
$ mkdir ~/perl $ mkdir -p ~/.cpan/CPAN $ touch ~/.cpan/CPAN/MyConfig.pm $ cpan
cpan> o conf init
Set the following settings:
'cpan_home' => q[/home/username/.cpan], 'build_dir' => q[/home/username/.cpan/build] 'keep_source_where' => q[/home/username/.cpan/sources], 'makepl_arg' => q[PREFIX=~/perl] 'mbuildpl_arg' => q[--install_base /home/username]
$ cpan force install Module::Name
Add this line in each of your Perl scripts (change perl version accordingly):
use lib '/home/your_username/perl/lib/perl5/site_perl/5.8.7';
OR rather than editing all your Perl scripts, in your cgi-bin/.htaccess file:
SetEnvIf Request_URI "^/cgi-bin/" PERL5LIB=/home/user/perl/lib/perl5/site_perl/5.8.7:/home/user/perl/lib/perl5/site_perl/5.8.7/site_perl
OR in your .bash_profile:
export PERL5LIB=/home/user/perl/lib/perl5/site_perl/5.8.7:/home/user/perl/lib:/home/user/perl/lib/perl5:/home/user/perl/lib/perl5/site_perl
It won’t be effective until you log back in, if you want to make it effective in your current session, just type that line in your command prompt.