At Part 1 I described a basic way to call and consume data from xml-rpc web services based on XML string operations.
This can be only the first approach. It's unhandy and not easy to maintain.
The next level for me would be to cast this into an object oriented data structure that could be easily maintained and customized for special needs.
At this post I try to show my object oriented approach to consume such services.
Thursday, April 8, 2010
Thursday, March 25, 2010
Permanent redirect with Apache Mod rewrite
Yesterday, I set up a permanent redirect for my personal site on baer-torsten.de to redirect all requests without leading www using Apache Mod rewrite and RewriteCondition and RewriteRule.
Here's my snippet that I'm using
Someone may ask why I should do that?
The simple answer: SEO
Search engines are crawling the web to indexing content of web pages. So if they discover links to www.example.com they are not seen as a reference to the same content reachable through example.com.
That's all.
Good german resource explains redirection: Automatische Weiterleitung
Here's my snippet that I'm using
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^/(.*)$ http://www\.%{HTTP_HOST}/$1 [R=301,L]
Someone may ask why I should do that?
The simple answer: SEO
Search engines are crawling the web to indexing content of web pages. So if they discover links to www.example.com they are not seen as a reference to the same content reachable through example.com.
That's all.
Good german resource explains redirection: Automatische Weiterleitung
Tags:
Apache,
Mod rewrite,
Redirect,
RewriteCondition,
RewriteRule
Friday, March 19, 2010
Consuming XML-RPC web services with C# - Part 1 - the rough way
While dealing with integration of Bugzilla as data provider within BugtraqPlugin (which I described here) I encountered that bugzilla has an XML-RPC interface. Not this bad, but
How to perform XML-RPC calls with c# and .NET?
It's a simple task to get access on soap web services because it provides a description of it's own interface through a wsdl definition, so you easily can generate proxy classes for such a case.
But whats about XML-RPC web services? Here is just a sample practiced on bugzilla web service.
Monday, February 15, 2010
Customizing Visual Studio code templates to fit your needs
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.
Here is a guide how do you extend this template.
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!
Subscribe to:
Posts (Atom)