I am a big fan of little check-ins as often as possible during the day, instead of 1 big check-in at the end of the day.
Sometimes it works, sometimes not
This is not good!
If something in your software is dependent from the combination of
- current weather in London (weather there changes very often, and you and your system actually sits in Sydney)
- the mood of your girlfriend (or wife) this morning and
- amount of nuts in your muesli in your breakfast bowl
you have a big problem
I can’t run tests anymore with MsTest
“Sometimes I can”
... and I am not sure if this is the fault of the latest TFS KB Update... Since we moved to TFS2010 we had to install this KB to work with VS2008 an TFS2010
When I try to run my tests I get this error
Same problem as Gabriel had described in his post about Error: "Exception has been thrown by the target of an invocation."
His solution: none. Over time it was fine :-)
To reproduce this I can easily do
- Start VS2008
- Go to “Test” | “Windows” | “Test Results”
- Error message!
I had a couple of things installed like: Resharper, Testdriven.Net, Coderush, … and was not sure what it is…
The last thing I installed was the KB article about using VS2008 with TFS2010.
What I did and didn’t help:
- Start up Visual Studio in safe mode (parameter /SafeMode )
- Start up Visual Studio and reset user data (parameter /resetuserdata )
---------------------------------
Note: I hate to do a /resetuserdata because it looses all my “nice” settings like:
- Removing animations and speedup start of VS
- Changing F1 keyboard key to do NOTHING (That’s a big one!) ( -> Tools -> Options –> Environment –> Keyboard –> F1 “Remove” )
- Track Active Item in Solution Explorer ( -> Tools -> Options -> Projects and Solutions )
More of this settings can be found on stackoverflow Visual Studio optimizations
---------------------------------
After all that, I attached another VS to the other one running with “Debug” –> “Attach to process” and enabling all exceptions in “Debug” –> “Exceptions”
---------------------------------
Note: I saw a lot of Resharper exceptions once I start to open a solution and browsing through files…
exceptions in VSActionManager.cs, VSProjectInfo.cs, VSSolutionManager.cs, …
---------------------------------
BUT NO EXCEPTION when I tried to reproduce the problem!
Figure: The top VS2008 is attached to the lower one (that reproduces the error).
Fix: None so far
but I was able to run the tests (and to see my “Test results” window) sometimes.
I think it must be a weird combination of “devenv /safemode”, “Open solution”, “Build”, “Clean”, “Rebuild”, “Cross fingers”, “Run all tests”… Or maybe the other combination mentioned at the top of the post.
Didn’t figure it out yet
Will update this post once I know!
How to create a Karaoke machine in Silverlight
(Scroll to the bottom for the nice UI)
Figure: Karaoke machine UI done by a Developer :-)
Goal
- We have 2 textboxes for artist and title
- On click of “Start fun” button we call a web service to get the lyrics of the requested song
- After that we scroll the lyrics in the textbox below
See how easy that is, with Silverlight!!!
System overview
Figure: Silverlight application calls the local web server, which calls the Lyrics web server
It’s that complicated, because cross domain access is blocked in Silverlight and the Lyrics web service doesn’t have a clientaccesspolicy.xml file
Prerequisites
“Silverlight SDK Toolkit”
Download “Silverlight SDK Toolkit” from MSDNhttp://www.microsoft.com/downloads/details.aspx?FamilyId=c22d6a7b-546f-4407-8ef6-d60c8ee221ed&displaylang=en
Create a new Silverlight Application project
Figure: Create a Silverlight project
Figure: Yes, Add a ASP.NET web project
Create a reference to the external Lyrics web service
- Right click on “SilverlightApplication.Web”
- Click on “Add Web Reference”
- Use this URL to reference the web service
http://lyricwiki.org/server.php?wsdl - Click on Add Reference to finish
Create the web service proxy that calls the external Lyrics web service
- Right click on “SilverlightApplication.Web”
- Add New item
- Choose “Web Service”
- Name it “LyricService”
- Enter a new method called GetSong
[WebMethod]
public org.lyricwiki.LyricsResult GetSong(string artist, string title)
{
org.lyricwiki.LyricWiki lyricWiki = new org.lyricwiki.LyricWiki();
return lyricWiki.getSong(artist, title);
}
Build your solution!
Create a reference to the web application proxy service
Create the layout (page.xaml)
<UserControl x:Class="SilverlightApplication.Page"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" Height="300">
<StackPanel>
<TextBlock Text="Artist"></TextBlock>
<TextBox x:Name="textBoxArtist" Width="200" Margin="5" Height="50"></TextBox>
<TextBlock x:Name="Artist" Text="Title"></TextBlock>
<TextBox x:Name="textBoxTitle" Width="200" Margin="5" Height="50"></TextBox>
<Button x:Name="buttonStart" Content="Start fun!" Margin="10" Width="100" Height="50" Click="buttonStart_Click"></Button>
<TextBlock x:Name="textBlockResult" FontSize="20" Text="nothing so far" Margin="10" Height="30" Width="700"></TextBlock>
</StackPanel>
</UserControl>
Figure: XAML for the ugly Karaoke player
Code! Finally :-)
Use a timer to tick every 100 milliseconds and scroll through the lyrics
DispatcherTimer timer = new DispatcherTimer(); timer.Interval = new TimeSpan(0, 0, 0, 0, 100); timer.Tick += new EventHandler(timer_Tick);
On each timer tick, we scroll the text
private void ScrollText()
{
// Scroll 1 caret to the left, I know thats not nice :-) but easy!
textBlockResult.Text = textBlockResult.Text.Substring(1) + textBlockResult.Text.Substring(0, 1);
}
Create the event handler on song completed call
//No code, tooo easy
Create the timer and start it after song completed call
//No code, tooo easy
Remember: Everything is async in Silverlight
Advanced Tasks
1. Add a slider for the speed of the text
Figure: Slider for adjusting the speed of the text scrolling
2. Make your Silverlight application look pretty
3. Make the text show only 1 line full, the other lines with low opacity
Google for: Silverlight Opacity
4. Scroll the text line by line (instead by characters)
Search for the first Newline in the text and split the text there
5. Make the application go in full screen after start
Have a look at http://www.silverlightshow.net/tips/Tip-How-to-enter-full-screen-mode.aspx
6. If no title entered, let the user choose from a list of songs by the artist
7. Make the song scroll like Star wars
See http://franksworld.com/blog/archive/2009/05/01/11451.aspx
8. Embed a youtube video next to the text of that song
See http://code.google.com/apis/youtube/overview.html for details on calling the youtube webservice
Labels: how to, silverlight, Vs2008
Fresh Install Visual Studio - Do this - Link Tip
"Pimp My IDE": 101 Visual Studio tips, tricks, and add-ins
my top 3 on new Visual Studio Install
- Change startup options, FAST performance is needed
- Arrange toolboxes, windows, ...
- Download and Install Addins:
- GhostDoc
- Resource Refactoring Tool
Resex - SmartPaster (when its working...)
Dont forget to print the "Visual Studio 2008 Keyboard Shortcuts Reference"
Data driven unit tests with Text Files!!
i wanted to do unit tests with a text file as input
1 line contains: entity serialized as string, entityName and other parameter
e.g.
1|12|123123,123123,143123|54| Riga1_GPS true
line is delimited by tab
#1
create file in your test project
righevalid.txt
File Properties: --> Copy to Output Directory --> copy always
#2
create file in your test project
schema.ini
File Properties: --> Copy to Output Directory --> copy always
#3
content of schema.ini
[righevalid.txt] Format=TabDelimited
#4
create testmethod
#5
add following attributes to testmethod
[TestMethod()] [DeploymentItem(@"righevalid.txt")] [DeploymentItem(@"schema.ini")] [DataSource("System.Data.OleDb", @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.;Extended Properties='text;FMT=TabDelimited;HDR=YES'", @"righevalid.txt", DataAccessMethod.Sequential)] public void LoadValidRigaTest() { } Note DeploymentItem copies files to Test Run Directory
DataSource is a special OleDb Usage with txt Files
#6
use TestContext.DataRow[index] to access your single columns (line) of the text file
TestContext.DataRow[0] = col1 and so on
#7
Run Test
#8
see output Passed or Failed
Doubleclick Result you can see the result of the single lines!
GREAT!
Labels: .NET, unit tests, Vs2005, Vs2008
Roaming User Config File - IMPORTANT on Terminal Server
Problem: On Terminal Server all User Settings for a Winforms Application get lost on logout (logoff) The Settings are written to:
\Documents and Settings\"username"\Local Settings\Application Data\...but this folder is not saved in the Active Directory like the folder:
\Documents and Settings\"username"\Application Data\...But in the Settings Designer we can change a flag IsRoaming that says where the .net Configuration System should save the settings! (click picture)
Labels: deployment, Vs2008

