Monthly Archives: June 2011


Find node in XML with NameSpace

Beginers C# parse XML manually :)
Using XPath is more efficiently, like this:

XmlDocument xmlDoc = new XmlDocument();

XmlNamespaceManager nsmgr = new XmlNamespaceManager(xmlDoc.NameTable);
nsmgr.AddNamespace("ns1", xmlDoc.DocumentElement.NamespaceURI);

XmlNode nodeEmail = xmlDoc.SelectSingleNode("/ns1:feed/ns1:author/ns1:email", nsmgr);
XmlNode nodeUserID = xmlDoc.SelectSingleNode("/ns1:feed/ns1:entry/ns1:id", nsmgr);
XmlNode nodeUserName = xmlDoc.SelectSingleNode("/ns1:feed/ns1:entry/ns1:title", nsmgr);

For more interest, use XPathVisualizer


Always show ScrollBar in browser

To prevent horizontal shifts when browsing website, use th following CSS for body:

<body style="overflow-y:scroll;">

Apache as HTTP Proxy Server

There are many various proxy servers on all platforms. But Apache is my favorite! And now I’ll show how to configure it as HTTP Proxy Server with Authentication.

1. Install Apache to “C:\SERVER\ApacheProxy” (

2. Let’s configure “conf/httpd.conf”

ServerRoot "C:/SERVER/ApacheProxy"
Listen 3128

LoadModule actions_module modules/
LoadModule alias_module modules/
LoadModule asis_module modules/
LoadModule auth_basic_module modules/
LoadModule authn_default_module modules/
LoadModule authn_file_module modules/
LoadModule authz_default_module modules/
LoadModule authz_groupfile_module modules/
LoadModule authz_host_module modules/
LoadModule authz_user_module modules/
LoadModule autoindex_module modules/
LoadModule cgi_module modules/
LoadModule dir_module modules/
LoadModule env_module modules/
LoadModule include_module modules/
LoadModule isapi_module modules/
LoadModule log_config_module modules/
LoadModule mime_module modules/
LoadModule negotiation_module modules/

LoadModule proxy_module modules/
LoadModule proxy_ajp_module modules/
LoadModule proxy_balancer_module modules/
LoadModule proxy_connect_module modules/
LoadModule proxy_http_module modules/
LoadModule setenvif_module modules/

<IfModule !mpm_netware_module>
<IfModule !mpm_winnt_module>
 User daemon
 Group daemon

ServerName firetrot
DocumentRoot "C:/SERVER/ApacheProxy/htdocs"

<Directory />
 Options FollowSymLinks
 AllowOverride None
 Order deny,allow
 Deny from all

<Directory "C:/SERVER/ApacheProxy/htdocs">
 Options Indexes FollowSymLinks
 AllowOverride None
 Order allow,deny
 Allow from all

<IfModule dir_module>
 DirectoryIndex index.html

<FilesMatch "^\.ht">
 Order allow,deny
 Deny from all
 Satisfy All

ErrorLog "logs/error.log"

# Possible values include: debug, info, notice, warn, error, crit, alert, emerg
LogLevel error 

<IfModule log_config_module>
 LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
 LogFormat "%h %l %u %t \"%r\" %>s %b" common
 CustomLog "logs/access.log" common

<IfModule alias_module>
 ScriptAlias /cgi-bin/ "C:/SERVER/ApacheProxy/cgi-bin/"

<Directory "C:/SERVER/ApacheProxy/cgi-bin">
 AllowOverride None
 Options None
 Order allow,deny
 Allow from all

DefaultType text/plain

<IfModule mime_module>
 TypesConfig conf/mime.types
 AddType application/x-compress .Z
 AddType application/x-gzip .gz .tgz

AllowCONNECT 443 563 5050

ProxyRequests On
ProxyVia On

<Proxy *>
 AuthName "FireTrot Proxy Server"
 AuthUserFile "C:\SERVER\ApacheProxy\users\userlist"
 AuthType Basic
 Require valid-user

The most interested part is at the end.

AllowCONNECT 443 563 5050

To make ability to work with services that need CONNECT protocol (for ex. tunnels) (

3. Create directory “C:\SERVER\ApacheProxy\users”

4. As you see, in “Proxy” directive:

 AuthUserFile "C:\SERVER\ApacheProxy\users\userlist"
 AuthType Basic
 Require valid-user

These lines are for Basic Authentication procedure.

Users (login:password) are listed in “C:\SERVER\ApacheProxy\users\userlist” file which can be made by:

C:\SERVER\ApacheProxy\bin\htpasswd.exe -cm "C:\SERVER\ApacheProxy\users\userlist" testuser

And type password.

5. Install service

C:\SERVER\ApacheProxy\bin\httpd.exe -n "ApacheProxy" -k install

That’s all! Run server!

Why Java?

Almost 2.5 years I am developing enterprise business logic. When I’ve started as developer I didn’t know about cross-platform concept. Then it was need to develop that one. And this is amazing experience to learn about java programming language. After Bruce Eckel “Thinking in Java”I was discouraged and a little disappointed by syntax because C# is more simple. After that I’ve return to .Net. The time passed and once I was tasked by other team lead to develop some module. Now it is finished on 80% and I’m awesome with Java! It’s really cool!

Work regardless OS is main reason to write Java project.


Hi folks!

The pilot post is out, see the sequence.