Monday, April 27, 2009

Gmail Configuration

CNAME: mail - 3600 - ghs.google.com.
MX: vinculumventures.com. - 3600 - 1 - aspmx.l.google.com.
MX: vinculumventures.com. - 3600 - 5 - alt1.aspmx.l.google.com.
MX: vinculumventures.com. - 3600 - 5 - alt2.aspmx.l.google.com.
MX: vinculumventures.com. - 3600 - 10 - aspmx2.googlemail.com.
MX: vinculumventures.com. - 3600 - 10 - aspmx3.googlemail.com.

Monday, April 20, 2009

A generic error occurred in GDI+.

When you program in VB.NET/C#, if you encounter into situation such as a GDI error. Chances are it is a permission issue. Do check that you have the required 'write' permission for the ASPNET and USER account. That should solve your problem.

Similarly for flex, if it keeps checking for permission when you are loading images from a folder, chances are it is a permission issue on your server.

To modify permission, Right click on 'permission' inside IIS for the folder.

Saturday, April 18, 2009

Phrases

One chapter in a person life is not going to define the rest of his life.
Countries that out studies us will outperform us tomorrow
The absence of evidence, does not give evidence of absence
You do not marry someone whom you can live with, you marry someone whom you can't live without

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;
}

List of countries

<option value="Andorra ">Andorra </option><option value="Argentina ">Argentina </option><option value="Australia ">Australia </option><option value="Austria ">Austria </option><option value="Azerbaijan Republic ">Azerbaijan Republic </option><option value="Bahrain ">Bahrain </option><option value="Belgium ">Belgium </option><option value="Belize ">Belize </option><option value="Bhutan ">Bhutan </option><option value="Brazil ">Brazil </option><option value="Brunei ">Brunei </option><option value="Bulgaria ">Bulgaria </option><option value="Cambodia ">Cambodia </option><option value="Canada ">Canada </option><option value="Chile ">Chile </option><option value="China Worldwide ">China Worldwide </option><option value="Costa Rica ">Costa Rica </option><option value="Croatia ">Croatia </option><option value="Cyprus ">Cyprus </option><option value="Czech Republic ">Czech Republic </option><option value="Denmark ">Denmark </option><option value="Ecuador ">Ecuador </option><option value="El Salvador ">El Salvador </option><option value="Estonia ">Estonia </option><option value="Finland ">Finland </option><option value="France ">France </option><option value="French Guiana ">French Guiana </option><option value="Germany ">Germany </option><option value="Gibraltar ">Gibraltar </option><option value="Greece ">Greece </option><option value="Greenland ">Greenland </option><option value="Guatemala ">Guatemala </option><option value="Honduras ">Honduras </option><option value="Hong Kong ">Hong Kong </option><option value="Hungary ">Hungary </option><option value="Iceland ">Iceland </option><option value="India ">India </option><option value="Indonesia ">Indonesia </option><option value="Ireland ">Ireland </option><option value="Israel ">Israel </option><option value="Italy ">Italy </option><option value="Japan ">Japan </option><option value="Jordan ">Jordan </option><option value="Kazakhstan ">Kazakhstan </option><option value="Kuwait ">Kuwait </option><option value="Kyrgyzstan ">Kyrgyzstan </option><option value="Latvia ">Latvia </option><option value="Liechtenstein ">Liechtenstein </option><option value="Lithuania ">Lithuania </option><option value="Luxembourg ">Luxembourg </option><option value="Malaysia ">Malaysia </option><option value="Mexico ">Mexico </option><option value="Nepal ">Nepal </option><option value="Netherlands ">Netherlands </option><option value="New Zealand ">New Zealand </option><option value="Nicaragua ">Nicaragua </option><option value="Norway ">Norway </option><option value="Oman ">Oman </option><option value="Papua New Guinea ">Papua New Guinea </option><option value="Peru ">Peru </option><option value="Philippines ">Philippines </option><option value="Poland ">Poland </option><option value="Portugal ">Portugal </option><option value="Qatar ">Qatar </option><option value="Romania ">Romania </option><option value="Russia ">Russia </option><option value="San Marino ">San Marino </option><option value="Saudi Arabia ">Saudi Arabia </option><option value="Singapore ">Singapore </option><option value="Slovakia ">Slovakia </option><option value="Slovenia ">Slovenia </option><option value="South Africa ">South Africa </option><option value="South Korea ">South Korea </option><option value="Spain ">Spain </option><option value="Sri Lanka ">Sri Lanka </option><option value="Suriname ">Suriname </option><option value="Sweden ">Sweden </option><option value="Switzerland ">Switzerland </option><option value="Taiwan ">Taiwan </option><option value="Tajikistan ">Tajikistan </option><option value="Thailand ">Thailand </option><option value="Turkey ">Turkey </option><option value="Turkmenistan ">Turkmenistan </option><option value="Ukraine ">Ukraine </option><option value="United Arab Emirates ">United Arab Emirates </option><option value="United Kingdom ">United Kingdom </option><option value="United States ">United States </option><option value="Uruguay ">Uruguay </option><option value="Vatican City State ">Vatican City State </option><option value="Venezuela ">Venezuela </option><option value="Vietnam ">Vietnam </option><option value="Yemen ">Yemen </option>

Thursday, April 9, 2009

Hitler (Charlie Charplin) Speech

"I'm sorry, but I don't want to be an emperor. That's not my business. I don't want to rule or conquer anyone. I should like to help everyone if possible - Jew, Gentile - black man - white.
We all want to help one another. Human beings are like that. We want to live by each other's happiness - not by each other's misery. We don't want to hate and despise one another. In this world there's room for everyone and the good earth is rich and can provide for everyone.

The way of life can be free and beautiful, but we have lost the way. Greed has poisoned men's souls - has barricaded the world with hate - has goose-stepped us into misery and bloodshed. We have developed speed, but we have shut ourselves in. Machinery that gives abundance has left us in want. Our knowledge has made us cynical; our cleverness, hard and unkind. We think too much and feel too little. More than machinery we need humanity. More than cleverness, we need kindness and gentleness. Withouhese qualities, life will be violent and all will be lost.

The aeroplane and the radio have brought us closer together. The very nature of these inventions cries out for the goodness in man - cries for universal brotherhood - for the unity of us all. Even now my voice is reaching millions throughout the world - millions of despairing men, women, and little children - victims of a system that makes men torture and imprison innocent people. To those who can hear me, I say: 'Do not despair.' The misery that is now upon us is but the passing of greed - the bitterness of men who fear the way of human progress. The hate of men will pass, and dictators die, and the power they took from the people will return to the people. And so long as men die, liberty will never perish.

Soldiers! Don't give yourselves to brutes - men who despise you and enslave you - who regiment your lives - tell you what to do - what to think and what to feel! Who drill you - diet you - treat you like cattle, use you as cannon fodder. Don't give yourselves to these unnatural men - machine men with machine minds and machine hearts! You are not machines! You are not cattle! You are men! You have the love of humanity in your hearts. You don't hate, only the unloved hate - the unloved and the unnatural!

Soldiers! Don't fight for slavery! Fight for liberty! In the seventeenth chapter of St Luke, it is written the kingdom of God is within man not one man nor a group of men, but in all men! In you! You, the people, have the power - the power to create machines. The power to create happiness! You, the people, have the power to make this life free and beautiful - to make this life a wonderful adventure. Then in the name of democracy - let us use that power - let us all unite. Let us fight for a new world - a decent world that will give men a chance to work - that will give youth a future and old age a security.

By the promise of these things, brutes have risen to power. But they lie! They do not fulfil that promise. They never will! Dictators free themselves but they enslave the people. Now let us fight to fulfil that promise! Let us fight to free the world - to do away with national barriers - to do away with greed, with hate and intolerance. Let us fight for a world of reason - a world where science and progress will lead to all men's happiness. Soldiers, in the name of democracy, let us unite!

Inmates as telemarketers

The US prison department is using the inmates as telemarketers.

You know.. What I do to telemarketers when they call me? I will pick up and then I will say oh yes, and ask them to hold on for a second and go about doing my things, come back one hour later and hang up the phone. Its not such a good idea anymore huh? They are inmates, they have my telephone number, and they may come out one day.


--------------------------------------------------------------------------------

Tay Choon Teng (I kill you). Multiple disruptions. The NSF that burst my vein.

--------------------------------------------------------------------------------


Oh you are a scholar? Can I do project with you?

--------------------------------------------------------------------------------

The world is small, becareful on who you tell on. (I think he cannot make it in life)
Followed by the dinner with Erika which ended up with the conclusion


--------------------------------------------------------------------------------

Mango spoon licking incident

--------------------------------------------------------------------------------

Italy and how unsafe it is (coach lost camera). TomatoMayo. Breastfeeding with muslim

--------------------------------------------------------------------------------

USA, sucky weather, nothing to do, black man smile, thanksgiving turkey, black friday, online shopping addiction, research on HCI and Virtualization. Demographics of students, lack of exams, student quality - project manager only, z4, bribe, driving test that never materialize, danger, snow, spring carnival. Lost of iphone.

--------------------------------------------------------------------------------

Golf, pittsburgh, singapore, malaysia, indonesia

--------------------------------------------------------------------------------

Poly, KTV days, Javelin, President Track and Field, Play poker in car


--------------------------------------------------------------------------------

Kath, demanding, mad, clinic, jeans, combing hair, breakup threats, birthday breakup

--------------------------------------------------------------------------------

Perry, Samantha, Carol, MH, PY, Nikky. Running at gim moh, driving across the causeway. pimp

Monday, April 6, 2009

Populate Dropdownlist programmatically

Say if you need to populate a dropdownlist programatically and do not have access to a bindable object or array. You have to first of all create an ArrayCollection, then create an object. Add that object within the ArrayCollection then set the dataprovider of the combobox to point to that. Its incredible how something so simple can be so hard to achieve in Flex.

try {
var qnsArrayList:ArrayCollection = new ArrayCollection();
var counter:int;
for (counter = 0; counter < qnsArray.length; counter++) {
var obj:Object = {data:qnsArray[counter][0],label:qnsArray[counter][1]};
qnsArrayList.addItem(obj);
}
ddl_response.labelField = "label";
ddl_response.dataProvider = qnsArrayList;
} catch (error:Error) {
Alert.show(error.message);
}

Saturday, April 4, 2009

SQL Left Join Twice

Say if you have two category id for a logo {logoId, logoCode }, and the category {catId,catDescription} belongs to another table with a link on table {catId, logoId} we need to left join on each logo twice, so that we can get the logo category as a single row. The SQL is as follows:

SELECT `categoryLinksId`, `_category`.`catId` as `pcatId`, `_category`.`catName` as `pcatName`, `category1`.`catId` as `ccatId`, `category1`.`catName` as `ccatName` FROM (`_categorylinks` LEFT JOIN `_category` ON `_categorylinks`.`parent_categoryId` = `_category`.`catId`) LEFT JOIN `_category` as `category1` ON `_categorylinks`.`child_categoryId` = `category1`.`catId`

Update parent body from child popup

This script is typically full of bugs due to the difference in the way Javascript is being processed in Internet Explorer or Firefox. Fundamentally, the difference is in the way Internet explorer does chaining (its more intelligent) as compared to that of Firefox. But then again, Firefox forces you to write good codes. What normally works in Firefox will work in Internet Explorer, but not neccessarily the other way round.

Anyhow, the codes for the parent window is as follows:
<script type="text/javascript">
<!--
// What these codes does it open up a popup when you click on something and when we receive a signal from the child, we updateLayer
function openBrWindow(theURL,winName,features) {
(theURL,winName,features);
}
function updateLayer() {

var obj = document.getElementById('selectcat1');
obj.innerHTML = "Testing"; // I had to do it this way else Firefox won't accept it!
}
//-->

</script>
You can open a new window with the following:

<a onclick="openBrWindow('selectcat.php','selectcat1','location=0,scrollbars=1,width=700,height=300')" href="#">popup</a>
The thing to update in parent is a SPAN Tag:
<span id="selectcat1" class="greyFont">None</span>


The codes for the child popup window is:
<script type="text/javascript">
<!-- function updateParentCloseSelf() {

opener.updateLayer();
self.close();
}
//-->
</script>

The button within the child is:

<input onclick="javascript:updateParentCloseSelf();" border="0" value="Submit Query" type="submit" name="Submit">

Wednesday, April 1, 2009

Accurately Position Drag and Drop Item

Anyone who played with Flex' drag and drop function (for canvas) will know that the drag and drop function will cause the image to be incorrectly placed on a canvas. That is, the background transparent image will appear on this particular position (when you hold down your mouse button) but when you release your mouse, the image appears in another position that is not accurately where you dropped it.

This is due to the fact that the image (when you clicked) had a pointer that was not at coordinates zero, zero. When we click the image and drag, it was most likely at a portion of the image, and when we drag it around the canvas, the 'transparent rectangular background of the image' made it appear as if we are dropping the image at that particular rectangular position.

You can see the codes to do drag and drop for canvas at:
http://livedocs.adobe.com/flex/3/html/help.html?content=dragdrop_7.html

In order to overcome this problem, at line dragInitiator, i added the following lines:
ds.addData(event.localX, "NumberX");
ds.addData(event.localY, "NumberY");

Then at the line of dragDropHandler, I placed the following:
Image(event.dragInitiator).x =
Canvas(event.currentTarget).mouseX- parseInt("" + event.dragSource.dataForFormat("NumberX"));
Image(event.dragInitiator).y =
Canvas(event.currentTarget).mouseY- parseInt("" + event.dragSource.dataForFormat("NumberY"));

Viola! Your image should appear wherever you drop them now.