• Home
  • Posts RSS
  • Comments RSS
  • Contact me
Blue Orange Green Pink Purple

FEATURED - CONTENT ---> An Absolute Dummy's guide to Silverlight 3

I know it’s a little late for a Silverlight 3 Tutorial and there are “ample” of Tutorials out there on this topic, but what I found lately during my quest to learn Silverlight 3 technology was that the Beginners got lost in the deluge of information and don’t know where to begin. Somebody very well said : “ Wealth of information creates poverty of attention” On my journey (which still continues) named "Learn Silverlight" I came across some really useful Tutorials which get lost in the large search list returned by Google ( I would suggest you not to click it ) . So as a moral duty , I present to you – Beginners like myself , the “Absolute Dummy’s guide to Silverlight 3” as a series of Blog posts . Keep checking for updates !!

Hello World.

Just testing the mobile blogging app on my P1i. Verdict : It seriously lacks features. Note to @gx_saurav. Can we work on a Blogging app instead ?
Read More 0 comments | Scribbled by vandit | Links to this post | edit post

My Novice Photography

The final vacations of my Engineering degree have just began and I have already made a trip to Nainital ! Due to delays in the Vacations and a few uncertainties I couldn’t book the Train Tickets in advance and ended up paying a little premium for the Tatkal tickets . However the sorrow mitigated as I boarded the train and set off for Nainital.

In Nainital I decided to pursue one of my Hobbies i.e. Photography. Frankly speaking I am a Novice at it. The tool at work was a  Sony Cybershot T77 whose review* I had written earlier. Nainital is a host to some wonderful flowers and scenery and I thought of working with the Shutter a bit.

Flower

For clicking the pictures of the Flowers, I used the Macro-Focus mode, threw in some imagination and I hence I have a Flickr stream of my own now :) . Most of them were clicked just for practice – you know – adjusting the focal point, position relative to the Sun, Matter of Subject etc.

Too bad I couldn’t find the settings to change the shutter speed else you’d have ogled at some awesome pictures that I visualized in my mind. So the round of shooting Flowers is over. Next time I venture out in the Vacations , you’ll find more variety in my PhotoStream. Thinking of Shooting some Black & White scenes but that’ll be after the exams ( Starting from 8th June ‘10 and ending probably by the end of June )

So that’s that and here I present you some of the pictures I shot there at Nainital.

GOTO My Flickriver Photostream © (in case you missed the link on the picture above)

Comments on the photos are Appreciated .

- Vandit Khamker.

* The pictures in the Review post were taken with utter disregard of Photography Principles .

Read More 1 Comment | Scribbled by vandit | Links to this post | edit post

IPL 3 Standings ( Extrapolated )

Hello Folks ! IPL Season 3 is here and I have  this strong urge to write about a strange pattern I have observed. The 1st season of IPL was as exciting as Cricket can be made. The feeling when an underdog wins can be scripted into a Hollywood movie.  IPL 2 was a bit on the down side on excitement due to it being shifted outside India and given the short duration for preparations , I think the IPL team did a fantastic job . Come to season 3 and the season so far has been exciting with all teams being equally competitive and the game being played in spirit (with all the money involved , they have to ;-) )

So far the Standings (that matter) of the IPL in the 2 seasons are :

Season Winners Runners up Semifinalists Sore Losers
#1 Rajasthan Royals Chennai Super Kings

1.) Punjab

2.) Delhi Daredevils

Deccan Chargers.
#2 Deccan Chargers Royal Challengers Bangalore 1.) Delhi Daredevils

2.)Chennai Super Kings.
Kolkata Knight Riders.

Based on some *analysis on a scratch pad, some random guessing and some assumptions (will not be specified ) , I prepared a extrapolated points table based on the trend observed in the two previous seasons  with the time scale in mind . My predictions for this year’s standings are :

Season Winners Runners up Semifinalists Sore Losers
#3 Kolkata Knight Riders
Delhi Daredevils 1.)Mumbai Indians

2.)Royal Challengers Bangalore
Kings XI Punjab.

Don’t ask me how I made these predictions or put your money on them. They are as much strongly based on facts as an over-zealous Mac-fanboy making statements on the Microsoft line of products. I would like to know your opinions and your Guesses on this year’s Teams and their standings.

( *Analysis ? What Analysis ? If you are a sick guy demanding exhaustive data on such an usefullless issue , go waste yourself over Alcohol and buy an iPad or something . Rest of you just enjoy the proceedings. )

Read More 4 comments | Scribbled by vandit | Links to this post | edit post

Ch. 2 – Communicating With Web Services from a Silverlight application For Absolute Dummies !

 

First of all , let me make it clear that I am not a Graphics Designer (and neither I am cool.) . I am the guy that handles stuff that goes on the backend of a software – the Database and Business Logic stuff . So queries regarding what tools to use to design the interface and giving shiny animations will not be responded to or at the best redirected somewhere else.

NOTE : If you are accustomed to the ASP.Net programming model , you *will* face some mental blocks during the Silverlight application development. Why ? Because there are no Auto-Postbacks to the server in Silverlight !! If a call to the server is necessary, it must be manually initiated by the  developer. No need to worry, we will handle all that confusion in this chapter.

SILVERLIGHT 3 – THE SUPPORTED COMMUNICATION PROTOCOLS AND CHANNELS

Sockets:
Silverlight 3 supports sockets programming (Use the System.Net.Sockets namespace). A socket is a low-level communication channel that is generally configured using TCP/IP.Silverlight 3 supports asynchronously sending data back and forth across a socket over TCP ports, ranging from 4502 to 4534. Be aware that sockets programming is low level,requires more code to implement, and lacks the more robust features of some of the other networking standards. Silverlight 3 supports socket communications between a Silverlight application and any server as long as a cross-domain policy implementation is in place on the server.Sockets are most commonly used to push data from the server to a client. A socket, when used in this manner, eliminates the need to poll the server for updates on a timed basis thus reducing network traffic generated due to polling. We will be using a cooler and higher level channel/protocol for communication –> Web Services +  The SOAP (Simple Object Access Protocol) protocol ; So if there is a strong urge to know more , a detailed view of Sockets can be visited at the MSDN page  HERE.

WEBSERVICES  – The real thing !

If you are a .Net web developer, you might have an idea of what web services are. Yes , you can consume those pricks  using Silverlight .  * slurp ! *. For those who don’t know what the hell are Web Services , for them:  Web services are, well , services that are hosted on the server and you can write your code into them and use entities from them like calling functions  etc from the front-end. This will keep your code free from front-end implementations and also make it reusable. They are a common implementation of the SOA ( Service Oriented Architecture ) model. Don’t worry, the picture will get clearer as we proceed.

So what we want to build has a simplified architecture as shown.

SOA Silverlight Architecture

CREATING A WEB SERVICE :

  • Create a new Silverlight project with a web application as a Test Harness. Right-click on the .Web project , select Add>New Item>web service. Give it some cool name. ( I preferred WebService1.asmx  for this tutorial ).
  • Now open the code of the service you just created and you’ll see a [webmethod] named helloworld()  already built by VS. To test a WebService without any front-end , right click on the WebService and click “Open in Web Browser” . This will let you test methods which take primitive data types variables as arguments. Cool , click on the method name and you’ll see hello world returned in XML. This will signal everything is fine.
  • Now create a ClientAccessPolicy.xml File. In order to protect Web Services from being called by malicious Silverlight controls, Microsoft added a configuration file to Web Services so that access to the service from a control can be configured. A Web Service that is to be consumed by a Silverlight application should include a ClientAccessPolicy.xml file in the root of the virtual directory where the Web Service is hosted. The ClientAccessPolicy.xml file includes information pertaining to the controls and domains that are allowed to call a service. A standard ClientAccessPolicy.xml file is shown here:
    <?xml version="1.0" encoding="utf-8" ?>
    <access-policy>
      <cross-domain-access>
        <policy>
          <allow-from http-request-headers="*">
            <domain uri="*" />
          </allow-from>
          <grant-to>
            <resource path="/" include-subpaths="true"/>
          </grant-to>  </policy>
      </cross-domain-access>
    </access-policy>

CONSUMING A WEB SERVICE :

  1. Adding a WEB REFERENCE : Right click on the references folder of your Silverlight project in solution explorer and click “Add web reference”. Click Discover to find Web Services currently available. You’ll find the following screen Ok and it will be added to your application ready to be consumed :Webservice 
  2. To start using the Web methods defined in the service , open the MainPage.xml we created in Ch –1 (the dumb 1 textbox – text1 and a button b1 GUI ). Create a Object of the service we just added as a reference by adding the following code in the MainPage ServiceReference1.WebService1SoapClient svc1 = new ServiceReference1.WebService1SoapClient();
  3. In the MainPage constructor we will create handlers for the Asynchronous calls to methods as we mentioned earlier that Silverlight supports only asynchronous calls . To do that add the following code :

    callbackcode

  4. Now add an event handler to the button b1 as discussed in ch 1. add the code in the event handler body as follows :
      1. svc.HelloWorldAsync(); 
  5. run the application. Press the button and observe.

WOW ! HOW DID THAT HAPPEN ??

Lets rewind a bit and understand what happened there. When the button is clicked , its event handler is called which executes the HelloWorldAsync method of the service SOAP Client object and hence the helloworld() webmethod from our webservice is called. The return value of helloworld() method of the service is captured by the “Result” property of the HelloWorldCompletedEventArgs object which we are displaying in the textbox (text1) .

Did you notice the communication between the Web Service and the Silverlight frontend. This is handled by default by the SOAP protocol so we didn’t need that much coding to handle the communication. You can use other protocols like  POX , REST , JSON but as this is an introductory tutorial, we wont dive deep.

PS :

Do try your hands at developing new Web methods which take arguments and return objects of your custom class. [Hint : you will have to “Serialize” your custom class objects to transport them over SOAP . ]

Do ask if you have any doubts . Till then . Chao !

- Vandit.

 

 

Read More 0 comments | Scribbled by vandit | Links to this post | edit post

Ch. 1 – Getting Started with Silverlight 3 – For Absolute Dummies.

 

DISCLAIMER : The Author of this Article doesn’t claim this article series to be original. The author himself is a beginner in Silverlight Development and has written this only to help beginners find their way in the maze.

Silverlight is a technology developed by Microsoft that enables the development of Rich Interactive Applications (RIAs) that target the Web ( Silverlight 3 also has the “Out-of-the-browser effect” ). Silverlight is a cross-platform and cross-browser plug-in that is composed of a subset of the functionality included in Windows Presentation Foundation (WPF) and the .NET Framework.

- Microsoft Silverlight 3 – A Beginner’s Guide.

I am not going to discuss the History of Silverlight but , when designing and developing the Silverlight versions ,Microsoft has taken notice of the features being offered by all competitors (Flash, JavaFX  … blah blah blah) and has used that as a baseline for creating a new product. As a result, Silverlight includes many features and functionality not available from competing technologies.

For a detailed listing of features , visit here. (You might not actually want to use that many.) Now that sets up the background for Silverlight 3 .

The TOOLS you’ll need to Develop Silverlight 3 Applications are as listed and can be obtained from HERE :

  • Visual Studio 2008 SP1 / 2010  / Visual Web Developer Studio. (Our Favorite IDE  !! )
  • Silverlight 3 tools for Visual Studio. (Needed for Dev. Silverlight 3 Applications. )
  • Silverlight 3 Toolkit. (Provides additional Silverlight Controls )
  • Microsoft Expression Blend 3 . (Required for Graphical Editing of UI  . Awesome Tool . )
  • .NET RIA Services ( If you want to utilize server side data in a 3 Tier application . Don’t worry too much if you don’t understand it at this moment.)

GETTING YOUR HANDS DIRTY SILVER, FOR THE FIRST TIME.

  1. So now that you have the required tools in place, Open up Visual Studio 2008/2010 IDE and Click on FILE > NEW > Project.  new_project
  2. Select the Language of Coding (of your preference , I chose C# ) and Select the Silverlight option in the left frame .
  3. In the templates frame (on the right ) Select the Silverlight Application  and Give it a suitable name and click create.
  4. In the dialog box that pops up , check the “Host the Silverlight Application in a New Website.” and select the project type as ASP.NET web Application .
  5. Ok so you have created your First Silverlight application !

WAIT A MINUTE , I DON’T UNDERSTAND A THING.

That’s what this article is written for my boy. Wait.

UNDERSTANDING THE SILVERLIGHT APPLICATION STRUCTURE

Open up Solution Explorer (Ctrl + Alt + L). You’ll see Two projects added to your Solution. The first project shown is the web application test harness (The part where you’ll test your Project is called the Test Harness.). The second project shown is the Silverlight application. In the Silverlight application, the only files of interest at this time are the MainPage.xaml file and the associated code-behind file, MainPage.xaml.cs.

The MainPage.xaml file will be opened by default in Visual Studio for editing. The WPF Cider XAML designer was introduced to Silverlight in version 2 but is currently locked in read-only mode. Hence, Silverlight 3 applications created by using Visual Studio 2010 must be created through direct XAML coding. The alternative method  for creating and designing a Silverlight application is to use Expression Blend. A Silverlight application created in Visual Studio can easily be opened in Expression Blend as both of use the same project Structure .

To open it up in Expression Blend 3 , right click on the MainPage.xaml file in the Solution Explorer and select open with Expression Blend option and click yes if prompted by a security warning dialog.

WHAT IS XAML AND WHY DO I HAVE TWO FILES , ONE WITH A .xaml.cs EXTENSION ?

The Extensible Application Markup Language (XAML, pronounced zammel) is a custom
XML grammar that Microsoft created for use in WPF.

A XAML file is used to define user interface components and layout. A parser reads
the XAML file and instantiates objects behind the scenes to build and lay out the interface
indicated. As related to WPF, a XAML file may contain one of three document elements:
the <Window> element, the <Page> element, or the <UserControl> element, depending on
the type of WPF application created . ( Didn’t we say SIlverlight is a subset of WPF and .NET framework ?? )

The other file with the extension .xaml.cs is the code-behind file which maintains the event handling and other mechanisms related with the designer file (.xaml file).

OK THAT EXPLAINS IT , BUT NOW WHAT ??

  • From Expression Blend add a TextBox and a Button to the Canvas (The default drawing area ).
  • Click on the Textbox and from the properties frame , give a name .eg. Text1 . Repeat similarly for the Button.
  • Save the project and open it in VS and check the Mainpage.xaml file again and you’ll find the XAML code written for the Textbox and the Button. Explore the various properties of the controls using the VS’s Intelli-sense (press a spacebar after one of the properties and you’ll get a list to choose from .) intellisense
  • In the properties of the Button we will add an event handler. To do this , add the following code

<Button x:Name="B1" Content="Click me" Click="B1_Click"/>

  • Right click on the B1_Click and select “Navigate to event handler” .  In the click event , add the following code.

Text1.Text = "hello, I am a dummy";

(Text1 is the name of the TextBox you added from Expression Blend.)

  • Right click on the SilverlightApplication1TestPage.aspx from Solution Explorer and Click on “Set as Start Page”.
  • Run the application by going to the Debug menu and click start debugging. (Try using F5 for the same thing from the next time.) Voila ! You have created your first Silverlight Application.

WOW ! BUT HOW DID THAT HAPPEN ? THE ADDRESSBAR OF MY BROWSER READS “http://localhost:52456/SilverlightApplication1TestPage.aspx” WHEREAS WE DID THE CODING IN MAINPAGE.XAML .  HOW ??

You are a smart-ass but the Visual Studio got the better of you. As I said before the .web project is your TEST HARNESS , your highness. click on the  SilverlightApplication1TestPage.aspx and select the designer view. If you look carefully , you will see a frame with an object tag on its top. (NOTE: VS 2010 may have <asp:Silverlight > tag.) This is where your Silverlight application will be loaded and displayed . Ok , Now open the SOURCE view. Observe the Object tag we discussed in the design view.  The main part is here

<param name="source" value="ClientBin/SilverlightApplication1.xap"/>

This determines the source of the Object . (In our case it is our Silverlight project.)

I leave it to the curious reader to explore the Source in detail.

 

NOTES :

  • This was a superficial Introduction to the topics covered due to time and space anomalies of a Blog . For a more exhaustive one, read the first 2 chapters of “Microsoft Silverlight 3 – A Beginner’s Guide.” by Shannon Horn. (But don’t hurry , you’ll lose hope and some hair too. )
  • The application we just created is useless and just for getting used to various things.
  • I recommend the reader to practice using simple controls like textbox , button , label , etc and get used to writing event handlers for them before jumping on to the complicated ones. (Yeah, Lots more fun coming up.)

- Vandit.

Read More 0 comments | Scribbled by vandit | Links to this post | edit post

“ Bored till creation ” - The theory.

 

Disclaimer : What you are going to read is in no way a work of research or scientific thesis . It’s just a random outcome of the thought process that exists in a sick (literally… the throat infection kind..) person’s mind who is “ bored till ingenuity ”and might have psychedelic effects on your mind ( just joking ) . Don’t know what this drab sounding theory is all about ?  Read on …

Someone asked me , “ Is the Darwin’s theory the ultimatum for the explanation of evolution ? Does it not have the loop holes that usually exist in other theories ? ”  I shrugged off his question as my mind was too occupied with other things and I thought it was a trivial question. Things that didn’t allow me to look beyond the obvious and the unquestioned . Our minds are trained to accept the conventionally theorized principles in the schools. If you begin to question the textbooks in your exams , well , you stay in the school for a few more years than you normally would  ( not a personal experience… ).

The thing is , when you have nothing to occupy your mind - no books around , nothing worthy of reading , no classes in the college and no project at hand and you are too Sick to think anything Academic or do your Homework or play outside , then , you get start getting bored . There is that  phase when you feel as if Time is going by slowly, you check your watch twice every  minute or so and you want to do something. This span of moments , as no great man once said , gets you thinking more clearly on a seemingly trivial thing  than you normally would. The mind “searches” for information from weird sources .

There was this day long back when I had nothing to do for a few hours as I was away from my HQ. No computers to play around and code some apps for personal use . I couldn’t find any sort of literature to read as I was miles away from a homely environment/newspaper stand , I had friends who were busy that day and the GPRS service on my cell-phone wouldn’t work. I had absolutely nothing on my mind. Had it been occupied at that time , it wouldn’t have allowed me to think of  “Cloud Computing” as a basis for the Major Project for my college curriculum . Observe the tendency of the human mind to get thinking when there is nothing to think. If it would have been any other day in the park, I would have procrastinated to even think about what I am going to do the next week ,  leave the next semester project .

I guess getting bored lets creative things flow . You start to look into things more deeply , analyze every aspect and even question the obvious and the well theorized . Einstein would have had many such days at a stretch and so would have Newton. #Just_thinking . The traits of this can also be seen in the prehistoric days.

Imagine the prehistoric man in the form something similar to an ape. He had nothing to do but play around with his family and eventually got too much of it and hence got bored . Then came the inventions to play around with Animals - the nicely groomed sticks and clubs and started running around in the Forest . This straightened his posture as well as got his legs’ muscles strong. What is more intriguing is the discovery of fire. Yes , it was an accident and what I think is , that Man got bored of  playing with sticks and adopted Flint stones instead. This lead to cooking ( The “Mommy , I am bored of eating raw flesh everyday” thing. ) . See it might be Necessity that is the mother of invention but not always. 

As days passed , the prehistoric man got bored of wearing tree barks and animal skin and found out a way to stitch , weave and his posture got straighter as he was bored of walking with a hump on his back and we have the “homo- erectus” and  gradually the “ homo- sapiens” .

I have started becoming a fan of getting bored. Necessity says “Adapt or find a way,you prick !!” but these valuable moments of having nothing on your mind say “ Hey this seems cool , let me venture more into it” and eventually you end up inventing something or the other.

Even the Yoga Gurus spread the same thought. They tell you relax , let go off everything from your mind. I have read about some camps where you can’t speak with anyone . (Hey is this article making a serious note  here ? ) They tell you to meditate for an hour or so in an empty room so that you don’t get distracted. You begin to look for things to interest you but in vain. Then, if you religiously carry it along for a few more ticks of the clock , a time comes when you attain “Dhyana” …. or so they say in an enchanting way.

A careful observer would say that it is precisely the thing I have been saying all along this article. Actually, all they do is get you bored.  Now folks , those who said this word didn’t feature in their Dictionary , better add it – It is the cool thing now .

And by-chance if you have read till this “comma”(,) Congratulations , you’ve got bored !!

- Vandit.

Read More 2 comments | Scribbled by vandit | Links to this post | edit post
Older Posts

Vandit's web-zine

  • About
      About me:
      Hello World. I am Vandit , a sensible person generally, but I do write some obscure articles occasionaly. Hope you like my blog and keep coming up with your creative comments ! Apart from technology , I do write about current affairs, daily anecdotes and other interesting topics. Thanks for Visiting !
  • Subscribe To

    Posts
    Atom
    Posts
    All Comments
    Atom
    All Comments

    Quotation of the Day

    You Are Visitor no:

    web counter

    My Twitter updates

    Twitter Updates


      follow me on Twitter

      Blog Archive

      • ▼  2010 (7)
        • ▼  September (1)
          • Hello World.
        • ►  May (1)
          • My Novice Photography
        • ►  March (2)
          • IPL 3 Standings ( Extrapolated )
          • Ch. 2 – Communicating With Web Services from a Sil...
        • ►  February (1)
          • Ch. 1 – Getting Started with Silverlight 3 – For A...
        • ►  January (2)
          • “ Bored till creation ” - The theory.
          • The 3 Idiots - 5 Point Someone Fiasco and my Opini...
      • ►  2009 (42)
        • ►  December (1)
          • A pledge to keep blogging.
        • ►  October (1)
          • Thoughts from people of our age ( via @sengupta )...
        • ►  September (1)
          • Heights of epicaricacy !
        • ►  August (1)
          • A twitter application under development.
        • ►  July (2)
          • Thoughts on Piracy and My disappearance from the b...
          • Awesome Geeky “Your momma … ” quotes !
        • ►  June (3)
          • Fantastic Optical Illusion
          • Respect for opinion.
          • Pardon me for a moment ,fellas !
        • ►  May (4)
          • The Twitter Faux Pas .
          • Yes, I am flabbergasted !
          • Access the root without a root password on a Linux...
          • Google’s innovation of the year is …
        • ►  April (7)
          • Partitioning HDD in Vista .
          • CAT 09 to go online !!
          • “ The Hummus ” Recipe
          • Hackintosh is pointless, after all !
          • Earnest apologies, my amigos !!
          • The “ THE ” and the “ A ” .
          • Why do people despise the GOTO statement ?
        • ►  March (6)
          • An experience at the vaccination centre
          • Sony Cybershot T77 – An unofficial Review
          • Dell Studio 15 - The flaws that crop up !
          • Amazing Photoshop Tutorials !
          • The Linux Kick-Off !!
          • Get a full-screened turbo c/c++ on windows Vista !...
        • ►  February (5)
          • An experience with Dell customer care .
          • Creating Unattended Windows XP installation CDs .
          • Imposing beauty !!
          • An account on Sharukh Khan- His pre-stardom days !...
          • The strange case of stubborn bails
        • ►  January (11)
          • A day in the garden with my p1i
          • What went wrong with SATYAM ? - A brief note on sa...
          • The mysterious case of missing “ LIFE ” !!
          • The official invitation post !!
          • The journey !!
          • Wah India !! Way to go !!
          • Stamp and coin collection .
          • Tilt-shift photography
          • Windows 7 available for beta testing .
          • An attempt to phish me in vain !
          • Hidden / Useful features in windows vista.
      • ►  2008 (36)
        • ►  December (6)
          • Benchmarking approaches insanity
        • ►  November (7)
        • ►  October (8)
        • ►  September (6)
        • ►  August (6)
        • ►  July (3)
      • ►  2006 (1)
        • ►  July (1)

      Our recent Visitors !!

    • Find Your Favourite Articles




      • Home
      • Posts RSS
      • Comments RSS
      • KNOW ME BETTER !!

      © Copyright Vandit's Webzine. All rights reserved.
      Designed by FTL Wordpress Themes | Bloggerized by FalconHive.com
      brought to you by Smashing Magazine

      Back to Top