Tuesday, November 30, 2010

jQuery Mobile has launched API for Mobile Applications Development

Hmmm.... jQuery launched Mobile API called jQueryMobile. http://jquerymobile.com/

I have tried to use this for a blackberry mobile application. But it was not working as it should work :(

jQuery Mobile issues for BlackBerry device:

The following are the 2 main reasons that i have come across while using jQuery Mobile.

1. If i use jQuery mobile API, the content loading is very slow, & even a small ajax request is making the browser to hang.

2. Lists hyperlinks are not working. 

Hope, they will fix all the issues in next release :)

Friday, October 1, 2010

Unique Variant in Lotusscript

Get unique values in a variant by calling the below function in lotusscript.

Pass the variant to Unique function.


Function Unique(vSourceArray As Variant)
Dim iFound As Integer
Dim sTargetArray() As Variant

Redim sTargetArray(0) As Variant
sTargetArray(0) = ""

Forall sText In vSourceArray
iFound = False
Forall sNewText In sTargetArray
If sText = sNewText Then
iFound = True
Exit Forall
End If
End Forall
If Not iFound Then
If sTargetArray(0) ="" Then ' First time
sTargetArray(0) = sText
Else
Redim Preserve sTargetArray(Ubound(sTargetArray)+1)
sTargetArray(Ubound(sTargetArray)) = sText
End If
End If
End Forall

Unique = sTargetArray
End Function

Friday, July 2, 2010

Hide/Show the flex elements by id in action script 3

Hide/Show any flex element by ID in action script. Toggle any element in flex.

The below example gives the toggle of HBox on click of the label.

Here is the code to achieve the toggle functionality of any flex element in actionscript 3.

Have added the comments in the code to explain use of each element.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[
//Add event listner to any element in flex to call the below function to hide/show the HBox by id

//Say on click of the lable call the handlerFunction.
public function handlerFunction(event:Event):void {
//get the id of the element by getting the data of the calling element event
var id:String = event.currentTarget.data.toString();
//get the handle of parent element. i.e. VBox in the below code
var parentVBox:VBox = event.currentTarget.parent as VBox;
//get the handle to the element by id
var hBoxtoShow:HBox = parentVBox.getChildByName(id) as HBox;
//code to toggle the HBox (hide/show)
if (hBoxtoShow.includeInLayout) {
hBoxtoShow.includeInLayout = false;
hBoxtoShow.visible = false;
} else {
hBoxtoShow.includeInLayout = true;
hBoxtoShow.visible = true;
}
}

public function init():void {
//add HBox id to the lable data. This is used for dynamic hide/show of multiple elements
labelID.data = "hideHBox";
labelID.addEventListener(MouseEvent.CLICK , handlerFunction);
}
]]>
</mx:Script>
<mx:VBox id="mainVBox">

<mx:Label text="Click me" id="labelID"/>
<mx:HBox id="hideHBox">
<mx:Text text="Sample HBox filed to hide this on click of the label"/>
</mx:HBox>

</mx:VBox>
</mx:Application>

Sunday, June 6, 2010

Google Motion Chart using XML datasource

Gooogle Motion Chart using XML as data source

A dynamic chart to explore several indicators over time. The chart is rendered within the browser using Flash.

XML is used as datasource for motion chart instead of google spreadsheet.

<html>
<head>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load('visualization', '1', {'packages':['motionchart']});
google.setOnLoadCallback(getXMLData);

function getXMLData() {
url = "XML data url here"
if (window.XMLHttpRequest) { // Non-IE browsers
req = new XMLHttpRequest();
req.onreadystatechange = drawChartData;
try {
req.open("GET", url, true);
} catch (e) {
alert("Problem : " + e);
}
req.send();
} else if (window.ActiveXObject) { // IE
req = new ActiveXObject("Microsoft.XMLHTTP");
if (req) {
req.onreadystatechange = drawChartData;
req.open("GET", url, true);
req.send();
}
}
}

function drawChartData() {
if (req.readyState == 4) { // Complete
if (req.status == 200) { // OK response
var reqResponse = req.responseXML;
var xmlItems = reqResponse.getElementsByTagName("item")
//alert(xmlItems[i].getElementsByTagName("item1")[0].childNodes[0].nodeValue);
var data = new google.visualization.DataTable();
data.addColumn("string", "Country");
data.addColumn('date', 'Year');
data.addColumn('number', 'Projects');
data .addRows(xmlItems.length);

for (var i = 0; i < xmlItems.length; i++) {
//alert(xmlItems[i].getElementsByTagName("year")[0].childNodes[0].nodeValue);
data .setCell(i, 0, xmlItems[i].getElementsByTagName("country")[0].childNodes[0].nodeValue);
data .setCell(i, 1, new Date(xmlItems[i].getElementsByTagName("year")[0].childNodes[0].nodeValue));
data .setCell(i, 2, Number(new Number(xmlItems[i].getElementsByTagName("projects")[0].childNodes[0].nodeValue)));
}
//alert(data.getValue(0,0));
var chart = new google.visualization.MotionChart(document.getElementById('chart_div'));
chart.draw(data, {width: (screen.availWidth-50), height:(screen.availHeight-250)});
}

} else {
//alert("Problem: " + req.statusText);
}
}
</script>
</head>

<body>

<div id="chart_div" width="100%" height="90%">
<table width="100%" height="100%"><tr><td height="80%" width="100%" align="center" valign="center">
<img src="Loading Image URL"></img>
</td></tr></table>
</div>
</body>
</html>

******************

XML format shoule be as shown below

<items>
<item>
<country>India</country>
<year>12/24/2009</year>
<projects>2000<projects/>
</item>
<item>
<country>USA</country>
<year>12/24/2009</year>
<projects>4000<projects/>
</item>
</items>

Wednesday, May 19, 2010

Flex progress bar while loading the xml data using URLLoader

Show progress bar in flex while loading the xml data using URLLoader class.


For progress bar display, have a separate MXML component called LoadingBar

MXML Main Code

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:net="flash.net.*" layout="absolute" creationComplete="init()">
<mx:Script>
<![CDATA[

import mx.managers.PopUpManager;
import mx.containers.TitleWindow;
import flash.geom.Point;
import mx.containers.HBox;
import mx.controls.Spacer;
import mx.containers.*;
import mx.controls.*;
public var loadingBar:LoadingBar;

public function init():void{
loadingBar=LoadingBar(PopUpManager.createPopUp( this, LoadingBar , true));
loadingBar.progressBar.source = urlLoader;
PopUpManager.centerPopUp(loadingBar);
urlLoader.addEventListener(Event.COMPLETE, xmlLoaded);

urlLoader.load(new URLRequest("http://localhostdatasource"));
}

private function xmlLoaded(event:Event):void {

PopUpManager.removePopUp(loadingBar);

}
]]>
</mx:Script>

<net:URLLoader id="urlLoader" />

</mx:Application>

MXML Loading Bar component code

<?xml version="1.0" encoding="utf-8"?>

<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" title="Progress"
width="300" height="100" borderThicknessLeft="1" styleName="loadingStyle"
borderThicknessRight="1" borderThicknessBottom="1" borderThicknessTop="1" >

<mx:VBox width="100%" height="100%" verticalAlign="middle" horizontalAlign="center">
<mx:ProgressBar id="progressBar" label="Loading Data..." mode="event" labelPlacement="center" />
</mx:VBox>

</mx:TitleWindow>

The Flex Project looks like below image.

Tuesday, May 18, 2010

Wednesday, April 28, 2010

Develop Mobile Applications in Flex

Slider: Flex Mobile Framework

Adobe is currently developing a mobile-optimized version of the Flex framework that will make it easy for developers to build Flex applications that run across mobile devices. Using Slider, developers can leverage their existing skills to build intuitive applications that can be easily customized and rapidly adapted across platforms.

More info at http://labs.adobe.com/technologies/flex/mobile/

Wednesday, March 24, 2010

Excel active rows check in vb, lotusscript

Excel import active rows check in lotus script

Its not the best way to check the blank value in a mandatory row and stop the process while importing data from excel file.

You can get the active rows in an excel file by using SpecialCell function.

The syntax for the SpecialCells Method is;
expression.SpecialCells(Type, Value)

Where "expression" must be a Range Object. For example Range("A1:C100"), ActiveSheet.UsedRange etc.

Type=XlCellType and can be one of these XlCellType constants.
xlCellTypeAllFormatConditions. Cells of any format
xlCellTypeAllValidation. Cells having validation criteria
xlCellTypeBlanks. Empty cells
xlCellTypeComments. Cells containing notes
xlCellTypeConstants. Cells containing constants
xlCellTypeFormulas. Cells containing formulas
xlCellTypeLastCell. The last cell in the used range. Note this XlCellType will include empty cells that have had any of cells default format changed.
xlCellTypeSameFormatConditions. Cells having the same format
xlCellTypeSameValidation. Cells having the same validation criteria
xlCellTypeVisible. All visible cells

These arguments cannot be added together to return more than one XlCellType.

Value=XlSpecialCellsValue and can be one of these XlSpecialCellsValue constants.
xlErrors
xlLogical
xlNumbers
xlTextValues

These arguments can be added together to return more than one XlSpecialCellsValue.

The lotus script code to get the active rows count.

Set varExcel = CreateObject( "Excel.Application" )

varExcel.Visible = False ' Making the selected Excel invisible

varExcel.Workbooks.Open xlFilePath '// Open the Excel file

Set xlWorkbook = varExcel.ActiveWorkbook

Set xlSheet = xlWorkbook.ActiveSheet

xlSheet.Cells.SpecialCells(11).Activate

xlsRows = varExcel.ActiveWindow.ActiveCell.Row

xlsRows variable gives the count of the active rows in an excel file.

Facebox is not loading in FireFox

If you use removeAttribute function in your page, and if you try to load facebox, then facebox will not load properly in firefox.

removeAttribute function is used to make the font as clear type in IE.

This function solves the issue of clear type text in IE with jQuery.

You should use removeAttribute function only for IE.

if ((verOffset=navigator.userAgent.indexOf("MSIE"))!=-1) {
this.style.removeAttribute('filter');
}

Wednesday, March 3, 2010

Gauge in flex open source code by brightpointinc

I need to develop a dashboard application with the column/bar charts and Gauges.

I searched in google for Gauge chart, i could find Gauge charts by IBM Ilog Elixir which is licensed version.

I continued my searching for a free Gauge chart and at last i found Gauge chart by Brightpointinc which is an open source.

Its very easy to use and easily customizable.


You can find the sample and source code here -- http://www.brightpointinc.com/flexdemos/gauge_v04/gauge_v04.html

Search This Blog