Welcome Vivek's Weblog

Saturday Nov 21, 2009

From the day I bought a laptop with windows vista 64 (in dec 2008), I
have been struggling to get a vpn client which works on it. Cisco
vpn3000 client does not support Vista 64 platform. There were few
options to vpn-connect my laptop:


1) Install another 64 bit OS (Open Solaris / Ubuntu / etc...) and run some vpn client from there.

2) Install Windows XP on VirtualBox (or any virtualization software), and run cisco vpn client from there.

3) Install Cygwin on Vista 64. Compile and run vpnc from there.


All these options works, but was painful to do it just to be able to
connect to vpn. Recently I heard about Shrew Soft VPN Client
(http://www.shrew.net/download/vpn) and gave it a shot. Amazing... It
works great on Windows Vista and Windows 7 64-bit platforms and it is
free. It supports importing .vpn and .pcf files (.pcf support is added
recently in 2.1.5 rc). I am very happy that finally some vpn client
woks on Windows 64-bit :).

Tuesday May 20, 2008

 

Zone Creation in Solaris 10 is very fast, simple and easy. Following is an example on creating a zone (Virtual OS) on your Solaris 10. This example shows the creation of 'testzone':



# zonecfg -z testzone

testzone: No such zone configured

Use 'create' to begin configuring a new zone.

zonecfg:testzone> create

zonecfg:testzone> set autoboot=true

zonecfg:testzone> set zonepath=/test/zones/testzone
zonecfg:testzone> add inherit-pkg-dir

zonecfg:testzone:inherit-pkg-dir> set dir=/opt

zonecfg:testzone:inherit-pkg-dir> end

zonecfg:testzone> info

zonename: testzone

zonepath: /test/zones/testzone

brand: native

autoboot: true

bootargs:

pool:

limitpriv:

scheduling-class:

ip-type: shared

inherit-pkg-dir:

        dir: /lib

inherit-pkg-dir:

        dir: /platform

inherit-pkg-dir:

        dir: /sbin

inherit-pkg-dir:

        dir: /usr

inherit-pkg-dir:

        dir: /opt

zonecfg:testzone> add net

zonecfg:testzone:net> set address=10.1.1.1

zonecfg:testzone:net> set physical=bge0

zonecfg:testzone:net> end

zonecfg:testzone> verify

zonecfg:testzone> commit

zonecfg:testzone> exit


 

We have added "/opt" directory as well, so that it will not be replicated for zones. This will make zone installation faster.

Now, List the zones:



# zoneadm list -cv

  ID NAME             STATUS         PATH                         

   0 global           running        /                            

   - testzone           configured     /test/zones/testzone

 

The newly created zone is now listed, and is in configured state. The configuration information is stored in an XML file within /etc/zones. The zone can’t be used, until it is “installed.”

Here is the step to install my testzone:



bash-3.00#  zoneadm -z testzone install

Preparing to install zone <testzone>.

Creating list of files to copy from the global zone.

Copying <2383> files to the zone.

Initializing zone product registry.

Determining zone package initialization order.

Preparing to initialize <1032> packages on the zone.

Initialized <1032> packages on zone.

Zone <testzone> is initialized.

Installation of <1> packages was skipped.

The file </test/zones/testzone/root/var/sadm/system/logs/install_log> contains a log of the zone installation.

 

It took less than 5 mins to install the testzone on my system. List the zones now:

 

bash-3.00# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   - testzone         installed  /test/zones/testzone           native   shared

 

You can see that zone status is installed. After installing zone, you have to boot it for the first time setup, and also answer boot-time questions. For this, log into the zone console from another terminal:

 

 zlogin -C testzone

 

This will let you into the zone console (no password req)

Now from the main terminal, boot the zone:

 

zoneadm -z testzone boot

 

On the console, the installation will ask set-up related questions. Answer them appropriately.

Check the Zone status:

 

bash-3.00# zoneadm list -cv
  ID NAME             STATUS     PATH                           BRAND    IP
   0 global           running    /                              native   shared
   2 testzone         running    /test/zones/testzone           native   shared

 

The Zone is now started running, and is ready to use.

 

Thursday Mar 20, 2008

From www.netbeans.org ...

[

Blog about NetBeans
IDE 6.1 Beta
for...


10 chances to win a $500 American
Express Gift Certificate !


100 chances to win a cool NetBeans
T-Shirt !

Simply:


1. Download
the NetBeans
IDE 6.1 Beta (or later release) and try it out.


2. Blog about
it !


3. Submit
the URL to
your
blog.


4. Do it before
April 18, 2008 !

]

Friday Jun 22, 2007


Sun Microsystems Inc announced that Singapore Airlines has rolled out StarOffice software in its new Boeing 777-300ER aircraft.

more info: http://www.dqchannels.com/content/global/107062106.asp

Friday May 25, 2007

Today I was asked to provide the number of lines of code I have written in last few months.

I quickly googled to find if there is any netbeans plugin which can help me doing this and yes, I found one:

WordCount Nb Module Count words, lines, and statements of java source files

You just have to select the package containing your java files and this plugin will give you details like:

Number of Files
Name of Files
Characters

Words

Lines

Characters/Line   

Words/Line   

Blank Lines   

Code Lines   

I found this plugin very useful.
 

Thursday Apr 05, 2007

NetBeans 6.0 Milestone 8 Available with New Features:
http://www.netbeans.info/downloads/dev.php

 

You can find NetBeans 6.0 Milestones Calendar here:
http://wiki.netbeans.org/wiki/view/NB6Milestones

Following link contains information about planning and design of Java EE features in NetBeans 6.0.
http://wiki.netbeans.org/wiki/view/JavaEEPlanning#section-JavaEEPlanning-NetBeans6.0 

Monday Mar 12, 2007

In my previous blog I have mentioned that you need Netbeans 5.5.1 + Enterprise Pack 5.5.1 for getting schema based code completion. Actually schema-based code completion for XML files was possible since 5.5
Enterprise Pack, but there was an important issue that was fixed in
5.5.1, see issue 91333 for details.

Tuesday Mar 06, 2007

I wanted to post this tutorial long back, but couldn't due to lack of time. Anyways here it is:

The following topics are covered below:


  • Setting Up a Plug-in Module Project
    • Installing the Software
    • Creating a NetBeans Plug-in Module Project

  • Adding Libraries to the Project
  • Implementing the Catalog Registration Class
  • Register XML module catalog plugin to Layer.xml
  • Installing and Using the Plug-in Module
    • Installing the Plug-in Module
    • Using the NetBeans Plug-in Module


This tutorial can be completed in 20 minutes.

For more information on NetBeans plug-in modules, see the
NetBeans Development Project home
on the NetBeans website. If you have questions, visit the
NetBeans Developer FAQ or use the feedback link
at the bottom of this page.


Setting Up a Plug-in Module Project


Before you start writing the plug-in module, you have to make sure you have all of the necessary software
and that your project is set up correctly. NetBeans provides a wizard that sets up all the basic files
needed for a plug-in module.



Installing the Software

Before you begin, you need to install the following software on your
computer:


  • NetBeans IDE 5.5.1 (download) (daily build)
  • NetBeans IDE Enterprise Pack 5.5.1 (download) (daily build)
  • Java Standard Development Kit (JDK™) version
    1.4.2 (download)
    or 5.0 (download)

Creating a NetBeans Plug-in Module Project

  1. Choose File > New Project. Under Categories, select NetBeans Plug-in Modules.

    NetBeans plug-in module support provides three project types:

    • Module Project. Creates a template for a standalone plug-in module.
    • Library Wrapper Module Project. Creates a plug-in module for an external JAR file required by one or more plug-in modules.
    • Module Suite Project. Creates a template for a set of interdependent plug-in modules and library wrapper modules, which you want to deploy
      together.

    Create Module Project
  2. Select Module Project. Click Next.
  3. In the Name and Location panel, type CodeCompletion in Project Name.
    Change the
    Project Location to any directory on your computer, such as c:\Documents and Settings\Administrator. Leave the Standalone Module radio button
    and the Set as Main Project checkbox selected.
    Click Next.Create Module Project
  4. In the Basic Module Configuration panel, replace yourorghere in Code Name Base with myorg,
    so that the whole code name base is org.myorg.codecompletion.
    Notice that the localizing bundle and the XML layer will
    be stored in the package org.myorg.codecompletion. These files do the following:
    • Localizing Bundle. Specifies language-specific strings for internationalization.
    • XML Layer. Registers items such as menus and toolbar buttons in the NetBeans System Filesystem.

     

    Click Finish. The IDE creates the "Schema Based Code Completion"
    project. The project contains all of your sources and
    project metadata, such as the project's Ant build script. The project
    opens in the IDE. You can view its logical structure in the Projects window (Ctrl-1) and its
    file structure in the Files window (Ctrl-2).

Adding Libraries to the Project

Add the following libraries to this project. We will be using classes of these libraries in our Catalog Registration class.

1) XML Entity Catalog

2) Utilities API



 

Implementing the Catalog Registration Class

Here we will see the implementation of "RgisterCatalog.java" class. Create a java pacakge called "org.myorg.codecompletion.catalog" inside the project. Create new java class, and name it "RgisterCatalog" and click finish.

 

Implement three interfaces to this class ie: CatalogReader, CatalogDescriptor, EntityResolver.

Import all the three interfaces to this class:

After importing these interfaces, a light buld will appear on the left side of the class declaration. Click that bulb and it will ask you to implement all abstract methods. Just click that, and your class will get empty implementation of all abstract methods.

Also create the new package "org.myorg.codecompletion.catalog.resources". Place any 16x16 icon and the schema xsd file to that package. I have used this icon in my project. The schema file used by me is po.xsd.

After implementing the empty methods, your class will look something like this:


package org.myorg.codecompletion.catalog;

import java.awt.Image;
import java.beans.PropertyChangeListener;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.netbeans.modules.xml.catalog.spi.CatalogDescriptor;
import org.netbeans.modules.xml.catalog.spi.CatalogListener;
import org.netbeans.modules.xml.catalog.spi.CatalogReader;
import org.openide.util.Utilities;
import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

/**
 * Catalog to register Schema files to runtime tab
 *
 * -AT-author Vivek Jain (Vivek.Jain@Sun-DOT-COM)
 */
public class RegisterCatalog implements CatalogReader, CatalogDescriptor, EntityResolver {
   
    private static final String PURCHASE_ORDER_XSD = "po.xsd";
    private static final String PURCHASE_ORDER = "http://www.w3.org/2001/XMLSchema/po.xsd";
    private static final String PURCHASE_ORDER_URL = "nbres:/org/myorg/codecompletion/catalog/resources/po.xsd";
    private static final String PURCHASE_ORDER_ID = "SCHEMA:" + PURCHASE_ORDER;
   
    /** Creates a new instance of RegisterCatalog */
    public RegisterCatalog() {
    }
   
    public Iterator getPublicIDs() {
        List<String> list = new ArrayList<String>();
        list.add(PURCHASE_ORDER_ID);
       
        return list.listIterator();
    }
   
    public void refresh() {
    }
   
    public String getSystemID(String publicId) {
        if(publicId.equals(PURCHASE_ORDER_ID)) {
            return PURCHASE_ORDER_URL;
        } else {
            return null;
        }
    }
   
    public String resolveURI(String string) {
        return null;
    }
   
    public String resolvePublic(String string) {
        return null;
    }
   
    public void addCatalogListener(CatalogListener catalogListener) {
    }
   
    public void removeCatalogListener(CatalogListener catalogListener) {
    }
   
    public Image getIcon(int i) {
        return Utilities.loadImage("org/myorg/codecompletion/catalog/resources/Schema.gif";);
    }
   
    public String getDisplayName() {
        return "PurchaseOrder Catalog";
    }
   
    public String getShortDescription() {
        return "XML Catalog for PurchaseOrder Schema";
    }
   
    public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener) {
    }
   
    public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener) {
    }
   
    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
        if (PURCHASE_ORDER.equals(systemId)){
            return new org.xml.sax.InputSource(PURCHASE_ORDER_URL);
        }
        if (systemId != null && systemId.endsWith(PURCHASE_ORDER_XSD)){
            return new org.xml.sax.InputSource(PURCHASE_ORDER_URL);
        }

        return null;
    }
   
}

Register XML module catalog plugin to Layer.xml


You have to register the Catalog class to Layer.xml inside Plugin/XML/UserCatalogs. You can register it as following:

    <folder name="Plugins">
        <!-- Register XML module catalog plugin -->
        <folder name="XML">
            <folder name="UserCatalogs">
                <file name="org-myorg-codecompletion-catalog-RegisterCatalog.instance">
                    <attr name="instanceCreate" newvalue="org.myorg.codecompletion.catalog.RegisterCatalog"/>
                    <attr name="instanceOf" stringvalue="org.netbeans.modules.xml.catalog.spi.CatalogReader"/>
                </file>
            </folder>
        </folder>
    </folder>

Installing and Using the Plug-in Module


The IDE uses an Ant build script to build and install your plug-in module. The build script is created for you
when you create the plug-in module project.



Installing the Plug-in Module

  • In the Projects window, right-click the "Schema Based Code Completion" project and choose Install/Reload
    in Target Platform.

    The plug-in module is built and installed in the target platform. The target
    platform is set in Tools > NetBeans Platform Manager. The target platform opens so that you
    can try out your new plug-in module. The default target IDE or Platform is the
    installation used by the current instance of the development IDE.

Using the NetBeans Plug-in Module

  •  After your plug-in is built and installed in the target platform, you can go to the runtime tab and see that the schema file gets registered to the XML catalog.
  • Create a new project and create a new empty xml document. Write the xml root element, its namespace and schemaLocation. In our example, xml will look something like this:  
    • <?xml version="1.0" encoding="UTF-8"?>
      <purchaseOrder xmlns='http://www.w3.org/2001/XMLSchema/po.xsd'
                     xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
                     xsi:schemaLocation='http://www.w3.org/2001/XMLSchema/po.xsd po.xsd'>

      </purchaseOrder>
This is all you have to do. You can see the code completion while writing new elements, attributes, etc









  • You can also validate this xml against the schema. The "Validate XML" contextual action will validate your xml file against the schema and report the output.


In case you want to refer the project, I have attached this module project here.


Monday Feb 26, 2007

Yes, Its possible to get schema based code completion for your xml files in netbeans 5.5.1 editor.

Soon I will be writing "HOW"... 

Saturday Feb 03, 2007


Do you administer a group of Solaris 10 servers?  Would you like some free stuff from Sun Microsystems?  Read on through following link...  

http://blogs.sun.com/stevewilson/entry/free_swag_for_solaris_administrators 

Friday Jan 12, 2007


Last year was the 50^th anniversary of the hard drive. If the auto
industry had kept the same pace as disk drives, a car today would cost
less than $25, hold 160,000 people, weigh half a pound and travel up to
940 mph.

Great Revolution: Hard-driving Valley Began 50 Years Ago," By Dan Fost
URL:

http://www.sfgate.com/cgi-bin/article.cgi?f=/c/a/2006/09/11/BUGH3L23T01.DTL

Monday Dec 18, 2006


The Wall Street Journal, Michael Totty; September 11, 2006

http://online.wsj.com/public/article/SB115755300770755096-R2Ct41cQ4ZIPMwk4_xh0xU_HnQI_20061011.html?mod=tff_main_tff_top

Sun’s DTrace software is named the Gold winner in The Wall Street Journal's 2006 Technology Innovation Awards. According to the piece, “Bryan Cantrill and a team of engineers at Sun have devised a way to diagnose misbehaving software quickly and while it's still doing its work. While traditional trouble-shooting programs can take several days of testing to locate a problem, the new technology, called DTrace, is able to track down problems quickly and relatively easily, even if the cause is buried deep in a complex computer system … Mr. Cantrill came up with the general idea for DTrace in 1996, while he was a computer-science student at Brown University, but didn't get to start work on it until late 2001. It took nearly three years for him and his team -- Michael Shapiro, a Sun distinguished engineer, and Adam Leventhal, a staff engineer -- to make it work; a final version shipped early last year as part of Sun's Solaris 10 OS.”

Friday Dec 08, 2006

Do you know the patent office granted a patent on the peanut butter and
jelly sandwich? (Recently voided on appeal)

http://www.msnbc.msn.com/id/7432980/

Or a patent on moving a playground swing by pulling sideways on the
chains? This one was granted to a five year old kid whose patent
attorney father was using it as an illustration of what daddy did for a
living, and never expected it would be granted.

http://www.freepatentsonline.com/4296923.html

Here's an article on bad patents

http://www.spectrum.ieee.org/careers/careerstemplate.jsp?ArticleId=i080502

Here's the best reform proposal I've seen

http://www.spectrum.ieee.org/careers/careerstemplate.jsp?ArticleId=i120204

 

Thursday Nov 30, 2006

(This essay is derived from a talk at Oscon.)

Lately companies have been paying more attention to open source.
Ten years ago there seemed a real danger Microsoft would extend its
monopoly to servers. It seems safe to say now that open source has
prevented that. A recent survey found 52% of companies are replacing
Windows servers with Linux servers.

More significant, I think, is which 52% they are. At this point,
anyone proposing to run Windows on servers should be prepared to
explain what they know about servers that Google, Yahoo, and Amazon
don't.

But the biggest thing business has to learn from open source is not
about Linux or Firefox, but about the forces that produced them.
Ultimately these will affect a lot more than what software you use.

We may be able to get a fix on these underlying forces by triangulating
from open source and blogging. As you've probably noticed, they
have a lot in common.

Like open source, blogging is something people do themselves, for
free, because they enjoy it. Like open source hackers, bloggers
compete with people working for money, and often win. The method
of ensuring quality is also the same: Darwinian. Companies ensure
quality through rules to prevent employees from screwing up. But
you don't need that when the audience can communicate with one
another. People just produce whatever they want; the good stuff
spreads, and the bad gets ignored. And in both cases, feedback
from the audience improves the best work.

Another thing blogging and open source have in common is the Web.
People have always been willing to do great work
for free, but before the Web it was harder to reach an audience
or collaborate on projects.

 

Monday Nov 13, 2006

Sun Releases Its Java Technology As Open-Source Software Project for Free on the Internet

The announcement represents one of the largest additions of computer
code to the open-source community -- and it marks a major shift for a
company that had once fiercely protected the source code used in 3.8
billion cell phones, supercomputers, medical devices and other gadgets.