Friday, 18 June 2010

Adobe Flex Combo box Binding Bug

I was working on one project at 2nd Byte and hit this problem of Combo Box's data provider not being updated intermittently.

I came across one post which described the bug in SDK 3.5 (it was in previous SDK's as well.

I was doing like this:
[Bindable] public var comboDP:ArrayCollection;

myComboBox.dataProvider = comboDP;

and this wasn't getting updated values and had to do like this to get this working:

myComboBox.dropdown.dataProvider = comboDP;


Link to the post

Enjoy

Yahoo rejects emails

My Friend Anuj hit a problem of his clients emails not being delivered to Yahoo users. and I found few links which could be a help if you hit the same problem.

Link 1

Link 2

Link 3

Link 4

DomainKeys

This looks like a Marathon or Herculean task to sort this thing out.

I thought putting it here might help someone or me at some point.

Friday, 11 June 2010

SQL makes decision for you - strange

I ran into a strange MSSQL behaviour.

I wanted to do some calculation and output it in my application like this:

Declare @aFlaot float

set @aFlaot = 3*1/2

select @aFlaot aFlaot

From above I was expecting a float value as I was storing it in a float type variable but it was returning 1 ( as an integer)

And when I tried following I got back right value with correct decimals

Ex 1)

set @aFlaot = 3*1.0/2

select @aFlaot aFlaot

Returned 1.5 (as expected)

Ex 2)

declare @aVal float
set @aVal = 1

set @aFlaot = 3*@aVal/2

select @aFlaot aFlaot

Returned 1.5 (as expected)

What I understand is SQL decides on the basis of values you are using in your calculation not the container type you are using.

Friday, 4 June 2010

Few links to get going on Ajax or Flex - Swiz

Flex framework - Swiz
http://www.briankotek.com/blog/index.cfm/2009/1/8/Using-Swiz-Part-1-Initial-Setup

JasonLint Validator
http://www.jsonlint.com/

Tuesday, 1 June 2010

Coldfusion transaction error

I came across very weird error from one of my cold fusion cfc page, which has quite a lengthy cftransaction in it with quite a lot insert queries and the error was:
Branch target offset too large for short

I had to split the code in 2 pages and moved transactions in and include page though I am against having an include page in cfc but for time being wanted this code to work, found an article related to this problem here:
Branch offset error

I am very amazed that this error is in Cold fusion from CF7 and CF9 still throws the same error.

I will try to ask the solutions from ColdFusion Gurus.

Finding file extension in SQL

Here is the SQL code to find the extension of a file:

declare @appurl varchar(50)
set @appurl= reverse('philip.singh.bedi.doc')

select reverse(LEFT(@appurl, CHARINDEX('.', @appurl) - 1)) ext,
reverse(RIGHT(@appurl, LEN(@appurl) - CHARINDEX('.', @appurl))) fname

Monday, 31 May 2010

Few Handy Javascript functions for HTML forms

Here are few handy javascript function, which I use on day today basis in my Web development:

// Returns string after trimming spaces from both sides
function AllTrim(str)
{
str = LTrim(str);
str = RTrim(str);
return str;
}
//Returns string after trimming spaces from left side
function LTrim(str)
{
return str.replace(/^\s+/g,'');
}
//Returns string after trimming spaces from right side
function RTrim(str)
{
return str.replace(/\s+$/g,'');
}
// validates email form field, if you pass true, it checks for empty field as well
function checkEmail(str, required)
{
regexPattern = /^[a-zA-Z_0-9-]+(\.[a-zA-Z_0-9-]+)*@([a-zA-Z_0-9-]+\.)+[a-zA-Z]{2,7}$/;
str = AllTrim(str);
if (required == 'undefined' || required )
{
if( str.length == 0 )
{
return false;
}
}
else
{
if( str.length == 0 )
{
return true;
}
}
return regexPattern.test(str);
}
// returns selected radio button value from a group of radio buttons in a form
function getSelectedRadioValue(formObj, obj)
{
var selected_radio_val = '';
for (var i=0; i < document[formObj][obj].length; i++)
{
if (document[formObj][obj][i].checked)
{
selected_radio_val = document[formObj][obj][i].value;
break;
}
}
return selected_radio_val;
}