Monday, August 22, 2016

Angular

https://plnkr.co/edit/k2lhKHpmsE2AgoIBNtrX?p=preview

Tuesday, December 22, 2015

http://plnkr.co/edit/Y3m7SZQu0V0hgEci4LTK?p=preview

Tuesday, December 8, 2015

Flex Migration to Angular


Step by Step migration
https://github.com/w11k/w11k-flash

Demo
http://w11k.github.io/w11k-flash/

Friday, January 2, 2015

ECMA Script 6


Traceur Demo
https://google.github.io/traceur-compiler/demo/repl.html#
In the options tab -- select the show all options

es6 Fiddle
http://www.es6fiddle.net/

Compitable Tab
http://kangax.github.io/compat-table/es6/




Good explanation of prototype and javascript fundamentals
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Inheritance_and_the_prototype_chain#With_a_constructor

Friday, December 5, 2014

Angularjs

Own Plnkr.co
http://plnkr.co/edit/0daJFdwWm32zT8hpfNvB

Creating Tree View
http://jsfiddle.net/brendanowen/uXbn6/8/

Validate
http://angular-ui.github.io/ui-utils/#/showhide

Bootstrap Components
http://getbootstrap.com/components/#btn-dropdowns

AngularJS Magazine
https://flipboard.com/section/the-angularjs-magazine-bbIMWS

JavaScript Design Patterns
http://addyosmani.com/resources/essentialjsdesignpatterns/book/

Angular Design Patterns
http://blog.mgechev.com/2014/07/05/angularjs-in-patterns-part-3/

Javascript Flipboard magazine
https://flipboard.com/section/the-javascript-magazine--bMrmRp

Customer Manager with AngularJS
https://github.com/DanWahlin/CustomerManagerStandard

Some good gyan regarding the flow of anugular js
http://www.phase2technology.com/blog/code-reuse-in-angularjs/

this in javascript
http://javascriptissexy.com/understand-javascripts-this-with-clarity-and-master-it/

Javascript 16 pointers ..[ Every developer should know]
http://javascriptissexy.com/16-javascript-concepts-you-must-know-well/

Path to pdf 60 min
http://fastandfluid.com/publicdownloads/AngularJSIn60MinutesIsh_DanWahlin_May2013.pdf

sample code to start
http://www.codeproject.com/Articles/607873/Extending-HTML-with-AngularJS-Directives

validation framework
http://www.ng-newsletter.com/posts/validations.html

JavaScript Training
http://www.pluralsight.com/courses/javascript-good-parts

Good Article Covering all the basics
http://www.ng-newsletter.com/posts/beginner2expert-directives.html

Angularjs Blogs to Watch
http://neverfriday.com/2013/10/10/writing-an-angularjs-tutorial-first-draft-is-up/


Saturday, July 13, 2013

Database JOINS

JOINS - http://stackoverflow.com/questions/38549/difference-between-inner-and-outer-join

Sybase Search

In Sybase search for 'the contents of publishers (table name)' Transaction Mode - http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.help.ase_15.0.sqlug/html/sqlug/sqlug855.htm

Sunday, January 29, 2012

Unix Alias

Create Unix Alias to get rid of entering long paths every time.

Login into su
prompt>cd
prompt>vi .bash_profile

alias tcb2='cd /local/apps/tomcat/apache-tomcat-7.0.23-2/bin'
alias logs2='cd /local/apps/tomcat/apache-tomcat-7.0.23-2/logs'
alias tclogs2='tail -f /local/apps/tomcat/apache-tomcat-7.0.23-2/logs/catalina.out'

prompt>. .bash_profile

Next time, you do not need to enter complete path like cd /local/apps/tomcat/apache-tomcat-7.0.23-2/bin just type "tcb2" and will be in directory.

Sunday, January 8, 2012

RAP (Rich Ajax Platform) and JMeter

The purpose of this article is to share my experience with JMeter tool when recording the test cases for RAP application using URL Rewriting. This is in continuation with http://wiki.eclipse.org/RAP/LoadTesting

Env:
Tomcat 7.0.23
Java 1.6.0_06-b02

RAP(Rich Ajax Platform):
RAP 1.5M4

File to Deploy:
app.war

Set Up:
Deploy the war file in Tomcat.It creates folder app(name of the war) inside webapps folder. Inside the plugins, we need to add the org.eclipse.rap.widgetidgenerator plugin.You can do this manully. Open the buldles.info (app\WEB-INF\configuration\org.eclipse.equinox.simpleconfigurator) add the org.eclipse.rap.widgetidgenerator,1.0.0.201112291625,plugins/org.eclipse.rap.widgetidgenerator_1.0.0.201112291625.jar,4,true. Copy the org.eclipse.rap.widgetidgenerator_1.0.0.201112291625.jar in plugins folder. This plugin need to be build from the source code and does not come in the rap tool.It will be good to test if the plugin is in active state when the war is installed using the ss command of the osgi framework.

In RAP application the session id is passed from server to client in the result of the first request. Session id can be viewed in the result

Sample Portion of Response Data:

"target": "w1",
"action": "call",
"method": "init",
"properties": {
"rootId": "w1",
"entrypoint": "sapphire",
"url": "rap;jsessionid=7F829865016AD6D0634595306844108A.sapphire01"
}

It can be anywhere in the response from server but it will be having the same format.

Our purpose is to use the session id and pass it into every request to server. Create a regular expression extractor which will extract the jsession id. See the attached image. This should be attached to the first request to server or HTTP Sampler.Store it in a variable.




Now we need to pass this session id in each and every request to sever.In the second HTTP Sample add a pre bean shell processor.




Recording the test case:
Hit the first request on the browser.
Stop to make the below changes.
In Jmeter, If you notice that we have session id in the request. Now we store this in the User Defined Variable. When we further keep recording the test case, session id is replaced by ${snum}

So the actual request
/sever5/rap;jsessionid=AD08983085AB2DA747EC6B6E158E6EC8?nocache=1326086526260
will be presented as
/server5/rap;jsessionid=${snum}?nocache=1326086526260

Now when we run testcase, ${snum} will be replaced with actual session id.




Our Final Test Case will look like

Thursday, July 22, 2010

Code for PopUp


package com
{
import com.adobe.cairngorm.control.CairngormEventDispatcher;
import com.vzw.mpi.rss.events.DataReceiveEvent;
import com.vzw.mpi.rss.model.RdsModelLocator;
import com.vzw.mpi.rss.serverEvents.RdsEvent;
import com.vzw.mpi.rss.utils.RDSConstants;
import com.vzw.mpi.rss.utils.RssConstants;

import customComponents.ImageFocus;
import customComponents.datagrid.CheckBoxDataGrid;
import customComponents.popups.SingleSelectCustomPopup;

import flash.events.Event;
import flash.events.FocusEvent;

import mx.controls.TextInput;
import mx.controls.dataGridClasses.DataGridListData;
import mx.controls.listClasses.BaseListData;
import mx.controls.listClasses.IDropInListItemRenderer;
import mx.controls.listClasses.IListItemRenderer;
import mx.core.UIComponent;
import mx.managers.IFocusManagerComponent;
import mx.managers.PopUpManager;


public class SpyGlassFieldEditor extends UIComponent implements IListItemRenderer, IDropInListItemRenderer, IFocusManagerComponent
{

public function SpyGlassFieldEditor()
{
super();
addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
}

private var txtInputByUser:TextInput;
private var spyGlassImage:ImageFocus;
private var maxInputCharacters:int=20;

private var _data:Object;

public function get data():Object
{
return _data;
}

public function set data(value:Object):void
{
_data=value;
invalidateProperties();
}


private var _listData:BaseListData;
private var _dataGrid:CheckBoxDataGrid;
private var _dataField:String;
private var win:SingleSelectCustomPopup;

[Bindable]
protected var rdsModel:RdsModelLocator=RdsModelLocator.getInstance();

public function get listData():BaseListData
{
return _listData;
}

public function set listData(value:BaseListData):void
{
_listData=value;
_dataGrid=value.owner as CheckBoxDataGrid;
_dataField=(value as DataGridListData).dataField;
}

override public function setFocus():void
{
if (dgOwner.shiftKey)
{
spyGlassImage.setFocus();
}

else
txtInputByUser.setFocus();
}

private function onTextChange(event:Event):void
{
var textInput:TextInput=event.currentTarget as TextInput;

if(_dataField)
{
var properties:Array=_dataField.split(".");

if (properties.length >= 2)
{
var object:Object=data[properties[0]];
object[properties[1]]=textInput.text;
}
else
{
data[_dataField]=textInput.text;
}

_dataGrid.dataProvider.itemUpdated(data);
invalidateProperties();
}
}

override protected function createChildren():void
{
super.createChildren();

txtInputByUser=new TextInput();
txtInputByUser.maxChars=maxCharacters;
txtInputByUser.addEventListener("change", onTextChange, false, 0, true);
addChild(txtInputByUser);
spyGlassImage=new ImageFocus();
spyGlassImage.source="assets/images/spyglass.gif";
spyGlassImage.buttonMode = true;
spyGlassImage.addEventListener("click", onImageClick, false, 0, true);
addChild(spyGlassImage);
}

protected function onImageClick(evt:Event):void
{

}

public function get editValue():String
{
return txtInputByUser.text;
}

private var dgOwner:CheckBoxDataGrid;

override protected function commitProperties():void
{
dgOwner=owner as CheckBoxDataGrid;
super.commitProperties();

if (_dataField)
{
var properties:Array=_dataField.split(".");
if (properties.length >= 2)
{
var object:Object=data[properties[0]];
txtInputByUser.text=object[properties[1]];
}
else
{
txtInputByUser.text=data[_dataField];
}
}
}


public function onPopUpClose():void
{
var properties:Array=_dataField.split(".");
if (properties.length >= 2)
{
var object:Object=data[properties[0]];
object[properties[1]]=win.idSelected.text;
}
else
{
data[_dataField]=win.idSelected.text;
}
_dataGrid.dataProvider.itemUpdated(data);
invalidateProperties();
}

override protected function updateDisplayList(w:Number, h:Number):void
{
super.updateDisplayList(w, h);
txtInputByUser.move(0, 0);
txtInputByUser.setActualSize(w - 25, h);
spyGlassImage.move(w - 11, 0);
spyGlassImage.setActualSize(11, 11);
}

private function keyFocusChangeHandler(event:FocusEvent):void
{
//trace("Focus Manager " + focusManager.focusPane);
if (event.shiftKey)
{
//trace("Inside Shift Key");
if (spyGlassImage.contains(getFocus()))
{
event.preventDefault();
txtInputByUser.setFocus();
}
}
else
{
if (txtInputByUser.contains(getFocus()))
{
event.preventDefault();
spyGlassImage.setFocus();
}
}
}

public function set maxCharacters(max:int):void
{
maxInputCharacters=max;
if (txtInputByUser)
txtInputByUser.maxChars=max;
}

public function get maxCharacters():int
{
return maxInputCharacters;
}
}

}

Friday, May 22, 2009

Event Demo

http://learn.adobe.com/wiki/display/Flex/Event+Demo

Friday, January 30, 2009

Logging

xmlns:mx="http://www.adobe.com/2006/mxml"
layout="absolute"
initialize="init()">

import mx.logging.LogEventLevel;
import mx.logging.targets.TraceTarget;
import mx.logging.ILogger;
import mx.logging.Log;
import mx.logging.LogLogger;

/*
* This is a sample application that uses a simple logger. There are 4 simple
* steps to using it:
* 1. Get an Instance of ILogger, with the appropriate category
* (Done in each class)
*
* 2. Define a Target and set it's properties
* (Done only once when initializing the logging API)
*
* 3. Add the target to Logging runtime
* (Done only once when initializing the logging API)
*
* 4. Use the instance of ILogger to log messages
*/

// 1. Get an Instance of ILogger, with the appropriate category
private var _log:ILogger = Log.getLogger("mx.com.yahoo.com");

// Initialize the remote logger
// import to do this on the application's initialize callback if you want to log
// the construction of your application's child component's
private function init():void {
// 2. Define a Target and set it's properties
var target:TraceTarget = new TraceTarget();
target.includeCategory=true;
target.includeDate=true;
target.includeLevel=true;
target.includeTime=true;
target.level=LogEventLevel.INFO;

// 3. Add the target to Logging runtime
Log.addTarget(target);
trace("Hello World");

}
//4. Use the instance of ILogger to log messages
private function sendDebugMessage():void {
_log.debug("This is a test debug level log message");
}

private function sendInfoMessage():void {
_log.info("This is a test info level log message");
}

private function sendWarnMessage():void {
_log.warn("This is a test warn level log message");
}

private function sendErrorMessage():void {
_log.error("This is a test error level log message");
}
]]>


]]>

CorssDomain in Flash Player 10 and 9

The cross domain works differently in flash player 10 and 9.

Sceanrio:
A swf file at location http://url2/Sow.swf make a request to the http://url1:9085/SOW_DSVServices/. As both the files are in different domain, crossdomain.xml file is required.

Flash Player 10.
In flash player 10, crossdomain is required at two location.
1.
http://url1:9085/SOW_DSVServices/crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
2.
http://url1:9085/crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<site-control permitted-cross-domain-policies="all"/>
</cross-domain-policy>

3.
In swf file code you have to loadPolicyFile
Security.loadPolicyFile("http://url1:9085/SOW_DSVServices/crossdomain.xml");

While in the case of Flash Player 9, crossdomain.xml file is required at only one location
1.
http://url1:9085/SOW_DSVServices/crossdomain.xml
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy
SYSTEM "http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>

2.
In swf file code you have to loadPolicyFile
Security.loadPolicyFile("http://url1:9085/SOW_DSVServices/crossdomain.xml");
3.
CrossDomain.xml file is not required at location
http://url1:9085/crossdomain.xml

This is due to the more security enchancement in flash player 10.

Monday, January 26, 2009

Force Browser to get new version of cached swf file

How to make the request to server only if new version of swf file?

It is very common opportunity, that whenever any new changes are made to the swf file it does not load into the browser as swf is already in browser
cache. At the sametime, you do not want to make the request every time to the server when swf file is accessed. You want to make the request to server only if new version of file is on server. To get rid of the issue, follow the steps.

In the file AC_OETags.js, inside function AC_GetArgs

1.
modify the statement : args[i+1] = AC_AddExtension(args[i+1], ext);
to : args[i+1] = AC_AddExtension(args[i+1], ext+"?v="+appVersion);


2.
add case statement

case "appversion":
appVersion = args[i+1];
break;

3.add global variable in the AC_OETags.js
//Application Version
var appVersion = '1';

Now changes in the .html file where flex swf is embedded
4. Modify the function in the

AC_FL_RunContent(
"appversion", applicationVersion,
"src", "Sow",
"width", "100%",
"height", "100%",
"align", "middle",
"id", "Sow",
"quality", "high",
"bgcolor", "#869ca7",
"name", "Sow",
"allowScriptAccess","sameDomain",
"type", "application/x-shockwave-flash",
"pluginspage", "http://www.adobe.com/go/getflashplayer"
);


5. Declare the
//Application Version
var applicationVersion =

Conclusion:
Every time a new version of swf comes , change the "applicationVersion". In the below request there will always be new version value which will force browser to make request to the webserver
If you see the request it will be
http:///SOW/Sow.swf?v=2.0.0

Saturday, January 24, 2009

Links

Flex Coders yahoo group

Icons

Charts Sample

Flex Styles Explorer

Flex Regular Expression Explorer

Easing Function Calculator

Flex Developer General

Styles Website

Tips for Style Manager

In the style sheet(.css file) declare
.icons
{
add: Embed('images/add.png')
mul: Embed('images/mul.png')
}

icon="{StyleManager.getStyleDeclarations('.icons').getStyle('add')}"
label="Customize" />