Monday, June 30, 2008
Event Watch: Moblin - Intel's Mobile Flavour Part 2
0 comments Posted by udooz at 6/30/2008 10:15:00 PMThis is part 2 of Event Watch: Moblin - Intel's Mobile Flavour.
After spending two hours, the Mobile Image Creator (MIC) created Moblin environment on my development machine. During these period, it swallow 1GB and after completing all the target environment swallow 600+MB of my hard drive (Hope that each target only took 373.8MB, others are one time update of necessary components).
Okey, let me write about the remaining notes about the seminar. Moblin is nothing but a emulator of the target device. It contains all set of libraries to develop rich interactive, power saved mobile applications. You can develop and deploy your C++/Python source code into the environment.
The lunch was excellent and one of the high attractive point in this seminar.
After the lunch, Thamarai Selvi from Anna University presented a full length of theoretical session about various mobile communication. Its good to her to explain all brief about Wifi, WiMax and other non-matured technologies. But she just forgot that this is neither academic class room nor off-room lecturer.
The final session "Ubuntu in the Mobile Space" was given by Prakash from Canonical, a sponsor of Ubuntu. He provided good and humorous speech about Ubuntu's Notebook edition (a very thin laptop) and he talked about Ubuntu's mobile edition Linux on Moblin.
A Simple Hello World! Application
I followed the steps to create a sample Hello World application in Moblin at http://moblin.org/toolkits/prepDev/toolkits_prepDev_useImgCrtr.php.
One very important thing while create project, add target and setting FSets is that please connect your system with a broad band internet connection. It gets lots and lot of things from Moblin.org.
It is pleasure for Intel to give all required components in a separate development CD/DVD kit.
Two things I would like to tell Intel.
1. Atleast provide the entire Moblin kit in a DVD.
2. Be sure what is needed to be conveyed to the large audience, because now you are targeting the developers and you should touch their heart as like as the one and only Microsoft and its various TechEd/TechMela/Day events those are nothing but a magic point on which all developers are focused.
Caution: You have to spend more than two hours when you selected a full target function sets on the selected target. For Samsung full function set It downloads more than 450 components from Internet. What a wonderful repository? Actually, why Intel organized Moblin like this way. God only knows.
Friday, June 27, 2008
This is second time in Chennai, Intel had arranged developer session on their new mobile environment Moblin (Mobile Linux).
Microsoft came into mobile software arena very latetly. Like, Intel also has entered into the mobile hardware market very lately. Surprisingly it comes along "Moblin" platform.
When I had received the registration email from Intel, two things gave me surprise. One is repetition of the event in the same city and the location was Anna University campus. Although the campus was surrounded by old aged trees, I would like to request the university board to improve the ambiance of the campus. One of the sign board informs wrong direction to Muthain Auditorium. At the time I reached the place, the first session was almost in the final stage given by an official from CDAC (Centre for Development of Advanced Computing). He was talked about pervasive computing. One of my manager and me had a quick chat with him about the public participation on pervasive computing. They do not have any idea about this.
I was started to download the Moblin on my Ubuntu 8.04 machine by following the instruction given at http://moblin.org/toolkits/prepDev/toolkits_prepDev_instImgCrtr.php half hour before writing this post by "git" clone.
Prerequisites:
- git-core (intltoolize also)
- automake
- autotools-dev
- build-essential
- dh-make
- fakeroot
- python
- debootstrap
- syslinux
$ sudo apt-get install curl
$ sudo apt-get install intltool
Note that have to give "intltool", and not "intltoolize". After installing the MBs of these prerequisites, I gave the below command to get moblin-creator from moblin.org.
$ git clone http://moblin.org/repos/tools/moblin-image-creator.git
Beware it took more than half hour in my broad band internet connection.
After getting the kit, key the following:
$ cd moblin-image-creator
$ ./autogen.sh
$ sudo make install
$ sudo image-creator
Really I would like to write about the my very fist hello world in Moblin in this post, let us see, since after executing "moblin-image-creator" (simply MIC), and add new platform project, it took more than half hour. It simply said "Please wait while installing HelloMoblin". Woooop!
Narendra Bhandri from Intel gave session about "Mobility Trends & Moblin Overview". Its the same old presentation given in the previous seminar. Oops, still MIC retrieving and validating large number of libs and tools. The session was about the internet experience and usability of the current mobile devices. And, of course he talked about Intel's new processor for mobile devices oh, sorry MIDs (Mobile Internet Devices) "Atom" from its famous Centrino platform.
Oo God, still MIC retrieving and validating. This time I found that It start from tool with name starting "a" and in the ascending order. More than 40 minutes over. I did not worry about the time it took, because it completely created the image of Moblin Linux environment. After a while, It extract, unpack and configure various Moblin components. Oh God, my hard drive space. let us see.
Santhosh from Intel gave session about "Software Framework for Mobile Devices". He directly talked about the Moblin stack. Wait..are you confused about "What is really mean Moblin?".
Most of the attendees in the hall had the same confusion (may be still), because none of the speaker clearly explain and convey the real aspect of Moblin.
-To be continued on next part (my wife called me thrice to shutdown the system) bye!!
Tuesday, June 24, 2008
WF: Exception Handling with State Machine Workflow
0 comments Posted by udooz at 6/24/2008 09:22:00 PMEvery day comes with some new wishes and challenges. Today my team struck up with handling in a state machine workflow. They digged the web for finding a solution, unluck.
Problem: How to rethrow an exception from a state machine workflow to the workflow runtime host?
Description: I have designed one of our product as the service interface layer (WCF) invokes some of the business functionalities through workflow. We can say "workflow enabled business functionalities". This is a state machine workflow (I don't find real enterprise level usage of sequential workflow, of course you can use it at UI level). We have instrumented (exception handling and logging) well the non-workflow enabled services and business functionalities. Whenever a request comes from the clients of these services (currently, we have only one ASP.NET client) to perform a business operation, each layer do their responsibilities well. In case of any failure, they respond to the client gently with all necessary details. However, we were not able to handle exception in our "workflow enabled business functionalities". Laughing...! Initially, I was also felt that we have missed something. After a while, my team found that this is the issue with WF itself. Actually, you can handle exception within the workflow runtime, but how can you respond to your client there is a fault while executing their requested business functionality.
By its asynchronous nature of state machine workflow, even though WF provides rethrow activity, it cannot propagate upto the calling place which is the host of the workflow instance. This is common for any type of host such as Console, ASP.NET, etc.
How to reproduce:
1. Create a state machine workflow (for an example, RoseWorkflow) and add an event driven activity (onPluckFlowersEvent) on the initial state (Bud State).
2. In the onPluckFlowersEvent handling code, forcefully throw an exception (throw new Exception("You cannot pluck flowers in this state"));. The value of the properties of this external event handler activity are:
Name: handlePluckFlowersEvent
InterfaceType: RoseIsRoseWorkflow.IRoseWorkflowService
EventName: PluckFlowers
e: Activity=RoseWorkflow, Path=EventArgs
sender: Activity=RoseWorkflow, Path=Sender
For both sender and e, I've declared two properties named "EventArgs" of type ExternalDataEventArgs and "Sender" of type object.
private void handlePluckFlowersEvent_Invoked(object sender, ExternalDataEventArgs e)
{
// here _delegatedException is the member of RoseWorkflow
_delegatedException = new Exception("In this stage, you cannot pluck flowers");
throw _delegatedException;
}
3. Add fault handler activity (onPluckFlowersEventFaultHandler) for the event and set its "FaultType" property as "System.Exception".
4. If need, add normal code activity to handle the exception, like
private void onPluckFlowersEventFaultCodeHandler_ExecuteCode(object sender, EventArgs e)
{
FaultHandlerActivity faultHandler = ((Activity)sender).Parent as FaultHandlerActivity;
Console.WriteLine("Handle exception in workflow itself. Details: {0}", faultHandler.Fault.Message);
}
5. Add Throw activity, and set the following properties:
Fault: Activity=onPluckFlowersEventFaultHandler, Path=Fault
FaultType: Activity=onPluckFlowersEventFaultHandler, Path=FaultType
6. Host it into a console:
class Program
{
static void Main(string[] args)
{
using(WorkflowRuntime workflowRuntime = new WorkflowRuntime())
{
AutoResetEvent waitHandle = new AutoResetEvent(false);
workflowRuntime.WorkflowCompleted += delegate(object sender, WorkflowCompletedEventArgs e) {waitHandle.Set();};
workflowRuntime.WorkflowTerminated += delegate(object sender, WorkflowTerminatedEventArgs e)
{
Console.WriteLine(e.Exception.Message);
waitHandle.Set();
};
ExternalDataExchangeService dataExchange = new ExternalDataExchangeService();
workflowRuntime.AddService(dataExchange);
RoseWorkflowService roseWorkflowService = new RoseWorkflowService();
dataExchange.AddService(roseWorkflowService);
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(RoseWorkflow));
instance.Start();
roseWorkflowService.PluckFlowers += new EventHandler(roseWorkflowService_PluckFlowers);
try
{
roseWorkflowService.RaisePluckFlowersEvent(instance.InstanceId);}catch(Exception e){Console.WriteLine("from host. {0},{1}", e.GetType().Name, e.Message);
}
waitHandle.WaitOne();
}
Console.WriteLine("Pressto quit");
Console.ReadLine();
}
static void roseWorkflowService_PluckFlowers(object sender, ExternalDataEventArgs e)
{
Console.WriteLine("Handling PluckFlowers event");
}
}
I used RoseWorkflowService as one of my local service which implement my IRoseWorkflowService which is used in my workflow.
IRoseWorkflowService:
[ExternalDataExchange]
public interface IRoseWorkflowService
{
event EventHandlerPluckFlowers;
void RaisePluckFlowersEvent(Guid instanceId);
}
RoseWorkflowService:
[Serializable]
public class RoseWorkflowService : IRoseWorkflowService
{
#region IRoseWorkflowService Members
public event EventHandlerPluckFlowers;
public void RaisePluckFlowersEvent(Guid instanceId)
{
if (PluckFlowers != null)
PluckFlowers(null, new ExternalDataEventArgs(instanceId));
}
#endregion
}
Now run the application. It never reaches to host place.
Solution (Workaround): You can resolve it through by "CallExternalMethod" activity. I will explain about this on next part with downloadable source code.
Although I am very irregular to Orkut, one of my friend called me from US one day about his new application in Orkut.
This application lets you scrap graphically and you can share it with your friends. As a novice Orkut user, I am alleged about the real usage of this application. It could be very helpful to convey my though process in a graphical manner. I like the terms "Ort" for "Art" and Ortist. It lets you save your "Ort" also.
I have faced two issues when using this application:
1. Where is my eraser? May be it is not visible for my eyes.
2. Dedicated tool for writing. Even though I can decrease the thickness of "Pencil" tool, its not convenient for me to write anything in the "Ort".
Wishes to my friend for this nice idea. Let the world to use it successfully. Happy Programming.
For more details: http://ortist.wordpress.com/about-ortist/
Monday, June 23, 2008
Though, I am very comfortable with other Microsoft Live services, but I am very much comfortable with Blogger when it is blog.
After two plus years in Space blog (http://udooz.spaces.live.com/), I have come back to blogger.
Hope that your system has loaded with Microsoft's new Visual Studio 2008. I was really excited when I saw the new features of C# 3.0. In this article, I am going to brief you about the new features of C# 2.0 and 3. The reason I have taken C#2.0 also is for "Generics".
If your company yet to buy VS2008, don't worry. You can download FREE express edition of VS2008 at http://www.microsoft.com/Express/Download/.
Let us start.
When I have a chance to see Ruby code a year before, I was really astonished by its clean syntax of. Three main aspects that are impressed me lot. These are:
1. Clean syntax
2. Simple syntax
3. Smart syntax
After a long while, I saw the new features of C# 3.0 those are just inspired by Ruby's syntax and features. After gone through the small exercise on various new features, I just really love C# 3. Before looking into these, it could be helpful to know about Generics, a feature derived from C++.
Generics
If you are coming from C++ (learned in academic also a worth), you know the "Templates". It provides a kind of reusability. When you need to store a collection of objects, the first choice was ArrayList in the days of .NET 1.x. It lets you store a collection of any type. When you iterate through the collection, you should very careful about type casting of the object in the collection. To store a collection of objects with same type, then Plain Old Array (please do not try to create another TLA - Three Letter Acronym POA) is the best choice. Then what is the necessary for Generics.
The first concern with .NET 1.x collection types is the type casting a.k.a boxing/unboxing. These collections only knows "System.Object". Each time when storing or retrieving, we have to pay the cost of boxing/unboxing.
The second concern is the need of strongly-typed collection. Suppose you want to store a collection of object of type "Account", you have two choices based on the usage frequency of "Account" collection. Either you have to create custom collection by deriving IEnumerable. Otherwise, the illiterate "ArrayList".
The above two are the main reasons for the born of C# Generics inspired by its grand father "C++" in its version 2.0.
Assume that whenever you need to implement common behavior for more than one type, you can just put a place holder on the type declaration. Suppose, I want to implement common behavior for object storage with "Stack" model, in .NET 1.x period, I have to declare it as:
public class Stack
{
private int _position;
private object[] _elements = null;
public void Push(object element)
{
if(_position <= _elements.Length) _elements[_position++] = element; // else through exception } public object Pop() { if(_position >= 0) return _elements[_position];
}
}
In the modern age of .NET 2.0, I can put a place holder for type declaration like:
public class MyStack<T>
{
private int _position;
private T[] _elements = null;
public MyStack(int capacity)
{
_elements = new T[capacity];
_position = 0;
}
public void Push(T element)
{
if (_position < _position =" _elements.Length">= 0) return _elements[_position--];
return default(T);
}
}
In line 1, I have declared MyStack class with the place holder T. You can use any name within the angle bracket (< >). But you should use the same name across the code. After specified the place holder, I have assumed and used T as a strong type.
In line 15, you can see that the Pop() method returns either the element at the head of "null" value of the type. How can you specify the null value of a type. Here, the problem is I have to return "null" for reference type and default value for value types. For this, C# provides "default" keyword which returns default value of the given type. Ok, now how can you use this class for all variety of types:
MyStack<int> s = new MyStack<int>(2);
try
{
s.Push(100);
s.Push(200);
s.Push(300);
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
Console.WriteLine("1: {0}", s.Pop());
Console.WriteLine("2: {0}", s.Pop());
Console.WriteLine("3: {0}", s.Pop());
You can see the output like this:
Stack full
1: 200
2: 100
3: 0
Here, when I tried to get the top element third time, it returns default value of "int" type 0.
You can declare Generic on struct and interface also. .NET 2.0 provides the following interfaces:
- ICollection
- IComparer
- IDictionary
- IEnumerable
- IEnumerator
- IList
Generic Method
You can also use/apply Generic in a method which might be a static or non-static member of either generic and non-generic type. Like the declaration of Generic type declaration, you specify the template like the following:
public void MyGenericMethod<T>(T arg1);
Generic methods change the way we use factory methods. For example, in .NET 1.x, we declared factory method like the following:
public object CreateInstance(Type t);
If you need to use this method, you have to use boxing/unboxing, like:
Account myAccount = (Account) MyClass.CreateInstance(typeof(Account));
But, when you use Generic on this method like
public T CreateInstance<T>();
You can simply use CreateInstance like:
Account myAccount = MyClass.CreateInstance<Account>()
See the clear syntax of the Generic method. And it is not necessary to apply type casting also.
Obviously you can use Generics in delegates also.
-to be continued.
Wednesday, June 11, 2008
After attending Intel Developer Network meeting regarding their Moblin community, I was really liked to install Ubuntu on my machine.
After a month, I got a Live DVD of Ubuntu 8.04 LTS. I was really stunned the way Ubuntu organize the installation steps. Wit 7 smart steps, you can install Ubuntu without any technical challenges. But I've faced issues in disk allocation in Live CD mode. The guided option is not soo smart. It tried to swallow my Windows partition. The manual option throws error. After that I came into installation mode and used manual disk allocation. This time Ubuntu installed successfully.
Once completed the installation, I have configured my Internet connection through my Wifi without any issues.
One thing I hate with major Linux distros is that they have installed most of the softwares under a same category. For example, for Programming, KDevelop, QtDesigner, etc have been installed. But Ubuntu is very clear on this. If you want then install.
Ofcourse, one thing I still feel bad is the unhealthy fonts.