Wednesday, November 30, 2005

Divide By Zero in Java

After developing for so long in Java, today only I realize that we can actually do divide by zero in Java and does not get runtime exception. I think so far, this is the only language I can see executing divide by zero and show infinity as a result. Most runtime will throw error whenever it encounter divides by zero. This shows that I still lack a lot of basic Java knowledge. Must improve myself more and not let my skills be rusty. To allow divide by zero, zero literal you use should be in double.
public class TestDivideByZero{
    public static void main(String[] args){     
        System.out.println("This will show as infinity : " + 100/0.0);
        System.out.println("The following will throw runtime exception : ");
        System.out.println("Exception :" + 100/0);

Wednesday, November 23, 2005

How to Prevent the Creation of Administrative Shares on Windows NT Server 4.0

This Microsoft article(Article ID:288164) explains how to prevent creation of the administrative shares on Microsoft Windows NT Server 4.0. Create values for AutoShareServer and AutoShareWks:
  1. In the registry, locate the following key: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanServer\Parameters
  2. On the Edit menu, click Add Value.
  3. Type AutoShareServer, click REG_DWORD, and then click OK.
  4. Type 0, and then click OK.
  5. On the Edit menu, click Add Value.
  6. Type AutoShareWks, click REG_DWORD, and then click OK.
  7. Type 0, and then click OK.Note: Sometimes the values are already present, especially after use of a policy that affects these entries. In addition, on Windows 2000 you are not required to add the AutoShareWks value. I tested this on W2Ksp4, need to have AutoShareWks.
  8. Quit the registry, and then restart the computer.
This process can easily be done through a policy. The path for the system policy is System Policy Editor\Windows NT Network\Sharing\Create Hidden Drive Shares. For additional information about hidden administrative shares that are not created, click the article number below to view the article in the Microsoft Knowledge Base: 156365 Hidden Shares Are No Longer Available After Using System Policy APPLIES TO: Microsoft Windows 2000 Server, Microsoft Windows 2000 Professional Edition

Wednesday, November 09, 2005

Where Babies Come From in Germany

Very useful book for parents when their child ask them where do babies come from.

Tuesday, November 08, 2005