Friday, December 28, 2007

How to disable Exchange Security Policy for Windows Mobile Devices

Direct Push pushes email into your Windows Mobile device and it's good. However it pushes you security policy as well, that sometimes make you unable to set password that you want and sometimes, lock your device after one minute of inactivity. How to disable this useful feature? How to cancel autolock feature of your WM machine, connected to Microsoft Exchange server?

As everything in WM, you should patch registry, but what to patch? Well, it's simple

  • Enable/Disable the Exchange security policy - HKLM\Security\Policies\00001023: 0 = Enabled; 1 = Disabled
  • Inactivity time
    • HKLM\Comm\Security\Policy\LASSD\AE\{50C13377-C66D-400C-889E-C316FC4AB374}\AEFrequencyType: 0 = No inactivity time; 1 = Activity time enable
    • HKLM\Comm\Security\Policy\LASSD\AE\{50C13377-C66D-400C-889E-C316FC4AB374}\AEFrequencyValue: number of minutes before timeout
  • Password strength
    • Minimum number of characters: HKLM\Comm\Security\Policy\LASSD\LAP\lap_pw\MinimumPasswordLength
    • Password complexity: HKLM\Comm\Security\Policy\LASSD\LAP\lap_pw\PasswordComplexity: 0 = Require Alphanumeric; 1 = Require numeric (PIN); 2 = No restriction
  • Wipe settings
    • Number of failed attempts before all your information will go: HKLM\Comm\Security\Policy\LASSD\DeviceWipeThreshold: -1 = disabled; other failed attempts
    • Number of failed attempts before displaying codeoword: HKLM\Comm\Security\Policy\LASSD\CodewordFrequency: number of failed attempts

Well, that all. After you'll fix it, just go to Lock settings in your device manager and you'll be able to unmark and change whatever you want. I hate, when program denies me from doing anything in my device.

If you are not feeling comfortable with changing registry settings, I create simple program, that do it instead of you. You can download and use it for free, but notice, I'm not responsible if it will brick your device (this is system hack)

image

Download Exchange Police Patch >>

Friday, December 21, 2007

Learning marathon - December 23-29

Do you want to know WPF, Silverlight or it's architecture or appliance and you are in Israel next week? If so, please keep reading. Next week (Dec 23-29) it's going to be a lot of workshops, courses and other learning attractions, related to those technologies.

  • 24-Dec [4:00PM-8:00PM] - Architects user's group "Architects Forum Meeting - User Experience - Architecture and Technologies Dillemas" in Microsoft Israel (2, haPnina str, Ra'anana). The place to discuss with me + light dinner
  • 25-Dec [9:30AM-4:30PM] - "WPF training for designers" in Sela college (14, Baruch Hirsh str., Bnei Brak). If you are designer and want to stop getting rejects from developers, you should attend. You'll learn how to use efficiently Microsoft Expression tools and begin to designing real applications. What's in agenda?
    • What is UX? (Developers are strange nation)
    • Expression Design (It’s not Adobe)
    • Expression Blend (We do not need those strange designers)
    • Windows Experience (Visual Studio is old and bad tool)
    • Hands On Labs (Let’s make it work)
  • 26-Dec [8:30AM-1:30PM] - "Microsoft technologies appliance in C2 and military systems" in Microsoft Israel (2, haPnina str, Ra'anana). You'll hear about real world real time and near real time applications, command and control systems, and using WPF, Silverlight, Windows Server and .NET technologies to build them. If you are working in military industry - you have to attend. Lunch and dinner included.
    • Modern C&C systems, using new technologies (me)
    • mCore as C2 framework (Eli Arlozorov)
    • Israel Navy as C2 and WPF successful case study (Lior Rozner)
  • 27-Dec [9:30AM-4:30PM] - "Silverlight training for designers" in Sela college (14, Baruch Hirsh str., Bnei Brak). If you are designer and want to start writing Silverlight applications, you should attend. One day session to start work in Silverlight, by using Microsoft Expression suite. Agenda
    • How to start project (developers understand nothing)
    • Prepare assets (make developers not interrupt you)
    • Expression Blend how to (if I know Adobe, I already know it)
    • Make it moving (Adobe Flash is my friend)
    • Make it play (You are producer)
    • Fundamentals (make you understand developers)
    • How to finish project (developers understand nothing)

Not bad, ah? You should register @ Microsoft [send me an email if you have registration problem] to attend any of those events (it's free, if there are places). See you there and have a good weekend.

Wednesday, December 19, 2007

Anonymous types sharing or why it's still sucks?

Did you try to cast anonymous types (vars)? You are. However, you never was able to pass var from one method to another. Why is it? Cos, anonymous type got known in context of current method only. Well, we always can cast one anonymous type into other. How? By using Extension methods. Let's make small repro. In one method, you have following structure

var myVar = new[] {
               new {Name = "Pit", Kind = "Alien},
               new {Name = "John", Kind = "Predator"},
               new {Name = "Fred", Kind = "Human"}
           };

In other method, you have other variable

var theirVar = new[] {
                new {Name = "Kent", Kind = "Alien"},
                new {Name = "Rob", Kind = "Predator"},
                new {Name = "Bill", Kind = "Human"}
            };

Cool. Now you can cast myVar easily into object or object array, and transfer it into other method. Then, cast theirVar into another object or object array and cast myVar into theirVar, right? Why not to use extension to make your live easier (tnx to AlexJ)?

public static class Extender
   {
       public static T Cast<T>(this object obj, T what)
       {
           return (T)obj;
       }
   }

Now, it's very cool part. Change theirVar assignment to following:

var theirVar = myVar.Cast(new[] {
               new {Name = "Kent", Kind = "Alien"},
               new {Name = "Rob", Kind = "Predator"},
               new {Name = "Bill", Kind = "Human"}
           });

You got theirVar type of myVar type. Isn't it cool? You even can enumerate through those objects, by using strong types

foreach (var q in theirVar)
            {
                Console.WriteLine("{0}-{1}", q.Name, q.Kind);
            }

Well, as always, I have a goat for you. Let's change myType as following

var myVar = new[] {
               new {Name = "Pit", Kind = "Alien", Goat = "bee"},
               new {Name = "John", Kind = "Predator", Goat = "mee"},
               new {Name = "Fred", Kind = "Human", Goat = "eee"}
           };

And we will not tell to theirType developer about what type Goat member is. So, we let him write

var theirVar = myVar.Cast(new[] {
                new {Name = "Kent", Kind = "Alien", Goat = 1},
                new {Name = "Rob", Kind = "Predator", Goat = 2},
                new {Name = "Bill", Kind = "Human", Goat = 3}
            });

Eaht! Will it works? Sure, if exceptions will be handled. Actually, you'll get

Unable to cast object of type '<>f__AnonymousType0`3[System.String,System.String,System.String][]' to type '<>f__AnonymousType0`3[System.String,System.String,System.Int32][]'.

Extremely informative exception (if you know what <>f__AnonymousType0 is). Isn't it? Don't use anonymous types. It's bad behavior! Have a nice day and be good people.

Tafiti goes open source (well, actually, shared source under MS-PL)

All those, how want to implement data visualization in Silverlight (as Tafiti does), can look into this CodePlex project and use it for your own. Notice, you can download, modify and, even, resell this code, due to fact, that it's under MS-PL shared source licence. Well done, Live team.

Tuesday, December 18, 2007

Messed with Silverlight video player skin, generated by encoder? See how to customize it

Have you ever try to create your own video player skin, by customizing one, generated by Microsoft Expression Media? If you not really familiar with Silverlight development, it's rather hard to do. Microsoft recognizes it and recently released special document about Silverlight Media Player skin customization. It's very useful for you, if you do not want to begin learn Silverlight internal, however, you want to create your own player skin fast. Here it is (direct link). You'll need BasePlayer.js debug version as well, so download it here.

image

Silverlight for LOB? Here it is

Are you asking for case studies of LOB (line-of-business) application, written in Silverlight? Nothing simpler. Here is the result of the partnership between Microsoft and Infusion. Another great Penza and Airport type RIA (rich-internet-application)

Monday, December 17, 2007

WPF for developers from Dev. Academy 2 - recordings

If you was unable to attend Developers Academy 2 and still want to see sessions there, you are more, then welcome to do it. Here link to the recording of my session. And here is the presentation. The quality of the recording is awful, as well as whole hosting site quality. It seemed like "Gisha Hadasha" has no QA and particle employed student to make sites. However, if you still want to see the screencasts of the sessions, go there.

image

See screencast "WPF for developers (or optimizing your WPF application)" >>

How to see Hebrew in Windows Mobile device (baltic)

Official answer - you can not. Unofficial - take tahoma and tahoma bold from your computer (in /Windows/Fonts) and put it into Windows/Fonts directory of your WM6  device. You'll see hebrew in most of applications. However, it will be הכופה תירבע. So, who tell, that Haaretz are old fashioned because they are still using  Hebrew-Logical?

Better, then nothing. If you want full Hebrew support, you should buy localization for WM6 (this one [Eyron's extender] for example).

image

<EOM>

Wednesday, December 12, 2007

Flickering in WPF ItemsControl? No way!

Remember WinForms GDI+ days, when we have to enable DoubleBuffering to prevent flickering of fast changing elements in the application screen? Do you think, that we already after it with WPF? Not exactly. Today, I'll explain how you can force 100% hardware rendered stuff to flicker in your WPF application and how to prevent it.

Let's start. I want to draw fast large amount of primitives in the screen. Let's say Rectangles. My source is underlying collection of Rect and I have one ItemsControl, bounded to the collection to visualize them.

<ItemsControl ItemsSource="{Binding}" Name="control">
                <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                        <Canvas/>
                    </ItemsPanelTemplate>
                </ItemsControl.ItemsPanel>
                <ItemsControl.Background>
                    <SolidColorBrush Color="Gray"/>
                </ItemsControl.Background>
  </ItemsControl>

I also created DataTemplate, that uses TranslateTransform to set the rectangle positions (remember my Dev Academy performance session?)

<DataTemplate x:Key="theirTemplate">
            <Rectangle Fill="Red" Width="{Binding Path=Width}" Height="{Binding Path=Height}">
                <Rectangle.RenderTransform>
                    <TranslateTransform X="{Binding Path=X}" Y="{Binding Path=Y}"/>
                </Rectangle.RenderTransform>
            </Rectangle>
        </DataTemplate>

Now I'll add method to fill the ObservableCollection and force my ItemsControl to show them

ObjectDataProvider obp = Resources["boo"] as ObjectDataProvider;
           Boo b = (Boo)obp.Data;
           b.Clear();
           for (int i = 0; i < 100; i++)
           {
               Rect r = new Rect();
               r.Width = this.Width / 5;
               r.Height = this.Width / 5;
               r.X = (double)rnd.Next((int)this.Width);
               r.Y = (double)rnd.Next((int)this.Height);

               b.Add(r);
           }

So far, so good. Running this stuff, you'll notice red ghost rectangle in the left top corner of items control. It appears and disappears. What's the hell is it?

This is rendering order. First it creates visual, then draws it and only after it uses transformation to move it. Should not it be before rendering? Probably it is, how it is not working this way today.

So how to solve this problem? Just create your own rectangle, that works as required.

It is FrameworkElement (the simplest class, that can be used within DataTemplate).

public class myRectange : FrameworkElement
    {}

How, let's create brushes and pens (do not forget to freeze them to increase performance)

Pen p;
        SolidColorBrush b;

void rebuildBrushes()
        {
            b = new SolidColorBrush(this.Fill);
            p = new Pen(b,2);
            b.Freeze();
            p.Freeze();
        }

Draw Rectangle on Render event

protected override void OnRender(DrawingContext drawingContext)
        {
            drawingContext.DrawRectangle(b, p, new Rect(0,0,Width,Height));
        }

And change transformations and color, before rendering

protected override void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);
            if (e.Property == XProperty | e.Property == YProperty)
            {
                RenderTransform = new TranslateTransform(X, Y);
            }
            else if (e.Property == FillProperty)
            {
                rebuildBrushes();
                InvalidateVisual();
            }
        }

We done. Now, our "ghost rectangle" disappears. Don't forget to change DataTemplate

<DataTemplate x:Key="myTemplate">
            <l:myRectange Width="{Binding Path=Width}" Height="{Binding Path=Height}" X="{Binding Path=X}" Y="{Binding Path=Y}" Fill="Red"/>
        </DataTemplate>

Have a nice day.

Source code for this article.

Monday, December 10, 2007

Hanukkah is almost over

Well, very smart Jew sells special made sufganiot (Hanukkah Jelly Doughnuts). Delicious!

image

via Ben Tamblyn

Friday, December 07, 2007

Feeling alone without x-mass tree on Hanukkah? Here is a song for you

Adam Sandler performed Hanukkah song on Comedy Central. As for me, I do not know what to do. To laugh or to cry. Here the beginning

Put on your yalmulka, here comes hanukkah
Its so much fun-akkah to celebrate hanukkah,
Hanukkah is the festival of lights,
Instead of one day of presents, we have eight crazy nights.
When you feel like the only kid in town without a x-mas tree, heres a list of
People who are jewish, just like you and me:
David lee roth lights the menorrah,
So do james caan, kirk douglas, and the late dinah shore-ah
Guess who eats together at the karnickey deli,
Bowzer from sha-na-na, and arthur fonzerrelli.
Paul newmans half jewish; goldie hawns half too,
Put them together--what a fine lookin jew!

A couple of updates - mega update post

Today, only updates

Yahoo finally releases Yahoo! Messenger for Vista - this was one of very first prototypes, shown in Mix last year. I did not install it, however, here a couple of review Erik Burke, Tim Sneath and Ryan Stewart. As for me, they lost "wow effect" last year

image Microsoft Expression Blend 2 - December Preview. What's new? VS2008 integration, inheritance, no SL2.0 support (strange, maybe, because of breaking changes toward near beta)

 

 

 

Vista SP1 RC1 available for MSDN subscribers (via Nick Whites). Nothing special, 40 minutes of installation, profile information loss and performance fixes

 

Office 2007 SP1 is expected to ship 10-December week. This time it is not RC or Beta, but final product (via Mary Jo Foley). Great work.

 

Windows XP SP3 is very close to RC1, but nothing about public beta yet.

 

Starting today, you can configure Messenger presence.  Some cool features become available (via Angus Logan). Here is how.

 

PDC 2008 (canceled last year) will be on October 27-30 in LA (hello, Peter). It promised to be great event about the company's emerging services platform efforts, .NET, Windows and Mobile technologies.

 

imageA little about mobile devices, while waiting for my new mega-device (more information soon): Dell is about to enter mobile phone industry in 2008, Opera compiled their browser for Brew platform (hello, Pelephone), while Google create their mobile version for IPhone.  Windows Mobile 6.1 is going to be cool. Here screenshorts. Meanwhile, you can update your Mobile Office to version 6.1 for free or your Nokia (N-series) with Internet Radio application. As for me, 8 hours speak time and 30 days standby, quad-band. Those are features, that you need from your handy.

 

Well, that's it for now. Have a nice weekend.

 

Now I have a question for you. What do you think, about such format of posts? Should ?I go on with it or continue to write post-per-event?

 

Thank you

Thursday, December 06, 2007

Volta - typed JS?

Recently, Microsoft released Volta. This is kind of framework, that using .NET to emit client side JS code. Something very similar, was released in ASP.NET AJAX 1.0. So, now, you can access your anchor element in HTML DOM by using following expression

string val = Document.GetById<A>("myHref").Value;

Instead of using following expression in current JS

var val - document.getElementById("myHref").Value;

Pretty cool, however, while web development trying to escape variable types, client side development trying to get into it. Isn't is nonsense?

BTW, this concept already incorporated by Google and other web "prototype" service providers.

Other possible appliance of such framework is ability to work with typed and generic methods, revealed by Silverlight.

image

Download and try Vola >>

Wednesday, December 05, 2007

WPF - order is matter (especially with DependencyProperty)

What's wrong with following code:

class aaa : DependencyObject { }

class bbb : DependencyObject
    {
        static readonly bbb b = new bbb();
        public static bbb GetMe { get { return b; } }

        public static readonly DependencyProperty MyPropertyProperty =
            DependencyProperty.Register("MyProperty", typeof(aaa), typeof(bbb), new UIPropertyMetadata(default(aaa)));

        private bbb()
        {
            MyProperty = new aaa();
        }
        public aaa MyProperty
        {
            get { return (aaa)GetValue(MyPropertyProperty); }
            set { SetValue(MyPropertyProperty, value); }
        }
    }

Nothing special, One DependencyObject, that implement singleton pattern. You should call GetMe to create and get an instance and then use it.

Well, this code throws "Value cannot be null. Parameter name: dp" exception. Why this happens? Why class aaa can not be null? It can - it dependency object!

How to fix it? Just move registration of DependencyPropery above initialization of static bbb to solve it. Like this

class aaa : DependencyObject { }

class bbb : DependencyObject
    {
        public static readonly DependencyProperty MyPropertyProperty =
            DependencyProperty.Register("MyProperty", typeof(aaa), typeof(bbb), new UIPropertyMetadata(default(aaa)));

        static readonly bbb b = new bbb();
        public static bbb GetMe { get { return b; } }

        private bbb()
        {
            MyProperty = new aaa();
        }
        public aaa MyProperty
        {
            get { return (aaa)GetValue(MyPropertyProperty); }
            set { SetValue(MyPropertyProperty, value); }
        }
    }

Why this happens? Well, even compiled, WPF initializes static classes by using it's order in code. Don't believe me? Open ILDasm for evidences.

Conclusion - I think, it should be reported as bug, however, from the other hand, it makes sense. You choose what's right and what's wrong.

Great thank to Kael and Matthew for helping me to debug it.

WPF quiz #1 answer: Moving rectangles

I posted this question at Nov-28 and promised an answer Nov-29. Well, was a bit busy for it, however now it comes

Creation 

  1. It's absolutely unnecessary to create DO, with unchangeable data template. You are not going to use different DataTemplate, and your  rectangle is visual model, so in order to create them,  it's better to one of derived classes, that enables visualization. For example UIElement, which is one of simplest visual objects
  2. This is the right answer
  3. UIElement is smaller and simpler, then FrameworkElement. If you do not need additional features, provided by FrameworkElement (for example input, focus, layout, routed event), use UIElement
  4. Absolutely unnecessary to use custom control in order to create simple visuals. It's huge overhead.

Movement

  1. Binding to Canvas.Left/Top X and Y properties forces layout to happen again - we do not want it happened
  2. This is the right answer
  3. Creating and removing objects from the source collection, forces full redraw, thus rendering thread will throw and tessellate visuals.
  4. Changing X and Y properties by using  Dispatcher timer (or any other way to do it) will do exactly the same thing, as in 1 - invalidation. We do not want it.

Have a nice day. And keep looking for WPF quiz #2

Happy Hanukkah!

You can also spear it.

<iframe src="http://silverlight.services.live.com/invoke/216/menorah/iframe.html" frameborder="0" scrolling="no" style="width:88px; height:96px"></iframe>

via Michael S. Scherotter

Tuesday, December 04, 2007

Seek and hide x64 or where my Sound Recoder?

Everyone knows a useful Windows utilities, SoundRecorder.exe application. I believe, that most of you knows where this application in your disk. If not, it's always possible to look into shortcut.

 image

So, let's go to %SystemRoot%\system32 and look for the application

 image

So far so good. Now, let's look for this file by using File.Exist method of C#

File.Exists(@"%SystemRoot%\system32\SoundRecorder.exe");

It returns true. Of course, the file SoundRecorder.exe is there. As well as all other "smart" methods for seeking for system directories

File.Exists(Environment.SystemDirectory + @"\SoundRecorder.exe");
File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.System) + @"\SoundRecorder.exe");

All those are true. Now let's compile the file not for "Any CPU", but for x64. It still works! Why now, it is there. Now, let's try to compile for x86 or, just run our process from other 32 bit process (emulation!). You'll get false. Sound Recorder just disappears in x86...

Actually, the problem is x64 file system and registry redirection. Actually, the file exists, but not in C:\Windows\System32. It is in C:\Windows\Sysnative directory, which actually not exists. According MSDN, it should be transparent for your applications. Actually, it's transparent for those applications, which works not in WOW64 mode.

image

In order to make it work, you should expand the actual location, by using

File.Exists(Environment.ExpandEnvironmentVariables(@"%systemroot%\Sysnative") + @"\SoundRecorder.exe");

Now, the file exists, but not in x64 mode. What to do? Check both locations? Probably yes (don't forget to check the target platform). You can either disable registry redirection, by using native method.

[DllImport("advapi32.dll", SetLastError = true)]
static extern int RegDisableReflectionKey(IntPtr hBase);

One thing is for sure. We should learn more about x64 applications. Maybe in this case, our programs begin to work much faster, by utilizing double power of x64 processors.

For your convenience, here the list of system programs, that can "fool you" in x64 platforms (Vista):

alg.exe
bcdedit.exe
BitLockerWizard.exe
bridgeunattend.exe
change.exe
chglogon.exe
chgport.exe
chgusr.exe
cofire.exe
CompMgmtLauncher.exe
consent.exe
csrss.exe
Defrag.exe
DeviceEject.exe
DFDWiz.exe
dfsr.exe
dispdiag.exe
dpinst.exe
dwm.exe
fsquirt.exe
fvenotify.exe
FXSCOVER.exe
FXSSVC.exe
FXSUNATD.exe
irftp.exe
Locator.exe
logoff.exe
lpksetup.exe
lpremove.exe
lsass.exe
mblctr.exe
MdRes.exe
MdSched.exe
mrt.exe
msconfig.exe
msdtc.exe
msg.exe
Narrator.exe
netcfg.exe
NetProj.exe
ntoskrnl.exe
nvcolor.exe
nvcplui.exe
nvudisp.exe
nvuninst.exe
p2phost.exe
PkgMgr.exe
plasrv.exe
PnPUnattend.exe
PnPutil.exe
poqexec.exe
PresentationSettings.exe
PrintBrmUi.exe
printfilterpipelinesvc.exe
PushPrinterConnections.exe
qappsrv.exe
qprocess.exe
query.exe
quser.exe
qwinsta.exe
rdpclip.exe
RelPost.exe
reset.exe
rstrui.exe
rwinsta.exe
sdclt.exe
setupcl.exe
shadow.exe
sigverif.exe
SLLUA.exe
SLsvc.exe
SLUI.exe
smss.exe
SnippingTool.exe
snmptrap.exe
SoundRecorder.exe
spoolsv.exe
srdelayed.exe
StikyNot.exe
tabcal.exe
tscon.exe
tsdiscon.exe
tskill.exe
ucsvc.exe
UI0Detect.exe
vds.exe
VSJitDebugger.exe
VSSVC.exe
wbadmin.exe
wbengine.exe
wercon.exe
WFS.exe
wiawow64.exe
winload.exe
winresume.exe
WinSAT.exe
wisptis.exe
wpcumi.exe
wpnpinst.exe
wsqmcons.exe
wuauclt.exe
WUDFHost.exe

Have a nice day

Monday, December 03, 2007

Software is sucks? Probably it really is!

Remember new features, that make your code unreadable? A couple of days ago, CLR team released first preview of Parallel Computing for .NET. Isn't it really cool, that now you can use full power of your computer? I decided to test the extension and wrote simple routine, that throttles your CPU.

static int i=0;
static void MessMe()
        {
            for (;;)
            {
                i ++;
                if (Console.KeyAvailable)
                {
                    Console.ReadKey(true);
                    break;
                }
            }
        }

Cool, now let's run it (with measurement) on my Dual Core 2 processor.

MessMe();

image

Nice, 54K simple math operations per second with half of each of my cores

image

It's already works (maybe because of my super OS?), but I still did not used it. Let's try to use the Parallel Computing extension.

Parallel.Do(MessMe);

image

What's going on with CPU?

image

Looks the same? Probably. Now the question is why the application performance degraded? Maybe it should know how much cycles I need?

image

And now with the Extension

image

Well, not really works. Let's try another method

Parallel.For(1, int.MaxValue, delegate(int k)
            {
                i = k;
                if (Console.KeyAvailable)
                {
                    Console.ReadKey(true);
                }
            });

 image

Hmmm, it looks much better now, but still I do not understand that's going on here.

Yes, I know, this is stupid way to test framework and it's very early stage to judge, however, please someone can explain me what exactly wrong I'm doing?

Download Parallel Computing December CTP

Sunday, December 02, 2007

WPF designers, want more work? Stick with me!

I have a lot of clients with my consulting job, most of them in Israel and have a huge problem to find "right" user experience professionals to design their WPF (and Silverlight) interfaces. So, I want to advice them what UX expert to work with, but I do not know you. If you think, that you are such expert and you are familiar with Microsoft Expression family, send me your contact information aside with your portfolio and if it'll be impressive, I'll recommend you as next designer for my clients.

Saturday, December 01, 2007

What did they smoke? (these are actual MSDN articles)

After publishing KB support article about unattended classical music, played by BIOS in Windows systems, I got an email from one of my friends with dozen (actually 20) of other real KBs, confirmed by Microsoft as known issues. Here it comes - what did they smoke, approving such stuff?

Q303969: How to Work with More Than 64,000 Children Per Parent

Q189826: PowerPoint Centimeters Different from Actual Centimeters

Q282850: Cookies Lost After Upgrading to Windows XP

Q811443: The Italian Proofing Tools Make a Potentially Offensive Suggestion

Q178748: SATAN Causes High Memory Utilization in WUSER32

Q133357: Differences Between Temporary and Permanent Relationships

Q259754: Invalid Page Fault If a Player Shoots the Moon "...you may receive the following error message if a player successfully shoots the moon...

Q269916: Office Assistant Makes Sudden Loud Noise

Q191241: Money: Stuck in Endless Loop When Reading Statement from Broker

Q145674: How Long Does it Take to Set Up Pregnancy and Child Care

Q138990: No Ball on Table in 3D Pinball

Q206145: Random Characters Appear in Network Adapters List

Q106121: Sleeping Server Stops Responding to Requests

Q244763: Access Violation Under High Cursor Stress

Q170433: Cannot Stop Ignoring a Person in a Whisper Box

Q264443: Wall Will Not Glue or Is Not Cleaned Up “Microsoft has confirmed that this is a problem in the Microsoft products that are listed at the beginning of this article”

Q143366: ErrMsg: Solar System Needs More Memory to Run

Q227925: Access Violation When Sending One Million Faxes on VFSP Device

Q167705: Talking Loudly into Microphone May Cause Disconnect

Q811544: Holidays Available Only Through 2005 Calendar Year “This behavior is by design.”

bang

Smile and have a nice week

As promised, I reinstall my laptop with Windows Vista 64bit

I decided to reinstall my D820 with 64 bit version of Windows Vista as involvement act with Gadi. 13 minutes of installation. All hardware was found and all drivers were installed (this why I love Dell). The same score as was with 32 bit version - 3.2. Fist run of Windows Update = 38 fixes (about 130MB, only required updates, downloaded and installed within 55 minutes including first restart). Another turn of Windows Update brings me additional 2 fixes (63.9MB of driver's updates and 10 minutes ). It downgrade my computer to 3.0. Now I have to add my computer to domain. It was done via VPN over WiFi and took about 10 minutes including security check, policy update and IPSec. After Vista was activated, come Office's and Live Suite turn to be installed. 

image

Office installation took about 2(!) hours. Well, I do not know why it happens, however, let's go on and install VSTS 2008. The first step of VSTS installation required me to restart my computer twice. It looks like there are issues with "Microsoft .NET Framework v3.5 (x64)". However, after I "run as Administrator" the Visual Studio installer, the problem disappears. It looks like there are some files become locked, when running the installer without elevated permissions (THIS IS BUG). After the first step passed, I wait for another 35 minutes for VSTS to be completely installed. To be honest, in x64 HxMerge works a bit faster, then on x32 platform. Additional 15 minutes of MSDN library.

Well, overall experience of installations was rather bad, but much worse is how x64 works. More then half of system processes (see the example of such service - Console IME at screenshot)  are working in simulation mode, so performance of the system is sucks.

image

What will be my next step? Probably, uninstall of x64 bit version of Windows Vista and installation of x32 bit system. I can not see real advantages of using x64 due to fact, that this software is not ready for public use and waste your system resources.

What do you think about this point?

Thursday, November 29, 2007

Free official copies of Camtasia studio and SnagIt

Want Camtasia Studio (the best software to make screencasts - remember about Justin's competition?) and SnagIt for free? No problem, just go and download it from official Techsmith website. What's the catch? No catch! This is old versions, provided for free by the company.

Download Camtasia 3 (current version 5) here and get free license key here.
Download SnagIt 7.2.5 (current version 8.2) here.

Have a nice weekend.

via Windows Connect

Wednesday, November 28, 2007

WPF quiz #1: Moving rectangles

Referring last event, I want to start new section in my blog, named "WPF quiz".  In this section, I'd like to ask you WPF related question and a day later answer the question my self. So, let's start

Question:
I have to display large amount of rectangles, which moving randomly at the screen. What approach, should I use in order to gain best performance for my application?

Answers (creation):

  1. Create DependencyObject with relevant properties. Create ObservableCollection of those objects. Create DataTemplate to visualize the object into Rect. Bind ObservableCollection to Children property of Canvas.
  2. Create UIElement, that draws Rect. Create ObservableCollection of those UIElements. Bind ObservableCollection to Children property of Canvas.
  3. Create FrameworkElement hosts Rect. Create ObservableCollection of those FrameworkElements. Bind ObservableCollection to Children property of Canvas.
  4. Create CustomControl, that visualizes Rect. Create ObservableCollection of those FrameworkElements. Bind ObservableCollection to Children property of Canvas.

Answers (movement):

  1. Bind attached properties Canvas.Left, Canvas.Top to X and Y of the objects
  2. Bind RenderTransform -> TranslateTransform property of the objects to X and Y
  3. Create and remove appropriate objects with preset X and Y in ObservableCollection
  4. Create DispatcherTimer to change X and Y properties of the objects.

You should choose one from Answers(creation) section and one from Answers(movement) section to archive full answer to this question.

Please use comments for this post to answer.

My answer will come tomorrow. Good luck.

DEV411 - presentation and demos download

I uploaded my presentation, done in DevAcademy2 to SkyDrive. Now you can download, use and review it.

PPT only presentation (7.2 MB)

PPT only presentation before final cleanup (7.6 MB)

Full presentation, including demos, code and PPTX file (26.1 MB)

Have a nice day.

Thank you and Microsoft Expression Blend SP1

First of all, I want to say thanks for all those, who took part in DevAcademy2 event yesterday. I believe, that such events can bring a lot to developer's community all over the world.

Next, I want to announce great work of Microsoft Expression team, that brings us SP1 for Microsoft Expression Blend product.

What fixed in SP1? Most of issues, you reported here.

Download Microsoft Expression Blend SP1 >>

Monday, November 26, 2007

Dev Academy II - updated matrix

Today, I got about 10 phone calls about what's happen with time matrix for Dev Academy II time slots matrix. Please note, that the matrix you got is updated. Please, download and print updated one from here (my slot is at 9:30 AM).

 

Download Dev Academy II Matrix >>

DEV411 - WPF for developers: optimizing your WPF application

Less, then 24 hours until Developer Academy 2 a lot of pressure and stress. Last fixes to my presentation - it's too long now. A lot of stuff, I want to speak about, a lot of demos (mostly very bad performing applications, I dealing with), three computers (one is really cool with 8.9 Vista score) and, of cause, a lot of code to write. But I have only 75 minutes to do it all. So, I have to think a lot about how to do it all together with such tight timeframe (do you remember? - 9:30)

What I'll speak about? I'll speak about cool luxury cars, really.

  • First of all, the most common problem, WPF developers faced with, is performance. No, WPF scale it, but you should know how to do it smart way.
  • Next, practices. Yes, there are practices and it's worth to learn wisdom by the follies of others. So, I'll speak about those follies.
  • Why sometimes, pixel is matter, and sometimes it is not?
  • What two threads, you are working with? Are there really two? Where the application problems is lying?
  • What is tier? How to measure it? How to know when I'm working with GPU and when with CPU? How to influence it?
  • How much memory (either computer and graphic card) I need?
  • What's the greatest evil of your WPF application?
  • How to scale very large bitmaps or very large amount of controls?
  • How to easily make data virtualization by your own hands?
  • How to create your own UI threads? Yes - you can do it!
  • How to make your ListBox x70 times smaller and faster, your data x20 smaller and x700 faster
  • How manage layout and measurement engines
  • How to do things in background without paying application fees
  • How to manage dispatchers
  • How to use visual and data performance measurement tools and how to analyze and profile unmanaged resources
  • How to make your application starts x400 faster and load resources on demand
  • How to load XAML without loading System.Xml.dll and using DOM or SAX
  • How to run the same WPF application on P3 with 128MB RAM and internal graphic card and Core Duo 2 with 4GB RAM and GeForce 880 GTX and get the same behavior of fast running application
  • ...and much much more...

Waiting for you tomorrow at 9:30 AM (this is almost night, kind of morning) at Arbel hall of Avenue at Airport City near Ben Gurion airport. Come an hour before.

image

Thursday, November 22, 2007

Time slot of my session in Developer Academy 2 has been changed

Due to external factors, the time slot of my session in Developer Academy 2 has been changed and now it from 9:30 to 10:45 in Arbel hall in floor 0 (entrance at left). I'm really apologies for this inconvenience and waiting for all of you to come. We're open at 8:30 and there is registration and might be sandwiches in the hall. Come first and park near entrance :)

Please notice: that there are morning traffic jams at the entrance to Airport City as well as registration hassle, thus all those, even come via road 6, take half an hour to 40 minutes spare to enter the parking lot and register.

I'm sorry, that you have to wake up so early, but remember: "Early to bad and early to rise makes a man healthy ,wealthy, wise and not late to DEV411 about WPF lessons learned from last year" :)

27-Nov @ 9:30 AM
set your clock to wake up at 6:30AM and I'll bring you a coffee¹

¹ Limited to first 250 visitors only

Very bad startup name

Today morning, I got call from someone, who ask me to assist new startup with WPF development. I asked a name of the startup. The name is "Proc To Light". Nothing special, they are doing very interesting application, that support analysis to make right decisions regarding different business process. I typed the name of the startup and phone number into my E61 without spaces. Once I got to office, I looked into the note made burst out laughing like crazy. The name of this startup is "PROCTO LIGHT". I called the guy and told him, that I advice them to change their company name in order not to spawn investor's relation.

Image:Anorectum.gif

What other fun startup names do you know?

Wednesday, November 21, 2007

Why good programmer never write good programs

Here, one of visitors, begun a discussion about good and bad programmers. Here, I wrote about absolutely unnecessary and not relevant questions to good programmers. Someone things, that good programmers should write good programs. However, I want to interpose my objections to the statement. And this why.

image

Let's start with the term "good programmer". What is it?

  • He knows any, even small details of programming language
  • He knows to write very efficient algorithms
  • He always in new technologies and applies them in his everyday work
  • He is extremely innovative
  • He tries to make his every bit to be perfect
  • He glows with enthusiasm
  • He's very smart and inventive

Can such person write good program? Probably not. He can not write even average program, because of very small fact - the target of the programs we writing.

Whom we write for? For customers. The customers has no idea about what programming language we are using to write the program. He even do not know why we use this or other approach to solve his business problems. He do not care about algorithms, structures and abstract layers. He do not care about top and very efficient technologies, helps us to perform tasks better. He want to solve his problems and he want to do it quicker as possible with minimal effort from his side.

Now I want to ask you a question: "Do you (as programmers) interested with his (customer's) business processes and problems?" - the answer is NO! You're much more interested with how to make your work smaller and be able to expand it in the future upon customer's requests (not needs). To expand and enhance the program by yourselves - not by any other. You are the programmer!

Honestly, you are right, it is not your job to understand user - this is the job of business intelligence expert. However, how many companies hires this one? How many job boards advertises "BI experts"? - NONE (except those, how want him to sell their products). Everyone are looking for programmers, team leaders and architects. They want you to do it. They want you to understand customer's problem and you to solve it. Will you? Probably not, but you'll try to and this will take most of your work time. This why the programmers of today, probably good programmers, but, actually, they are not writing (and unable to write) good programs. It maybe very good from inside, but will be never good outside.

Tuesday, November 20, 2007

I love such SPAM

That's exactly what I mean, when writing such articles.

image

Translation for English speakers: "Wake up!!! Job boards are overloaded... Very high wage in HighTech. .NET. Press here and you're financially secured.

Monday, November 19, 2007

Visual Studio 2008 new test features

Referring my disappointment from the topics on 70-552, I start looking on new test features, provider by Visual Studio 2008. I worked with performance analyzer in VS2005 (which is looked much more like debug tools for .NET CLR developers in MS) and today, after public release of VS2008, I can show you my research.

From the first sight, it looks like nothing changed

 

image

But when we're digging deeper, we discover new interesting features.

image

Look in this. My application decodes jpegs most of the time. And this is very right.

image

Another great feature, that makes our live easier is Set Root method and Hot Path marking. Now, once, you found the root of your application, you're able to "hide" unnecessary nodes (in most cases, those are system calls) and then mark the critical path (from performance point of view) in your call tree. You also can find all modules and functions, called selected method.

image

Another feature of new performance analysis tool is ability to compare your test run samples.

image

Very very cool tool, however it still too complicated for average user to understand what all those numbers mean, even with handy new Noise Reduction filters :)

image

Now you, probably, know what the problem with CarKiosk.exe application. You do not know what is it? Come and see at Developer Academy II at DEV 411.

VS2008 RTM is available for MSDN subscribers

After long wait, Visual Studio 2008 (code name Orcas) become available for MSDN subscribers. Download it now >>

Sunday, November 18, 2007

How to make your code completely unreadable with .NET 3.5

With the time we got our developers less and less professional by enhancing programing languages and using easier code syntax. However, while we are trying to make things better, we discovered that things are going bad. Let's see following code sample

delegate string BringBeerDelegate(int amount);

 

static void Main(string[] args)
        {
            Console.WriteLine("Bringing beer using anonymous delegates");
            AskBarmenAboutBeer(2);

        }

 

static void AskBarmenAboutBeer(int amount)
        {
            BringBeerDelegate bringBeer = new BringBeerDelegate(BringBeer);

            Console.WriteLine("You got {0}", bringBeer.Invoke(amount));
            BringAnotherBeer(bringBeer, amount+1);
        }

 

static string BringBeer(int amount)
        {
            return string.Format("{0} beers",amount);
        }

 

static void BringAnotherBeer(BringBeerDelegate firstPint, int newAmount)
       {
           string res = firstPint(newAmount);
           Console.WriteLine("You got another {0}",res.ToString());
       }

It pretty clear what this code is doing. It creates new delegate named BringBeerDelegate, that actually formats string. Then it invokes the delegate. After it the delegate transferred into BringAnotherBeer method and invokes there. This way it works in .NET 1.1 So far, so good. Let's use anonymous delegate, introduced in .NET 2.0 instead on using method to invoke it. Now, we'll add another method, that creates and invokes the anonymous delegate BringBeerDelegate.

static void AskBarmenAnonymouslyAboutBeer(int amount)
        {
            BringBeerDelegate bringBeer = delegate(int am) { return string.Format("{0} beers", am); };

            Console.WriteLine("You got {0}", bringBeer.Invoke(amount));
            BringAnotherBeer(bringBeer, amount + 1);
        }

Now, calling AskBarmenAnonymouslyAboutBeer with number of pints we want, we'll create and invoke the anonymous delegate. The code less readable (as for me), but never mind, we saved a couple of code lines.

Now, let's write following:

BringBeerDelegate bringBeer = am => string.Format("{0} beers", am);
BringAnotherBeer(bringBeer, ++amount);

What the hell all those => are doing? This is anonymous delegate BringBeerDelegate defined by lambda¹ expression.

small lyrics: ¹Lambda (uppercase Λ, lowercase λ) - the 11th letter of the Greek alphabet. In the system of Greek numerals it has a value of 30. Letters that arose from Lambda include the Roman L and the Cyrillic letter El (Л, л).
Lambda expressions provide a more concise, functional syntax for writing anonymous methods.

Is it really more concise and functional syntax? What do you think, following code doing?

Func<int,string> firstTime = (int am) => { return string.Format("{0} beers", am); };

Func<T..> is generic delegate type for lambdas. That's piece of cake, isn't it? Let's see you to predict what following code will output...

BringBeerDelegate bringBeer = am => string.Format("{0} beers", am);
Func<int, BringBeerDelegate, string> bringBeerFunc = (int am, BringBeerDelegate beer) => { return beer(am); };
Func<int, Func<int, BringBeerDelegate, string>, string> lastTime = (int am, Func<int, BringBeerDelegate, string> func) => { return func(am, bringBeer); };

The other awful thing in new .NET 3.5 is anonymous types. So, great news, VB programmers, there is new king in the village. His name is VAR. Following previous code section, following make our life even more complicated.

var whatBeer = bringBeer;

//At least, either compiler and interpreter knows, that whatBeer variable is of BringBeerDelegate type

image

Happy and very unreadable coding, my friends.

Source code for this article.

Just released - Microsoft Visual Simulation API

Do you know Microsoft Flight Simulator (X) game? Want to incorporate it's features in your development? Let me introduce you Microsoft ESP. Now, you have visual simulation platform, that might bring realistic visual environment without a lot of development affords. 

Now, connect it with Virtual Earth (with it's new geophysical API) and you have your own .... {censored}. You know, what I mean and can hear it here. Sky is not limit anymore :)

image

70-552 should be removed (or, at least changed)

About two weeks ago, I'm failed on 70-552 (UPGRADE: MCAD Skills to MCPD Windows Developer by Using the Microsoft .NET Framework). I'm FAILED. Just flaked it off, stumble on it, loooooose! I even was unable to imagine, that I can fail any MCP exam? So, I investigate why it happened (shit does not happen, we make it happens)

  • I found, that I ever, never used (aint even think of using) build it unit test framework from VS, 'cos it's really SUX!
  • I do not think, that I ever though to "Test the identified component based on the requirements", 'cos first of all I should understand what client need and what other systems he has. Only then I can begin of thinking about "components"
  • I do not want to "Design a new exception handling technique", 'cos we either can use error handling design patters or incorporate existing exception handling best-practices, used by clients.
  • I do not want to "Decide which configuration attributes to store", 'cos we need them all and if you found, that you should not store some attributes, you can just void them
  • I do not think, that I should "Evaluate the test environment specification" or "Evaluate the performance testing strategy" or, even "Evaluate the stress testing strategy", 'cos we have really good external companies, that does it professionally. I have to write good code, while keeping performance in my mind. I definitely should not test the application performance with Windows Task Manager - this is very bad behavior. So, "Identify performance spikes" and "Track logon times" is not my job!
  • I'm unable to "Evaluate the impact of the bug and the associated cost and timeline for fixing the bug", 'cos if you are only developer in the company, you'll fix it. If not, you should know all developers involved.
  • If you are going to "Track bugs that result from customer activity", you should do only this task. I think any of you, who ever did it, know, that we're, developers, trying to explain the customer, that we never have bugs. All those behaviors are kindly expected.
  • If you are not aware about security and want your customer to report "suspicious activity" with your application installer, you, probably, should know how to "Identify scripting requirements for deployment. Considerations include database scripting". As for me, I do not!

So, by summarizing those points, I'll retake the exam, by writing whatever they want me to write, however, I'm very sure, that this exam should be removed from developers certification, if we do not want our developers to become even worth, than they are.

For conclusion about you, as developers. Try to answer following question (from this examination). Later, I'll tell you what the right and "right" answer for this one.

You are developing application, which includes several components:

  • 3rd party webservice
  • External API, developed in other company
  • Core component, developed in your company
  • MSSQL database in your company
  • External component, that using external API

What two components you advice to test in integration tests.

Good luck.

Friday, November 16, 2007

DIY: How to replace your Dell Latitude D820 keyboard for only $13.99

  Well, after my fight against Dell Israel and Omnitech, I decided to replace my keyboard my self. The keyboard was ordered via official Dell US website for only $13.99 (inc. P&P)

DSC06586

It took about a week to arrive and now I'm ready to start replacement process.

DSC06587

You'll need two wrenches like those.

DSC06605

First of all, you should shut down your computer and remove it's battery

DSC06588

 

DSC06589

Next, by using plastic scribe or small wrench remove front hinge cover.

DSC06590

DSC06591

DSC06592

After the hinge removed, you'll get an access to three screws in the top side of the keyboard and small plug. Unplug it.

DSC06593

 

DSC06594

Then remove screws.

DSC06595

DSC06596

After the screws removed, rotate your laptop by 90 degrees and pull the keyboard forward up to remove it.

DSC06597

Turn the keyboard upside down. You discover the plug, that connects the keyboard. Unplug it by pulling it up.

DSC06598

DSC06599

And remove the old keyboard. Now replace the old with new one and plug it back.

DSC06600

Put the new keyboard to it's place and push it down from the upper side and both right and left side to secure it in place. Do it gently to avoid scratches.

DSC06601

Replace all three screws and upper plug.

DSC06602

Put the hinge cover back by pushing it gently

DSC06603

And you done.

DSC06604

 

You just save $121.01. Not bad does not it? Thank you, local thieves, and know, who spares the bad, injures the good. However, here in Israel, an open door may tempt a saint.

Be good men and have a nice weekend.