Did you ever get rid of that the default template on project context menu > add > class misses you prefered regions, default method overrides, properties or constructors?
Here is a guide how do you extend this template.
Monday, February 15, 2010
Tuesday, February 9, 2010
Tortoise SVN Plugin for issue tracking system
In the field of software development it is enssential that source code is managed through a version control system. Without that, you loose an easy way to track changes and versions of your project.
(But discuss that is not the intention of this blog post, so skip comments about that.)
On the other hand, a version control system is not the right tool to manage project dependent things, feature requests and to track bugs. So professional teams use also a project management tools in combinition with bug tracking systems.
(To discuss the pro an cons of different systems is also not the intention of this post, so ...)
And now, one question:
What it will be, if you combine these applications and let them communicate in two ways?
(But discuss that is not the intention of this blog post, so skip comments about that.)
On the other hand, a version control system is not the right tool to manage project dependent things, feature requests and to track bugs. So professional teams use also a project management tools in combinition with bug tracking systems.
(To discuss the pro an cons of different systems is also not the intention of this post, so ...)
And now, one question:
What it will be, if you combine these applications and let them communicate in two ways?
Monday, February 8, 2010
Multi-Startpage with Firefox
Ever get rid that firefox doesn't open multiple pages on startup?
The settings dialog only offers to set the current page as startpage, not the opened tabs. But a a short research on the internet results, that is it possible to sett multiple startpages by manual.
So just enter the urls to the pages separated by pipes an you get multiple startpages with firefox.
German version on www.baer-torsten.de
The settings dialog only offers to set the current page as startpage, not the opened tabs. But a a short research on the internet results, that is it possible to sett multiple startpages by manual.
So just enter the urls to the pages separated by pipes an you get multiple startpages with firefox.
German version on www.baer-torsten.de
Wednesday, January 20, 2010
Two ways of disabling Ctrl-Alt-Delete on logon
Especially in domain environments users are forced to press Ctrl-Alt-Delete (German: Strg-Alt-Enf) to logon any machine by default.
Some like this feature, I not.
I have found two ways to disable this on Windows 7® and Vista®.
Not Requiring Ctrl-ALT-DEL at logon
Vista requiring ctrl-alt-del before login
The two ways are:
The Advanced User Accounts Control Panel is reachable via
The Local Security Policy is reachable via
Have fun.
Some like this feature, I not.
I have found two ways to disable this on Windows 7® and Vista®.
Not Requiring Ctrl-ALT-DEL at logon
Vista requiring ctrl-alt-del before login
The two ways are:
- Advanced User Accounts Control Panel (NETPLWIZ; %systemroot%\system32\netplWiz.exe)
- Local Security Policy
The Advanced User Accounts Control Panel is reachable via
- <Win> + <R> ⇒ type Netplwiz ⇒ hit <Enter>
- Start button or <Win> ⇒ press Run ⇒ type Netplwiz ⇒ hit <Enter>
- Start button or <Win> ⇒ press "Help and Support" ⇒ search for "Secure Login" or Ctrl-Alt-Del ⇒ usually the first result ⇒ hit "Click here to open Advanced User Accounts"
- Control Panel ⇒ User Accounts ⇒ User Accounts ⇒ Manage User Accounts ⇒ Advanced
[not reproduceable]
The Local Security Policy is reachable via
- Start or <Win> ⇒ Control Panel ⇒ System and Maintenance ⇒ Administrative Tools ⇒ Local Security Policy ⇒ Local Policies
- <Win> + <R> ⇒ Type gpedit.msc ⇒hit <Enter> ⇒ Local Computer Policy ⇒ Computer Configuration ⇒ Windows Settings ⇒ Security Settings ⇒ Local Policies
Have fun.
Thursday, December 10, 2009
Wednesday, December 9, 2009
Printing numeric values as HEX
I sometimes need to print integer numeric values as a hexadecimal string for better reading and everytime I have to search about it with google.
So here is a collection of printing values as hexadecimal string.
The simpliest way is to use the IFormattable interface:
Other ways with support of differend radix is to user Convert.ToString().
Radix could be 2, 8, 10, or 16.
From:
MSDN: Convert.ToString()
mikrocontroller.net
Are there any other ways? So let me know!
So here is a collection of printing values as hexadecimal string.
The simpliest way is to use the IFormattable interface:
1: String.Format("{0:X02}", int.MaxValue);
Other ways with support of differend radix is to user Convert.ToString().
Radix could be 2, 8, 10, or 16.
1: Convert.ToString(int.MaxValue, 2);
From:
MSDN: Convert.ToString()
mikrocontroller.net
Are there any other ways? So let me know!
Monday, December 7, 2009
Advanced Stringreplace
While handling string data it's often needed to replace or cut a partial string. String.Replace is such a simple method to replace values in C#.
But what about if you have to deal with patterns to replace or manipulate partial string?
Here you have to go beyond String.Replace and deal with regular expressions.
If you have't heared about Regular Expressions, I suggest to read this articles about it:
And now, time for some excamples.
Assume you have a string like
and have to replace the zeros after the slash.
Your regex could be the following
but take care about the zeros within the numbers. So you have to extend you regex like this:
If you run this expression over the sample data, the result looks like this:
Missing the prefix?
Extend the expressions with some named groups and use the matching values:
That's it!
But what about if you have to deal with patterns to replace or manipulate partial string?
Here you have to go beyond String.Replace and deal with regular expressions.
If you have't heared about Regular Expressions, I suggest to read this articles about it:
- Regular Expression article @ wikipedia (german: Regülärer Ausdruck)
- MSDN: Regex (german: Regex)
- The 30 Minute Regex Tutorial @ codeproject.com
And now, time for some excamples.
Assume you have a string like
1: string data = "52/00000012340056";
Your regex could be the following
1: Regex regex = new Regex(@"0+");
but take care about the zeros within the numbers. So you have to extend you regex like this:
1: Regex regex = new Regex(@"^\d+/0+");
If you run this expression over the sample data, the result looks like this:
1: string result = regex.Replace(data, String.Empty);
2: // result == "12340056";
Missing the prefix?
Extend the expressions with some named groups and use the matching values:
1: Regex regex = new Regex(@"^(?<prefix>\d+/)(0+)");
2: string result = regex.Replace(data, "${prefix}");
3: // result == "52/12340056";
That's it!
Thursday, November 19, 2009
Thursday, November 5, 2009
MetalScroll
Just got a hint from rschu@twitter / blogpost @ kodierer.blogspot.com about a MetalScroll extension for Visual Studio.
Here some features:
Check it out:
MetalScroll @ code.google.com
MetalScroll in der Visual Studio Gallery
Here some features:
- scrollbar extension (shows file structure with highlighted position of booksmarks and breakpoints)
- split editor into two panes
- highlighting all occurrences of a word within a file
Check it out:
MetalScroll @ code.google.com
MetalScroll in der Visual Studio Gallery
XML Validation
Next post in the line of XML processing hints with C#. This time we want to validate a xml file.
Assume a sample:
You've got an XML-File books.xml as follows:
And a xml schmema (books.xsd) like this:
Now there is more than one way to validate the xml file.
The first way I want to show is to load the whole xml file into a XmlDocument instance like.
Now we need the schema to validate against ...
Add this to the schemas of the XmlDocument to provide it for validation. Be carefull, that the schema is added for the namespace of the document nodes.
Now the document could be validated. (Just providing a lamda expression as ValidationEventHandler.)
There is only one handycap: Validation Warnings are not passed to the ValidationEventHandler.
The other way to validate a xml file is to use a XmlReader (or just one of it's derived classes). This is the favored way for large xml files.
First let us initialize such an reader. To use validation functionality of the reader we must pass in some XmlReaderSettings to configure that reader.
This is it, now you receive validation errors and warnings.
Assume a sample:
You've got an XML-File books.xml as follows:
1: <books xmlns="urn:books">
2: <book>
3: <author>It's just me</author>
4: <publisheddate>2009-09-25T09:06</publisheddate>
5: </book>
6: </books>
And a xml schmema (books.xsd) like this:
1: <?xml version="1.0" encoding="utf-8"?>
2: <xs:schema targetNamespace="urn:books" xmlns:xs="http://www.w3.org/2001/XMLSchema">
3: <xs:element name="books">
4: <xs:complexType>
5: <xs:sequence>
6: <xs:element name="book">
7: <xs:complexType>
8: <xs:sequence>
9: <xs:element name="author" type="xs:string" />
10: <xs:element name="publisheddate" type="xs:dateTime" />
11: </xs:sequence>
12: </xs:complexType>
13: </xs:element>
14: </xs:sequence>
15: </xs:complexType>
16: </xs:element>
17: </xs:schema>
Now there is more than one way to validate the xml file.
The first way I want to show is to load the whole xml file into a XmlDocument instance like.
1: // load xml
2: XmlDocument xmlDoc = new XmlDocument();
3: xmlDoc.Load("books.xml");
Now we need the schema to validate against ...
1: // load schema XmlSchema schema; using(XmlReader schemaReader = XmlReader.Create("books.xsd")) schema = XmlSchema.Read(schemaReader, (p, q) => if(q.Exception != null) throw q.Exception);
Add this to the schemas of the XmlDocument to provide it for validation. Be carefull, that the schema is added for the namespace of the document nodes.
1: // add schema xmlDoc.Schemas.Add(xmlDoc.DocumentElement.NamespaceUri, schema);
Now the document could be validated. (Just providing a lamda expression as ValidationEventHandler.)
1: // validate document
2: xmlDoc.Validate((p, q) => if(q.Exception != null) throw q.Exception);
There is only one handycap: Validation Warnings are not passed to the ValidationEventHandler.
The other way to validate a xml file is to use a XmlReader (or just one of it's derived classes). This is the favored way for large xml files.
First let us initialize such an reader. To use validation functionality of the reader we must pass in some XmlReaderSettings to configure that reader.
1: // loading schema
2: XmlSchemaSet schemaSet = new XmlSchemaSet();
3: schemaSet.Add("urn:books", "books.xsd");
4: XmlReaderSettings settings = new XmlReaderSettings();
5: settings.ValidationType = ValidationType.Schema;
6: settings.ValidationFlags |= XmlSchemaValidationFlags.ReportValidationWarnings;
7: settings.Schemas = schemaSet;
8: settings.ValidationEventHandler += (p, q) =>
9: {
10: if (args.Severity==XmlSeverityType.Warning)
11: Console.WriteLine("Warning: Matching schema not found. No validation occurred." + args.Message);
12: else if(q.Exception != null)
13: throw q.Exception;
14: else
15: Console.WriteLine("\tValidation error: " + args.Message);
16: };
17: // create reader
18: using(XmlReader reader = XmlReader.Create("books.xml", settings))
19: {
20: // validate
21: while(reader.Read());
22: }
This is it, now you receive validation errors and warnings.
Subscribe to:
Posts (Atom)

