Thursday, March 06, 2008
Thursday, February 21, 2008
Indian Fashion, Human Mannequins
Quote from the Wiki:
# A jointed model of the human body used by artists, especially to demonstrate the arrangement of drapery. Also called lay figure.
# A life-size, articulated doll mainly used to display clothing.
There seem to be a lot of India clothes tailors in Bangkok. These guys share a common trait and that is to stand *outside* the store like retards.
It is annoying as hell to see these characters standing around, doing nothing, staring the whole damn day.
I was quick to grab this photo. My hand was in the bag, I instantly powered on the camera, made the guy think I was going to climb up the stairs – only to turn around point and shoot! He was caught off guard and moved out of the frame after I shot the photo. Oops! Too late ;-)
Invest in some real Mannequins guys.. That's the least you can do!



External References:
http://en.wikipedia.org/wiki/Mannequin
Posted by
Andrew
at
Thursday, February 21, 2008
0
comments
Sunday, February 17, 2008
What Not to Do on Duplicate Records
You've probably grabbed a bunch of records from the database, pumped them into an array and then tried to delete the duplicate records. The result is a dataset that is messed up, the reason why is unknown.
Lets look at the array:
// Your query here
$SqlSelectRow = mysql_fetch_array($SqlSelectResult)
This behavior occurs because you perform the action on the contents in the array. Updates to the array are not reflected on the database, and therein lies the problem.
Be sure to directly update records in the database or have the array update contents in the db.
An easy solution though is to set the column as 'unique' and then dump the dataset. Be sure to remove the unique attribute once this process completes if you want duplicate records during future inserts.
Posted by
Andrew
at
Sunday, February 17, 2008
0
comments
Monday, February 11, 2008
Mobile Technology Forges Ahead At Barcelona
Interesting developments this year at the wireless industry meet in Barcelona.
Sony Ericsson decides to bundle Windows Mobile on smart phones.
Yes! This just *had* to happen sooner or later. Sony has designed and produced great looking hardware, be it notebooks, cellphones, flat screen TVs etc. Back in the Palm days, the Sony Palm PDA had the best form factor.
Designing software apps for a mobile device is a challenge. Small screens, restrictive input methods, tiny memory RAM/ROM and the User Interface real estate is limited.
Symbian is an obnoxious OS on a cellphone. I can never figure out the flow of logic on a Symbian OS. The UI is big and ugly, menus are nested way too deep and any setting that involves a network configuration … ouch .. good luck finding your way around.
I hope Sony decides to get rid of Symbian altogether, go full steam ahead with the Windows Mobile OS and release loads of applications off the Windows Mobile SDK. There is a great cloud of win mobile applications already, so finding developers should not be hard.
Windows mobile has been doing great on HTC devices. To keep the innovation going, HTC now has a giant of a competitor.
The newly announced Sony Xperia is packed with a gorgeous 800x480 touchscreen, WiFi radio and Mobile 6. The microSD flash support (a first one from Sony?) signifies Sony’s seriousness in embracing open standards and making its presence felt in the market.
I guess what really spun this development is the Apple iPhone. The iPhone was the *first* in telling users, “Hey look, we’ve re-created the software stack”. There are features like touch and a full fledged desktop class browser that users can now look forward too. Not to mention a gazillion of other features that cellphone companies never bothered about.
Motorola is in trouble today because of crappy software. The RAZR cellphone did not have a rock solid OS. Plus, adding in features and installing apps was hard and impossible. Hardware with pathetic software slapped on is junkyard scrap. Sony would be in this state too, had they not jumped the Windows Mobile route.
Interesting to see how this is going to go ahead. Robust windows mobile on sexy hardware that seamlessly integrates with the desktop. Good times ahead!
More Details on the Sony Press Release
Posted by
Andrew
at
Monday, February 11, 2008
0
comments
Monday, January 28, 2008
Summer of 69 Guitar Tablature
I am a Bryan Adams fan. Summer of 69 needs no introduction.
This is the guitar tablature of the first few seconds that starts the electricity.
Create these tabs in Guitar Pro.
Track 1
E E E E E E E E E E E E E E Q
E||--0--------2--------3-----|-----2--------0-----2----|
B||-----3--------3--------3--|--------3----------------|
G||--------2--------2--------|--2--------2-----2-------|
D||--------------------------|-------------------------|
A||--------------------------|-------------------------|
E||--------------------------|-------------------------|
E E E E E E E E E E E E E E Q E E E E E E E E
--------------------------|-------------------------|--0--------2--------3-----|
--0--------2--------3-----|-----2--------0-----2----|-----3--------3--------3--|
-----2--------2--------2--|--------2----------------|--------2--------2--------|
-----------------2--------|--2--------2-----2-------|--------------------------|
--------2-----------------|-------------------------|--------------------------|
--------------------------|-------------------------|--------------------------|
E E E E E E Q E E E E E E E E E E E E E E Q
-----2--------0-----2----|--------------------------|-------------------------||
--------3----------------|--0--------2--------3-----|-----2--------0-----2----||
--2--------2-----2-------|-----2--------2--------2--|--------2----------------||
-------------------------|-----------------2--------|--2--------2-----2-------||
-------------------------|--------2-----------------|-------------------------||
-------------------------|--------------------------|-------------------------||
Posted by
Andrew
at
Monday, January 28, 2008
0
comments
Wednesday, January 23, 2008
Enable UTF-8 on PHP, MySQL and Apache
Before we begin, you need r00t access to key Apache, PHP and MySQL configuration files.
Let’s start with the apache config. The location paths may differ based on your server setup. Look around and be sure that you are editing real config files and not the templates.
Apache Config - /etc/httpd/conf/httpd.conf
AddDefaultCharset UTF-8
PHP Config – /etc/php.ini
default_charset = "utf-8"
MySQL Config - /etc/my.cnf
[client]
default-character-set=utf8
[mysqld]
character-set-server=utf8
default-character-set=utf8
default-collation=utf8_unicode_ci
init-connect='SET NAMES utf8'
character-set-client = utf8
Restart the above services once these updates have been applied.
Confirm if UTF-8 is Enabled:
# mysql –uroot –hlocalhost –p
# show variables like 'c%'
The above output should be:
+--------------------------+-------------------------------------------------------------------+
| Variable_name | Value |
+--------------------------+-------------------------------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8 |
| character_set_system | utf8 |
| collation_connection | utf8_general_ci |
| collation_database | utf8_unicode_ci |
| collation_server | utf8_unicode_ci |
| completion_type | 0 |
| concurrent_insert | 1 |
| connect_timeout | 5 |
+--------------------------+-------------------------------------------------------------------+
It is possible that after these updates, PHP will continue to decode a UTF-8 character set in the form of question marks. Eg: ????
The solution is to call mysql_query() immediately after mysql_connect() has attempted a connection to the database.
$db_ = @mysql_connect (HOST, USER, PASSWORD, TRUE) or die("Could not connect");
mysql_query('SET NAMES utf8');
mysql_select_db(DB, $db_);
(Note the mysql_query('SET NAMES utf8'); above)
// Other db connect info here
// To be continued
Howto override php.ini through htaccess
Posted by
Andrew
at
Wednesday, January 23, 2008
6
comments
Monday, January 14, 2008
MySQL Access Denied Error
Before dumping a list of databases between different MySQL servers, be sure to exclude the MySQL database.
Assuming you are importing the dump from Server A to Server B, the database imports the password from Server A onto B. There could be a few other settings that could be messed up too in the MySQL db if the versions are different.
To resolve this issue, set the MySQL password /etc/my.cnf on Server B to the one that was set on Server A. Restart the MySQL daemon.
To prevent this issue from occurring, specify the --databases parameter and explicitly mention the database names to be included before the process is executed.
Posted by
Andrew
at
Monday, January 14, 2008
0
comments
Tuesday, January 01, 2008
Queen Elizabeth - The Christmas Broadcast 1957
Interesting how a message from Queen Elizabeth back in 1957 continues to hold true today.
Minute 2:33/7:56
... trouble is caused when honesty is counted as foolishness
... loose the trust of the world if we abandon fundamental principles
... it has always been difficult to build and destroy. To build and cherish is much more difficult.
Posted by
Andrew
at
Tuesday, January 01, 2008
0
comments
Wednesday, November 21, 2007
The Future of Books
There are the brick and mortar book stores, used and tattered books, online book stores and ebooks. All these book models have issues.
Books in book stores can be overpriced. You might spend a tonne on a book, read and figure out it wasn't worth the money. Your stuck with an expensive paperweight. Used books can be in a bad shape, pages missing, dogs ears and everything that can destroy paper.
The ebook format is not the best to read on a laptop. Hard to read on a bed and the experience is far from a real book.
Enter amazon.com
A whole new device that specializes in book reading from the worlds largest book store! Books, newspapers, blogs and magazines pushed to the device, straight from the store.
The amazon kindle is a wireless reading device. The kindle connects to a cellphone network (USA only) and downloads books wirelessly. You need to buy books in the kindle format. Books are pushed by amazon.com onto the device FREE. And No, you don't need a cellphone plan to connect to the network. The device is network *aware* out of the box.
The e-ink display ensures that text is clearly visible in direct sunlight. Hardware controls flip pages and zoom in/out of text.
Kudos to amazon.com. A device such as this, allows a subscription model and maybe book rentals.
This would also allow better and flexible screen displays and maybe the end of fat-n-heavy books.
Amazon Kindle Tech Specs:
Display: 6" diagonal E-Ink® electronic paper display, 600 x 800 pixel resolution at 167 ppi, 4-level gray scale
Size (in inches): 7.5" x 5.3" x 0.7"
Weight: 10.3 ounces
System requirements: None, because it doesn't require a computer
External Links:
Amazon Kindle
Posted by
Andrew
at
Wednesday, November 21, 2007
0
comments
Friday, November 09, 2007
Global Warming, Sue the Government
With every passing year, our climate seems to be getting hotter or colder (depending on where you are located). It is easy to notice unexpected rainfall in the middle of summer or winter, rise in sea levels and other natural disasters.
I think the first step in getting a grip on green house gases is to sue the government. Oil companies are evil. They will do whatever it takes to _stop_ progress and widespread adoption of renewable sources of energy.
A case against the government should be such that:
A) A settlement (buying out of officials) is never reached
B) The case cannot be dismissed
C) A solution should be found
D) After the court proceedings have ended, the government should fund projects related to renewable sources of energy
So why sue the government?
Governments pass and enforce laws -> Oil companies do not -> Oil companies buy out government officials -> Government officials buy out climate *experts* -> Government officials lax out laws/rules related to environment.
Governments _profit_ trillions of dollars from oil companies.
Global Warming Fast Facts
http://news.nationalgeographic.com/news/2004/12/1206_041206_global_warming.html
This is a great start,
California Sues EPA Over Auto Emissions
http://www.breitbart.com/article.php?id=D8SPL3IG1&show_article=1
Posted by
Andrew
at
Friday, November 09, 2007
1 comments
Wednesday, October 31, 2007
Howto Display Records from a Database without Refreshing the Entire Page, PHP & AJAX
This post address a common question found on on AJAX and PHP forums.
Howto grab the newest records from the database and display them without the traditional meta refresh?
Or
Howto display records from a database without refreshing the entire page?
The requirements:
A basic understanding of AJAX. Get started with AJAX here: http://developer.mozilla.org/en/docs/AJAX:Getting_Started
PHP
MySQL
A dataset
I am going to use the mozilla developer docs as a reference point.
The first step is to create a HTTP request. Before we do that we need to figure out the browser that the user is running.
If the browser is Internet Explorer, call the ActiveXObject
else, call the XMLHttpRequest();
// This includes all browsers other than Microsoft Internet Explorer.
//Mozilla, Safari etc
// Create the HTTP request
function createRequestObject()
{
var browser;
if (window.XMLHttpRequest)
{
// Mozilla, Safari, ...
browser = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{
browser = new ActiveXObject("Microsoft.XMLHTTP");
}
return browser;
}
var httpRequest = createRequestObject();
Once we've got the HTTP request setup, our next step is to grab the contents from the database. It is here that we set the time interval or the frequency on when the updated content is displayed.
We're going to call a PHP script get_records.php that actually grabs the dataset from the database. More on the PHP script later.
The time interval is set to 300000 milli seconds, 5 minutes
Convert minutes to seconds:
5 minutes = 5 x 60 seconds = 300 seconds
Convert seconds to milli seconds:
300 seconds = 300 x 1000 milli seconds = 300000 milli seconds
Note the exception handler below. The alert popup box will appear if there was an error. You can comment out that line later.
function displayOutput()
{
try
{
setTimeout("displayOutput()", 300000); // Recursive JavaScript function calls displayOutput() every 5 minutes, 1800 seconds
httpRequest.open('GET', 'get_records.php', true);
httpRequest.onreadystatechange = handleResponse;
httpRequest.send(true);
}
catch( e1 )
{
// Unable to open file
alert('Caught Exception: ' + e1.description);
}
}
The next step is to handle the data. We've made the HTTP request, we've called the PHP script, we've got the data. What are we going to do with the data?
If everything went well, readystate should be == 4(complete) and httpRequest.status should be == 200. All ok .. Proceed to set the innerHTML with the data.
Read about innerHTML:
http://msdn2.microsoft.com/en-us/library/ms533897.aspx
function handleResponse()
{
try {
if (httpRequest.readyState == 4) {
if (httpRequest.status == 200) {
//alert(httpRequest.responseText);
document.getElementById("data").innerHTML = httpRequest.responseText;
} else
{
alert('There was a problem with the request.');
}
}
}
catch( e2 )
{
alert('Caught Exception: ' + e2.description);
}
}
Our final step is to display the data:
\<\body onload\=\"displayOutput\(\)\;\"\>
\<\div id\=\"data\"\>\<\/div\>
\<\/body\>
To be continued ...
Posted by
Andrew
at
Wednesday, October 31, 2007
0
comments
Crash A Wedding
Living in a boring city that does nothing during the weekends?
Crash a wedding!
The important tip to remember is , "Dress Appropriately"
Read more:
How To: Crash A Wedding
http://www.askmen.com/fashion/how_to_200/241b_how_to.html
Watch the movie, Wedding Crashers
http://www.imdb.com/title/tt0396269/
Posted by
Andrew
at
Wednesday, October 31, 2007
0
comments
Friday, October 12, 2007
Parse error: syntax error, unexpected ':'
If short open tags are enabled and if the HTML content in a PHP file has a <\?, PHP will display the error, Parse error: syntax error, unexpected ':'
Tags such as <\? could be used to open XML tags or other non PHP based tags.
The solution is to disable the short_open_tag directive in the \/etc\/php.ini file. This would force PHP to parse PHP code with tags that begin with <\?php
Posted by
Andrew
at
Friday, October 12, 2007
0
comments
Thursday, October 11, 2007
Winamp's Redesign Interface .. Thumbs Down
A friend of mine once mentioned, "But Winamp looks old". I had to agree with her on this one.
We were talking about media players. Media players that support a variety of formats thrown at them, support ripping and burning on the fly and Yes - Look Modern.
It is Winamp's 10th anniversary. "A completely redesigned interface, including Album Art" says the updated version history. I have been looking out for a Winamp redesign since version 3. The fact that Winamp version 3 Wasabi was dumped wasn't a good thing, but that is another story.
So I proceed to download, click the download link, hit save, 8 minutes later I run the installer. A few pre-install questions and 5 seconds to go. Tada! The new "Bento redesigned interface" appears. The default color scheme is dark, pasty and bland. I am not impressed at all. Nothing to wow about. Fonts do _not_ look smooth and are in need of anti-aliasing.
The three pane layout feels fossilized. I remember Winamp version 1 and 2 looking the same. Screen elements look clumsy. I need to click a handler inorder to figure out what they do.
I am on a 1280x800 resolution display at 120 DPI. Winamp should have looked gorgeous. I fail to understand why the redesign did not include better and _modern_ color schemes. The royal blue color scheme looks hideous. There is a total absence of gloss or the glass effect found on Windows Vista, Windows Media Player, the Windows Media Center application etc. Even Windows Mobile 6 and the new Motorola UI look shiny.
So what happened? Nullsoft is owned by AOL. Is AOL trying _not_ to get into the Radio business? AOL has probably secured deals with a dozen other apps.
Posted by
Andrew
at
Thursday, October 11, 2007
0
comments
Monday, October 01, 2007
Bad ; sign errors in crontab file, can't install
Editing crontab with PICO editor might display the error:
"bad ; sign errors in crontab file, can't install"
The ; character is used to combine and run multiple commands in one statement. Your cron job might look like:
# Command One; Command Two
*/3 * * * * cd /usr/home/; php -q whatever.php
The above statement consists of two commands. The second command would be executed even if the first were to fail.
The solution is to get rid of the ; character. Use the && character instead.
The && character will _not_ execute command two if command one were to fail.
To get rid of the error, edit your cronjob like this:
*/3 * * * * cd /usr/home/ && php -q whatever.php
Posted by
Andrew
at
Monday, October 01, 2007
0
comments
Saturday, September 29, 2007
Unzip: cannot find or open file.zip
When extracting the contents of a corrupted .zip file, unzip will display the error:
"unzip: cannot find or open file.zip, file.zip.zip or file.zip.ZIP."
Before you move the .zip, be sure to run a test on the .zip:
#unzip -t file.zip
If the test fails, recreate the archive with tar or gzip.
Posted by
Andrew
at
Saturday, September 29, 2007
1 comments
Friday, September 28, 2007
Enable .htaccess to Overwrite Apache Config
If the htaccess AllOverwrite is disabled, Apache will throw up a 500 Internal Server Error
Enable htaccesss AllOverwrite by editing the following file on the webserver:
vi /etc/httpd/conf/httpd.conf
#Add or edit the line to look like this
AllowOverride AuthConfig Indexes Limit All
Posted by
Andrew
at
Friday, September 28, 2007
0
comments
Thursday, September 06, 2007
Apple is on Steroids
The business model at Apple is on steroids. A few more billions this holiday season.
Two months ago, the 8GB iPhone bagged a heafty price tag of $599. Fast forward today, two months later, a price cut of $200.
The iPod line has been split into two. iPod classic and the new iPod touch.
The breakdown:
iPhone 8GB - $399
iPod Classic 80GB - $249
iPod Classic 160GB - $349
iPod Touch 8GB - $299
iPod Touch 16GB - $399
The 8GB iPhone sounds reasonable at $399. The 16GB iPod Touch that has all the bells and whistles of the iPhone - is limited at 16GB!!?? WTF!
Why would a standalone device such as the iPod Touch boast a touch interface, 3.5inch widescreen, Safari, YouTube, WiFi on 16GB of storage? I guess this is a beta release. A years worth of waiting will see that storage double, triple and quadruple.
Innovative idea one, users can now purchase music directly from their iPod Touch and iPhone devices through the integrated iTunes store. Access iTunes through WiFi and buy music. Anywhere. Anytime.
Innovative idea two, Apple cut a deal with Starbucks. If your sipping coffee at Starbucks and wondering what song is playing, you bring up the iPod Touch or the iPhone, get into iTunes (through WiFi) and buy the song instantly. I guess, with Apples design philosophy behind great interfaces, this feature will trigger millions of legal downloads. USA only (for now).
A musician could well release an album at Starbucks and iPod users would _buy_ tracks they like. This strategy has great potential to start a whole new way to sell music legally and quickly.
Just in time for the holidays.. Ho Ho Ho
Very clever!
Posted by
Andrew
at
Thursday, September 06, 2007
0
comments
Monday, September 03, 2007
Put Your Laptop SD Card Slot to Use, Create Backups
Backups are generally created on the following media:
- DVD/R
- External USB flash devices
- External USB HDD
A laptops SD card slot generally goes unused. Mounting an external USB flash device takes over a USB port and can break if you forget to unplug the device.
- Stick in a SD card
- Create a batch script that runs the backup either manually or invoked through a task/CRON schedule
The following script executes winrar with command line parameters and dumps the ZIP onto the SD card.
-- Begin Copy and Paste --
@ echo off
echo Kill a running app
taskkill /f /im APP_NAME_HERE.exe
echo cd into the winrar directory
c:
cd progra~1\winrar\
echo Run winrar
winrar a f:\ -r -afrar -m1 -rr -rv -t -ilog -ag+bck-MMM-DD_YYYY__NNN -x@F:\exclude-dirs.txt F:\SOURCE
echo Copy .ZIP to the SD Card, h:\ is the SD destination
copy /v f:\bck-*.rar h:\
pause
-- End Copy/Paste --
Dump the above contents into a .bat file and voila!
Requirements:
SD/MMC/MS Card - newegg.com
Winrar or Winzip
Laptop, duh!
Posted by
Andrew
at
Monday, September 03, 2007
0
comments
Saturday, August 25, 2007
Managing Multiple Simultaneous Sessions With PHP
The Issue:
Managing multiple simultaneous sessions with PHP is not a fun thing.
How does one go about creating a session that is unique to the browser window or tab? The goal is to freeze the session state.
Generally when a user signs in into a Control Panel type of environment -> screen elements are displayed -> the user clicks on the element and performs the action. If the user were to open multiple new windows or tabs, all of the assigned session variables _will be_ overwritten. What this results in, is a huge mess of what was opened previously and newly opened content.
One way to work around this problem is to disable the right-click. Prevent the user from opening new windows, prevent the user from clicking any of the mouse buttons other than the left click. This workaround requires the user to sign in into the Control Panel with the Internet Explorer browser. Any other browser would fly through the filters. Javascript must be enabled etc etc. Detecting the browser_type is the next issue. It is possible to spoof the HTTP User Agent and have the client report, spoof and copy any other client/app. The disadvantages on such an approach quickly add to the mix. A lot of the online banking portals seem to follow this approach.
The next solution involves renaming and creating new PHP sessions. I haven't found this to work too well. There were too many hoops involved.
The Solution:
The solution is to create a multi-dimensional array. Dynamically feed and call the multi-dimensional array based on the parent called.
Lets say you have five variables (parent vars) and need to register five sessions. Create a unique hash for each of the five variables, create a multi-dimensional array and call the hash in every GET and POST request. Its that simple!
// session_start();
// Select vars from db
$foo = generate_hash();
// Loop them {
$_SESSION[$foo]['type'] = $foo;
}
To call these sessions, the subsequent pages would need to call a GET request of the form, $type = hash_value
Posted by
Andrew
at
Saturday, August 25, 2007
1 comments
Wednesday, July 18, 2007
RSM database is corrupt and cannot be Rebuilt
RSM database is corrupt and cannot be Rebuilt
Windows XP - If the Removable Storage service is disabled, the Computer Management applet will create an event log alert with the error:
"
RSM database is corrupt and cannot be rebuilt
"
To resolve this issue, set the Removable Storage startup type to Manual or Automatic(services.msc)
Alternatively, rebuild the RSM database by:
1. Stop the RSM Service
2. Delete the RSM databases located at %SystemRoot%\System32\NtmsData
3. Restart the RSM Service
Posted by
Andrew
at
Wednesday, July 18, 2007
0
comments
Tuesday, July 17, 2007
Google, Unable to login - Certificate Expired Error
Google, Unable to login - Certificate Expired Error
Logging in to any of google's services will display a certificate expired error. This issue will occur if your computer clock is out of sync and displays an incorrect date/time.
Internet Explorer will display the certificate error and the post login process will stall. A temporary workaround to the problem is to enter the correct date/time through the windows date/time applet located in the systray. Attempt the login again after the date/time has been corrected.
Generally, a date/time error occurs due to a dead CMOS battery.
This issue affects all of google's services that require a google account- gmail, gtalk, google accounts, orkut etc.
Further reading:
Google Support - I received an error message that said to check my computer's clock settings
Posted by
Andrew
at
Tuesday, July 17, 2007
0
comments
Tar: Cannot write: Disk quota exceeded
Tar: Cannot write: Disk quota exceeded
When creating a tar archive, tar will display the annoying error:
"
sdaX: write failed, user block limit reached
tar: Cannot write: Disk quota exceeded
tar: Error is not recoverable: exiting now
"
To resolve this issue, check that:
1) You have two times the free disk space proportionate to the size of the archive you are creating
2) The server does not have restrictions on individual file sizes
3) Hsphere - Double the disk quota value by navigating to the FTP user area and look for the quota parameter.
Note: Why hsphere has two config areas (FTP and Disk Limits) for controlling disk quotas is beyond my understanding.
The FTP quota is the real disk quota that controls free space available on the filesystem.
Posted by
Andrew
at
Tuesday, July 17, 2007
0
comments
Friday, June 22, 2007
Is your computer running out of RAM?
Windows Users, Howto know if your computer is running out of RAM/Memory:
Open the Windows Task Manager (ctrl + alt + delete). Note the stats below the PF history. (screenshot)

From the screenshot above:
Total Physical Memory - This is the total amout of RAM/Physical memory installed in the computer. Total amount of RAM installed = 1.5GB
Commit Charge - The maximum amount of space used by the pagefile = 1.2GB
Total Physical Memory (K) = 1562668 ~1.5GB
Commit Charge Peak value (K) = 1340072 ~1.2GB
* Divide (K) by 1048576 to convert value to GB
Total Free RAM/Memory = Total Physical Memory - Commit Charge Peak value
= 1.5 - 1.2
= 0.3GB (~307MB)
In this example, 307MB is the total free memory available under load. This number is acceptable. I still have room to run a few more apps.
IF your total free memory is in the negative, Windows _will_ swap contents to the pagefile instead of the memory. This causes applications to slow down and Windows runs like a pig. Perhaps its time for that long awaited RAM upgrade. ;-)
Linux, check the amount of free RAM available:
Run the command free -m at the shell prompt:
-sh-3.00$ free -m
total used free shared buffers cached
Mem: 1010 794 215 0 14 205
-/+ buffers/cache: 575 435
Swap: 2000 257 1743
Posted by
Andrew
at
Friday, June 22, 2007
0
comments
Sunday, June 17, 2007
Getting Up to Speed with RaidRails, Ruby on Rails
This how-to assumes you have a basic understanding of Ruby and Rails.
Requirements:
Windows XP (I have tested the following in a Windows XP Pro SP2 environment)
XAMPP:
Install - Apache & MySQL
http://www.apachefriends.org/en/xampp-windows.html
Instant Rails:
http://rubyforge.org/frs/?group_id=904
Radrails:
http://www.aptana.com/download_radrails.php
1) Configure Rails and Rake path
Navigate to the Instant Rails directory.
Select the rails binary and rake.bat as shown below
2) Setup the Ruby Interpreter
Select ruby.exe located in the \bin\ dir
3) Start the MySQL server
4) Create a New Project - RadRails
5) Enter a Project Name
6) Hello World!
Ruby:
http://www.ruby-lang.org/en/
Ruby on Rails framework:
http://www.rubyonrails.org/
Ruby forge:
http://rubyforge.org/
Ruby Help and Docs:
http://www.ruby-doc.org/
Streamlined:
http://streamlinedframework.org:8079/trac/
IBM Fast-track your Web apps with Ruby on Rails:
http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/
Posted by
Andrew
at
Sunday, June 17, 2007
0
comments
Thursday, May 24, 2007
PHP Fatal error: [] operator not supported for strings
PHP Fatal error: [] operator not supported for strings
PHP will throw up the error:
"Fatal error: [] operator not supported for strings"
if:
- The array variable eg, $foo[] has been set elsewhere as a string
- The array variable has already been set as an array elsewhere
The solution:
- Do not mix the same variable names between strings and arrays
- Do not create duplicate array names
Posted by
Andrew
at
Thursday, May 24, 2007
0
comments
PHP fopen Fails to Open Directory in Windows
fopen Fails to Open Directory in Windows
fopen — Opens file or URL
However, if the file is a directory, fopen will fail to open the directory in windows. This issue does not occur in Linux.
Windows Error:
Warning: fopen(c:\windows\): failed to open stream: Permission denied
Regardless of the permissions on the windows or any other directory, fopen will display the error.
PHP Code:
Windows:
$fh = fopen('c:\\windows\\', 'r');
Linux:
$fh = fopen('/home/test/', 'r');
fopen Fails to Open Directory in Windows
Posted by
Andrew
at
Thursday, May 24, 2007
1 comments
PHP INSERT an Array into MySQL
Inserting an array into MySQL while escaping the string with mysql_real_escape_string() will throw up the error:
"mysql_real_escape_string() expects parameter 1 to be string"
I haven't got down to research the real reason behind this issue. The obvious reason is that mysql_real_escape_string() escapes all characters in a string. To escape an array, I guess we'd need to loop the contents and return the escaped array.
The solution:
-- During INSERT or UPDATE
- Serialize the array before the INSERT or UPDATE query
$array_var[] = $some_data;
$serialized_array = serialize($array_var);
// mysql_real_escape_string() will now escape $serialized_array and insert/update without errors.
-- During SELECT
- Unserialize the array after the SELECT query is executed
$array_var = unserialize($get_all[$k]['array_var']);
// Print the array
print_r($array_var);
Posted by
Andrew
at
Thursday, May 24, 2007
0
comments
Tuesday, May 22, 2007
Logic to Check the Status of a URL
Open socket to host
Check socket status
Proceed to grab headers
Check headers status
IF the URL is a file or similar
Parse page and look for href patterns
For each URL
Open socket to host
Check socket status
Proceed to grab headers
Check headers status
End
// Local Filesystem - Perform integrity checks
// Local Filesystem - Checks on date attribute
// Local Filesystem - Replace domain with the localPath, check status
Posted by
Andrew
at
Tuesday, May 22, 2007
0
comments
Monday, May 21, 2007
sudo vs su -
The "sudo" command allows users specified in a sudoers file which is usually located in the /etc directory to perform certain functions (again, as permitted by the sudoers file) that are normally reserved for the root user. The syntax would be something like:
sudo command
where command is normally limited to the root user. You may be prompted for your normal user password, and if the root user has given you permission (in the sudoers file) to perform that action, you can.
The "su" command is a "switch user" command. In its simplest form, typing "su" will prompt you for the root password and if given correctly you get root privileges. Typing "su -" and giving the correct password gives you root's privileges and environment. The "su" command can also be used to gain access to another "normal" user's account if you have that user's password. To do that you would type "su" where is a valid normal user on that system.
Posted by
Andrew
at
Monday, May 21, 2007
0
comments
