Start Apache server on Cygwin 1.7 and Windows 7

I installed the full Cygwin 1.7 package on Windows 7. When I try to start Apache server following the linux style by running command
$ /usr/sbin/apachectl2 start
I got “Bad system call” error.

After some web search and trial and error, I finally got it work. Below are the steps that I’ve tried. Not sure whether all are necessary though.

Step 1: right click the Cygwin terminal and select “Run as adminstrator”

Step 2: create correct user and group info. Not sure whether this step is necessary.
$ mkpasswd.exe -l
$ mkgroup.exe -l

Step 3: configure server by running command
$ cygserver-config

Step 4: start cygserver
$ net start cygserver

Step 5: start apache
$ /usr/sbin/apachectl2 start

RPM builder quick steps

Step 1, install rpm tools
[sourcecode]yum install rpmdevtools rpmlint[/sourcecode]

Step 2, set up working directory
[sourcecode]rpmdev-setuptree[/sourcecode]

Step 3, create and edit the spec file
[sourcecode]
cd rpmbuild/SPECS
rpmdev-newspec
[/sourcecode]

Miscellaneous commands:

show environment variables
[sourcecode]rpm –showrc[/sourcecode]
show specific variable
[sourcecode]rpm –eval %_usr[/sourcecode]

Procedures to simulate RPM building with Mock
– Build source rpm
[sourcecode]
rpmbuild -bs SPECS/myproject.spec
[/sourcecode]

– Mock the build, i.e., testing the build in an isolated building environment simulating a specific platform (Redhat or Fedora etc.)
[sourcecode]
mock -r platform_name SRPMS/myproject.src.rpm
[/sourcecode]

– If it’s a multiple-project task, mock install the first project first, and then mock build the 2nd, i.e.,
[sourcecode]
mock -r platform_name –install /mock_path/myproject.rpm
mock -r platform_name SRPMS/myproject2.src.rpm
[/sourcecode]

Change Java environment in CentOS

See this blog

To install/ register a JVM use the following
/usr/sbin/alternatives --install "/usr/bin/java" "java" "/usr/java/default/bin/java" 2
/usr/sbin/alternatives --install "/usr/bin/javac" "javac" "/usr/java/default/bin/javac" 2

And to configure systemwide changes use
/usr/sbin/alternatives --configure java
/usr/sbin/alternatives --configure javac

Singlton vs Static class/method

Based on Wikipedia: “Note the distinction between a simple static instance of a class and a singleton: although a singleton can be implemented as a static instance, it can also be lazily constructed, requiring no memory or resources until needed. Another notable difference is that static member classes cannot implement an interface, unless that interface is simply a marker. So if the class has to realize a contract expressed by an interface, it really has to be a singleton.”