Showing posts with label Visual Studio. Show all posts
Showing posts with label Visual Studio. Show all posts

Thursday, May 27, 2010

A 3D Desktop and baby cloves

I get an email today from my business partner. One year ago i was promoted to got to the Cebit 2009. And since Nick (business partner) was going with me. We met in Augsburg. I really wanted to implement Microsoft Touchless into AntMe! while we travel to Hanover. Since the German answer to TGV is the ICE it wasn’t that lucky. I bought baby cloves in a shop around Augsburg central station. What? Well you know, in order to use Touchless i need something trace- and trackable. So i had two choices. Paint my fingernails, which is obviously gay. Or be creative. I choose the second one. So sitting in the well cooled, very well cooled ICE i cut of the fingers of the baby cloves. In order to get Markers. People around me look at me there thoughts were so loud that i could here them. But anyway. So i started developing a XNA PlugIn for AntMe! controlled by the baby cloves.

IMAG0018

Nick remembers that story well since it was a little embarrassing for him to sit beside someone how plays with baby cloves. So he write me an email these days.

“Why do i always have to think about baby cloves?”

http://gizmodo.com/5545623/these-technicolor-dream-hands-could-revolutionize-ui

lycra-gloves-computing-mit

Well from my perspective it’s not that hard to implement. But to get a clear and smoothie marker. It’s nearly impossible with the first version of Touchless. So the Idea of the cloves is brilliant. But to use the hole clove? I think it looks like the 80ths or worse. Maybe a filter on the Webcam can do that crap to. I have to think about that idea and let you know if it worked out.

Friday, February 26, 2010

Password Character usage in TextBox

So you already recognized the new Windows feature for showing the password of a WLAN? A student asked me, how to do that. So here is the tutorial. “How to set and reset a password character in a textbox via C#”

password

So this is the screen hiding the Password by a Password Character. The Picture below shows you the same with unhidden Password.

passwordshow

The question is how did they do that. So let’s start with a quick tutorial.

I created a new Windows Form Project. And put a Textbox named “txtPassword” and a Checkbox with the name “checkPassword”. So the solution should look like this.

pwform

Switch to the Code Window. I like to create a Method to initialize Controls. So this is how this should look like.

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InitializeControls();
        }

        private void InitializeControls()
        {
            checkPassword.Checked = false;
            txtPassword.PasswordChar = '●';
        }
    }

So how do you get the character for the Textbox? In Windows you can find the Character Map by Windows –> All Programs –> Accessories –> System Tools –> Character Map.

charmap

Select the character you want. Copy it and set the Textbox PasswordChar Property to that character. The next step is to create a new Event Handler for the checkbox CheckedChange event. The code should look like this.

        private void checkPassword_CheckedChanged(object sender, EventArgs e)
        {
            txtPassword.PasswordChar = checkPassword.Checked ? '\0' : '●';
        }

The idea of resetting the character map is to use the empty character symbol which is presented by ‘/0’. You recognized that i like to use the conditional operator instead of the if-else. Immo would say: “Why did you that way, because you can?” The if else way would look like this.

        private void checkPassword_CheckedChanged(object sender, EventArgs e)
        {
            if (checkPassword.Checked)
                txtPassword.PasswordChar = '\0';
            else
                txtPassword.PasswordChar = '●';
        }

The complete code should look like this. Now it’s time to run the our program. Everything should work fine now. Here is the complete code.

using System.Windows.Forms;

namespace Password
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
            InitializeControls();
        }

        private void InitializeControls()
        {
            checkPassword.Checked = false;
            txtPassword.PasswordChar = '●';
        }

        private void checkPassword_CheckedChanged(object sender, EventArgs e)
        {
            txtPassword.PasswordChar = checkPassword.Checked ? '\0' : '●';
        }
    }
}
Hope this was helpful.

Friday, February 19, 2010

Visual Studio 2010 RC1, Windows 7 – I’m so happy now! – Part One Windows 7

Preface

Ok, a lot of you guys asked me in my talks and sessions, you said VS 2010 is slow and bad. Looks like somebody is reading my Blog. And the “Missing Features” is well known i guess. So first of all. I have a lot of Microsoft products i really don’t like. Outlook for example is hate-love relation. It’s slow, the UI is ok, the features even more. But guys the sorting is a mess. And the best thing is the error handling. Well Windows 7 says i have no internet connection right now, but i’m outlook i bet i can find one! No you’re not. But hey why not suspending and slowing down the system. This is just one of the problems you have if you work with outlook on a daily basis.

And once up on a time there was this browser. What was his name? Internet Explorer. Why does people don’t like him. I like him! Yes for sure as a user it’s not as friendly as you might expect. But as a developer. It’s the best Browser in the market. Mozilla for a Developer is a mess. Sorry guy, I’m not able to render your CSS even if it is standard why should i as freeware care about it. Chrome is reading my profile and safari is Netscape 1.0. So i choose a mix of browsers. IE for the work. Since they releasing security Updates fast, and i can debug webservices and applications. And yes Fiddler is the best. And i use Mozilla for downloading stuff and browsing on sites no one should browse after all. Why do i use Mozilla for that sites. Best thing on Mozilla is. Even if you activate the Javascript and Flash and … shit. The most webdeveloperkids are making mistakes. While IE is running it, and try to fix the errors. Mozilla is not running the scripts. I deactivated all the scripts. So i have a robust Browser. And only the Scripts i really care about are allowed to run. That makes Mozilla my number one browser for bad or evil sites. I suggest you guys try that way. Work with IE, browse with Mozilla. Oh, and then we have this new Windows Mobile. I’m so glad I'm not a Windows Mobile Developer! Ha, ha! And i thought the Apple iPhone Objective C is the most restricted and most stupid solution you can find on the market. Microsoft reacted on it and say: “We can do this crap, too!”. Looks like both want to clear the way up for Google.     

169657118_934780c2df

There are many people out there which hates Windows Vista. I can understand them. But as a developer i was so glad to get it. The Error Handling and reporting, the UAC, …. I know a lot of guys blame Microsoft for reasons like: “it’s to slow”, “the Hardware prerequisites” – and the list goes on and on. But i really used to like Vista.

Part One – Windows

And Windows 7, it was love from the early Alpha. It’s fast, performing and even faster. Yes there are some issues with drivers of people how really thought they can install a Windows XP 32 Bit driver on a Windows 7 64 Bit Version. But this is a PEBKAC problem. And yes sometimes in companies you have problems with file handling if you run Windows 7 and a Windows 2003 Server. But there are Updates for Server 2003. Using Windows Server 2008 R2, i had no problems with the network stack in the past years working with Windows 7 since the early preview bits. So i love Windows 7. Please do not make a Windows 8. Leave us alone with 7 :-). Yes, from a computer scientist perspective there are a lot of things to burden about 7. In a perfect world i would still prefer SOLARIS in a Terminal – Client manner “Ray 1”. But hey, we’re just not living in a perfect world. So Windows it is.

You have to know how to handle the cute Windows. BSG Admiral Cain: A philosopher once said:

When faced with untenable alternatives, you should consider your imperative.”

So here is how i use Windows 7.

Keyboard Shortcuts

imageWindows + P
I have a lot of presentations to make. So the Presentation mode of Windows Seven is for me is one of the coolest Features. It’s a faster way then handling it via Windows + X for the mobile settings. And thanks to Windows + and Windows – i don’t have to use ZoomIt any more.

imageOk a lot of you guys use the Windows + E to get to the Explorer. But there are still a few things how you can get the best out of it. Here are some features you should turn on if you are a Pro on working with Windows.

Goto –> Explorer –> Organize –> Folder and search options –> View. Uncheck the:  “Hide extensions for known file types” and  check the “Use check boxes to select items”. These two options allows you to first display the file extensions. The second option you just activated allows you to easily select files by checking and unchecking them. In combination with STRG + A for select all, or SHIF + Mouse selection this is a very useful tip.

image  Since i don’t want to wait until the explorer shows me all the files, i really like the Windows + R

image

I prefer that way of running some Applications and navigate to Folders, since i think the Windows Search is to slow for me. I often tend to browse through special folders via Command Shell which i also start via the Windows + R.

Ok when it comes to the Windows you all be familiar with Windows + Left and Right Keys to dock the Windows to the Left or right corner on Notebooks or sending them to different monitors on a multi monitor environment. The docking thing is cool stuff. And shaking the Windows is also a good tip for users with multitouch or touch screens. But how can you get rid of the Windows on your Desktop. Ok you can click on the Button on the very right corner of the Taskbar. Or you can press Windows + D to Minimize all Windows. If you want to simply undock a Window you can do that by clicking on STRG + double-click. 

image

And i just want to mention the Windows + UP and Windows + Down Shortcuts where you can maximize or minimize Windows and Dock them on the hole active screen. Another create Shortcut is the Windows + T, with this you can cycle through the apps and Windows + Shift + T you can cycle back in your Taskbar. And With Windows + Number you can start the Applications. In my Setting Windows + 1 will start IE and Windows + 2 Will start Explorer and so on. And there are two more keyboard shortcut i use often. Windows + Pause to get the properties information about a computer. And the last one is Windows + L to lock a computer.

More Keyboard Shortcuts….

Ok since i don’t care much about Gadgets and all that Design stuff i just want to point at the new Themes you can download or create for yourself. Here you go …

So i use currently a lot of Microsoft Tools to optimize my Windows behavior. Two tools i really suggest to all of you are Autoruns and ProcessExplorer.

Autoruns – optimize startup

With this little app by Mark Russinovich you can detect software which runs when you start your computer.     

image

Since you can harm your computer you should just use Logon Tab and IE Tab when you’re not familiar with Windows. You can deactivate a program or delete it from the startup. Especially helpful for applications like Skype and browser toolbars.

Process Explorer the better Task Manager

image There is so much i can tell you about Process Explorer and why it is the better Task manager. So i would suggest you read the articles about it or watch the webcasts.

This is just a sneak peak overview of Windows 7 focusing on users interaction. I could tell you more about the sensor kit or the new managed code wrapper in the windows 7 SDK. And the multitouch support.

Part Two will be about Visual Studio 2010  

Wednesday, February 10, 2010

Language Integrated Query (Linq) Session @ HM

Ok, seems like i always get the talks nobody else want to have. Mh, what can i say about Linq? Well i tend to tell the people how things work. But explaining how they build Linq is a hell of hack. Yes i can tell them about “computable functions” or let’s define better “higher-order functions”. WTF? So where to start? Functional Programming? Or maybe the Lambda calculus? Well i don’t think so. And reading the the Paper? “Can Programming Be Liberated from the von Neumann Style? A Functional Style and Its Algebra of Programs” written by John Backus at the IBM Research Laboratory, San Jose. Is this the start for my Session?

I often come to the conclusion people don’t want to know anything. Like in the movie “The Island” where McCord says: “Just cause people wanna eat the burger doesn't mean they wanna meet the cow.” And talking to students @ University of Applied Sciences Munich is always a pleasure. Give them a ball, and let them run with it. You’ll be amazed by the things they will come back with.

So, decided - i show the Technology and explain it step by step. Perhaps they will surprise me again.

So showing how to work with Linq, you can find so many solutions …

  • Perhaps you start with reading?

Linq start Webpage @ Microsoft
Thank you Charlie, again!

  • Or maybe you want to check out some Webcasts?

MSDN Webcast: Introduction to Microsoft .NET Language Integrated Query
and even more Linq Webcasts …

  • i for myself prefer the code:

So one step could be Open Visual Studio –> Help –> Samples –> local Sample folder –> CSahrpSamples.zip –> Linq Samples
or direct via C:\Program Files\Microsoft Visual Studio 10.0\Samples\1033

another way of learning by code start here … CodeProject … or look closer to Charlie’s Blog.

And yes, there are Books to:

Introducing Microsoft LINQ
byPaolo Pialorsi and Marco Russo
Microsoft Press 2007 (240 pages)
ISBN:9780735623910

Save the money, give it to me. :-) The book is not as good as his title promises. Since it’s the only one i read about this topic, i can’t tell much about others.

So i finally mixed up this things with an early preview of Anders Hejlsberg and came to this solution.

The Presentation stuff:

Luca Bolognese introduces Linq always by saying developers != plumper's. What that means is, like any other O/R Mapper Linq to SQL is doing the Mapping of SQL data - Types to you’re development data – Types. Well i prefer to introduce Linq by first of all telling the folks about Duck typing.

duck     

What you can do with Duck typing is you can use a shorter way to define your variables. Instead of using something like

   1:  int i = 10;

you can do the same thing by typing

   1:  var i = 10;

Ok, that however doesn’t means that it is a non strictly typed variable. Since the compiler understands that 10 is a integer value. Where is the duck? Well the duck means – it smells like a duck, it looks like a duck, it even acts like a duck ==> so it must be a duck.

Sine 10 is obviously a integer value C# knows that and using the best fitting data type which is int. Well you may argue: “Where is the benefit?”. There are 2 profits of Duck typing. The first one is easy to explain. Think of declaring a variable of a class or .net Type like 

System.Security.Cryptography.ManifestSignatureInformationCollection collection = new ManifestSignatureInformationCollection();

ok, don’t you think that this is a very long way telling the compiler what you mean. A shorter way would be:

var collection = new ManifestSignatureInformationCollection();

I personally like that profit. Using the var when you declare a string, int, … i personally don’t like that way. It makes the code a little bit harder to understand. Because i don’t see it on the first look, what the code is trying to tell me. I have to think a second about it. Ok it’s just a second but it’s still a second.

The other benefit is by using Linq. You really don’t have to think about the result you get back from your query. Telling about queries it’s time to talk about Linq in general.

With Linq you be able to query against anything which implements IEnumerable. Since any Object and data type in dotnet is using this Interface you be able to query against it.

Another aspect on Linq is that you can query against wrappers for databases, XML files and a lot of other implantations.

Now comes the part to explain Lambda expressions and the query style. 1st against Objects, 2nd against the O/R Mapper and 3rd against XML.

Since this blog post already a bit long and i don’t want to bore you any further here are coming the links. Tada…

So here you can find the empty Demo Project.

And here you can find the solved Demo Project.

Last but at always not least, the presentation.

So one good suggestion i can give you, think twice before you use “Linq to SQL”. Don’t think twice if you use Datasets. I have the hunch that Datasets are the hypocrite of death (memory). RAM Footprints, Race conditions, bad performance … are just a view results of using Datasets. “Linq to SQL” instead is a O/R Mapper. It helps a lot and brings performance to your design time. But performance and persistence problems at runtime could occur. If you have a performance critic solution, don’t touch “Linq to SQL”. And using the Entity Framework which means ADO.net makes it worse. Do it by hand - is the only way. Use stored procedures and let the databases do the things they are made for. Yes you can use stored procedures and that stuff in Linq too. But how do you get rid of the caching, the overcharged objects and the heavy memory usage of “Linq to SQL”?         

Visual Studio – Tips & Tricks 2010 @ HM

Ok, i had this Session on 11th February 2010 @ University of Applied Sciences Munich. Since i do that session for many years now, it’s a bit freaky that every time i tell new things. But Visual Studio offers a bunch of tools and features you can use to improve and customize you’re environment the way you like.

Here are some links to other tracks and and a few other tips & tricks i didn’t show at all.

Karen Liu, Lead Program Manager Visual Studio IDE

Dirk Primps, Developer Evangelist

You can download my Presentation right here.

And also the full Demo’s i showed could be found here.

Last but not least the Poster.

Thanks to the speakers above.

Tuesday, April 28, 2009

My days at CeBit 2009

Wow it’s been a while since i wrote my last blog entry. But it’s time to write some new amazing things.

Well first of all, yes i attended the CeBit 2009 Fair on the Microsoft stand at hall 4. Well the project is AntMe! and we worked very hard so that people get information about the AntMe! Ltd. and the AntMe! Version 1.6. Due to the good graphic accelerators in the computers we could also show the new XNA PlugIn.

sshot-5

Now our main character looks like a stoned cute ant instead of a dot with six arms. But also our Bugs changed.

sshot-4

Yes it looks like a big stupid Monster. I like them. And also the sugar Mountains and the apples changed.

I had a lot of interesting meetings and meet a lot of cool guys. So i really had to mention our new friends from xaitment which developed a state Machine for Bots and AI. So visit there homepage www.xaitment.com to get more Information on how you can give your brainless zombie like bots some brain.

And the german TV also recognized us. Welt der Wunder.

CanControls, hubermedia and Visio had a interactive wall. And Manuel from Visio and we had a lot of fun at the Microsoft Party.

Uwe Baumann and i held the daily Patric & Uwe Show. A short 1 hour Presentation on Visual Studio Express, Coding4Fun and AntMe! You can download the PDF Version of the Presentation here. 

A lot of people asked me for the desktop background and where to download so here you go, just click on the image.

While we were travelling with the train i added a touchless to the new XNA Plugin. It worked not very well at that time. But now i finally did it. So perhaps we release this Plugin with version 1.6.1

cheers Patric

Wednesday, December 24, 2008

Meeting Jason Zander

Hey folks, it’s a long time since i write my last blog entry. I was bussy this days. But now i will be back. First of all there is this Interview with Jason Zander. I met so many great people this year. John Leffor which is the Pheonix and Research guy from Microsoft. Then on the Technical Summit 2008 Thomas Dallmair and i had the Chance to talk to Jason. We did a short Interview for Channel8


10 Minutes on Dev 10 - Jason Zander

I don’t like the this pink color. Anyway, we asked Jason about the new Visual Studio Editor. It’s a proof of concept for WPF from my personal feeling. Jason told us how hey actually told his LPM’s to test the new Features in .net 4.0.

An we asked him if it is possible to extend the Visual Studio Express. Due to the fact that we really have some things we want to share with users how still learning visual studio. Or students who are using the free version. Well as a matter of fact the their is no legal chance to do this. However doesn’t means it impossible. But you better don’t try it. Microsoft will not be amused.

What else more can i tell you? Well there is this little promise he made. Ok for all of you guys already have developed a vs plugin. Don’t worry. In some cases it will work great under dev 10. And in some others perhaps not. But their will be an easy to use deployment strategy. Whatever that means. ;-)

So enough about Berlin and the Technical Summit. Except the strange Hotel i was. It’s called Hotel Kaiser. Well this is really something strange. Imagine a house in a house in a house. It was a bit of adventure. But i liked it.

DSC00016

And another strange thing. The Convention Center the Technical Summit took place was like a space ship designed in the early 70th. Well i doesn’t liked it until Tom tells me: “Think about it as a space ship” since this sentence everything fits. And i was totally impressed. More about the Technical Summit.