Posts

Showing posts from 2007

anonymous delegate class object

//////////////////////////////////////////////////////////
The code example below show you how to use anonymous delegate
//////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Text;

namespace YummyYummy
{
class Program
{

static void Main(string[] args)
{
doStuff();
}

private static void doStuff()
{
List _list = new List();
List _subList;

_list.Add(addClientInfo("AAA", "1111"));
_list.Add(addClientInfo("BBB", "2222"));
_list.Add(addClientInfo("CCC", "3333"));
_list.Add(addClientInfo("AAA", "4444"));

string _targetSearchString = "AAA";

ClientSessionEntity _client = _list.Find(delegate(ClientSessionEntity _entityA)
{
return _entityA.transactionId.Equals(_targetSearchString);

Newline in Flex

I just can't get this up my head. In order to use newline in Flex i just have to
use "\r" this symbol. Gosh!!

Flex and Javascript - ExternalInterface

The best article i read about Flash and javascript interaction can be found here.

Manipulating ArrayCollection

Manipulating Flex ArrayCollection

This shows you how to manipulate flex data structure called ArrayCollection.

Assuming that you have the following data

[Bindable]
private var medalsAC:ArrayCollection = new ArrayCollection( [
{ Country: "USA", Gold: 35, Silver:39, Bronze: 29 },
{ Country: "China", Gold: 32, Silver:17, Bronze: 14 },
{ Country: "Russia", Gold: 27, Silver:27, Bronze: 38 } ]);


To retrieve let say Russia record, you can do the following

/// get the Rusia Info /////

var _target:Object = medalsAC.getItemAt(2);


To change its value, use the following codes
///// set the Rusia Info /////
_target["Gold"] = 50;
medalsAC.setItemAt(_target, 2);


If you want to add a new country let say Czech, then you can use the following codes

medalsAC.addItem({ Country: "Czech", Gold: 2…

Self Signing Certificate for IIS

Create a self signing certificate for IIS

VS2005 provides tools to do this which is called makecert and pvk2pfx. First all you need to do is run the following batch file and specify a name for it.

For example

yourBatchFile.bat testCert

The content of batch file is as follows

makecert -r -pe -n "CN=testCert" -sky exchange -sv %1.pvk %1.cer
pvk2pfx -pvk %1.pvk -spc %1.cer -pfx %1.pfx

Once you have this installed, please goto

Start->Run->MMC->File->Add SnapIn->Add->Certificates


A wizard will appear asking you the scope of your certificates. Choose Computer account and Finish.

Select Local Computer and again click Finish. Click Close and then OK.

This will bring you to aCertificates Console.

Expand Personal -> Certificates, right click and select Import.

The wizard will prompt you for the certificate that you have generate earlier. Provide the test.pfx. When ask for password click Next, Next and Finish.

You need to repeat the same process for Trusted Root Certification Au…

Document

Start from the top

Page DocTypes

Setting your page rendering mode. What is the use of docTypes?
It basically tells the browser which version of html that will be used to render your page.
There are many variation which includes

a) strict
b) loose
c) frameset
d) xhtml1-strict
e) xhtml1-transitional.dtd
f) xhtml1-frameset.dtd
g) declaration for html 3.2 and 2.0

http://htmlhelp.com/tools/validator/doctype.html

Determine your page Layout.

It is crucial to determine your page layout first and then test it with different browser to see if the positioning is correctly done.

Use minimal Table in your page More Div + CSS

There should be only one level table in your page. Putting two level of table is something you might need to consider twice.


For positioning, formatting that the job of CSS

Follow the XHTML convention and apply the final touches to it by using WC3 Validator service
http://validator.w3.org/

CSS should be used to align your text, phase out the use of spacer gifs and

Make your page conform to XHTM…

BizTalk notes

To quick (close to useless) guide to create biz transformation solution in BizTalk Server.

Define Schema ---> Define Messages --> Map Message to Schema
--> Perform Message Transformation and operations ---> Setup your project file --> Create your snk ---> Deploy from V Studio --> Configure your project accordingly in BizTalk

*Create all your schema and messages first* Things can get easier.

Flex 2 Events

I found a great blog where you can get information on how to create Flex 2 custom events. Its better than going through pages of documentation.

Custom Server Controls Vs Entirely Custom Controls

Sometimes you find yourself writing custom controls which uses server control provided by Microsoft.

These controls include TextBox, GridView and Button. With these control you don't have to implement IPostBackDataHandler (unless you're doing something customization) as you can wire the event shown here.

protected override void CreateChildControls()
{

base.CreateChildControls();

_txtBox = new TextBox();
this.Controls.Add(_txtBox);

_txtBox.Text = _defaultText;

System.Web.UI.WebControls.Button _txtBtn = new Button();
this.Controls.Add(_txtBtn);

_txtBtn.Click += new EventHandler(_txtBtn_Click);
_txtBtn.Text = _cmdText;

}

void _txtBtn_Click(object sender, EventArgs e)
{

////// triggerring take place here /////////

}


If you need to customized your control above to implement IPostBackDataHandler for your custom server control, then just register your component. Beware if you do that, …

Interesting WPF Tools

Found some interesting WPF Tools

a) swfToXAML
b) MayaToXAML
c) LightWavetoXAML
d) Adobe Illustrator to XAML

Some really interesting stuff is going on.......

WebPart - UserControl Loaded Multiple Times and GridView Event not Triggerd

Creating user control declaratively in your WebPart won't give your alot of problem. But when you try to load pro grammatically a user control (ascx) into your webparts using something like this:-

Your WebPartPage

Control uc = this.LoadControl(@"webparts\CompanyNews.ascx");
uc.ID = "webPartyMan";
GenericWebPart wp2 = wp.CreateWebPart(uc);
wp.AddWebPart(wp2, LeftZone, 1);

You found that you loaded it multiple times and somethings GridView events are not triggered.
What the trick?

You only load your ascx once (you won't load it ever again) and right after you dynamically load it call SetPersonalizationDirty(); This is done using your custom WebPartManager;

This is a very simplified version of your custom webPartManager (loadPersonalizationBlob and savePersonalizationBlob)

namespace CoreWebPart
{
public class myWebPartManager : WebPartManager
{

public void SetDirty()
{
SetPersonalizationDirty();
}
}

} ///// end namespace


Then your we…