Friday, April 17, 2009

Transparency issues with SPRY in Dreamweaver

When we add transparent PNG and use any effects in dream weaver, we may get problems with the transparency. There may be unwanted border color around the area of transparency. To solve that, we can very simply add a border color to it using CSS.

A simple style="background-color:#FFFFFF" will fix the problem.

Centering DIV

Centering a DIV using CSS

#content { width: 700px ; margin-left: auto ; margin-right: auto ;}

But how do you center a DIV in the center within a DIV? Say I have two absolute div and one is within the other. Both has got position set to absolute. We can do this:
<div style="width:900px;position:absolute;margin-left:-450pxtop:50px;left:50%;">

position:absolute will set the position to absolute
left:50% will set the child div to be drawn in the center
margin-left:450px will dictate that the drawn child be drawn to left by 450

Tuesday, April 14, 2009

Convertible Top Care

I was researching on convertible top car care kits recently and found two products. Mainly 303 and RaggTop. RaggTop is the premium version of 303 (as it appears by pricing). The last thing I want to do is to spoil my convertible's roof and hence I went ahead to buy the RaggTop kit from Amazon.

But before you buy any convertible car care kits, do make sure you check out if your convertible's roof is fabric or vinyl. It is different! Google about your car top material online. At least I am certain that my Z4 is Fabric :)

RAGGTOPP Convertible Top Care Kit - Fabric

PHP Debug Using TextFiles

The best way to debug PHP application is using textfiles.

$fp=fopen("temp.txt",'a');
fwrite($fp, $sqlCmd . "\n\n");
fclose($fp); // close file

Monday, April 13, 2009

Flex Getting Image Dimension before load complete

Flex does not have any library that supports obtaining the source image height and width on load. If you need to put the image into a container, you will not be able to manipulate the container/image accurately. For example, I was trying to put an image into a container, and set the image to 100% width and 100% height. But this wont work since the container does not have the correct image dimension.

To overcome this, we can make use of PHP's internal function 'getimagesize'. The codes are as follows:

$file = "uploader/upload/" . $row_imageinfo['bitmapurl'];
$info = getimagesize($file);
$width = 0;
$height = 0;
list($width, $height) = $info;


echo("<?xml version=\"1.0\" encoding=\"utf-8\"?>");
echo("<result>");
echo(sprintf("<picurl>%s</picurl>",$row_imageinfo['bitmapurl']));
echo(sprintf("<width>%s</width>", $width));
echo(sprintf("<height>%s</height>", $height));
echo("</result>");

?>

Sunday, April 12, 2009

css id and class

Usage of class and id in CSS for DIVs

.newsRowText {
color:#333333;
margin:10px;
line-height:22px;}

.newsRowText#errors {
color:#CC0000;
margin:10px;
line-height:22px;
}

<div id="errors" class="newsRowText">Error Message</div>
<div class="newsRowText">Normal Message</div>

Flex getting objects that are created

Things to note:
1. When we create an object, they belong to a particular container, so when we access it we need to make sure that the accessor is going in order of it. Say for example, I have a button inside the RichTextArea object, I need to do this in order to access it:
this.richtextarea.textarea.button and not just simply this.richtextarea.button

2. We can access objects created on screen in two ways.
a. When we add the objects we created via an array. e.g.
public var imgArray:Array = new Array(); // this is declared at the top of the page
for (var count:int =0; count <>
var myImage:Image = new Image();
myImage.x = 10;
myImage.y = 10;
myImage.source = "whatever.jpg";
imgArray.push(myImage);
}

b. When we add a name to the object and obtain the current Event Source of it e.g.
public function init():void {
var myImage:Image = new Image();
myImage.x = 10;
myImage.y = 10;
myImage.source = "whatever.jpg";

myImage.name = "whatever";
myImage.addEventListener(MouseEvent.CLICK, getEventName);
}

public function getEventName(event:Event):void {
var myObject:Image = event.currentTarget as Image;
// if you want to get the image Name, we can do it like this:
// var myObjName:String = (event.currentTarget as Image).name;
}