Jul 5 2009

Converting from SVG to XAML

Category: WPF | Softwarefossmo @ 19:22

To night I spent hours trying to convert from a SVG file to XAML. The reason for wanting to do the converting, is that I want a vector based image in a WPF application I’m currently developing. Using a vector based image will scale much better than using a bitmap image.

imageThe solution

I first downloaded a vector based image from this url: http://iconeden.com/icon/free/get/milky-a-free-vector-iconset
Inside the zip file you will find a SVG file. You can open this file using Adobe Illustrator, but I prefer using free alternatives, so I downloaded Inkscape. Inkscape is a open source vector graphics editor. I opened the file, and it contained several images. I wanted one of them; a clock. I copied and pasted the image into a new instance of Inkscape. If you choose Save as from the file menu in Inkscape, you will notice that I gives you the option to save as XAML. I tried doing that without success. It turned out that the XAML produced by Inkscape is not valid when opening it in Expression Blend or Visual Studio. So I saved the file as Clock.svg

On Codeplex there’s a project called XamlTune. I downloaded it and used the command prompt tool called svg2xaml.exe found in the package. The output from this small application were a XAML file called Clock.xaml. I opened this file in Visual Studio and guess what? It worked. The image were converted from SVG to XAML without any errors.

If you need to convert from SVG to XAML, I recommend that you look at this tool. I have only used it a few time, but it looks good so fare.

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Apr 13 2009

Ten steps on how to store Git repositories in Live Mesh!

Category: Software | source controlfossmo @ 17:30

I probably don’t need to tell you that you shouldn’t code without having a source control system. In some of my later projects I have used Git to handle my source control. What is great about Git is that it’s a distributed version control system, but it’s also a centralized version control system.

You can use github.com or another service to host your git repositories, but you only get 300 MB if you choose the free account. If you want more space, you have to pay for it. If you are like me you probably have more than 300 MB of source code. So, what are your choices if you don’t want to pay for hosting?

One solution can be to to use Live Mesh to host your repositories. It gives you over 5 GB of space and it’s completely free. If this sounds cool, keep reading on.

I have created 10 steps on how to use Live Mesh as a centralized repository for Git:

1)
First I download Git for Windows from Google Code. The URL is http://code.google.com/p/msysgit/
The version I’m running is Git 1.6.2.2

2)
Then I install the software. I use the default settings (next, next, next)

3)
The next step is to create a Live Mesh account (you can, of course, use your old account).  The URL is http://www.mesh.com
I follow the steps on the webpage and finally install the software.  image

 

4)
Then I create a folder called Git on my Live Desktop.

image 

And the folder shows up on my local desktop.

image

5)
Then it’s time to create a local repository. My project is called Time Tracker. I navigate to the folder I want to add to Git and right-click on the folder and chooses Git GUI Here. A dialog pops up and I choose Create New Repository

 image

Git GUI shows up on the screen.

image

As you can see from the screenshot, files I don’t want in my repository are shown (like files generated by ReSharper). I need to remove them and this is what I will do in the next step of this guide.

6)
In the folder where I keep my code, a directory called .git shows up. I navigate into that folder and further into the info folder. Then I open the file called exclude in my favorite text editor.
In this file I can add files and folders I don’t want in my repository. The file looks like this:

image

7)
Then it’s time to add the project to my local git repository. This time I’m going to use the command prompt. I right-click on the Time Tracker project folder and choose ‘Git Bash Here’ and write: ‘git add .’.

The explanation of this command, cut from the help file, is:

“This command adds the current content of new or modified files to the index, thus staging that content for inclusion in the next commit.”

8)
The next step is to commit the files to the repository. That is done like this: ‘git commit –m “The first commit” ’
Ok, so now I have the files in my local repository. It’s time to add them to Live Mesh.

9)
At the command prompt I write git clone --bare . C:/Users/<user>/Desktop/Git/TimeTracker (I’m using Windows Vista).
The –bare keyword I use in the clone command means that I want to create a directory that contains the contents of the .git directory and not the actual workspace.

10)
Now I can work on my local repository and when I want to update the repository in Live Mesh I can simply use this command:
git push C:/Users/<user>/Desktop/Git/TimeTracker master

Changes done in the local repository are now reflected to Live Mesh and I can work on the project on an other computer (as long as Live Mesh and Git are installed) or share the mesh folder with other project members.

Hope you enjoyed this walkthrough of how to use Git with Live Mesh!

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Dec 2 2008

My tool belt

image

Earlier this fall I was tagged by Gøran Hansen. He wondered what tools I use besides Visual Studio. Here is my response to his post:

Addins:

- ReShaper (How can you program without this one?)
- Testdriven.NET (Great addin, but I don't use it much because of ReSharpers possibilities to run unit tests.)
- GhostDoc

Developer tool belt:
- NUnit (I know there are many frameworks out there, but this is a safe one that "everything" supports)
- Moq (mocking framework --> If you haven't looked at this framework, you should!)
- Tortoise SVN (code repository)
- Git (local code repository. I normally use this as a "shelf" for SVN.)
- CruiseControl.NET
- Team City (I really like this one. I don't like XML hacking :-) )
- MSBuild
- Nant
- RhinoMocks (Great framework, but maybe not so intuitive?)

Well, there's my list.
Do you have suggestions to tools I should look into?

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Sep 29 2008

This is the way I version most projects

I understand that Microsoft uses this template when versioning their products: Major.Minor.Build.Revision. Major is changed when the "developers" want to show that there is a big change in the software and backward compatibility cannot be assumed. Maybe a major rewrite of the code is done. Minor number represents a significant enhancement with the intention of backward compatibility. Build number is a small change, for example a recompilation of the same source. Revision is used to fix a security hole and should be fully interchangeable. Both Build and Revision are optional. This information is based on MSDN Version Class.

The way I version most projects is the same way that Microsoft does, but I increase the Build and Revision each time I build the project. The build number is created this way: MMdd. MM is number of months since the project started and dd is the rest in days. A project started yesterday (25.09.2008) will have this build number to day: 0001. Revision is created this way: HHmm. HH is the hour of the day, and mm is the minute of the hour. It will for example show like this: 1302.
Major and Minor is used much the same as Microsoft suggests. A beta product will have a zero as the Major number.
I often use MSBuild as the build scripting language and I have created a MSBuild task for increasing the build number and revision. It can be downloaded from the link below.

To use it you have to add these lines to your MSBuild file:

<UsingTask TaskName="TFTasks.TFBuildNumber" 
    AssemblyFile="$(MSBuildStartupDirectory)\tools\treefrog.tasks\TFTasks.dll"/>
<UsingTask TaskName="TFTasks.TFRevisionNumber" 
    AssemblyFile="$(MSBuildStartupDirectory)\tools\treefrog.tasks\TFTasks.dll"/> 


And use the task by doing something like this:

<TFBuildNumber StartDate="09.09.08">
  <Output TaskParameter="BuildNum" PropertyName="buildNumber"/>
</TFBuildNumber>
<TFRevisionNumber>
  <Output TaskParameter="RevisionNum" PropertyName="revisionNumber"/>
</TFRevisionNumber> 


You can then update your AssemblyInfo file by doing something like this:

<Target Name="SetVersionInfo" DependsOnTargets="SetTimeStamp" >
  <Attrib Files="@(AssemblyInfoFiles)" Normal="true" />
  <FileUpdate Files="@(AssemblyInfoFiles)"
     Regex="AssemblyFileVersion\(&quot;.*&quot;\)\]"
     ReplacementText="AssemblyFileVersion(&quot;
     $(Major).$(Minor).$(buildNumber).$(revisionNumber)&quot;)]" />
</Target> 

To get this running, you also need to use the MSBuild Community Tasks. It can be downloaded from tigris.

I posted a question on StackOverflow and asked how people version their projects.
The answers can be found here.

How do you version your projects?

 

TFTasks-1.0.0927.0.zip (2.48 kb)

Tags: ,

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Sep 22 2008

TeamCity 3.1 tip

Category: Software | Testing | Continuous Integrationfossmo @ 17:42

I have used Cruise Control from ThoughtWorks at my CI server for a long time. CC.NET is a very good tool, but you have to spend a lot of time messing around with XML and tasks. It's time consuming. I have heard a lot of positive things about TeamCity from Jetbrains, so I figured that I wanted to try it. And, yes Jetbrains is the same company that makes ReSharper. A wonderful tool. I started out installing TeamCity on my server, and everything went like a breeze. I had my test project up and running within 10 minutes. Very easy configuration due to the web GUI. All good, BUT MY TESTS DID NOT RUN! I searched the Internet and could not find a good answer to why the tests did not run. I finally started to look at my build file, and it turns out that I imported my MSBuild community tasks this way:

image

This makes TeamCity very sad, and it won't display the test results. What TeamCity accepts is this:

image

So, the tip is: stay away from importing your tasks by using <UsingTask> tag, and rather use <Import>.

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Sep 10 2008

Running partcover in your MSbuild script

Category: C# | Software | Testingfossmo @ 16:53

Ncover is no longer free, and if you want to use code coverage in your build scripts, without paying for it, you need to find another solutions. In my case, this solution is partcover. It works pretty much like Ncover do (did) and you can include it in your MSbuild scripts to cover unit tests. Partcover uses some COM stuff and needs to be registered (you can of course install the msi on every computer you run partcover on and the problem is solved). I prefer that all the tools I use together with my build scripts, work without me installing anything. Adding the target shown below to your MSbuild script will make it possible to use partcover without installing it.

image

What it does is to register the PartCover.CorDriver.dll before partcover is run, and unregister it after partcover is run.

To run this script you need to run under administrator privileges.

Tags:

Currently rated 4.3 by 3 people

  • Currently 4.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Aug 28 2008

Speed reading

Category: Softwarefossmo @ 16:55

At Lifehacker there is a post about speed reading applications. I created a application for the same purpose for about a year ago.

image

If you want to try it out, download it from the link below. I find the application useful when I need to read a blog post or article fast.
You need Microsoft .NET 3.5 framework to run the application.
To read text, highlight it and then copy it to the clipboard and press Windows + ArrowDown.

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Mar 6 2008

Test new software in a virtual layer

Category: Softwarefossmo @ 12:41

Would it not be nice if you could install and test software without worrying about your computer getting cluttered up with dodgy registry settings and information stored at places you don't want information to get stored? These last months I have tested a virtualization layer called Altiris SVS. What it does, is to let you install software in a "sandbox" at your computer. You can turn the layer on and off as you please. All information written by the software installed in the "sandbox", can be removed. You can share a layer with a friend or co-worker. I find it quite handy when testing beta software.

altiris

Altiris SVS is free for personal use. You can download it from this site: http://juice.altiris.com/node/86

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Feb 20 2008

The Immediate Window in Visual Studio 2008 can save you some time!

Category: C# | Softwarefossmo @ 16:59

As you probably know, you can use the Visual Studio Immediate window to execute a method while your application is running, but you also can execute a method while the application is not running. Lately I have used this functionality to execute methods I'm working on without running the project. Like, for instance, in the figure below I didn't remember the syntax to format a date. So I wrote a test method and fired up the Immediate Window (Control-Alt+I or from the menu: Debug->Windows->Immediate) and entered Model.Tasks.testDate() (Model is the namespace, Task is the class and testDate is the method). The method was executed, and I got confirmed that my syntax was correct. This way I saved a lot of time. I didn't need to wait for VS.NET to compile the code, and execute the project.

 

immediate

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Dec 26 2007

Launchy 2.0 released

Category: Softwarefossmo @ 19:15

"Launchy is a free windows utility designed to help you forget about your start menu, the icons on your desktop, and even your file manager." Source: www.launchy.net

I have used Launchy every day the passed year. I love it. Recently it was released in version 2.0. Totally rewritten with a improved graphical user interface. You can use it to quickly launch applications, URLs, searchengines, etc. Check it out at www.launchy.net.

launchy

Tags:

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5