Wednesday 30 January 2013

WPF / MVVM Resource Collection

Open Source Applications Using WPF:

- Kaxaml (http://kaxaml.codeplex.com/)
- FamilyShow (http://familyshow.codeplex.com/)
- BabySmash (http://babysmash.codeplex.com/)
- Microsoft Ribbon for WPF October 2010 (http://www.microsoft.com/en-us/download/details.aspx?id=11877)
- Crack.NET (http://cracknetproject.codeplex.com/)
- Prism (http://compositewpf.codeplex.com/)
- Snoop (http://snoopwpf.codeplex.com/)
- BBQShack (http://karlshifflett.wordpress.com/2010/02/07/bbq-shack-ocean-v2-for-visual-studio-2008/)
- Tasks.Show (http://windowsteamblog.com/windows/b/developers/archive/2011/02/24/tasks-show-a-windows-7-developers-resource.aspx)

Links:


1> WPF Apps With The Model-View-ViewModel Design Pattern – Josh Smith
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
Code at: http://archive.msdn.microsoft.com/mag200902MVVM

2> In the box with VS 2010
http://visualstudiogallery.msdn.microsoft.com/3ab5f02f-0c54-453c-b437-8e8d57eb9942/

3> Exploring a Model-View-ViewModel Application; WPF Password Manager, Cipher Text
- By Karl Shifflett
http://www.codeproject.com/Articles/32101/Exploring-a-Model-View-ViewModel-Application-WPF-P

4> WPF Business Application Series Part 1 of n - Application Structure, Skinning, and Custom ToolBar Button Control
http://www.codeproject.com/Articles/23524/WPF-Business-Application-Series-Part-1-of-n-Applic

5> Localizing a WPF application
http://www.codeproject.com/Articles/31837/Creating-an-Internationalized-Wizard-in-WPF

6> Task Library
http://www.codeproject.com/Articles/152765/Task-Parallel-Library-1-of-n

7> WPF - Beginner's guide
http://www.codeproject.com/Articles/22980/WPF-A-Beginner-s-Guide-Part-1-of-n

8> Threading with WPF
http://www.codeproject.com/Articles/49659/WPF-A-Most-Useful-Threading-Component

9> Essential Facebook Programming: Building a Windows Client in WPF (MSDN Jan 2013)
http://msdn.microsoft.com/en-us/magazine/jj883950.aspx

Videos:

- Jason Dolinger’s video on MVVM:
  http://blog.lab49.com/archives/2650
  http://www.lab49.com/wp-content/uploads/2011/12/Jason_Dolinger_MVVM.wmv

- The Full-Stack
  http://channel9.msdn.com/Series/The-Full-Stack/The-Full-Stack-Part-14-Taking-a-look-at-MVVM-with-John-Papa
  http://channel9.msdn.com/Series/The-Full-Stack/The-Full-Stack-Part-15-Starting-a-Pomodoro-application-with-MVVM
  http://channel9.msdn.com/Series/The-Full-Stack/The-Full-Stack-Part-16-More-MVVM-Fun-With-Some-More-Complex-Binding-Scenarios

Tuesday 15 January 2013

PowerShell: Files and Directories

Many times we feel the need to get the list of files in a directory with all the file details. A picture (screenshot) is worth a thousand words (pixels) but at times it is not the best thing.

(1) Get the file list

Command: cd “C:\Program Files\Adobe\Reader 10.0\Reader”
Command: DIR

image 
This will give us the list, nothing unusual.

(2) Send the list to a text file

Command: DIR > C:\FileList.txt

The file “FileList.txt” will contain the same text that was shown on console

(3) Get only the files or only directory list

The list contains both the directories and files, how do we get only the files? (we can’t do this in a explorer)

Command: PS C:\Program Files\Adobe\Reader 10.0\Reader> dir | where{$_.Attributes -ne "Directory"}

image 
The output of DIR is sent to where{}, the “$_” is the current item, Attributes is a property, “-ne” means “not equal to”. Each item in the output of DIR is checked for having the “Directory” attribute. Fantastic!

To get only the directories – we change “-ne” to ‘-eq”
Command: PS C:\Program Files\Adobe\Reader 10.0\Reader> dir | where{$_.Attributes -eq "Directory"}

(4) Sort by size

So now we have “file only” list, let’s sort by size. This would be useful in next step.
Command: PS C:\Program Files\Adobe\Reader 10.0\Reader> dir | where {$_.Attributes -ne "Directory"} | sort-object Length

”Length” is a column in the output, which is also a property in each item.

 image

(5) Get only top 5

Command: PS C:\Program Files\Adobe\Reader 10.0\Reader> dir | where {$_.Attributes -ne "Directory"} | sort-object Length | select-object -first 5

(6) Get only the name of file

There is an extra Mode column in the output, let’s get only the Name and Length.

Command: PS C:\Program Files\Adobe\Reader 10.0\Reader> dir | where {$_.Attributes -ne "Directory"} | sort-object Length | select-object -first 10 | select-Object Name, Length

image 

(7) Save the list as .CSV file

It would be interesting to store the output as CSV file to open it in Excel.

Command: PS C:\Program Files\Adobe\Reader 10.0\Reader> dir | where {$_.Attributes -ne "Directory"} | sort-object Length | select-object -first 10 | select-Object Name, Length | Export-csv c:\filelist.csv

Monday 14 January 2013

Windows PowerShell - Get new GUID

Recently I took a brief tour of PowerShell, it’s the Microsoft’s task automation framework. It would suit you more if you consider your keyboard as your friend :). At the moment, I do not know whether I think it is useful or not. I think the more I get to know the various commands, the more I will use and appreciate it.

I am writing this post, so that I can record the PowerShell commands that I begin to use. Here’s is the first one:

Get a new GUID: Currently I use Visual Studio 2005 to get a new GUID value. Now opening up VS just to do that is really an overkill.
In PowerShell we can get it by:

image
[guid] is a type adapter (you can say alias) to the full class name – System.Guid. NewGuid() is a static method on that class.

If we don’t remember the adapter but if we do know the full class name, we can use –> $guid = [System.Guid]::NewGuid()

Shorts - week 3, 2022

Post with links to what I am reading: 1. A very good post on different aspects of system architecture: https://lethain.com/introduction-to-a...