Learning Flex3 Task2: First action and accessing component property
Posted on | June 7, 2008 | 2 Comments
Every person has his/her own way of learning. My way is to learn by example. I may understand some math rules but I will be more confident at exam if done some practice example using that theory. Similar to this, I can understand what a language can do by reading but I will be much more comfortable if you do some real codes using that language.
As you are accompanying me in this journey, I will rather emphasis on the code example than on theory. I will try my best to reveal all the strength of flex3 to you by examples.
In this lesson, we will use a button and perform an action when it is clicked.
Let’s see what we would do in html:
<input type=”button” value=”click me” onclick=”this.value=’clicked’” />
Now, this is what we need to do in flex3.
<mx:Button id=”btn1″ label=”click me” click=”{btn1.label=’clicked’}” />
Now, in flex this means the main movie which we can put aside for the moment. For the time being we can think that all UI components must be accessed with their ID.
Here we have seen another feature which is accessing properties of a component.
Besides accessing properties, we can also bind properties. We will use a text box, a label and a button to demonstrate binding components. We will also use a button to clear the text of the two components.
Here is the code:
<?xml version=”1.0″?>
<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml”>
<mx:Panel title=”App 2″>
<mx:TextInput id=”txtName” text=”hello” />
<mx:Button id=”btn1″ label=”Clear All” click=”{lblName.text=”;txtName.text=”}” />
<mx:Label id=”lblName” text=”{txtName.text}”/>
</mx:Panel>
</mx:Application>
We can see that on entering anything in the textbox automatically updates the label text.
Download file: Main.msxml
Prev : Learning Flex3 Task1: IDE and basic application
Start: Start
Next: Learning Flex3 Task 3: Using function in script tag and in separate ActionScript file
ASP.net C#: Easily switch between SQL server database and access by an abstraction layer
Posted on | April 20, 2008 | No Comments
Problem:
You are developing an asp.net application which runs on MS SQL server on the back end. You need to show a demo to a person who does not have MS SQL Server. You have to create or export to a access database.
or
Learning ASP.net,C# newly
Challenges:
You have to choose SqlConnection ,SqlCommand or OleDbConnection, OldeDbCommand for SQL Server or access respectively. Either you have to replace all or have to find out a way around for this.
My Way Around:
Creating an abstraction layer. I know there are many of such classes or modules present on the net. I searched on codeproject.com and find some nice and great data abstraction layers. If you are looking for a complete database abstraction layer, this post might not help you. Rather, it will help you showing how to develop a simple abstraction layer for different type of connection.
How to use:
DALFactory.StrConnection = ConfigurationManager.AppSettings["conn_string"];// How i’m using
DALFactory.DALType = DALFactory.SQL;// or ACCESS
DAL dal = DALFactory.GetDal();
dal.SetSql(”Select * from student where id=@id”);
dal.AddWithValue(”@id”,1);
IDataReader reader = dal.ExecuteReader();
Thats it
Here are the file:
dal.cs
dalfactory.cs
dalsql.cs
dalaccess.cs
PS: I think the naming is not proper.. DALAccesss should DALOle
How to create MS SQL Server 2005 unique key step by step example
Posted on | April 18, 2008 | 5 Comments
Looking at the title many of you may think what is the justification to write so basic stuff!
I admit. Honestly I also admit that I was searching for this over Google ! I am totally new to SQL server environment and also have no idea about its IDE. MySQL and PostgreSQL are the two DBMS which I have been using for long issuing the commands writing on the Linux console.
Anyway, here is how:
1. Connect to to the server and right click on the table you want add a unique key.
2. Click modify
3. Right click on the design panel and select Indexes/Keys.
4. A dialog will open and click the Add button on the lower left.
5. It will create a new entry on the list on the left panel of this dialog.
6. Click the browse button (button with three dots ‘…’) on the right of the first item(Columns) in the list on the right panel.
7. On clicking button a new dialog will appear with a list. This list items contains all the column names in a drop down combo box. Select the column you want to set unique from the drop down.
If you want have multiple columns together is unique, select the columns on the second row.
Say, besides the ID column, you also want to have names to be unique for each role type. So you have to select both the name and role columns.
It will automatically add a new row to give option for the third column which can left empty.
Click ok when done. It will close the dialog.
8. Now, click on the combo right the the field named “Type“. Select Unique Key. And click Close not Add.
That’s All ! You have successfully set up a unique in MS SQL Server 2005
Sorry.. my previous hosting service crashed and all images are gone
![]()
JQuery custom attribute selector, extending JQuery
Posted on | April 15, 2008 | 5 Comments
Problem: In my current project, i had many links and divs which
performs some tasks as they are clicked. say, some are links in
the list which shows categories, clicking this links, i need to show
the items. Again, clicking each item, i need do some other tasks. In
this way, all the action links/divs can be categorized.
I need to tell jquery to perform something on click event of those.
Current Solution:
Use different class or id and get it like $(”#id”) etc.
Problem of this:
It will limit you to use id’s which can be conflicting with other settings.
What I am doing:
Extended JQuery
say I have the following links(there are many other comtypes):
<a comtype=’category’ comid=” ….
<a comtype=’category’ comid=” ….
<a comtype=’category’ comid=” ….
Now, Need to bind click event to all comtype=’category’
jQuery.extend(
jQuery.expr[ ":" ],
{
catitem : (
“jQuery( a ).attr( comtype) == ‘category’ “
)}
);
The code above will let me do the below:
$(‘a:catitem’).bind(’click’,function(){
// do stuff});
Hope it may help you in such situations.
ScribeFire improvements 2008-04-13
Posted on | April 14, 2008 | No Comments
Wow!! just finished writing the earlier post on scribfire and need
to write another about its improvements.
1. Tabbed edit:
Now, you can create and edit multiple post at a time !
2. New control panel:
The left control panel is now with new look and features!!
3. Youtube and flickr addon!!!
Now, you can share your Youtube and flickr content !!!
Great work Chris!!!.
ScribeFire — Fireup your blogging
Posted on | April 14, 2008 | No Comments
Recently I made post on windows live writer. Since then I felt
little uneasy as I have not wrote any post on ScribeFire.. a simple,
efficient and feature rich blogging tool that was helping me for long.
ScribeFire is a Firefox extension. Unlike the blogging tool in Flock,
its much simpler and lightweight though heavy in options. You can
have the installer from here.
Having installed it you will find a little icon on the right of the status bar
of your FF browser:
![]()
Usually people feels to start writing a blog post when
they come across something interesting on the web, or a solution or
when they created something to share. In most cases it is initiated
by web. If see something on the web and like to share with all,
just press f8 and scribefire will slide to blog the page !
It really comes with some handy shortcuts which can be found here.
Take a look at the nice scribefire panel:
Middle panel is the editor, nothing more to say about it. But I like the
image addition features most. Unlike most of other blog tool scribefire
does not only provide image inserting by url but also from your
computer !!
The left panel contains the overall settings for scribefire. See the
options:
The right panel offers blog related settings like adding a blog,enter
trackback URL, manage entries,categories etc. Interesting is that, I can
also edit my WordPress static pages from here !!
Finally just to say, if you are not windows fan or tired of trying various
blog tools orrr have not yet tried any…. I would suggest just try scribefire!
Blogging will be more fun and easy !!
cheers.
Update is available here.
SQL Server permission problem in vista solved
Posted on | April 14, 2008 | No Comments
Recently I migrated to Window Vista and enjoying its cool looks
and features.
I was facing a weird problem with SQL Server. I am using SQL Server
2005 express edition that was available with VS 2005.
When I was trying to create a database the following problem raised:
As a result, I could not create any Database !! I failed to get
any answer from google.
Suddenly, one simple solution came in mind… right clicked on the
icon and run as administrator.
And it did the trick !!
cheers !
Assembla: Online project, with free svn,file upload,tickets and everything !!
Posted on | April 14, 2008 | No Comments
I was looking for an online space where I can securely host my project.
Google took me to Assembla after knocking a number of doors. Its an one stop solution for project
hosting.
You can create teams, have scrum meeting,chat, manage your
money(!),have wikis, different pages for a project…. etc etc.
Above all, it will allow you to have different project pages for everya
project you start !
Try it out !
How to unit testing with Visual Studio Team System 2008
Posted on | April 13, 2008 | No Comments
Testing is a vital part of any software project. In modern development
processes it is an umbrella task.
Visual Studio Team System 2008 offers an excellent way to perform
various types of test. It made testing as easy as it gets.
Lets see how to perform unit testing over a class.
Steps:
- Create a web project.
- Add a new class
- write a method, say
public String hello() { return “world”; } - Go to Test menu,
- Click New test.
- It will ask to create a test project first, give
- Then select add new test
- select unit test wizard
- select the files you want to test.
- Click Ok.
You will find XXXTest.vb file is created for every class.
XXX is the class name.
There a test class is created which has public routines like
YYYTest() for all the methods in XXX class. Here is a sample
descripion of such a basic function:
Public Sub helloTest()
Dim target As Class1_Accessor = New Class1_Accessor ‘ TODO: Initialize to an appropriate valueDim expected As String = “Worldss” ‘ TODO: Initialize to an appropriate value
Dim actual As String
actual = target.hello
Assert.AreEqual(expected, actual)
Assert.Inconclusive(”Verify the correctness of this test method.”)
End Sub
Look at the bolded word “Worldss” which I entered as the expected
result, certainly it is not expected, but is given to get a test failed
Now, run Test->Run->All tests in solution Ctr+R,A to run the test.
You can also run the test related to only the current context.
Enjoy programming… enjoy real programing..
Windows live Writer
Posted on | April 13, 2008 | 4 Comments
Have you ever tried windows live writer ? Try it once. I bet, you
wont be able to stop blogging !!
Its a great blogging tool with every feature you will ever need.
Have a look at the screen shot:
Sorry for the background, I forgot to close the VS 2008. )
The first tool that could recognize my blog settings just from the URL.
I have hosted wordpress on the root directory of my server. Just
before I tried scribfire and it failed to get the xmlrpc file.
Being a linux lover(also Vista lover :P, a bi-os-ual) I tried almost all
the blogging client available under linux( lately I was using Ubuntu).
None of them are as good as Windows live writer. Honestly speaking
keeping the emotion aside, none are even closer to windows live
writer.
Try and check my word.
