WPF / MVVM, RadioButton, binding enum and manipulating IsEnabled of Control.

A usefull snippet to create a RadioButton that manipulates a binded value in the ViewModel, and than manipulates Objects in the Control.

<UserControl.Resources>
	<ResourceDictionary>
		<geoTaskEditor:EnumConvertor x:Key="ConvertEnum" />
	</ResourceDictionary>
</UserControl.Resources>

<StackPanel>
	<StackPanel>
		<Label Content="@Target type:"/>
		<RadioButton GroupName="TargetType" Content="Target 1" IsChecked="{Binding TargetType, Converter={StaticResource ConvertEnum}, ConverterParameter={x:Static anyNamespace:TargetsTypes.Target1}, Mode=TwoWay}" />
		<RadioButton GroupName="TargetType" Content="Target 2" IsChecked="{Binding TargetType, Converter={StaticResource ConvertEnum}, ConverterParameter={x:Static anyNamespace:TargetsTypes.Target2}, Mode=TwoWay}"/>
	</StackPanel>
	
	<ContentControl Content="{Binding TargetA}" IsEnabled="{Binding TargetType, Converter={StaticResource ConvertEnum}, ConverterParameter={x:Static anyNamespace:TargetsTypes.Target1}}" />
	<myNamespace:MyView Content="{Binding TargetB}" IsEnabled="{Binding TargetType, Converter={StaticResource ConvertEnum}, ConverterParameter={x:Static anyNamespace:TargetsTypes.Target2}}" />
</StackPanel>
    public class EnumConvertor : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value.Equals(parameter);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return value.Equals(true) ? parameter : Binding.DoNothing;
        }
    }

SQL Server Data Tools

Abstract

If you need a comparison tool, you can use ‘SQL server data tools’ for the job.

Here are screenshots I found self explaining..

Tested Version

Current version I’m using is

My Visual Studio version Available SSDT Versions SQL Platform Support
Visual Studio 2012 SSDT July 2015 RTM in Visual Studio SQL Server 2005 – SQL Server 2014
Azure SQL Database

Screenshots

Comparing files

ServerExplorer

Compare-1

NewDataComparison

SqlDataCompare

Additional useful tools

Filters

Resources

Download Latest SQL Server Data Tools.

Announcing SQL Server Data Tools – June 2013

CR already pushed branch using git

Abstract

If you need to CR a branch that is already pushed in the past to the target branch, below are the steps to achieve it with easy.

 

Getting the wanted SHA’s for review

  • git checkout target_branch
    • this is the branch that the dev_branch was pushed to.
    • e.g. feature1
  • gitk
    • copy all the dev_branch related SHA commits (let’s call it dev_sha_collection)
    • copy SHA before first commit (let’s call it dev_pre_sha)

 

Cherry picking the commits for comparison

  • git checkout dev_pre_sha
  • git checkout -b my_branch_cr
    • name my_branch_cr as you like
    • will create a branch for CR just before the first commit was introduced.

For each <sha> in dev_sha_collection:

  • git cherry-pick <sha>

e.g.

git cherry-pick 83675a6da5f764c84515e577d8ac0c1543876764

git cherry-pick 561087e8dbe8044b6cfbb50e6c4fffc8a3b16053

git cherry-pick 79f240130f4c3e4198521b91ee26fd5d914918fa

 

Comparing the commit to the base

  • git checkout dev_pre_sha
    • Base of the commits – before starting the development of the branch.
  • git merge –no-commit –no-ff my_branch_cr
  • git difftool -d HEAD

HOWTO: Git cherry-pick with examples

 

Cherry picking

To cherry-pick commits from <branch_source> to <branch_target>:

  • git checkout branch_source
  • gitk
    • Copy the SHAs
      of the wanted commits (notepad++, …)

 

  • git checkout branch_target

Repeat for each SHA in SHAs:

  • git cherry-pick <SHA>

 

Example output

ShloEmi@ShloEmi-PC ~/work/workspace/ws-5 (site_version2)

$ git cherry-pick XXXX5e3713cc19d96fc50211bc8d7e0b564XXXX

[site_version2 9bf8031] refactoring

3 files changed, 5 insertions(+), 1 deletion(-)

 
 

ShloEmi@ShloEmi-PC ~/work/workspace/ws-5 (site_version2)

$ git cherry-pick XXXXa2dbcc21284a5abed2fab37e864b7357XXXX

[site_version2 4ad932e] logs fixed…

2 files changed, 3 insertions(+), 2 deletions(-)

 

Sources

http://git-scm.com/docs/gitk

GUIDE: Installing Python IDE using Eclipse

Abstract

Python development has many IDEs.

I found that Eclipse has many advantages over the others, like:

  • Debugger
  • Help
  • Auto complete
  • Unit-testing

Known alternatives

You can use your favorite editor (Notepad++, …), IPython, Python Notebook …

Installation Instruction

pydev+eclipse

Full instructions can be found here – http://pydev.org/download.html

Here are my notes / full instructions:

  1. Eclipse
    1. Get eclipse
      1. Go-to http://download.eclipse.org/eclipse/downloads/
      2. Find ‘Latest Release’, select the wanted build.
      3. Find ‘Platform Runtime Binary’, select the wanted platform (e.g. Windows (Supported Versions), (http) , 61 MB, eclipse-platform-4.3.2-win32.zip
    2. Extract
      1. Extract to the wanted folder (e.g. c:eclipse).
    3. Update eclipse…
  2. Java
    1. Download the appropriate java version (e.g. Java 7) and install …
  3. Python
    1. Download and install python
  4. PyDev extension for eclipse
  5. Configure eclipse for PyDev
    1. Basically, follow the instructions at http://pydev.org/manual_101_root.html

Resources

  1. http://www.rose-hulman.edu/class/csse/resources/Eclipse/eclipse-python-configuration.htm

 

2013 year in blogging

Hadasi

This year, 2013, was a year of massive blogging.

I’ve learned that some posts can bring you a lot of traffic, and some little.

Like any market – supply and demand. Seems that sometimes you write a post and don’t expect it to be a leading post.

This year we had a new baby girl to our family, so posting in the last quarter of the year was harder.

Next year, I intend to post at least twice a week and since I’m part of a start-up developing a server, I guess most of the post will surround that area (mostly threading??).

Happy 2014 to everyone.

Annual report

Your 2013 year in blogging.