Facebook

The greatest social networking giant with more than 500 million users. Wow 500 million what a great number. We can see almost all the businesses having their pages or ads or something in FB; from Microsoft to the Dosa Shop near my campus. 🙂

I thought about some features that FB may implement in the future, and some features which I consider as nice to have.

FB can give some themes to decorate the home page as we want. These can be pre defined themes as Windows Live provides or they provide an editable CSS as MySpace does. I read in a blog entry this feature is not implemented because FB wants to ensure the same loading time in all the pages and no more delayed loading. But whatever it is it would be nice to have themes as we want.

Another advanced feature and I name this as ‘Facebook Globe’ which would be a prototyping tool to visually maps the relation ships we have and the links and the data shared. In highly advance this can also maps photos and able to create panoramic photos. Wow that will be really great and sounds interesting. Do not steal this project idea.

Just wanna share some thoughts on Facebook. Put your own suggestions and ideas that FB can adopt in the future.

Live Streaming with MS Encoder 3

I’ll explain you how to do a live streaming using Microsoft Encoder 3. Me and my friends tried out this in our boarding place using a simple local area network and succeeded. It’s not a big deal of course. Most of the work (almost all) is done by the Encoder 3. If you have a powerful machine then you can stream to many number of hosts. Here is the way how to do it.

Install Microsoft Encoder 3 in your machine. And I assume you have the Encoder installed on your machine for the further explanation. I did this in my machine which is running on Windows 7 Professional.

I didn’t explain here how to create a peer to peer connection between two machines thus it will make the post big, but you can get plenty of resources in a simple googling.

Once you set up a network check whether both machines are accessible. In your browser type the other machine’s IP like this http://yourIP. If both machines are networked and if a server is running on port 80 you’ll get a response.  There are plenty of ways to check the connection but I recommend this here since for the Silverlight Live Streaming you need the IIS as well. By this check you make sure that both machines are connected and well as the IIS is ready to be used.

Then start the Encoder. Click on Live Encoding. Select your webcam as Live source and if you have a sound device select it as a Audio device. Cue your live source.(your webcam). In this time you could able to see your web cam’s screen in the Encoder preview panel. Select the output as Broadcast. (Default port will be 8080 you can change it if you want). You can also set the maximum number of connections here.

Hit the Start. That’s it you are live now in the internal LAN.

Open your Windows media player (or any other player which has network support). Type the following mms://yourmachineIP:8080.

Wow you are online…. Your peer also have to do the same thing. If you listen to his IP and if he listen to your IP then it’s a local Skype. A Local Skype without the Internet.

If you have another machine in your network with a media server you can publish to that point and ask the media server to handle the connections. Here we don’t have media server and I used the broadcasting, where the source and server is our local machine.

If you want to go even further and want to watch inside the browser as we watch live matches in the YouTube just put an object tag and make it’s source as the above address. Really cool real streaming over the web. 🙂

Yuppie !!! 🙂

But unfortunately Encoder doesn’t provide an SDK to use the feature in our own applications. I put a forum regarding this and I got the following answer from a Moderator

“Unfortunately you would need to have Encoder on both PCs to perform something like this since we don’t have a way to deploy our SDK any other way at the moment. Without revealing state secrets, I believe that "Live" mode is returning to the free sku in our next version, so all your peer(s) would need to do is install the free version and use your application based on our SDK.”

The link to the updated forum :

http://social.expression.microsoft.com/Forums/en-US/encoder/thread/7ef23256-c46d-474b-856a-761938c70c93/

But in the Encoder 4 it comes with an SDK. But I did not put out my hands into that yet.

Blogs Here and There

Based some on going and some few past topics I write this entry here. I summarized some interesting topics that I read from here ant there in the cloud.

As we all know with the launch of Windows 7 (actually windows version 6.1) MS got the sensational hit again which it lost due to the Vista. (personally I don’t find that Vista sucked much but it is really a big fat OS) Another reason that why Vista was not accepted by the users was; MS thought the users are somewhat OK with high security controls in local networks. But really it was not the case. I remember when the launching of Windows 7 there was a blog post saying that Windows  7 will rock, because it is smarter and fool enough. I have another experience with an IT guy complained about the UAC system of Vista. It is really useful indeed and a good security protection. We have this in Windows 7 too, but some people still don’t want to have it. (here most of them complain because they do not know how to stop the UAC – but I recommend you to not to stop that)

Stepping away from the MS and you can see plenty of posts and news around the web about the Oracle’s acquisition of Sun and later part of the Java and mySQL. It was a moment that nobody thought that why Sun can’t stand alone. Of course Sun had the power and the strength to stand alone, but someone from the top rank decided to sell it. After Oracle acquired the Sun first all thought Oracle will bump on the mySQL and bang it. But it won’t happen. There are not any reasonable updates or new releases on any of the Sun’s products after the Oracle acquired Sun. What happened to JavaFX ? It was completely forgotten in the shadow of Silverlight. Now Oracle sue Google on Davlik (a JVM for Andriod). Where the patent rights go? What is the future of the open office ? But still Oracle keeps it competing bob – mySQL alive.

Java is an excellent platform which opened plenty of new trends in modern web standards. No body can deny this, but what is the future. I’m not against Java but the what does the Oracle buggers do? .NET needs a perfect competition.

Apache is funded by the MS in order to get the competition to IIS. (are you shocked ? but it is the truth Apache is funded by MS)

OAuth

Social networks like Facebook and Twitter use a method of authentication known as OAuth to grant permissions to the applications to deal with our data. The permission grant is explicit. But we do not know what the permission we are giving to the application. Though the social networks boast lot about this OAuth as secured and more, really they are not much secured.

It similar to give your password and username to this applications

Let’s see that if you are supposed to take a quiz in the Facebook. You click on the application and you will see a similar dialog box as below.

image

What we do in the curious of taking the quiz (even though we are not we do not read it Smile ). We just click the ‘Allow’ and jumped into the quiz or that particular app and do the stuff, publish the result in the wall (mostly) and exits. We do not care about the evil side of this.

Now take a close at the above declaration

image

Now you can understand it is similar to giving your password to someone. The worst part we think that this permission grant is for those few minutes we use the application. But once you give the permission it will remain forever until you remove the permission. Yes you can remove the permission.

In Facebook Go to the Account –> Application Settings.

There you can see the list of applications authorized by you, in the Authorized category. Simply click the ‘x’ mark to remove the authorization. When I checked my list there were 354 applications that I have authorized. Sad part is most of them are mere quizzes that we only take once. But they still have the access to our data. Sad smile

image

Creating your own app in Facebook using the OAuth is easy and you can get more details on the following page. http://developers.facebook.com/docs/guides/web

More on Facebook OAuth 2.0 : http://developers.facebook.com/docs/authentication/

Facebook OAuth 2.0 has some extended privilege options as well which gives full permission to our data.

Some applications and quizzes are more tempting so do them and delete the permission after you have done Open-mouthed smile

Windows Azure–Table Storage

Windows Azure provides three storage services – Table, Blobs and Queues. Here I explained about the Table Storage. Before getting into the coding stuff let me put some points about the Azure table storage.

Do not get misunderstand the Azure tables with a RDBMS table. In RDBMS table is an entity, but Azure table is a storage service.

We have rows and columns structure in Azure table. A row is called an Entity in Azure table. Columns are called Properties.

There 3 system properties attached to each Azure table, they are Partition Key, Row Key and Timestamp. Ex If you are creating a Azure table with Name, Address properties then your table would have total of 5 properties including the 3 system properties.

What are the System Properties ?

Partition Key – We know Windows Azure is a cloud OS hosted in MS datacenters. Where the applications and services we deploy are distributed among several servers. So when storing data in Windows Azure, partition key allows us to distribute the data among different partitions. (physically these partitions no need to be in different servers, they can be in one particular server as well; but Windows Azure maintains a method of grouping the data)

So If your table has very few numbers of entities, then probably you don’t need to create more partition keys. One is enough.

Still there are plenty of arguments and posts on selecting a proper partition key. Select the partition key in a way that you can balance the load of your table storage.

Partition keys are string values.

Row Key – Row keys are unique within a particular partition. We know partition keys form partitions. Within a partition a row key cannot be duplicated. So the partition key and the row key together forms a the unique identifier for a entity, similar to primary key known as Data Service Key.

Row key is also string value. Normally in the MS sites you can see this kind of row key implementation

RowKey = string.Format("{0:10}_{1}", DateTime.MaxValue.Ticks – DateTime.Now.Ticks, Guid.NewGuid());

This picture will explain you the concept of Partition Key and Row Key

image

 

Timestamp – This is fully maintained by the system. Every entity has a version maintained by the system. Timestamp is not a property for application programming uses. It is transparent to the users.

According MS Documentation – Timestamp is a read-only system maintained property which should be treated as an opaque property.

Azure Table Storage More…

An application must use a valid account to access Windows Azure Storage. You can create a new account via the Windows Azure portal web interface. The user will receive a 256-bit secret key once the account is created. This secret key is then used to authenticate user requests to the storage system.

Specifically, a HMAC SHA256 signature for the request is created using this secret key. The signature is passed with each request to authenticate the user requests. The account name is part of the host name in the URL. The hostname for accessing tables is <accountName>.table.core.windows.net.

An entity can have at most 255 properties including the mandatory system properties, so we can have our own 252 properties (columns).

Partition Key and Row Key are of string type, and each key is limited to 1KB in size.

Combined size of all data in an entity cannot exceed 1MB. This size includes the size of the property names as well as the size of the property values or their types, which includes the two mandatory key properties (Partition Key and Row Key).

Supported property types are: Binary, Bool, DateTime, Double, GUID, Int, Int64, String.

LightSwitch beta 1

Microsoft has introduced a new easy way to create Windows and Web based applications. When we develop applications much of the code we write for CRUD operations and data validation. LightSwitch makes this really easier by providing a very friendly manner.

You can download the LightSwitch beta 1and try it out. Download the LightSwitch Training kit. (Training Kit only provides VB.NET samples ).

LightSwitch is built on the Silverlight out of the browser feature. It has specific data types like phone number, email and others. These types are transparent to the database since a typical RDBMS ( in this case SQL Server) doesn’t have those types. So if you create table with email type in the LightSwitch it makes the SQL data type as varchar and it keeps the data type as email. So this makes LightSwitch to validate the string as email and store it in a typical varchar value in the database.

This works similar to the validation module we have in the ASP.NET where the validation is done through a Javascript code. Adobe Dreamweaver’s Spry also does the same thing.

But LightSwitch has more cool features like guided database relations, screen selections and connecting to external live data sources like bing maps.

Download the module and have fun

Smile

MCTS and MCPD Certification pathways

.NET 4.0 exams are there on the shelf. They have made plenty of changes to the .NET 4.0 and its exams as well. The main reason is .NET 4.0 has a CLR update and it is using a different version CLR. Normally there is no update from MCTS (old version) to MCTS (new version) the update exam available only for the MCPD holders. This is applicable to the .NET 4.0 also.

The .NET 4.0 has 4 MCTS versions and 3 MCPD versions.

MCTS Versions

  • .NET 4.0 Windows Application Development (includes WPF and XAML)
  • .NET 4.0 Web Application Development (includes Silverlight , MVC 2.0)
  • .NET 4.0 Data Access Application Development (ADO.NET)
  • .NET 4.0 Service Application Development (WCF)

MCPD Versions

  • .NET 4.0 MCPD in Windows Development  ( Following MCTS are pre requisites : Windows Application,Data Access,WCF)
  • .NET 4.0 MCPD in Web Development ( Following MCTS are pre requisites : Web Application,Data Access,WCF)
  • .NET 4.0 MCPD Enterprise Application Development ( Following MCTS are pre requisites : Windows Application,Web Application,Data Access,WCF)

There’s no separate exams for WPF, WF in .NET 4.0. But they may arrive very soon. I think MCTS for WF will definitely arrive with the SharePoint 2010 exams.

Starting a process from a Windows Service

If you have some knowledge about Windows services and their functionalities then go ahead. Otherwise you may not understand some of the points mentioned here.

Are you suffering from starting a process from your windows service ? I have a cunning solution for that. Normally we cannot start any process either on our local machine or from a remote machine through a windows service.

We can start the process by enabling the Desktop Interactive of the service, but the UAC system of Vista and Windows 7 is a problem, that every time we start the process from a service it asks whether to allow the desktop interactivity. We can’t ask our clients to stop the UAC system. So what is the solution ?

Now I think you have some idea why can’t we start a process from service. But you might have a question in your mind why we need a process for a service ? There can be several answers

  • We need to perform a CPU intensive operation
  • COM interoperability is clashing with some threading components of the service
  • Some actions can be performed more efficiently by a separate process rather than a service

I figured out this solution as I suffered from the bolded point. Here the method I have used.

Create an ASPX webpage (it should be hosted in a later version of IIS 4.0)

In the Page_Load method start the process.

Then Create the Windows Service to access the the web page. (Access it through normal WebRequest and WebResponse). Cool !

The real cool thing is you can almost start all the processes by using this method from a windows service. Even processes with arguments and Verbs.’

Here’s the code for the webpage

protected void Page_Load(object sender, EventArgs e)
{

Process p = new Process();

p.StartInfo.FileName = "path to your process (your .exe file)"

p.StartInfo.UseShellExecute = false;

p.StartInfo.CreateNoWindow = true;

p.Start();

p.WaitForExit();

p.Dispose();

}

 

In the service within the OnStart() put the following code

try

{

HttpWebRequest req = (HttpWebRequest)WebRequest.Create("ASPX page path");

HttpWebResponse resp = (HttpWebResponse)req.GetResponse();

}

catch (Exception ex)

{

}