Thursday, September 16, 2010

Windows 7: What’s new

Windows Desktop

Snap

  • Drag the title bar of an open window to either side of the desktop to align it there, or
  • Drag it to the top of the desktop to maximize the window.
  • To expand a window vertically using Snap, drag the top edge of the window to the top of the desktop.
  • To return the window to its original size, drag the title bar of the window away from the top of the screen.

Aero Shake

  • Just click the title bar of the window you want to keep open and drag (or shake) the window back and forth quickly, and the other open windows are minimized.
  • To restore the minimized windows, shake the open window again.
  • Press Windows logo key Picture of Windows logo key +Home to minimize all windows except for the currently active window. Press Windows logo key Picture of Windows logo key +Home again to restore all windows

Aero Peek

  • The Show desktop button has been moved the opposite end of the taskbar from the Start button, making it easier to click or point to the button without accidentally opening the Start menu.
  • You can temporarily view or peek at the desktop by just pointing to the Show desktop button. When you point to the Show desktop button at the end of the taskbar, any open windows fade from view, revealing the desktop. To make the windows reappear, move the mouse away from the Show desktop button.
  • Press the Windows logo key Picture of Windows logo key +Spacebar to temporarily preview the desktop. To restore the desktop, release the Windows logo key Picture of Windows logo key +Spacebar.
  • To minimize open windows so that they remain minimized, click the Show desktop button, or press the Windows logo key Picture of Windows logo key +D. To restore the open windows, click the Show desktop button again or press the Windows logo key Picture of Windows logo key +D again.

Desktop background

  • Your desktop background doesn't have to be a single picture anymore. With Windows 7, you can display a slide show of pictures, instead. Some Windows themes include a slide show, or you can create your own slide show from your personal collection of pictures.

Start menu

Jump Lists

  • Jump Lists are lists of recent items, such as files, folders, or websites, organized by the program you use to open them.
  • In addition to being able to open recent items using a Jump List, you can also pin favorite items to a Jump List, so that you can easily access the programs and files you use every day.

Libraries

  • A library gathers files from different locations and displays them as a single collection, without moving them from where they’re stored. There are four default libraries (Documents, Music, Pictures, and Videos), but you can create new libraries for other collections. The Documents, Music, and Pictures libraries appear on the Start menu by default. Like other items on the Start menu, you can add or remove libraries, or customize their appearance.

Search

  • The Start menu includes a search box that you can use to find files, folders, programs, and e-mail messages stored on your computer. When you start typing a word or phrase in the search box, the search begins automatically, and the search results temporarily fill the Start menu space above the search box.

TaskBar

Taskbar buttons

  • Taskbar buttons have a new look and do more than just show you which programs are running.
  • In the default view, each program appears as a single, unlabeled button—even when multiple items for a program are open—for a clean and uncluttered look. You can customize the taskbar appearance to change how buttons appear and how they group together when you have multiple items open. You can also choose to see individual buttons for each open file.
  • You can also rearrange and organize buttons on the taskbar, including pinned programs and running programs that aren’t pinned, so they appear in the order you prefer. To rearrange the order of buttons on the taskbar, drag a button from its current position to a different position on the taskbar. You can rearrange buttons as often as you like.

Previewing open windows with Aero Peek

  • When you open multiple windows on the desktop, sometimes it can be a challenge to view separate windows and switch between them.
  • You can use Aero Peek to take a quick look at other open windows without clicking away from the window you are currently working on. Point your mouse at a taskbar button, and thumbnail previews of any open windows associated with that button appear above the taskbar. If you want to open a window you are previewing, just click its thumbnail. For more information.

Pinning items

  • Pinning programs to the taskbar complements pinning programs to the Start menu, like in earlier versions of Windows. When you pin a favorite program to the taskbar, you can always see it there and easily access it with a single click. Windows 7 also includes Jump Lists, so that in addition to launching a program from the taskbar, you can now launch favorite and recent items from that program, just by clicking the same button.
  • Jump Lists are lists of recently or frequently opened items, such as files, folders, tasks, or websites, organized by the program that you use to open them. In addition to being able to open recent items using a Jump List, you can also pin favorite items to a Jump List so you can quickly get to the items that you use every day.
  • On the taskbar, Jump Lists appear for programs that you've pinned to the taskbar and programs that are currently running. You can view the Jump List for a program by right-clicking the taskbar button, or by dragging the button toward the desktop. You open items from the Jump List by clicking them.

Notification area

  • A new way of managing the notification area on the end of the taskbar means you get fewer notifications, and the ones you get are collected in a single place in Windows.
  • In the past, the notification area could sometimes become cluttered with icons. Now, you can choose which icons appear visible at all times. And you can keep the rest of the icons on hand in an overflow area, where they’re accessible with a single mouse click.
  • Action Center is a single area that collects important notification messages about security and maintenance settings. You can review these messages later if you don’t want to be interrupted. When you click the Action Center icon Picture of Action Center icon and then click Open Action Center, you’ll see information about the things you need to take action on, and find helpful links to troubleshooters and other tools that can help fix problems.

Viewing the desktop

  • The Show desktop button has been moved to the opposite end of the taskbar from the Start button, making it easier to click or point at the button without accidentally opening the Start menu.
  • In addition to clicking the Show desktop button to get to the desktop, you can temporarily view or peek at the desktop by just pointing your mouse at the Show desktop button, without clicking it. When you point at the Show desktop button at the end of the taskbar, any open windows fade from view, revealing the desktop. To make the windows reappear, move the mouse away from the Show desktop button.
  • This can be useful for quickly viewing desktop gadgets, or when you don’t want to minimize all open windows and then have to restore them.

Wednesday, September 15, 2010

Microsoft Windows and WebDAV

Introduction

Web-based Distributed Authoring and Versioning (WebDAV) is a set of methods based on the Hypertext Transfer Protocol (HTTP) that facilitates collaboration between users in editing and managing documents and files stored on World Wide Web servers. WebDAV was defined in RFC 4918 by a working group of the Internet Engineering Task Force (IETF).

Microsoft Windows supports WebDAV since Windows 98.  It also available in Windows 2000, XP and Windows 7.

WebDAV Service: Apache HTTPD

The following shows two simple WebDAV configuration for Apache httpd server.  The “DAV On” indicates the URL is a WebDAV service.

Configuration: Basic Authentication using LDAP

<Location /setup>
        DAV On
        Options All
        Order deny,allow
        Allow from all
        AuthType Basic
        AuthName "DAV"
        AuthBasicProvider ldap
        AuthzLDAPAuthoritative off
        AuthLDAPURL ldap://ldap.estream.com.my/ou=user,dc=example,dc=com?uid?sub?(objectclass=posixAccount)
        Require valid-user
</Location>

Configuration: Digest Authentication using password file

Digest authentication send MD5 hashed password to httpd server and thus provide a bit more security compare to Basic authentication.  However, Digest authentication is also not a secure mechanism for HTTP service.

<Location /setup>
        DAV On
        <LimitExcept GET OPTIONS>
                Options All
                Order deny,allow
                Allow From all
                AuthType Digest
                AuthName "DAV"
                AuthDigestProvider file
                AuthUserFile /etc/httpd/conf.d/digest
                Require valid-user
        </LimitExcept>
</Location>

WebClient service

In Windows XP or perhaps Windows 2000 onwards, WebClient is a service that communicate to WebDAV server.  Microsoft Windows doesn’t provide any GUI tools to configure WebClient.  All the configuration is done via Registry setting in HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebClient.

2

You should restart the WebClient if you modify any WebClient items in Registry to make changes take effect.

Windows XP and WebDAV

Both Basic and Digest Authentication works with Windows XP’s WebClient without much configuration.

You may connect to a WebDAV share via:

  1. File | Open of Internet Explorer (check Open as Web Folder):
    3
  2. “Add a network place” in My Network Places:

    4 
    5 
    6 
    7

Once the connection is authenticated and authorised, you should able to access the WebDAV share just like normal network share in Windows Explorer.

8

Windows 7 and WebDAV

It is not easy to make WebDAV works in Windows 7 like Windows XP.  You need extra care to get WebDAV done in Windows 7.

Windows 7 WebClient service supports Digest Authentication by default.  This restriction has lead to 2 use cases failed:

  1. All WebDAV with Basic Authentication will fail no matter how you configure the WebDAV URL.
  2. All WebDAV using Digest Authentication and LDAP as backend authentication will fail.  The LDAP service is unable to perform authentication again digest password.

If the WebDAV URL support digest authentication using file as AuthDigestProvider, Windows 7 should establish the WebDAV connection successfully.  During the frequent trial and error testing among httpd server and Windows 7 WebClient service, you might need to restart the WebClient service before start a new test.

You may change an entry in registry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebClient\Parameters\BasicAuthLevel

to allow Basic Authentication work in WebClient service.  BasicAuthLevel’s default value is 1.  The meaning of BasicAuthLevel is as follow:

0 - Basic authentication disabled
1 - Basic authentication enabled for SSL shares only
2 or greater - Basic authentication enabled for SSL shares and for non-SSL shares

You may set BasicAuthLevel to 2 for Basic Authentication to work in non SSL WebDAV share.  You may then use Basic Authentication  with LDAP as backend authentication service for the WebDAV share.

To add a WebDAV share in Windows 7,  you may use “add a network location” as shown in Windows Explorer:

9 

The rest of configuration is straight forward, just enter the WebDAV share URL and supply valid credential if necessary and you can start access the  WebDAV share as usual.

TroubleShoot

Error 0x800700DF: The file size exceeds the limit allowed and cannot be saved

When you use Windows 7 to access a WebDAV share copying a large file more than 50MB, you may encounter the following error:

1_thumb1

There is a setting for webclient service in registry that restrict the transmit file sizes (HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\WebClient\Parameters\FileSizeLimitInBytes):

Capture

Modify this value to something like 0xFFFFFFFF will allow transferring file size of 4GB.

Restart the WebClient service refresh the setting.

Reference

  1. You may receive an error message when you try to download a file that is larger than 50000000 bytes from a Web folder on a computer that is running Windows Vista or that is running Windows XP with Service Pack 1 or with Service Pack 2.
    URL: http://support.microsoft.com/kb/900900/en-us
  2. Howto Fix Webdav On Windows 7 64bit. URL: http://shon.org/blog/2010/03/04/howto-fix-windows-7-64bit-webdav/

Tuesday, September 14, 2010

Apache HTTP Server

Introduction

Apache HTTP Server is a famous open source web server.

Installation

yum install httpd

Default Behavior

  1. Server instance name: httpd
  2. Configuration file:
    1. /etc/httpd/conf/httpd.conf
    2. /etc/httpd/conf/conf.d/*
  3. TCP Port: 80
  4. Log files:
    1. /var/log/httpd/access_log
    2. /var/log/httpd/error_log
  5. Working folder: /var/www/html

Configuration

Configuration: Log Level

Default log level for httpd is “warn”.  You may change the log level to debug for more detail log message when you encounter problem with configuration.

For example:

LogLevel debug

Configuration: Server Side Includes (SSI)

SSI (Server Side Includes) are directives that are placed in HTML pages, and evaluated on the server while the pages are being served. They let you add dynamically generated content to an existing HTML page, without having to serve the entire page via a CGI program, or other dynamic technology.

To enable SSI in Apache HTTP, add the following in conf file:

AddType text/html .shtml 
AddHandler server-parsed .shtml 

<Directory /data/www> 
    Options +Includes 
</Directory>

If the index file is a SSI file, you should add this line too:

DirectoryIndex index.html index.html.var index.shtml

Configuration: Virtual Host

The term Virtual Host refers to the practice of maintaining more than one server on one machine, as differentiated by their apparent hostname. For example, it is often desirable for companies sharing a web server to have their own domains, with web servers accessible as www.company1.com and www.company2.com, without requiring the user to know any extra path information.

In order not to mess up the httpd.conf file, we may store the virtual host configuration in a separate file. (eg: /etc/httpd/conf/httpd-vhosts.conf)

vi /etc/httpd/conf.d/httpd-vhosts.conf
NameVirtualHost *:80 

<Directory /data/www> 
    Options +Includes 
</Directory> 

<VirtualHost *:80> 
    DocumentRoot /data/www 
    ServerName www.company1.com 
    ScriptAlias /cgi-bin/ /data/www/cgi-bin/  
</VirtualHost>

Configuration: HTTPS – Secure HTTP

https is HTTP secure protocol.

Installation:

yum install mod_ssl

You may restart httpd service and verify if secure http service is up and running by:

# netstat -na |grep -i 443
tcp        0      0 :::443                      :::*                        LISTEN

The configuration file for mod_ssl is stored in /etc/httpd/conf.d/ssl.conf.

Remember to exclude port 443 in firewall if you want to publish the service.

Configuration: Basic Authentication

mod_auth_basic is the module for http basic authentication.

The following command will prompt for password and create an entry of user with md5 hashed password:

htpasswd -c password_file username

An example of using the basic password file to protect a folder:

<Location /private/>
  AuthType basic
  AuthName "private area"
  AuthBasicProvider file
  AuthUserFile conf.d/password_file
Require valid-user </Location>

Configuration: Digest Authentication

mod_auth_digest is the module for http digest authentication.  It has similar mechanism as basic authentication except the password sent as MD5 hash value instead of plain text.  httpd.conf should include mod_auth_digest by default.

The following command will prompt for password and create an entry of user with md5 hashed password:

htdigest -c password_file digest-realm username

An example of using the digest password file to protect a folder:

<Location /private/>
  AuthType Digest
  AuthName "digest_realm"
  AuthDigestProvider file
AuthUserFile conf.d/password_file Require valid-user </Location>

Configuration: httpd 2.2 LDAP Authentication and authorisation

httpd 2.2 using a module mod_authnz_ldap to perform ldap authentication and authoisation.

The following example attempt to protect a URL cgi-bin with username/password authentication against a ldap directory server.  The LDAP connection is using TLS.

<Location /cgi-bin>
        Order deny,allow
        Allow from example.com
        AuthType Basic
        AuthName "CVSweb"
        AuthBasicProvider ldap
        AuthzLDAPAuthoritative off
        AuthLDAPURL ldap://ldap.example.com/ou=user,dc=example,dc=com?uid?sub
?(objectclass=posixAccount) STARTTLS
        Require valid-user
</Location>

The above configuration should work if your LDAP server is working.

If debug log level is used, you may notice the error_log shows something like this:

[Tue Sep 14 16:38:18 2010] [debug] mod_authnz_ldap.c(376): [client 192.168.0.107] [32672] auth_ldap authenticate: using URL ldap://ldap.example.com/ou=example,dc=example,dc=com?uid?sub?(objectclass=posixAccount)
[Tue Sep 14 16:38:18 2010] [debug] mod_authnz_ldap.c(475): [client 192.168.0.107] [32672] auth_ldap authenticate: accepting alice
[Tue Sep 14 16:38:18 2010] [debug] mod_authnz_ldap.c(847): [client 192.168.0.107] [32672] auth_ldap authorise: authorisation denied

A log message of “authorisation denied” sounds like the authorisation fail.  However, you don’t encounter problem accessing resource from web browser.  This message may confuse when checking the log message during troubleshooting session.

The message was a result from a configuration option:

AuthzLDAPAuthoritative off

The httpd security mechanism requires authentication and authorisation processes to be verified before a resource may access by an user.  In this case, the user is authenticated with user name and password via LDAP service.  And the authorisation process is verified by apache configuration.

Setting AuthzLDAPAuthoritative to off means mod_authnz_ldap let other authorization modules attempt to authorize the user, should authorization with this module fail.  That is the reason why the message “authorisation denied” shown in log.  The mod_authnz_ldap denied to perform authorisation here due to “AuthzLDAPAuthoritative off”.

Now, next problem raise.  If mod_authnz_ldap_ldap denied to perform authorisation, why the resource is accessible after valid credential is supplied via web browser?  And why the authorisation seems successfully perform?  Who perform the authorisation?

The key is this setting:

Require valid-user

The above clause performs authorisation.  It simply means authenticated user of mod_authnz_ldap is always valid and is authorised to use the resource.

What if we attempt to set AuthzLDAPAuthoritative to on?  This simply means mod_authnz_ldap will perform authorisation followed by success authentication:

<Location /cgi-bin>
        Order deny,allow
        Allow from example.com
        AuthType Basic
        AuthName "CVSweb"
        AuthBasicProvider ldap
        AuthzLDAPAuthoritative on
        AuthLDAPURL ldap://ldap.example.com/ou=user,dc=example,dc=com?uid?sub?(objectclass=posixAccount) STARTTLS
        Require valid-user
</Location>

Above configuration will cause browser keep prompt for username and password even correct credential is provided.  Log messages something like these will shown:

[Tue Sep 14 16:30:49 2010] [debug] mod_authnz_ldap.c(376): [client 192.168.0.107] [32596] auth_ldap authenticate: using URL ldap://ldap.example.com/ou=user,dc=example,dc=com?uid?sub?(objectclass=posixAccount)
[Tue Sep 14 16:30:50 2010] [debug] mod_authnz_ldap.c(475): [client 192.168.0.107] [32596] auth_ldap authenticate: accepting alice
[Tue Sep 14 16:30:50 2010] [debug] mod_authnz_ldap.c(842): [client 192.168.0.107] [32596] auth_ldap authorise: declining to authorise

The error message is “declining to authorise” as compare to “authorisation denied” in previous case.

In this case, mod_authnz_ldap should attempt to perform authorisation due to “AuthzLDAPAuthoritative  on” clause in configuration.  Again, the reason it “declining to authorise” was due to this clause:

Require valid-user

In this case, mod_authnz_ldap should perform authorisation but valid-user.  However, mod_authnz_ldap do not possess “Require valid-user” and thus it doesn’t know know how to perform authorisation and that lead to “declining to authorise” message logged.

To make mod_authnz_ldap perform authorisation successfully, we may use either:

  1. Require ldap-user
  2. Require ldap-group
  3. Require ldap-dn
  4. Require ldap-attribute
  5. Require ldap-filter

for different cases.  Refer here for more information.

Configuration: WebDAV

mod_dav is the module for HTTPD WebDAV.  it is extremely easy to use WebDAV in Apache HTTPD:

<Location /foo>
  Dav On
</Location>

Just include “Dav On” to Location or Directory block will straight turn on WebDAV share.

Reference

  1. Making Apache 2.2 valid-user work with mod_authnz_ldap.
    URL: http://neptune.ashtech.net/~dmarkle/blog/archives/108-Making-Apache-2.2-valid-user-work-with-mod_authnz_ldap.html

Thursday, September 09, 2010

CVS: Web GUI by FreeBSD CVSweb

Introduction

CVSweb is a WWW interface for CVS repositories with which you can browse a file hierarchy on your browser to view each file's revision history in a very handy manner.

Installation

# Web interface for CVS repositories 
yum install cvsweb

# Runtime Logging for C++ 
yum install rlog

# Revision Control System (RCS) file version management tools 
yum install rcs

# CVS/RCS repository grapher 
yum install cvsgraph

# A plain ASCII to PostScript converter 
yum install enscript

Configuration: Repository

Update the repository setting in CVSweb configuration file:

vi /etc/cvsweb/cvsweb.conf
@CVSrepositories = (
      'local'   => ['Local Repository', '/var/cvs'],
#       'freebsd' => ['FreeBSD',          '/var/ncvs'],
#       'openbsd' => ['OpenBSD',          '/var/ncvs'],
#       'netbsd'  => ['NetBSD',           '/var/ncvs'],
#       'ruby'    => ['Ruby',             '/var/anoncvs/ruby'],
);

Configuration: Web Server

CVSweb is a cgi program runs on Apache, the Apache configuration should configuration similar to this:

ScriptAlias /cgi-bin/ "/var/www/cgi-bin/"

Make sure the CVSweb cgi is place in the path specify in ScriptAlias.

Configuration: Syntax Highlighter

The syntax highlighter works if enscript package is installed. CVSweb keep the enscript configuration in /etc/cvsweb/cvsweb.conf.

The following example specify Delphi as syntax highlighter for pascal (.pas) file.

vi /etc/cvsweb/cvsweb.conf
%enscript_types =
(
 'ada'          => qr/\.ad(s|b|a)$/o,
 'asm'          => qr/\.[Ss]$/o,
 'awk'          => qr/\.awk$/o,
 'bash'         => qr/\.(bash(_profile|rc)|inputrc)$/o,
 'c'            => qr/\.(c|h)$/o,
 'changelog'    => qr/^changelog$/io,
 'cpp'          => qr/\.(c\+\+|C|H|cpp|cc|cxx)$/o,
 'csh'          => qr/\.(csh(rc)?|log(in|out)|history)$/o,
 'elisp'        => qr/\.e(l|macs)$/o,
 'fortran'      => qr/\.[fF]$/o,
 'haskell'      => qr/\.(l?h|l?g)s$/o,
 'html'         => qr/\.x?html?$/o,
 'idl'          => qr/\.idl$/o,
 'inf'          => qr/\.inf$/io,
 'java'         => qr/\.java$/o,
 'javascript'   => qr/\.(js|pac)$/o,
 'ksh'          => qr/\.ksh$/o,
 'm4'           => qr/\.m4$/o,
 'makefile'     => qr/(GNU)?[Mm]akefile(?!\.PL\b)|\.(ma?ke?|am)$/o,
 'matlab'       => qr/\.m$/o,
 'nroff'        => qr/\.man$/o,
 'delphi'       => qr/\.p(as|p)?$/io,
 'perl'         => qr/\.p(m|(er)?l)$/io,
 'postscript'   => qr/\.e?ps$/io,
 'python'       => qr/\.py$/o,
 'rfc'          => qr/\b((rfc|draft)\..*\.txt)$/o,
 'scheme'       => qr/\.(scm|scheme)$/o,
 'sh'           => qr/\.sh$/o,
 'skill'        => qr/\.il$/o,
 'sql'          => qr/\.sql$/o,
 'states'       => qr/\.st$/o,
 'synopsys'     => qr/\.s(cr|yn(th)?)$/o,
 'tcl'          => qr/\.tcl$/o,
 'tcsh'         => qr/\.tcshrc$/o,
 'tex'          => qr/\.tex$/o,
 'vba'          => qr/\.vba$/o,
 'verilog'      => qr/\.(v|vh)$/o,
 'vhdl'         => qr/\.vhdl?$/o,
 'vrml'         => qr/\.wrl$/o,
 'wmlscript'    => qr/\.wmls(cript)?$/o,
 'zsh'          => qr/\.(zsh(env|rc)|z(profile|log(in|out)))$/o,
);

Using CVSweb

Launch your favorite web browser and navigate to

http://<cvs-host>/cgi-bin/cvsweb.cgi

Troubleshoot: CVS folders doesn’t show up

The CVS folder specify in local repository of cvsweb.conf may not have appropriate access permission for cvsweb.cgi. You may use the following command to change the folder permission:

chmod o+rx <cvs-folder>

Troubleshoot: Encounter permission denied when browse a CVS tree

A CVS repository tree may contain arbitrary levels of folder. The tree may not have appropriate access permission for cvsweb.cgi. You may use the following command to change all the sub folders found in CVS repository:

find . -type d -exec chmod o+rx '{}' \;

Reference

  1. FreeBDS CVSweb Project. URL: http://www.freebsd.org/projects/cvsweb.html

Wednesday, September 08, 2010

CVS: Branching, Merging and Tagging

Introduction

CVS a.k.a. concurrent version system is the software version control in the field of software development.  Branching and Merging features in CVS allow developer to manage same piece of source file for several release and develop these release in parallel without interrupting each others.

Please note that the examples shown below are using WinCVS 1.2.

CVS Branching

For example, I have a file in CVS repository: App.DIY.Reg.pas.  The latest version for the file is 1.2 (The graph view is triggered with Ctrl+G Graph Selection):

1

Let look at the following scenario to see how could CVS branching manage the case:

I would like to make changes to a file.  These new changes is not yet ready for release to public. It may stay in CVS repository as internal or beta version for some time.  It will merge with main branch of the source file until it is mature.  However, the main branch may change due to bugs reported during the beta release period.  The bug fixed in main branch may merge with sub branch too during the beta release period.

The main trunk of a file in CVS is termed as “HEAD”.  You should define a meaningful name or tag to other branches but not the “HEAD” tag.  “HEAD” a reserve tag for main trunk.

Let us make some changes to local working versio of the file.  It will turn to red color once I make some changes:

2

The new changes is not ready for main release yet.  I am going to create a branch call BETA in version 1.2.  Please note that branch tag is case sensitive.

There are 2 ways to create a branch:

  1. Access via main menu.  Modify | Create a branch on selection... :

    4
  2. Click the Fork Selection of Tags tool bar icon:

    3

A windows with title “Create branch settings” prompt out:

5

Enter branch name and press OK button to create a “BETA” branch for the file.  We will leave an option “Check that the files are unmodified before branching” unchecked in this case.

The version of the file in graph view has a BETA branch shown:

6

Now everything seems ready and we are going to commit the local changes to BETA branch.  We will in trouble if we commit the changes now.  The changes we commit will stay in main trunk as version 1.3:

8

This is due to the sticky tag for the file in local copy is not mark as “BETA” tag.  It simply means we are working with the copy of main trunk in our local repository.  Whatever changes we commit will stay with main trunk:

7

We may update our local copy stick with "BETA” tag with CVS Update Selection:

9

Enter the stick tag “BETA” and press OK button to update your copy of file as BETA.

A

You will notice there is a tag BETA stick to the file after Update Selection.  Commit the local changes now and it will shown in BETA branch.  Please note also the file revision will update to 1.2.2.1 in this case:

B

We may remove the sticky tag and back to main trunk by checking an option “Reset any sticky date/tag/’-k' options” in Update Selection:

C

The local copy will become version 1.2 in this case:

D

We may always switch between HEAD and BETA branch by:

  1. “Reset any sticky date/tag/’-k' options” in Update Selection
  2. Retrieve rev./tag/branch of Stick options in Update Selection

respectively.

Now, assume we have another local working copy of the source with version 1.2 and empty sticky tag (a.k.a main trunk).  Perform Update Selection to this file will remain as 1.2.  It won’t update to 1.2.2.1 of BETA branch. unless we update the sticky tag to BETA.  We may continue making changes to version 1.2 and commit it as version 1.3, 1.4 or 1.5 and so:

E

CVS Merging

Let us back to version 1.2.2.1 of BETA branch.  We decided to merge the changes of 1.5 in main trunk to 1.2.2.1 of BETA branch.

Use the “Merge options” of Update Selection to merge main trunk into BETA branch:

F

Press OK button to proceed the merge operation.  Your local copy will then merge with main trunk.  You may decide to commit under BETA branch.  The following graph shows the result of commit work:

G

Now we decide to end the BETA branch and merge all changes from BETA branch to main trunk.  Let’s back to main trunk copy and perform the merging work:

H

After commit the changes, CVS repository will have the following version:

I

The version 1.6 is result of the merge of 1.5 in main trunk and 1.2.2.2 BETA branch.

CVS Tagging

CVS tagging allows you to mark an indication to a file for future reference.  A common usage for tagging is tag the source files with release or build number for future reference.  You may check out particular tag of source files for debugging purpose in future.

Here, we continue with CVS branching and merging example to use the CVS tagging feature to mark both 1.2.2.2 and 1.6 as “BETA_END”  and “BETA_MERGE” respectively.

To tag a version, use either:

  1. Access via main menu.  Modify | Create a tag on selection... :

    M
  2. Click the Tag Selection of Tags tool bar icon:

    L

A windows with title “Create tag settings” prompt out:

K

The following graph show the result of tagging:

J

The tagging is for reference only.  Remember that version 1.2.2.2 still exist in the CVS repository.  We may always go back to it anytime.

Working with main trunk and branch together in difference folders

When we start using branch in CVS repository, there may be a need to work with main trunk and difference branches together in same machine.  Check out a local copy from main trunk is easy:  Just check out as usual without any sticky tag.

Check out a local copy from branch may need extra care.  In real world example, only some of the source files may have branch.  Majority of source files may not have branch or already merge to main trunk.  If we check out a module with sticky options:

N

You will only get files with BETA tag:

O

This is not what we want in most situation.  We still need other files from main trunk in order to build a complete BETA release.  To check out the files from main trunk, check the option “If no matching revision is found, use the most recent one” :

P

Press the OK button and the local source copy will have:

Q

The same usage is also applicable to Update Selection.

Now, you will see all files in your local copy have BETA sticky tag.  However, this doesn’t mean all files have BETA branch in CVS repository.  In the example, only App.DIY.Reg.pas has BETA branch and the rest are not.  This always confuse the CVS user.

Now, if you make changes to a file App.DIY.pas and you decide to put it in BETA branch.  If you attempt to commit the local changes in this example, you will encounter:

cvs commit: file `App.DIY.pas' had a conflict and has not been modified
cvs [commit aborted]: correct above errors first!

This is due to App.DIY.pas doesn’t has BETA branch in CVS repository, you have to create a new BETA branch for it first before you can commit.  Refer to CVS Branching in early section of this article.

Friday, July 23, 2010

A machine equipped with 4 Gig RAM is so lagging running Linux PAE kernel and Windows 7 x64

I have a machine equipped with Intel motherboard DG965RY that has 4G RAM.  The machines work as usual running Windows Vista for years.

I installed Windows 7 x64 on the machine recently and the OS works extremely slow.  The CPU is Intel(R) Core(TM)2 CPU 6600 @ 2.40Ghz.  It should support 64 bits instruction sets as seens in BIOS page showing EM64T.  I first thought it could be CPU or motherboard that doesn’t support x64 OS well.  I then re-install the machine with Windows 7 x86 and it works like a charm.

2 Days later, I try to install AsteriskNOW backed by CentOS 5.5 (kernel 2.6.18-194.3.1.e15PAE) i386 on the same machine.  Again, the machine running the kernel 2.6.18-194.3.1.el5PAE is so lagging.  However, it works as usual if running kernel 2.6.18-194.3.1.el5.

I google for the different between PAE kernel and non PAE kernel.  PAE stand for Physical Address Extension.  A clue sparks on my mind suddenly after knowing from the PAE term that it might be something to do with the memory.  I remember that 32 bits machine have limitation on memory address in Windows Vista x86.  It may only detect 3.5G from 4G RAM installed.

I unplug a 2G RAM from motherboard slot and left 2G RAM to the machine and attempt to run PAE kernel.  It works like a charm.  A good news follow is Windows 7 x64 works extremely smooth with this 3 years old machine too.

I quickly browse the Intel BIOS update page and found there is update regarding addressing issues of 4G RAM.  I download and update the BIOS to the latest version, plug the 2G RAM back to motherboard and boot the machine with 4G RAM.  Both Linux PAE kernel and Windows 7 x64 works smoothly as expected.

Google Chrome is laging running on Windows 7 x64

Google Chrome is a web browser released by Google.  Google claims that the Chrome is the fastest browser in the market.  However, this is not my first experience when running Google Chrome on Windows 7 x64 desktop.

When I use Chrome on my Windows 7 x64 desktop, it will so lag and slow.  I continued using FireFox for quite some time and I am happy with the performance on my new Intel I7 machine equipped with 6G RAM.  I use Chrome when I want to use “Incognito Window” of Chrome to access my bank account.  It always lag for each page I visit.  This is not a pleasant experience with Chrome.

After google for the reason why Chrome is so lag for some time, I finally found a solution.  Uncheck “Automatically detect settings” in Internet Options of Microsoft Internet Explorer will boost the browsing speed of Chrome running on Windows 7 x64 platform.  Reason remain unknown why this helps.  No explanation from Google Chrome team so far.

To access Internet Options, you may use Tools | Options of Internet Explorer or double click the icon of Internet Options in Control Panel:

  1. Switch to Connections page
  2. Click “LAN Setting…” button to show “Local Area Network (LAN) Settings” dialog
  3. Uncheck “Automatically detect settings”
  4. Click OK button of LocalArea Network (LAN) Setttings dialog
  5. Click OK button of Internet Options dialog

Capture

You may then enjoy using Google Chrome to surf Internet in much responsive speed on Windows 7 x64 platform.  A side effect of this is the Internet Explorer 8 also render web pages faster than before.

Friday, May 21, 2010

Linux: Configure DHCP Server

It is pretty easy to configure DHCP server for Linux.

Install DHCP server

# yum list dhcp* 
Installed Packages 
dhcp.i386                                12:3.0.6-10.fc8        installed 
dhcpv6-client.i386                       0.10-51.fc8            installed 
Available Packages 
dhcp-devel.i386                          12:3.0.6-10.fc8        fedora 
dhcp-forwarder.i386                      0.7-12.fc7             fedora 
dhcp-forwarder-sysv.i386                 0.7-12.fc7             fedora 
dhcp-static.i386                         12:3.0.6-10.fc8        fedora 
dhcpv6.i386                              0.10-51.fc8            fedora

# yum install dhcp.i386  // depend on the yum list output

Configure DHCP Server

A sample dhcpd.conf can be found in /usr/share/doc/dhcpd-*/dhcpd.conf.sample  You may grab it and copy to /etc folder for further configuration.

Prior to Fedora 11, the dhcpd.conf is keep under folder /etc.

Fedora 11 and above, the dhcpd.conf should keep in folder /etc/dhcp

Wednesday, April 07, 2010

ANT: Java Heap Space Error

From time to time, when we use ANT script to perform jobs that drag some how longer time.  We may encounter Java heap space out of memory error.

The default heap space allocated for Java heap could be 128MB.  You may adjust the Java heap size from ANT via environment variable ANT_OPTS:

set ANT_OPTS=–Xmx512m

You may try to set in the system environment variable that is available to all users.  If it fail with message “Incompatible minimum and maximum heap sizes specified”, try remove the ANT_OPTS in system environment variable and set it in your home user account.

Tuesday, March 23, 2010

Share a folder in Windows 7

Sharing a folder of Windows 7 file system is as easy as Windows XP.  The following guidance shows how to share a folder in Windows 7 step by step.

The example shows how to share a folder of c:\estream\share.

  1. Open Windows Explorer and attempt to locate folder c:\estream\share
  2. Click the “Share with” on tool bar to bring out the sharing popup menu
  3. Click “Nobody” item

1

A File Sharing window show.  Choose “Changing sharing permissions”

2

Next window will show out.  The example shows how to share the folder for everyone’s access.  You may specify user name for limited access:

  1. Click the combo box to select a user name. e.g.: Everyone
  2. Click “Add” button to add the user
  3. Specify the "Level” of access. e.g.: Read
  4. Click “Share” button to commit (require privilege access)

3

Done.  You have successfully share the folder from Windows 7.  Go to any workstation to check if you may view the share folder via UNC path (e.g.: \\server)

Rename the share name

You may also use different name for the share folder:

  1. Right click the share folder to show the popup menu
  2. Click Properties to the following window
  3. Switch to “Sharing” page
  4. Click “Advanced Sharing” (require privilege access)

4

Next, “Advanced Sharing” window shows.  Click Add button to enter new share name.  You may remove old share name by clicking the “Remove” button.

5

Enter new share name and press OK button

6

Done.  You may check from other networked workstation if the new share name is up and ready to use.

Sunday, February 21, 2010

When not to use DoubleBuffered

As according to Delphi’s help,

DoubleBuffered determines whether the control's image is rendered directly to the window or painted to an in-memory bitmap first.

When DoubleBuffered is false, the windowed control paints itself directly to the window. When DoubleBuffered is true, the windowed control paints itself to an in-memory bitmap that is then used to paint the window. Double buffering reduces the amount of flicker when the control repaints, but is more memory intensive.

However, not all VCL’s controls work nice with DoubleBuffered.  There are at least 2 controls that I am aware of that can’t work with DoubleBuffered and would mess up visually.

These two controls are TRichEdit and TToolBar.  Any controls that are family of these 2 controls will mostly show expected outcome if using with DoubleBuffered.

You would probably not able to type text visually with TRichEdit if DoubleBuffered is True.  For TToolBar, it would show black background.  However, you may always place TToolBar in TPanel control to get rid of the DoubleBuffered nightmare.

Reference:

  1. Delphi on line help topic: Controls.TWinControl.DoubleBuffered. URL: http://docwiki.embarcadero.com/VCL/en/Controls.TWinControl.DoubleBuffered