Tuesday 29 June 2010

HTML5 and touch phone devices

Here is the first (I think) framework for Mobile phone (touch) devices, I need to explore more on this and will post in detail soon.

http://www.sencha.com/

Sencha Touch allows your web apps to look and feel like native apps. Beautiful user interface components and rich data management, all powered by the latest HTML5 and CSS3 web standards and ready for Android and Apple iOS devices. Keep them web-based or wrap them for distribution on mobile app stores

Friday 18 June 2010

Abobe Flex ArrayCollection Sort

This is a inbuilt functionality, which I used to sort the ArrayCollection.
I just wanted to put it here so this can be handy for my reference, ;)

public var availableRegions:ArrayCollection = new ArrayCollection();
/* Create the SortField object for the "data" field in the ArrayCollection object, and make sure we do a numeric sort. */
var dataSortField:SortField = new SortField();
dataSortField.name = "name";
dataSortField.caseInsensitive = true;

/* Create the Sort object and add the SortField object created earlier to the array of fields to sort on. */
var regionDataSort:Sort = new Sort();
regionDataSort.fields = [dataSortField];

/* Set the ArrayCollection object's sort property to our custom sort, and refresh the ArrayCollection. */
availableRegions.sort = regionDataSort;
availableRegions.refresh();

Load Testing using JMeter

This week I got chance to do load testing using JMeter for the work we have done @ 2nd Byte

This was the first time I used JMeter, which is an open source and quite impressive.

It's can't record user's click like some of the paid load performance check tools but it still does the job.

Here is the link for the Download: JMeter

Its very easy to use.

Give it a try, its worth trying it.

Enjoy

Action script Date Data Provider

I had a requirement to show 2 drop downs for From and To selection of months and year, values like this:

Jan, 2010
Feb, 2010 and so on

And I used the following class to get this working like this.

Based on the class from
http://flexdateutils.riaforge.org/

public function getListOfMonthsAndYear(date:Date,noOfMonths:int = 12):ArrayCollection
{
var monthArr:ArrayCollection = new ArrayCollection();
var obj:Object = new Object();
var dt:Date = new Date();
var n:int = 0;
for (var i:int = noOfMonths; i >= 0; i--)
{
n++;
dt = DateUtils.dateAdd(DateUtils.MONTH,-i, date);
obj = new Object();
obj['label'] = DateUtils.dateFormat(dt,'MMM YYYY');
obj['data'] = DateUtils.dateFormat(dt,'YYYYMM');
obj['no'] = n;
monthArr.addItem(obj);
}
return monthArr;
}

Then I created filtering on the second drop down to remove all the entries which are not relevent, like if you select in your From combo, say Month March, 2010 then you don't want user to select Jan, 2010 in To combo as that would be wrong.

Here is the filter I created on Array Collection:

/**
* From Month Change Handler
*/
private function onFromMonthChange(event:Event):void
{
var comboBox:ComboBox = null;

comboBox = event.currentTarget as ComboBox;
this.currFromMonthNo = Number( comboBox.selectedItem.no );
this.monthToDP.filterFunction = this.toMonthFilter;
this.monthToDP.refresh();
if (this.monthToDP.length > 0) this.monthsTo.selectedIndex = 0;
this.criteria.monthFrom = this.monthsFrom.selectedItem.data;
this.criteria.monthTo = this.monthsTo.selectedItem.data;
}

private function toMonthFilter(obj:Object):Boolean
{
return Number(obj.no) >= this.currFromMonthNo;
}

Actually I used a trick to store number starting from 1 to end of the list in both collections and removed the items with the no's above the selected one from To combo list

Enjoy

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