See my article on Mono in the BSD Magazine May issue
The BSD Magazine has released and there is an article in it by yours truly.
Check it out.
The BSD Magazine has released and there is an article in it by yours truly.
Check it out.
I recently bought an X-Box and let’s be honest. It isn’t getting used. Yes I noticed dust on it over the weekend.
That is why this article caught my eye today:
Why Is My Amazing, Ground-Breaking Microsoft Kinect Collecting Dust?
The main reason my XBox is collecting dust is, besides the fact that I haven’t bought my wife Dance, Dance Revolution, is because there isn’t a game that is enticing me to play it when I get home from work.
I want to play something like Metroid, and jump around and shoot friekazoid alien creatures. I don’t care if I have to combine some type of controller or gun-like device with the Kinect. Or I want to play Madden 2011 and just run over the computer team for 300 yards or bomb passes all games 7 touchdowns.
I just want to have fun and really, the Kinect just isn’t providing me the fun.
This is pretty cool. The animation looks as good as anything out there.
BYU Center for Animation’s new film a double ‘student Emmy’ winner
It is good to see a program at my Alma mater doing so well and those involved getting some praise!
Here is a little code that returns either x or y. It returns y if x is null, otherwise it returns x.
return (x == null) ? y : x;
The coalesce operator is basically short hand for this. The ?? operator simplifies and shortens the above expression.
return x ?? y;
It makes a difference if you do something the right way from the beginning. Everything seems to work out so much better and takes less time over all.
Here are some basic steps that I have learned will help you do it right the first time. These steps are from my experience, mostly because I did it wrong the first few times. These are not exact steps. They are subject to change and improve. In fact, you might have improvements to suggest immediately when you read this. But if you are new to WPF, then reading these steps before you start and following them, will have you closer it doing it the right way the first time. It is much more pleasant to tweak a pretty good process than it is to go in with no idea for a process and do it wrong.
Macintosh
Macintosh owns a significant market share. Determine if this application needs to run on Macintosh as well. Sure, since we are running C# your options are limited to either rewriting in objective C and Coca, or using Mono with a MonoMac UI. I recommend the latter.
Note: It is critical that the UI and business logic are separated to really make this successful.
BSD/Linux/Unix
BLU (BSD/Linux/Unix) doesn’t exactly own a significant market share. However, it is still important to determine if this application needs to run on on BLU as well. Sure, since we are running C# your options are limited to either rewriting in C++, or using Mono with a GTK# or Forms UI.
Mobile Platforms
Again, you may need to do this way sooner if the application is complex.
Today I had to solve a problem that appeared quite difficult, but turned out to not be so hard if I let Expression Blend do most the work and finish it up in the XAML. I ended up having to completely recreate the default template style and then modify it.
Note: This article could also be titled: How to change the default template style of a standard control?
I had a RadioButton with text that wraps and it wasn’t displaying exactly how my team wanted. Here is the XAML.
<Window x:Class="RadioButtonTopAligned.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="MainWindow" Height="350" Width="525"> <Grid> <RadioButton GroupName="RadioButtonList"> <Label> <AccessText TextWrapping="Wrap" Text="_This is a very long radio button control line of text that should wrap." MaxWidth="300"/> </Label> </RadioButton> </Grid> </Window>
The problem is that the circle bullet is center aligned like this:
Notice how the circle bullet is aligned in between the two lines of text. I need it to be top aligned like this:
Notice how the circle bullet is aligned with the top line of text. I need to get WPF to do this.
From a Visual Studio 2010 point of view, there is no easy way to do this. At first I thought it would be a simple dependency property, but it isn’t. An quick internet search led me to realize that I have to pretty much re-style the whole RadioButton. This sounds really hard and in fact, in Visual Studio, without help, it would be really hard. You would have to have the code for the default template style for the RadioButton control memorized.
Here is an forum post I found from MSDN: How do I make a RadioButton’s Bullet align top
While the post is exactly what I was looking for and has an answer, I didn’t at first grasp the answer. I wasn’t sure what was going on until one of my co-workers, Shawn, who is more skilled in Expression Blend, showed me. Now that I understand, I want to make sure the next person who finds the same forum post on MSDN can understand even easier by writing this article and adding it to the forum post.
This is where Expression Blend comes in. If you don’t have Expression Blend, don’t worry, you can still get through this article as I will include the the default style code that Expression Blend created for me right here in my post.
In Expression Blend, this is what to do.
Here is what happens to your XAML and you can do this to the XAML in you project manually if you don’t have Expression Blend.
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" x:Class="RadioButtonTopAligned_EB.MainWindow" x:Name="Window" Title="MainWindow" Width="640" Height="480"> <Window.Resources> <SolidColorBrush x:Key="CheckBoxStroke" Color="#8E8F8F"/> <Style x:Key="CheckRadioFocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="RadioButtonStyle1" TargetType="{x:Type RadioButton}"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> <Setter Property="Background" Value="#F4F4F4"/> <Setter Property="BorderBrush" Value="{StaticResource CheckBoxStroke}"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <BulletDecorator Background="Transparent"> <BulletDecorator.Bullet> <Microsoft_Windows_Themes:BulletChrome BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" IsChecked="{TemplateBinding IsChecked}" IsRound="true" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}"/> </BulletDecorator.Bullet> <ContentPresenter HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" Margin="{TemplateBinding Padding}" RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </BulletDecorator> <ControlTemplate.Triggers> <Trigger Property="HasContent" Value="true"> <Setter Property="FocusVisualStyle" Value="{StaticResource CheckRadioFocusVisual}"/> <Setter Property="Padding" Value="4,0,0,0"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <Grid x:Name="LayoutRoot"> <RadioButton GroupName="RadioButtonList" Style="{DynamicResource RadioButtonStyle1}"> <Label> <AccessText TextWrapping="Wrap" Text="_This is a very long radio button control line of text that should wrap." MaxWidth="300"/> </Label> </RadioButton> </Grid> </Window>
Now we can edit the XAML. Below is the same XAML as above with the following edits:
Note: If you change the font of the text content in the RadioButton, you should change the Margin in the style as well. I haven’t figured out how to make it always match the top line without manually tweaking it when you change the font. Also, if you don’t want the BulletChrome element to be the same size as the font, you will have to tweak Width and Height too.
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Microsoft_Windows_Themes="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero" x:Class="RadioButtonTopAligned_EB.MainWindow" x:Name="Window" Title="MainWindow" Width="640" Height="480"> <Window.Resources> <SolidColorBrush x:Key="CheckBoxStroke" Color="#8E8F8F"/> <Style x:Key="CheckRadioFocusVisual"> <Setter Property="Control.Template"> <Setter.Value> <ControlTemplate> <Rectangle Margin="14,0,0,0" SnapsToDevicePixels="true" Stroke="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" StrokeThickness="1" StrokeDashArray="1 2"/> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="RadioButtonStyle1" TargetType="{x:Type RadioButton}"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/> <Setter Property="Background" Value="#F4F4F4"/> <Setter Property="BorderBrush" Value="{StaticResource CheckBoxStroke}"/> <Setter Property="BorderThickness" Value="1"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RadioButton}"> <BulletDecorator Background="Transparent"> <BulletDecorator.Bullet> <DockPanel> <Microsoft_Windows_Themes:BulletChrome VerticalAlignment="Top" Margin="0,8,0,0" Height="{TemplateBinding FontSize}" Width="{TemplateBinding FontSize}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}" IsChecked="{TemplateBinding IsChecked}" IsRound="true" RenderMouseOver="{TemplateBinding IsMouseOver}" RenderPressed="{TemplateBinding IsPressed}" /> <ContentPresenter RecognizesAccessKey="True" VerticalAlignment="{TemplateBinding VerticalContentAlignment}"/> </DockPanel> </BulletDecorator.Bullet> </BulletDecorator> <ControlTemplate.Triggers> <Trigger Property="HasContent" Value="true"> <Setter Property="FocusVisualStyle" Value="{StaticResource CheckRadioFocusVisual}"/> <Setter Property="Padding" Value="4,0,0,0"/> </Trigger> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> </Window.Resources> <Grid x:Name="LayoutRoot"> <RadioButton GroupName="RadioButtonList" Style="{DynamicResource RadioButtonStyle1}"> <Label> <AccessText TextWrapping="Wrap" Text="_This is a very long radio button control line of text that should wrap." MaxWidth="300"/> </Label> </RadioButton> </Grid> </Window>
I hope this posts clarifies how to completely recreate a template style for a default control to modify something that at first doesn’t appear modifiable.
InfoWorld has the following article I thought was interesting:
7 programming languages on the rise
It mentions that the top three languages today are Java, C#, PHP.
Then it talks about the languages on the rise:
Note: No, that is not a mistake, they list 8 languages even though the title of the article says 7.
While they gloss over the Java, C#, and PHP languages, the article implies that these are the top languages used today.
What they missed in the article (besides being unable to count) is:
That development itself is on the rise. The lesser known languages are easier to learn any one language as every language now has serviceable documentation online, so we are limited to the languages that descent books were written about.
What I read from this article is:
If you really want job security stay with Java, C#, and PHP because they are the top three programming languages. Sure it is nice that others are on the rise. But who wants to limit themselves to 2% of the development jobs available.
I have recently started reading an e-book from PACKT Publishing.
With the internet and internet-based offering being renamed to “The Cloud” which is just a fancy buzz word marketing came up with that they don’t even themselves know what it means, understanding web services, which is mostly what “The Cloud” will be based on is going to be key in a developer’s job security.
Being able to provide a cloud offering without licensing costs because you are using free software such as Apache, is nice too.
Which brings me back to this book on Apache Axis2 Web Services.
I’ll let you know if it is well worth the read.
I am writing this post to you from a Motorola Xoom.
Typing is definitely harder than with a keyboard yet much easier than from a phone.
It didn’t work out of the box. Apps wouldn’t download, and Google talk wouldn’t connect. I finally factory reset it and started over and it worked. We think you have to log in during the initial configuration to avoid this issue, but we didn’t try to dupe it.
It is working great now.
I am using three things that are just not friends:
First off, Model-View-ViewModel is design centered around data binding. But PasswordBox.Password is not a DependencyProperty and therefore does not support binding. That is ok, a PasswordBoxAssistant
(alternately I have seen it named PasswordHelper
or PasswordBoxHelper
) as described originally here and also here fixes seems to fix this.
That is, it fixes it unless you are using the NavigationService.
See when the NavigationService navigates to another page, it somehow know that the current page has a PasswordBox and if it finds a PasswordBox, it blanks the password out. So since we are using PasswordBoxHelper to make MVVM and data binding work, the value is blanked in the ViewModel and Model as well.
For now, I happen to be using a custom button for navigation so I can simply do this in my ViewModel:
String tempPw = MyPassword; NavigationService.Navigate(NewPage); MyPassword = tempPw;
However, this is not the best solution. What if there were multiple links and different ways to navigate?
I think the best solution would be to figure out how to make PasswordBoxAssistant
handle this. But I am not sure how or if there is anyway to tell that the password was blanked by the NavigationService and to ignore binding in this instance.
Resource:
http://social.msdn.microsoft.com/Forums/en/wpf/thread/d91aec90-1476-41c0-a925-7661745094c5
I am working on a project at work that is a navigation application.
I wanted to use MVVM. I also wanted to document for others how I designed this, as there wasn’t much online about using MVVM with Navigation and Pages.
Here is my project. I will post an explanation of this project as soon as I can get to it, so look for it.
Project Download – Small: Navigation-Pages-MVVM.zip
Project Download – More complete: Navigation-Pages-MVVM 2.0
I was the 200th person to like the FreeBSD Foundation Facebook page.
The FreeBSD Foundation helps collect donations and fund projects to improve FreeBSD.
If you have the ability to contribute, you should. I realized I hadn’t contributed since last year, so I went ahead and donate a meager sum this year.
http://www.freebsdfoundation.org/donate
The FreeBSD needs a lot more than 200 people liking it and a lot more people donating.
I just go this email from Tivo.
This is a terrible email to get. Do I believe them that the passwords weren’t nabbed as well? No, I don’t. So I have to change every site that uses this same password.
How annoying!
|
|||||||||||||||||||||
© 2011 TiVo Inc. All rights reserved. TiVo and the TiVo logo are trademarks or registered trademarks of TiVo Inc. and its subsidiaries worldwide. All other trademarks are the property of their respective owners. TiVo Inc., 2160 Gold Street, Alviso, CA 95002-2160. Please feel free to review our Privacy Policy. You have received this email as an administrative communication to our customers and former customers. If you have opted-out from receiving promotional emails from TiVo Inc., you will not receive promotional emails from TiVo. If you would like to opt-out from receiving promotional emails from TiVo, Inc., you may opt-out at any time. |
If you are using Windows and you are using Internet Explorer 9, you are becoming a minority.
W3Schools has a browser statistics site that basically is made by tracking the browsers that hit it.
http://www.w3schools.com/browsers/browsers_stats.asp
It is probably not exactly accurate because most poeple who go to W3Schools are probably in some way technical and doing some type of development, most likely for the web. If there was a statistic built from the browsers that accessed the most popular pages on the web: Bing.com, MSN.com, Google.com, Yahoo.com, Youtube.com, Facebook.com, etc… then that would be accurate. But we make do with what we have.
This page shows that IE has a little over 1/4 the market share to start 2011, while it held over 1/3 the market share at the first of 2010.
2011 | Internet Explorer | Firefox | Chrome | Safari | Opera |
---|---|---|---|---|---|
February | 26.5 % | 42.4% | 24.1% | 4.1% | 2.5% |
January | 26.6 % | 42.8% | 23.8% | 4.0% | 2.5% |
2010 | Internet Explorer | Firefox | Chrome | Safari | Opera |
December | 27.5 % | 43.5% | 22.4% | 3.8% | 2.2% |
November | 28.6 % | 44.0% | 20.5% | 4.0% | 2.3% |
October | 29.7 % | 44.1% | 19.2% | 3.9% | 2.2% |
September | 31.1 % | 45.1% | 17.3% | 3.7% | 2.2% |
August | 30.7 % | 45.8% | 17.0% | 3.5% | 2.3% |
July | 30.4 % | 46.4% | 16.7% | 3.4% | 2.3% |
June | 31.0 % | 46.6% | 15.9% | 3.6% | 2.1% |
May | 32.2 % | 46.9% | 14.5% | 3.5% | 2.2% |
April | 33.4 % | 46.4% | 13.6% | 3.7% | 2.2% |
March | 34.9 % | 46.2% | 12.3% | 3.7% | 2.2% |
February | 35.3 % | 46.5% | 11.6% | 3.8% | 2.1% |
January | 36.2 % | 46.3% | 10.8% | 3.7% | 2.2% |
So why am I telling you this, in my review of Internet Explorer 9?
Because I am telling you to get ready for the percent of IE users to rise again with the release of IE9.
So far, I have the following positive feedback.
The negative feedback I have so far is simply one:
Right now I dual boot between FreeBSD and Windows 7. When I am booted to FreeBSD, I will use Firefox. Normally in Windows 7 I also use Firefox. Right now, I am not going to install Firefox in my new Windows 7 install in my dual boot scenario unless I start to dislike IE9.