A Place for C Sharpers/.Netters

I Will do coding till last moment of life-Kiran Patil

Archive for November, 2009

Access Internet/Local Website from Your Windows Mobile Device Emulators

Posted by kiranpatils on November 19, 2009

Challenge

If you want to access any website Or You want your locally developed mobile application/web application to be viewed in Windows Device Emulator then you are at the right post.

Solution
  1. Download ActiveSync and install on your local machine where you would like to run Emulator. How to setup ActiveSync?
  2. Open Visual Studio and click on Tools | Connect to Device:

clip_image002

  1. Select Device emulator to run and say connect.

clip_image004

  1. It will open your device emulator:

clip_image006

  1. Verify that ActiveSync is up and running by its symbol in Notification Area.

clip_image008

  1. Open Device Emulator Manager

clip_image010

  1. Currently running Device Emulator Manager will be shown in Green.

clip_image012

  1. Right click and say “Cradle”

clip_image014

  1. As you click on Cradle ActiveSync window will popup. Select Guest Partnership[Or better do cancel it will by default to Guest Mode]. If your Emulator got synced with ActiveSync then Notification Icon will go Green.
  1. Now you are ready to access website.
    1. Internet – Enter your URL.

clip_image016

    1. Local – To Access your Local Website which is running on Cassini(Development Web Server). To access it you need to access it by IP ADDRESS:PORTNUMBER. Please note that you can’t access it by localhost:PORTNO Because localhost points to Emulator’s localhost and it will never go to your machine. You have to see both Emulator and your local machine as a two different devices even though they are running on same machine.

clip_image018

If this blog helped you. Say a big thanks to my friends who always give me a shout whenever they found something challenging like this and inspire me to learn a new things which finally inspires me to pen down on my blog and share with you :)

Happy Emulating!

Webliography

Setup ActiveSync

Nice blog – Thanks to this blog

If you have Windows Vista or Later

Accessing Device Emulator Without ActiveSync

Feedback

Posted in ASP.NET, Windows Mobile | Tagged: , , | Leave a Comment »

Delivering Multimedia

Posted by kiranpatils on November 16, 2009

Now a days I’ve started preparing for my next Microsoft Certification exam 70-547. And it’s going on really well as i am learning the things which i was knowing but now i am coming in to know the PRO. use of it.

Anyways today i am going to show you how you can deliver Multimedia on your website. Because in this era everyone needs to have it :)

But before we delve in coding part which we all developers love to do. Let’s take a look at some basic things which is good to know.

Non-Streaming :- The Audi/Video files must be downloaded completely before playback can begin.

Non-Streaming Audio Formats are waveform(.wav), sound(.snd), Unix Audio(.au), Audio Interchange File format(.aif.aiff,.aifc)

Non-Streaming Video Formats are Audio-Video Interleaved(.avi)

Streaming :- The Audi/Video files can started playback and files keep downloading itself in background. This one gives better user experience.

Streaming Audio Formats are Moving Pictures Experts Group standard 1, Layer 1,2,3 (.mpa,.mp2,.mp3), Windows Media Audio(.wma)

Streaming Video Formats are Moving Pictures Experts Group standard 1 (.mpg,.mpeg,.mpv,.mpe), Windows Media Video (.wmv)

Hooh..too much theory. Let’s start how we can deliver multimedia on our page.

There are two ways of doing this:

1. Embedded Playback : you can embed Windows Media Player on your page directly. But client should have installed Windows Media Player on his/her computer to view your multimedia files.

The code looks like as below:

<div class="csharpcode"><html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
 <title>MultiMedia Page</title>

 <script type="text/javascript" language="javascript">
 function StartPlayer()
 {
 //Using DOM play your MultiMedia File
 document.player1.URL = "Resources/vande.avi";
 }

 function StartStreamingPlayer()
 {
 document.player1.URL = "Resources/Intro_to_ASP_.NET_3.5.wmv";
 }
 function StopPlayer()
 {
 document.player1.controls.stop();
 }

 function PausePlayer(buttonPauseOrPlay)
 {
 if(buttonPauseOrPlay.value == "Pause")
 {
 document.player1.controls.pause();
 buttonPauseOrPlay.value = "Play";
 }
 else
 {
 document.player1.controls.play();
 buttonPauseOrPlay.value = "Pause";
 }
 }
 </script>

</head>
<body>
 <form id="form1" runat="server">
 <div>
 <object id="player1" height="400" width="590" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
 </object>
 <br />
 <br />
 <input type="button" name="btnPlay" value="Start Non-Streaming File(.avi)" onclick="StartPlayer()" />
 <input type="button" name="btnPlay" value="Start Streaming File(.wmv)" onclick="StartStreamingPlayer()" />
 <input type="button" name="btnStop" value="Stop" onclick="StopPlayer()" />
 <input type="button" name="btnPause" value="Pause" onclick="PausePlayer(this)" />
 <br />
 UI Mode :
 <select id="selUIMode" onchange="this.document.player1.uiMode = selUIMode.value;">
 <option value="invisible">Invisible</option>
 <option value="none">None</option>
 <option value="mini">Mini Player</option>
 <option value="full">Full Player</option>
 </select>
 </div>
 </form>
</body>
</html></div>
<div class="csharpcode">

Output of the above piece of code is as below: It will be real fun when you try on your own :)

Media Player In Browser

In above code the main things is :


 </span><object id="player1" height="400" width="590" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6">
 </object>

<pre> 

2. Playing file with an External Player is easy. Just following piece of code does that for you:

this.document.location.replace(FILENAME.wma);

Hope you’ve enjoyed it!

Happy Video Playing!

Posted in ASP.NET | Tagged: | Leave a Comment »

MSDN got a new look!

Posted by kiranpatils on November 1, 2009

One of my best friend MSDN – i guess yours too :) got a new look! Few days back while i was searching for something on MSDN – Which i always do :) i saw the new look of MSDN. It really looks a great and really few nice enhancements they did.

image

image

Switch View functionality is really great you can switch the views to Classic, Lightweight Beta and ScriptFree

Happy Reading!

Posted in Latest happenings, MSDN | Tagged: , | Leave a Comment »

How to Debug Windows Service

Posted by kiranpatils on November 1, 2009

Hi Folks, Sorry for being invisible for a long time. But i got really tied up with my bits. Anyways it’s good if i be more busy then i will get more stuff to write :)

First of All Happy Diwali And Happy new year to all of you! I hope this year you face so many challenges which makes you strong in your field!

Challenge

If anyone of you worked developing Windows Services in Visual Studio then one thing you must be wondering too do Debug – which makes programming easier. It’s not as easy as putting breakpoint and do debug like console,windows or web. It is an art to debug windows service.

Solution

To Debug windows service you can use Debugger.Break() method — Signals a breakpoint to an attached debugger.

So here are the steps to debug any piece of code in windows service:

1. Call Debugger.Break() Method before the line you want to put Debug point.

2. Now on the point which you want to get called put breakpoint. Means next line to your Debugger.Break() Line.

3. Now start your windows service. Whenever your piece of code executed. You will see Visual Studio Just-In Time Debugger Window. Choose VS instance and here you go!

Have a Happy Debugging!

Webliography

http://dotnettipoftheday.org/tips/how-to-debug-windows-service-startup.aspx — Another Blog

http://stackoverflow.com/questions/761120/how-to-debug-a-windows-service-using-breakpoints — Same Challenge

Posted in Windows Forms | Tagged: | Leave a Comment »