Metah - A Web Technologist Adventure

Tweets

Windows Phone 7: Hands on Demo.

February 16th, 2010 by Ahmet Gyger

Interesting video (from Channel 9) showing a preview of the winPhone 7 OS.

Get Microsoft Silverlight

I am just a bit worried about the localized version of Bing. So far I have seen it working in the US. Does that mean that Bing will be updated for a worldwide support or that the winPhone7 will be available only in the US until it is done?



Microsoft Pivot – an innovative way of browsing information

February 12th, 2010 by Ahmet Gyger

After playing with Pivot, I have been really existed by the possibilities that Pivot offers.

Pivot makes it easier to interact with massive amounts of data in ways that are powerful, informative, and fun.

Simply speaking, Pivot is a tool that helps us visually browse collections of information.

Pivot screenshot 1

Figure 1: Item view in Pivot while browsing the mathematics section of Wikipedia

What really excite me is that Pivot is based on the concept of collections (group of objects that have common attributes). For website with huge amount of information, as Wikipedia, it is really a great way of browsing because you can apply filter information and have a visual result. These collection can also be assembled manually (it is a simple XML file) so it could be a great way to share an important amount of information easily.

Pivot screenshot 2

Figure 2 – National parks, filtered by type

Get more information and download pivot from Pivot’s website.



Siri, the mobile personal assistant

February 5th, 2010 by Ahmet Gyger

This mobile personal assistant looks awesome!
Unfortunately, for business model reason (the application is free and make money on referrals fees whenever someone buy through the service), the service works only in the US…

Interesting interview to watch with the Siri CEO and VP engineering.

Still is a great application to have on your pocket :)
Currently the application is available only on the iPhone but they claim to have support for other mobile platform coming soon.

If you are interested in getting more news about Siri, register.



Synchronous and Asynchronous use of Delegate with C#

January 18th, 2010 by Ahmet Gyger

 For developers the quality of a program can be often express in the time used to finish the computation. With current multicore processor we have to move our thinking from a serial execution to a concurrent execution. Using delegates in an asynchronous way can force the CLR to allocate multiple threads to your computation.

In below code sample, you will see that I call one method multiple times. This method simply waits 5 seconds. Calling 6 times this method in a synchronous way makes the time to finish obvious: at least 30 seconds! Now using the BeginInvoke method from my delegate I can add multiple threads to these computations. On my machine the time to achieve this is now 9 seconds only!

using System;
using System.Diagnostics;
using System.Text;
using System.Threading;

 

namespace Threads

{

    class Program

    {

        public delegate string myDelegate(string txt);

 

        static void Main(string[] args)

        {

            SynchronousDelegateSample();

            AsynchronousDelegateSample();

 

            Console.WriteLine(“Main thread exits.”);

            Console.ReadKey();

        }

 

        static void SynchronousDelegateSample()

        {

            Stopwatch sw = new Stopwatch();

            sw.Start();

 

            /*

             * All the calls to the delegate will be synchronous

             * This mean that the order will always be 1,2,3,4,5,6

             * The thread used will always be the same.

             */           

            myDelegate dm = new myDelegate(DelegateMethod);

            Console.WriteLine(dm(“calling delegate (1)”));

            Console.WriteLine(dm(“calling delegate (2)”));

            Console.WriteLine(dm(“calling delegate (3)”));

            Console.WriteLine(dm(“calling delegate (4)”));

            Console.WriteLine(dm(“calling delegate (5)”));

            Console.WriteLine(dm(“calling delegate (6)”));

 

            sw.Stop();

            Console.WriteLine(“All work was done in: {0} milliseconds.\n\n”, sw.ElapsedMilliseconds);

        }

 

        static void AsynchronousDelegateSample()

        {

            Stopwatch sw = new Stopwatch();

            sw.Start();

 

            /*

             * All the work will be invoked in a blink.

             * Multiple thread will be used to compute the result of the method.

             */

            myDelegate dm = new myDelegate(DelegateMethod);

            IAsyncResult result1 = dm.BeginInvoke(“calling delegate (1)”, null, null);

            IAsyncResult result2 = dm.BeginInvoke(“calling delegate (2)”, null, null);

            IAsyncResult result3 = dm.BeginInvoke(“calling delegate (3)”, null, null);

            IAsyncResult result4 = dm.BeginInvoke(“calling delegate (4)”, null, null);

            IAsyncResult result5 = dm.BeginInvoke(“calling delegate (5)”, null, null);

            IAsyncResult result6 = dm.BeginInvoke(“calling delegate (6)”, null, null);

 

            /*

             * EndInvoke is synchronous we force to wait for the asynchronous results.

             */

            string r1 = dm.EndInvoke(result1);

            string r2 = dm.EndInvoke(result2);

            string r3 = dm.EndInvoke(result3);

            string r4 = dm.EndInvoke(result4);

            string r5 = dm.EndInvoke(result5);

            string r6 = dm.EndInvoke(result6);

 

            sw.Stop();

            Console.WriteLine(“All asynchronous  work was done in: {0}”,

                sw.ElapsedMilliseconds);

        }              

 

        /// <summary>

        /// Method called by our delegate

        /// Will wait for a random time (between 1 and 10000 milliseconds).

        /// </summary>

        /// <param name=”txt”>Any string are okay.</param>

        /// <returns>A string confirming the end of the process.</returns>

        static string DelegateMethod(string txt)

        {

            // Wait 5 seconds.

            Thread.Sleep(5000);

 

            // Work is finished

            Console.WriteLine(txt + ” \n> Thread ID is: {0}”,

                Thread.CurrentThread.ManagedThreadId.ToString());

            return “>> “ + txt + ” Done !”;

        }

    }

}

Delegate can also be used to call method from different classes. I let you check at the documentation on Msdn.



Get Arguments array from CmdLine of a WPF Application.

December 18th, 2009 by Ahmet Gyger

 

This is my first post of, I hope, a series related to WPF and C#.

The examples below are made with VS (Visual Studio) 2010 and .Net 4.0, for this precise example you can make it work with .Net 3.5 at least.

During the life of an application we can listen for some important events, these events can help us to drive the logic of our application from the startup to the end of an application life.

If you are creating a simple WPF Application in VS you will get a file called App.xaml for free. In this file you can add arguments to handle events.

<Application x:Class=”WpfAppStartup.App”

             xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation”

             xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”

             Startup=”Application_Startup”

             Exit=”Application_Exit”

             Activated=”Application_Activated”

             Deactivated=”Application_Deactivated”

             SessionEnding=”Application_SessionEnding”

             StartupUri=”MainWindow.xaml”>

 

As you can see in the above code, I added the Startup and Exit arguments in the Application node.
(Tip: just write ‘Startup=’ and then press Tab on your keyboard to have the method name and signature automatically created in App.xaml.cs file).

Below is the list of Events you can catch and a short description.

Name

Description

Startup

Called when Application.Run() is called, shortly before the main window is displayed. This is where you can extract all cmdline arguments.

Exit

Called when the application is shut down, shortly before the Run() methods returns.

Activated

Called when application get focus.

Deactivated

Called when application lose focus.

SessionEnding

Occurs when the Windows session is ending (log off or shut down computer).

DispatcherUnhandledException

Called when an Unhandled application occurs in your application (main thread).

 

Now back to our first goal: getting the arguments array!

private void Application_Startup(object sender, StartupEventArgs e)

{

if (e.Args.Length > 0)

       {

             foreach (string arg in e.Args)

              {

                    // logic for arguments processing.

              }

}

       else

       {

             // No arguments!

}

 

MessageBox.Show(“Application.Run() is called, “ +

“this happen before the main window is displayed.”);

}


If there are any unclear sentence, please feel free to comment!



Search does not need engines, knowledge and decision does.

May 28th, 2009 by Ahmet Gyger

Search engine are not doing search anymore… No search is for small player, now the real thing is to have an evolved engine. Where Wolframalpha offer a computational knowledge engine, Bing offer a decision engine. So far Google can keep being Google fearless ; )

Bing (also known as Kumo) should be publicly available on June 3rd. At least the name is easy to remember :)

You can already get some information on it:
- Behind bing
- Decision engine

I personally think it is a good idea to not compete with Google directly on traditional search, they real do a great job there. Live.com showed to be quite good but did not had any motivational factor to change people habits. Bing, might succeed there, I guess most of the people will be positively surprised by something else than search : )

Enjoy soon,
Ahmet



Know our history: Pirate of Silicon Valley.

May 27th, 2009 by Ahmet Gyger

Just in case you haven’t seen it yet, a biographical look at the men who founded Apple and Microsoft and a look at the early days of the companies.

Enjoy,
Ahmet



Wanna try Visual Studio 2010 Professional Beta 1 ?

May 25th, 2009 by Ahmet Gyger

Just noticed that Visual Studio 2010 pro (beta 1) is now available to download as a web installer.

I am personnaly quite new to the VS world, I have been using it daily for only 9 month now. I must say that I am still quite impresse by the simplicity and the power this tool have.

Just try it, it is free so you can make up your own opinion and tell me what you think of it :)

For more info just head to the VS 2010 beta website.

Enjoy,
Ahmet



Wolfram Alpha, a Revolution for the Web?

May 18th, 2009 by Ahmet Gyger

Wolframalpha the so called computational knowledge engine, is finally available to the public :)

Why and when would you want to switch from Google, Yahoo or Live?
The answer is quite simple: Wolfram will give you an answer while other search engines will gives you a (too huge) set of related pages where you can go if the title / description seems to fit your query. 
Google and other search engine maps the keywords of our query to a set of pages known to be related to this keywords. Whereas Wolfram Alpha will try to compute the answer based on the contents of those pages and extract the exact answer to your query and a bunch of information answering to your query.

Go have a look at the introduction video from S. Wolfram.

 

Hope you enjoy as much as I do,
Ahmet



Rule your files – get permission on most of your pc files.

May 7th, 2009 by Ahmet Gyger

Sometimes it happens that you need to manually delete files and windows kindly inform you that you don’t have enough privileges to do so, even as an administrator of your own machine…

To fix this problem you will have to use cmd.exe (as an administrator):
> cd /d c:\thepath\whereYouWantControl\

Now you want to take ownership of this folder:
> takeown /F . /A /R /D Y > NUL

Finally get persmission to edit/delete under this folder:
> icacls . /grant:r Administrators:(F) /T /L /Q

Hope it helps,
Ahmet