Thursday, April 22, 2010

QuertyString and Includes PHP




instead of


The main reason being $navi will be an instance variable of header.inc.php file

Thursday, April 15, 2010

Flex Combobox

xmlSalons = XML(this.loadSalons.lastResult);
var xSalons:XMLList = xmlSalons.salon;

// add default for nothing
salons.push({data:"-1",label:"I will select a salon later."});

for each (var xSalon:XML in xSalons)
{
salons.push({data:xSalon.salonId,label:xSalon.name});
// for future usage to push salon object (for management) i.e. create/delete
//salons.push(new Salon(xSalon.salonId, xSalon.userId, xSalon.type, xSalon.name, xSalon.description));
}

ddlSalons.dataProvider = salons;
ddlSalons.labelField = "label";
ddlSalons.data = "data";
ddlSalons.selectedIndex = 0;

var obj:Object = ddlSalons.selectedItem;
obj["salon"] = obj["data"];

Wednesday, April 7, 2010

Bluetooth research

1. Problems getting bluetooth drivers to work on Vista.
-> Uninstall drivers and reinstall it, else try manually replacing the drivers. Lookout for the bluetooth icon on the bottom right on the taskbar instead of within control panel.

2. Motorolla offers WIDCOM stack.

Tuesday, March 30, 2010

PHP error on IIS

FastCgiModule
Data1 FASTCGI_RESPONSE_ERROR
Data2 PHP Warning: Unknown: open_basedir restriction in effect. File(C:\inetpub\rewards\index.php) is not within the allowed path(s): (C:\Windows\Temp) in Unknown on line 0
PHP Warning: Unknown: failed to open stream: Operation not permitted in Unknown on line 0

ErrorCode 5

The way to solve this is to comment the line on open_basedir in php.ini

Flash CS3 Alpha Tweening

In order for alpha to work, we have to set the text to static instead of dyanamic. It should still work as usual for images. if problem persists, close windows and make sure that the file is exported to the right place.

Tuesday, March 23, 2010

PHP File Upload

1. Setup .ini file within the directory to include the following lines:
post_max_size = 10000000
upload_max_filesize = 10000000

2. Make sure that HTML code contains the MAX_UPLOAD_SIZE hidden field

3. Use the following codes:
function uploadPicture() {

$uploaddir = "issuepics";

$pext = getFileExtension($_FILES['txtImgFile']['name']);
$pext = strtolower($pext);

if (($pext != "jpg") && ($pext != "jpeg"))
{
unlink($_FILES['txtImgFile']['tmp_name']);
return "Error: Extensions Unknown, only JPEG is allowed.";
}

// Resize image
$imgsize = getimagesize($_FILES['txtImgFile']['tmp_name']);
$imgfile = $_FILES['txtImgFile']['tmp_name'];

if (($imgsize[0] > 640) || ($imgsize[1] > 480))
{
$tmpimg = tempnam("/tmp", "MKUP");
system("djpeg $imgfile >$tmpimg");
system("pnmscale -xy 640 480 $tmpimg | cjpeg -smoo 10 -qual 50 >$imgfile");
unlink($tmpimg);
}

// Rename image
global $finalFileName;
$finalFileName = getRandomKey() . "." . $pext;
$newfile = $uploaddir ."/" . $finalFileName;

// copy image into directory
if (is_uploaded_file($imgfile))
{
if (!copy($imgfile,"$newfile"))
{
return "Error: Problem uploading file";
}
}

unlink($imgfile);

return "";

}

function getRandomKey() {
$rand = time() . rand(0,1000);
return $rand;
}

Saturday, March 13, 2010

503 Service Unavailable

This is likely due to the IIS application pool not being started.