Google

Wednesday, May 30, 2007

Wow to new Microsoft Surface Computing


Microsoft announces this tabletop technology with touch screen which is first of its kind. You can transfer content let say a shot from a camera without plugging it into computer, instead you just place it on top of the table and let your fingers drag them onto other device – clever! The tabletop will be available from 5000 to 10000 US dollars. The ‘wow’ thing continues on this video..




I see some great innovations on restaurants, hotels, casinos, and other areas like Point Of Sale systems.

Update: There's a Microsoft parody video of this at youtube. Kind a funny and irony to Apple. The video promote the table computer but sarcastically and directly hit the Apple reining gadgets.This makes me wanna laugh. Take a look here.

Friday, May 11, 2007

Dialogs in Compact Framework and Multithreaded Environment

Recently, I got stuck with uncontrolled dialogs on POCKET PC having it pop up anywhere in my App. As the process have been like popping up dialogs in the UI using new thread have been useful as I need to do other task after popping up that message box. Dotnet developers already know showdialog in winforms are blocking, so I have to take advantage of the showdialog-blocking thing and then continue to do the later task of the code.

My code goes like this…
static void Main()
{
Application.Run( new Form1());

PopItUpAnywhere();
PopItUpAnywhere2();
}

// Pops up messagebox anywhere in the UI.
Private void PopItUpAnywhere()
{
Thread t = new Thread( new ThreadStart(RunMessageNotification ));
t.Start();
}

// Pops up a dialog form.
Private void RunMessageNotification()
{
// will popup form that shaped like a message box.
Form2 dialog = new Form2();
dialog.ShowDialog();
}

// Pops up messagebox anywhere in the UI.
Private void PopItUpAnywhere2()
{
Thread t2 = new Thread( new ThreadStart(RunMessageNotification2 ));
t2.Start();
}

// Pops up a dialog form.
Private void RunMessageNotification2()
{
// will popup form that shaped like a message box.
Form3 dialog2 = new Form3();
dialog2.ShowDialog();
}


As you might think, after popping up using ShowDialog() method without the IWin32Window type owner, thus internal process will only get active window on runtime making it its parent.

Viewing inside CF Dotnet Form ShowDialog code, here it is.

public DialogResult ShowDialog()
{
if (this.m_fShown)
{
this.OnLoad(new EventArgs());
}
bool visible = base.Visible;
base.Visible = true;
if (!base.m_fDisposed)
{
bool fModal = this.m_fModal;
this.m_fModal = true;
PAL_ERROR ar = EVL.EnterModalDialog(base.m_hwn);
this.m_fModal = fModal;
if (!base.m_fDisposed)
{
base.Visible = visible;
}
MISC.HandleAr(ar);
}

return this.m_dlgres;
}

As you might notice, method EVL.EnterModalDialog is trying to identify the parent this dialog before showing it up.

EnterModalDialog has these possible values in return:

BadParam = -2147483642,
Empty = 0,
Failed = -2147483648,
Handled = 0x1001,
InvalidHandle = -2147483645,
NotEmpty = 0x1001,
NotHandled = 0,
NYI = -2147483640,
OOM = -2147483647,
Success = 0,
Unimplemented = -2147483640

If the method cannot find its parent, said method will return -2147483642, which is BadParam causing to throw ArgumentException. But luckily, you won’t get this exception while showing it up first.

THE BAD EXCEPTION HAPPEN.

Talking about method PopItUpAnywhere() which is first executed on the code then follows the PopItUpAnywhere2(), you expect things will go right. But if dialog in PopItUpAnywhere exits first, exiting dialog PopItUpAnywhere2 will likely to fail.

Why?

Its because Form3 cannot find its parent because Form2 has been terminated earlier.
Again by executing this.DialogResult = DialogResult.OK on dialog forms, you actually let that form find it’s parent form again.

Let’s take a look on the code inside Dotnet Compact Framework,

public DialogResult DialogResult
{
get
{
return this.m_dlgres;
}
set
{
this.m_dlgres = value;
if (this.m_fModal && !this.m_fClosing)
{
this._CloseModal();
}
}
}

private void _CloseModal()
{
if (this._FCanClose())
{
MISC.HandleAr(EVL.LeaveModalDialog(base.m_hwn));
}
}

Method EVL.LeaveModalDialog(base.m_hwn), finds again the parent the Form it is associated to. Since having variable m_hwn refer to non-existent object, method MISC.HandleAr will throw ArgumentException causing your app like somewhat deadlocked in a dialog that’s not well terminated.

POSSIBLE SOLUTIONS

1. If you are forced to exactly do the above execution of dialogs, it’s likely you have to implement Monitor class in threading to control the termination of simultaneous dialogs. Monitor class in CF 1.1 has only two methods – Enter() and Exit(), but enough to feed the control of those dialogs.

2. You can hinder dialog pop up one a time by your own logic.

My case I did all those two.

Tuesday, May 1, 2007

Microsoft new definition of Flash: “Silverlight”


Well, this is the Windows Presentation Foundation Everywhere (WPF/e) and a huge take off for Adobe Flash. Originally can run on a subset XAML but as released last April 30, 2007, the following were added.

Announcement Highlights:

  1. Inclusion of mini-CLR which is part of the .Net Framework. The mini-CLR is now supporting C#, JavaScript (ECMA 3.0), VB, Python and Ruby.
  2. Cross browser support. That means not just IE also both Firefox and Safari, and the team are also working interoperability on the Mac OSX platform.
  3. Strong support to multimedia like videos, DVD and other offline content. Their demos were extremely fast. Video editing on the fly were genius and its way greater than AJAX.
  4. Silverlight Streaming were also up for the said release. Microsoft allows users to host their Silverlight content and applications to this service for free.
  5. Support on mobile devices.

Excellent comparisons to rival Flash together with full featured .Net 3.0 are tabulated here.

Features/Benefits

Silverlight

.Net 3.0

Flash/Flex

Rich 2D animation/graphics with audio and video

x

x

x

Industry standard video codec

x

x


Scalable video format from HD to mobile

x

x


Hardware-assisted editing and encoding solutions

x

x


XML (XAML)-based presentation layer for SEO

x



Choice of standards-based and high-performance languages

x

x


End-to-end server and application platform

x

x


Media server licensing (unlimited bandwidth)

$999

$999

$4500

Content access protection (DRM)

x

x


Client side play lists for ad-insertion

x

x

x

Robust video publishing tools and 3rd party ecosystem

x

x


High-performance, multi-core enabled client

x

x


Scalable full screen video up to HD (720p)

x

x


Native support for device-based video

x

x


Offline, document support


x


Client size

2MB

50MB

2MB

Supported operating systems

Windows

/Mac

Windows

Windows/

Mac/Linux

Source: MSDN BLOGS

Demos are located here ( interactive ) and here( pictures only ).

Word of mouth from blogosphere about Silverlight

  1. “Fast, very, very fast.” - Nik Cubrilovic – A blogger at www.nik.com.au and he is the CEO of Omnidrive.
  2. “The engineering behind this is stunning.” - Steve Gilmore - A Microsoft hater.
  3. “Microsoft ‘rebooted the web.’” - Robert Scoble, an ex Softie who evangelizes MS products. He is notable of criticizing Microsoft and praising Google and other MS rivals. Current Vice President Media Development of PodTech.net.
  4. A silly question (I thought) was asked to Scott Guthrie by Robert Scoble, “Would Google use it?” Well Guthrie says, “They have to in some point.”
If you are interested playing around, get SDK here. I think entrepreneurs should take a look in this new technology that turns web even richer. For more information, you can visit the official site at www.silverlight.net.