Copyrights @ Journal 2014 - Designed By Templateism - SEO Plugin by MyBloggerLab

Saturday, February 27, 2016

People's Capacity to Dwell on their history

No matter what its failures and what may be in future, government can be the place where people come together, where no one gets left behind, no one. It is an instrument of good.... just good.
Makes me think, rather bothers me a lot what others think of government. People have phenomenal capacity, they may not know until it is the time. Them coming together may be the greatest assembly of human capacity of ambition, what sets them apart is their judgement on what matters to their heart and that decides their destiny as a nation. There is always time where they dwell frivolous try to correct it instead of accepting it. This kind of capacity is always better used shaping future while learning from past.

- Citing quote from Toby Ziegler on The West Wing. 

Sunday, February 10, 2013

Twitter Web Application in Minutes

I had been looking for creating and posting tweets to my twitter account for a long time. I found a good example ... considering I did not want to invest too much of time in creating/researching something like this.




Friday, January 21, 2011

Internet Explorer Upgrade and Lotus Notes Sametime

Recently I did upgrade my Internet Explorer to 8 Release. The IE is great, but I never imagined how bad the effect would be on Sametime.

Another discovery after that, Sametime is directly dependent on your default browser for rendering the chat sessions into a window. It showed a very weird behavior of not able to wrap long chat lines in the sessions. So horizontal scroll shows up for those long chat lines. The chat sessions became more and more annoying if I have to read it with scroll over a scroll (I blame it on people who like to write essays in Chat windows).

I found a link at IBM site which need you to modify a CSS file under notes folder and it sets up everything.

http://www-10.lotus.com/ldd/stforum.nsf/DateAllFlatWeb/e0487e6064116620852575860076c1cc?OpenDocument

Saturday, October 23, 2010

VMware Workstation and Multi-Core processors

Recently when upgraded to my new dual core laptop, all my development guests started freezing for a few seconds are random intervals of few seconds. As impatient as I am when developing, it was very annoying to wait till it resumes. Tried a lot of fruitless searches on Google and led me to start rebuilds on Virtual PC. The rebuild was really pain because of enormous time it takes to install the OS and then excruciating time taken to install all software and data migration.

Finally thanks to Code Journey’s blog post, it is quite simple solution to make.

It could be because of the fact that if the computer is dual core and the virtual machine is set to use both cores, then BOTH cores must be available every time CPU is needed by the guest. This might be the problem for some, and setting VMware to use 1 CPU core for clients may help, but for me it did not.

Add following line to your .vmx file.
mainmem.useNamedFile = false

The pauses should stopped now, and it does not matter if you use 1 or 2 cores on clients.

Anyways, however it did, thanks Code Journey.

Thursday, October 14, 2010

Software Architect – Best job of 2010?

Software architect named top on the best job of 2010. Surprisingly it was missing in earlier year’s listings, does it also mean that this is newly created “Job” in 2010? I am also a Software Architect in a fortune 500 company. I love my job but I would not necessarily put that on top of the list. 

I can say the description matches with what is listed, but their job does end at creating blue prints, sometimes it is important to write code also, unlike building architects, they don’t put brinks together, do they? Software architects do. It is usually said that architects don’t have to know the technology, but it is seldom practiced, they are also humans, they have their preferences for technologies. Technology agnostic architectures are very likely to be modified when it comes to design and develop those.

BEST JOBS IN AMERICA

Money/Payscale.com's list of great careers

1. Software Architect

Software Architect

Chaiken, a software engineer for more than two decades, relishes the more collaborative work.

Top 100 rank: 1
Sector: Information Technology

What they do: Like architects who design buildings, they create the blueprints for software engineers to follow -- and pitch in with programming too. Plus, architects are often called on to work with customers and product managers, and they serve as a link between a company's tech and business staffs.

What's to like: The job is creatively challenging, and engineers with good people skills are liberated from their screens. Salaries are generally higher than for programmers, and a typical day has more variety.

"Some days I'll focus on product strategy, and other days I'll be coding down in the guts of the system," says David Chaiken, 46, of Yahoo in Sunnyvale, Calif., whose current projects include helping the web giant customize content for its 600 million users. Even though programming jobs are moving overseas, the face-to-face aspect of this position helps cement local demand.

What's not to like: You are often outside the management chain of command, making it hard to get things done.

Requirements: Bachelor's degree, and either a master's or considerable work experience to demonstrate your ability to design software and work collaboratively.

Best Jobs in America 2010 - Top 100: Software Architect - Money Magazine on CNNMoney.com

Saturday, July 31, 2010

Project Codename

Recently a very interesting project came my way and making headway thru its architecture and design now. The project is making me think more than ever, surprisingly not about the use cases as much as name for the project.  We picked the concept several times before but was dropped due to politics, financials etc etc. Somehow I feel this is it… we are making it.

Here now comes the important question, what do we name it?

  1. Microsoft has very exciting tradition for naming their pre-production releases with a codename based on places
  2. Apple names their OS as cats
  3. Firefox as Nature parks
  4. Open source projects have weirdest traditions of naming the projects, not yet figured out yet.
  5. O’Reilly has chosen their book covers as animal kingdom
  6. Microsoft press chose the toolbox.
  7. webMethods uses product line major versions by alphabetically.

Longhorn, Leopard, Indigo, Poseidon, Gran Paradiso, Yukon, SharpFreedom, Supertanga, Revolution, Lightning, Lambrate, Orcas, Q98, Fiji, Pendolino, McKinley, there is absolutely nothing in common.

We need to have some fun with the project, pick a mythology and name the components. It is very monotonous to use very overused acronyms that make you feel geeky. Nothing makes sense anymore, use of boring version numbers is monotonous and dry. There may be a need to use these names in pre-release discussions, can be used in namespaces where needed in codebase, naming the codebase with the mythical project name. There are several reasons to name the project with the name that attracts the team.

Still wondering what should be the name of my project?

Saturday, June 12, 2010

This time for Africa.... eh eh




You're a good soldier
Choosing your battles
Pick yourself up
And dust yourself off
And back in the saddle

You're on the frontline
Everyone's watching
You know it's serious
We're getting closer
This isnt over

The pressure is on
You feel it
But you've got it all
Believe it

When you fall get up
Oh oh...
And if you fall get up
Oh oh...

Tsamina mina
Zangalewa
Cuz this is Africa

Tsamina mina eh eh
Waka Waka eh eh

Tsamina mina zangalewa
Anawa aa
This time for Africa

Listen to your god
This is our motto
Your time to shine
Dont wait in line
Y vamos por Todo

People are raising
Their Expectations
Go on and feed them
This is your moment
No hesitations

Today's your day
I feel it
You paved the way
Believe it

If you get down
Get up Oh oh...
When you get down
Get up eh eh...

Tsamina mina zangalewa
Anawa aa
This time for Africa

Tsamina mina eh eh
Waka Waka eh eh

Tsamina mina zangalewa
Anawa aa

Tsamina mina eh eh
Waka Waka eh eh
Tsamina mina zangalewa
This time for Africa

Wednesday, December 09, 2009

Windows desktop Search : Add-in for Lotus Notes

Isn't it cool?

The Windows Desktop Search Add-in for Lotus Notes is a protocol handler that allows you to index the content of Lotus Notes e-mail, contacts, calendar items, and journal items stored on your computer.
Once you have installed this Add-in, Windows Desktop Search (WDS) will index the content of your locally stored Lotus Notes databases. Indexing will occur when your PC is idle, or when you tell WDS to ‘Index Now’. Once the index is updated you can immediately search your Lotus Notes content.

Download it from here...  Microsoft Download Site

 

Baware though, it caused problems for me, I was continuously getting these.

Error: 'Windows cannot find 'Notes:///8525666600461713' occurs when attempting to open bookmarks in Notes
When users click local bookmarks on the left sidebar in Notes® 8 Standard Configuration, an error message displays indicating an operating system error and that "Windows cannot find" the file. This does not occur when using Notes 8 Basic Configuration.

Solution: Uninstall the plug-in and install it with latest version of Windows Search.

 

 

Good Luck!!

Wednesday, December 02, 2009

Weird ways to save our planet

I agree that there is growing need to save our planet. Global Warming is another major trouble next generation will face. But reading these weird ways to save our earth is just weirdest things I have ever heard.

 

8 weird ways to save the Earth

Geoengineering, or deliberately tinkering with the earth's climate, could help if global warming proves disastrous for mankind, but the ideas are untested and the risks unknown.

via: cnn.com

 

Every idea evolution starts with some weirdness in the beginning. Nobody ever thought about reality in Wireless Electricity (WiTricity) to illuminate a room without any wiring, guess what? it is coming to market hopefully next year. So I am amazed with thinking the scientist have put together to gather alternate ways for saving our planet.

There are several ways to reduce the green house effect, viz, "Reducing emission of green house gas", "Plant trees", "Conserve Energy and Water", and on and on... There is no alternatives to these everyday solutions, but they require a lot of awareness especially in developing and underdeveloped countries like India and China which are achieving their GDP growth at the cost of our planet. Till the awareness and their growth is achieved, it will be futile to get the everyday solutions are implemented and addressed. So these alternatives will boost the plan for saving the planet. Agreed, they are weird solutions, but they are not implemented yet, it will be a while before the real one strikes and get the venture capitalists lock on it. This is just the beginning, there will  be a lot more such ideas to come.

I saw the MasterCard Advertisement about "Helping your dad to be a better man"... priceless. The target audience for awareness is changing now, there are more kids who are climate change aware than before. The environmentalists are finding newer ways to make people aware.

 

Being a father I hate this advertisement, but this is the most innovative way I have seen to make people aware. I guess they are the ones who are going to face it, I will be long gone before that, but I just don't want them to curse us for what we have done... or how we did not do anything to save this beautiful planet...

Friday, April 17, 2009

CICS Web Services Assistant for Windows

As we know, web services are reached to mainframes also. The best way to enable any CICS program (except assembler) via web services is to use Rational Application Developer for System Z. I would say that is the best and also the most expensive way to create WS on mainframe. You can use CICS Web Services Assistant to do that. Usually the license of RAD4Z is very expensive, so if you only need to create webservices artifacts, use CICS WS assistant.

You need to first download the CICS WS A from here, importantly check the documentation that it comes with. Apart from that you need to download Java Record I/O for OS/390. You can both these from your CICS/USS installation on mainframe. Later I found out that, DFHLWS2WS batch program invokes the java classes one after the other to create Web services. Using JRIO, you can read the VSAM datasets (KSDS), system catalogs, I am still not sure why do we need this for running the Windows assistant. I would suggest reading this overview for more details.

Using the assistant you can create both approaches

  1. Top down approach - WSDL to CICS program - WS2LS
  2. Bottom up approach - CICS program to WSDL - LS2WS

First things first

  1. I created a utility class which will read from a properties file with the string/constant values that are needed.
  2. I downloaded the copybook for the CICS program that needs to be enabled via Web services.
  3. You may want to separate the input and output as two different copybooks.
  4. Read thru the sample code for more documentation.
Initialize
  1:     // Decide your defaults.
  2:     // Here is the target program name
  3:     public final String PARAM_PROGRAM_NAME = Utility.getProperty("PARAM_PROGRAM_NAME", "FIRSTCICS");
  4:     // Is the target program looking for perticular container name in
  5:     // default channel? Default container name is "DFHWS-DATA"
  6:     public final String PARAM_CONTAINER_NAME = Utility.getProperty("PARAM_CONTAINER_NAME", "DFHWS-DATA");
  7:     /*
  8:          * You need to provide Cobol mapping level that is used in copybooks.
  9:          * This is important because some mappings are not supported by certain
 10:          * version of CICS WS.
 11:          */
 12:     public final String PARAM_MAPPING_LEVEL = Utility.getProperty("PARAM_MAPPING_LEVEL", "2.0");
 13:     /*
 14:          * If you have preference for namespaces for the WSDL, you can specify
 15:          * that here. Usually, the auto generated Java/C# classes has reveresed
 16:          * package/namespace hierarchy. Like when you say com.test.myCo the
 17:          * namespace in Java will look like myCo.test.com. This is the reason I
 18:          * wrote it reversed. This helps if you plan to import the generated
 19:          * WSDL into JAX-WS or Axis based tool. Specify namespaces for request
 20:          * and response.
 21:          * 
 22:          */
 23:     public String PARAM_REQUEST_NAMESPACE_MF = Utility.getProperty("PARAM_REQUEST_NAMESPACE_MF", "myCo.test.com");
 24:     public String PARAM_RESPONSE_NAMESPACE_MF = Utility.getProperty("PARAM_RESPONSE_NAMESPACE_MF", "myCo.test.com");
 25:     // You must specify the programmming language for target program.
 26:     // 0 = COBOL.
 27:     public final int PARAM_LANGUAGE = Integer.parseInt(Utility.getProperty("PARAM_LANGUAGE", "0"));
 28:     // What is the target program need COMMAREA or CHANNELS/Containers.
 29:     public final int PARAM_PROGRAM_INTERFACE = Integer.parseInt(Utility.getProperty("PARAM_PROGRAM_INTERFACE", "1"));
 30:     // Name of default channel?
 31:     public final String PARAM_CHANNEL_NAME = Utility.getProperty("PARAM_CHANNEL_NAME", "CHANNEL");
 32:     // Define codepage for the PDS that will be used as input or output.
 33:     // I used default as IBM-037
 34:     public final String PARAM_PDS_CODEPAGE = Utility.getProperty("PARAM_PDS_CODEPAGE", "IBM-037");
 35:   
 36:     public String PARAM_SERVICE_INTERFACE = "";
 37:     //Location of generated WSDL (LS2WS) or WSDL to be used to generate (WS2LS)
 38:     public String WSDL_LOCATION = "";
 39:     
 40:     //Name of the PDS file names on local machine.
 41:     public String PARAM_REQUEST_CBMEMBER_MF = "";
 42:     public String PARAM_RESPONSE_CBMEMBER_MF = "";
 43:     /*
 44:      * This is the name of interface that wsbind file will use to create a web service.
 45:      * This will also be used at http://server:port/PARAM_SERVICE_INTERFACE
 46:      */ 
 47:     public String PARAM_INTERFACE_ID = "";
 48:     public String PARAM_DIRECTORY_PDS_LIB = "";
 49:     public String PARAM_DIRECTORY_ARTIFACTS_WSDL = "";
 50:     public String PARAM_DIRECTORY_ARTIFACTS_WSBIND = "";
 51:     public String PARAM_DIRECTORY_ARTIFACTS_LOG = "";
 52:     public final String PARAM_EXTENTION_WSBIND = Utility.getProperty("PARAM_EXTENTION_WSBIND", ".wsbind");
 53:     public final String PARAM_EXTENTION_WSDL = Utility.getProperty("PARAM_EXTENTION_WSDL", ".wsdl");
 54:     public final String PARAM_EXTENTION_LOG = Utility.getProperty("PARAM_EXTENTION_LOG", ".log");

Setup the parameters:

  1: private IAssistantParameters setParams(String type) {
  2:  IAssistantParameters params = Factory.createAssistantParameters();
  3:  /*
  4:          * You can create both LS2WS and WS2LS from CICS WS Assistant. Both use
  5:          * different parameters. this program is written to handle both
  6:          * scenarios.
  7:          */
  8:  if (type.equals("LS2WS")) {
  9:      //Copybook to web services approach
 10:      params.setParamLANG(PARAM_LANGUAGE);
 11:      params.setParamPDSCP(PARAM_PDS_CODEPAGE);
 12:      params.setParamMAPPING_LEVEL(PARAM_MAPPING_LEVEL);
 13:      params.setParamPGMNAME(PARAM_PROGRAM_NAME);
 14:      params.setParamREQMEM(PARAM_REQUEST_CBMEMBER_MF);
 15:      params.setParamRESPMEM(PARAM_RESPONSE_CBMEMBER_MF);
 16:      params.setParamPGMINT(PARAM_PROGRAM_INTERFACE);
 17:      params.setParamPGMINT(PARAM_CHANNEL_NAME);
 18:      params.setParamCONTID(PARAM_CONTAINER_NAME);
 19:      params.setParamPDSLIB(PARAM_DIRECTORY_PDS_LIB);
 20:      params.setParamURI(PARAM_INTERFACE_ID);
 21:      params.setParamREQUEST_NAMESPACE(PARAM_REQUEST_NAMESPACE_MF);
 22:      params.setParamRESPONSE_NAMESPACE(PARAM_RESPONSE_NAMESPACE_MF);
 23:      params.setParamWSBIND(PARAM_DIRECTORY_ARTIFACTS_WSBIND + PARAM_INTERFACE_ID + PARAM_EXTENTION_WSBIND);
 24:      params.setParamLOGFILE(PARAM_DIRECTORY_ARTIFACTS_LOG + PARAM_INTERFACE_ID + PARAM_EXTENTION_LOG);
 25:      params.setParamWSDL(WSDL_LOCATION);
 26:  } else {
 27:      //WSDL to Cobol copybook/program approach
 28:      params.setParamLANG(PARAM_LANGUAGE);
 29:      params.setParamPDSCP(PARAM_PDS_CODEPAGE);
 30:      params.setParamMAPPING_LEVEL(PARAM_MAPPING_LEVEL);
 31:      params.setParamPGMNAME(PARAM_PROGRAM_NAME);
 32:      params.setParamREQMEM(PARAM_REQUEST_CBMEMBER_MF);
 33:      params.setParamRESPMEM(PARAM_RESPONSE_CBMEMBER_MF);
 34:      params.setParamPGMINT(PARAM_PROGRAM_INTERFACE);
 35:      params.setParamPGMINT(PARAM_CHANNEL_NAME);
 36:      params.setParamCONTID(PARAM_CONTAINER_NAME);
 37:      params.setParamPDSLIB(PARAM_DIRECTORY_PDS_LIB);
 38:      params.setParamURI(PARAM_INTERFACE_ID);
 39:      params.setParamCHAR_VARYING("NO");
 40:      /*
 41:       * No need to specify namespaces here, because they come from specified WSDL.
 42:       */
 43:      // params.setParamREQUEST_NAMESPACE(PARAM_REQUEST_NAMESPACE_MF);
 44:      // params.setParamRESPONSE_NAMESPACE(PARAM_RESPONSE_NAMESPACE_MF);
 45:      params.setParamWSBIND(PARAM_DIRECTORY_ARTIFACTS_WSBIND + PARAM_INTERFACE_ID + PARAM_EXTENTION_WSBIND);
 46:      params.setParamLOGFILE(PARAM_DIRECTORY_ARTIFACTS_LOG + PARAM_INTERFACE_ID + PARAM_EXTENTION_LOG);
 47:      params.setParamWSDL(WSDL_LOCATION);
 48:  }
 49:  return params;
 50:     }

Part I: Create Copybook to Web service (LS2WS)


  1:  public String CreateWSArtifactsLS2WS() {
  2:  try {
  3:      /*
  4:       * Create the paths where you want your WS artifacts will be crated.
  5:       */
  6:      PARAM_REQUEST_NAMESPACE_MF = this.PARAM_SERVICE_INTERFACE + "." + PARAM_REQUEST_NAMESPACE_MF;
  7:      PARAM_RESPONSE_NAMESPACE_MF = this.PARAM_SERVICE_INTERFACE + "." + PARAM_RESPONSE_NAMESPACE_MF;
  8:      WSDL_LOCATION = PARAM_DIRECTORY_ARTIFACTS_WSDL + PARAM_INTERFACE_ID + PARAM_EXTENTION_WSDL;
  9:      
 10:      /*
 11:       * Setup parameters
 12:       */
 13:      IAssistantParameters params = this.setParams("LS2WS");
 14:      /*
 15:       * Create assistant
 16:       */
 17:      ICICSWebServicesAssistant cwsa = Factory.createCICSWebServicesAssistant();
 18:      /*
 19:       * Make the run
 20:       */
 21:      IAssistantResponse ar = cwsa.DFHLS2WS(params);
 22:      /*
 23:       * Check the output.
 24:       */
 25:      int retCode = ar.getReturnCode();
 26:      String retMessages = "";
 27:      /*
 28:       * There are list of messages.
 29:       */
 30:      String[] msgs = ar.getAllMessages();
 31:      for (int i = 0; i < msgs.length; i++) {
 32:   retMessages += msgs[i] + "\n";
 33:   Utility.PrintLine(msgs[i]);
 34:      }
 35:      Utility.PrintLine("DFHLS2WS:AssistantResponse.getReturnCode():" + retCode);
 36:      if (retCode == IAssistantResponse.RC_ERROR) {
 37:   Utility.PrintLine("Error while creating the WSDL\n" + retMessages);
 38:   throw new Exception("WSDL Creation Error : " + retMessages);
 39:      }
 40:  } catch (Exception e) {
 41:      Utility.PrintError(e);
 42:  }
 43:  
 44:  return WSDL_LOCATION;
 45:     }
 46: 

 

Part II: Create Web service to Cobol(WS2LS)

  1:     public String CreateWSArtifactsWS2LS() {
  2:  try {
  3:      /*
  4:       * Create the paths where you want your WS artifacts will be crated.
  5:       */
  6:      PARAM_REQUEST_NAMESPACE_MF = this.PARAM_SERVICE_INTERFACE + "." + PARAM_REQUEST_NAMESPACE_MF;
  7:      PARAM_RESPONSE_NAMESPACE_MF = this.PARAM_SERVICE_INTERFACE + "." + PARAM_RESPONSE_NAMESPACE_MF;
  8:      WSDL_LOCATION = PARAM_DIRECTORY_ARTIFACTS_WSDL + PARAM_INTERFACE_ID + PARAM_EXTENTION_WSDL;
  9:      /*
 10:       * You have to provide the names of the PDS which it will generate the the Copybooks.
 11:       */
 12:      PARAM_REQUEST_CBMEMBER_MF = "WBSXI";
 13:      PARAM_RESPONSE_CBMEMBER_MF = "WBSXO";
 14:      IAssistantParameters params = this.setParams("WS2LS");
 15:      ICICSWebServicesAssistant cwsa = Factory.createCICSWebServicesAssistant();
 16:      IAssistantResponse ar = cwsa.DFHWS2LS(params);
 17:      int retCode = ar.getReturnCode();
 18:      String retMessages = "";
 19:      String[] msgs = ar.getAllMessages();
 20:      for (int i = 0; i < msgs.length; i++) {
 21:   retMessages += msgs[i] + "\n";
 22:   Utility.PrintLine(msgs[i]);
 23:      }
 24:      Utility.PrintLine("DFHLS2WS:AssistantResponse.getReturnCode():" + retCode);
 25:      if (retCode == IAssistantResponse.RC_ERROR) {
 26:   Utility.PrintLine("Error while creating the WSDL\n" + retMessages);
 27:   throw new Exception("WSDL Creation Error : " + retMessages);
 28:      }
 29:  } catch (Exception e) {
 30:      Utility.PrintError(e);
 31:  }
 32:  return WSDL_LOCATION;
 33:     }

Glue it togather:

  1: String WSDL_LOCATION ="";
  2: CICSCreateWSDL createWSDL = new CICSCreateWSDL();
  3: 
  4: createWSDL.PARAM_INTERFACE_ID="GetCustomerAddress";
  5: createWSDL.PARAM_REQUEST_CBMEMBER_MF = "CUSTADDR.cpy";
  6: createWSDL.PARAM_RESPONSE_CBMEMBER_MF = "CUSTADDR.cpy";
  7: createWSDL.PARAM_DIRECTORY_PDS_LIB = Utility.BASE_ARTIFACT_FOLDER + "1.Interfaces\\";
  8: createWSDL.PARAM_DIRECTORY_ARTIFACTS_WSDL = Utility.BASE_ARTIFACT_FOLDER + "2.WSDLs\\";
  9: createWSDL.PARAM_DIRECTORY_ARTIFACTS_WSBIND = Utility.BASE_ARTIFACT_FOLDER +  "3.WSBINDs\\";
 10: createWSDL.PARAM_DIRECTORY_ARTIFACTS_LOG = Utility.BASE_ARTIFACT_FOLDER + "4.LOGs\\";
 11: createWSDL.PARAM_SERVICE_INTERFACE=PARAM_NAMESPACE;
 12: WSDL_LOCATION= createWSDL.CreateWSArtifactsLS2WS();

Monday, April 06, 2009

Read my book review from Amazon : Visual Basic.NET and XML

Few years back, somebody approached me to review a new emerging book on Visual Basic .Net and XML. The book is focused only on XML related processing in VB.Net.

Recently I had been searching for pages related to my website and I can see my review is sold on Amazon along with the book for $5.95.

Feels good to see...

Citation Details
Title: Visual Basic.NET and XML: Harness the Power of XML in VB.NET Applications.(Book Reviews)
Author: Vishal Khapre
Publication: Technical Communication (Refereed)
Date: February 1, 2004
Publisher: Society for Technical Communication
Volume: 51 Issue: 1 Page: 123(2)

Wednesday, January 21, 2009

Add Command prompt to explorer context menu

Its been always a long process to reach to desired folder using "cd" command on Command Prompt. It was easier to have a context menu for any folder in Windows Explorer as "Start command here". I had been using it for such a long time, so don't know who told me how to do this, but recently a friend asked me so thought it is easier to post a blog and point him to the post.

  1. Open Windows explorer

    image 

  2. Go to Tools menu -> Folder Options -> File Types. You can probably reach this place via control panel also.

    image
  3. Select "Folder" remember not to select "File Folder" and click on "Advanced". I already have created "command" as my context menu so you will see that here too.

    image
  4. Click New and put Action as "Start command here" and Application used as absolute path to cmd.exe usually it is in your system32 directory.

    image
  5. Click "Ok" and then "Close" to get back to Windows Explorer.
  6. Right click on any folder in Windows Explorer to see the context menu added.

Good luck!!

Wednesday, August 20, 2008

JAX-WS and Custom SOAP Header

Recently, during my transition to JAX-WS, a work in hand made me use Custom Soap headers in design in a JAX-WS implementation. Pertaining same, my recent conversations with friend, we need a quick sample how to use custom headers with JAX-WS.

JAX-WS by Sun’s specifications support custom soap headers. It is as easier as .Net or webMethods. It supports the WSDL with SOAP header information also.

https://jax-ws.dev.java.net/jax-ws-ea3/docs/annotations.html

As per W3C, “The Representation header block is designed to allow applications to carry a representation of a Web resource in a SOAP message”. 

Ref:http://www.w3.org/TR/soap12-rep/

It is not limited or only used by system processing, applications can use it for several reasons which include the access restriction, avoiding payload browse, and also overhead (accessing headers is faster than body). So it is perfectly allowed to use SOAP custom headers, philosophy being soap:body should contain only the payload, all routing headers should be used as soap:headers.

Here is how you do it.

Change your soapbinding annotation to DOCUMENT, by default it is DOCUMENT but I made it explicit because it was giving some error.

@WebService(name = "GoodbyeWorldWS", 
targetNamespace="http://webservice_producer/goodbyeworld") @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)

Add new @WebParam with header=true. You can also set the Mode to INOUT so that header value is returned to consumer too. You can access the headers via the WebParam name specified in the name attribute.

@WebMethod
public String sayGoodbye(
   @WebParam(name="message") String message,
   /*Add header element */
   @WebParam(name="header",mode=Mode.IN, header=true) String headerElement) 
{
System.out.println("SOAP HEADER VALUE" + headerElement); return ".Goodbye."; }

Here is how the WSDL looks like, it has the soap:header added.

<input> 
    <soap:body parts="sayGoodbye" use="literal" /> 
  <soap:header message="tns:GoodbyeWorldWS_sayGoodbye" part="header" use="literal" />
</input>

Here is the C# code to invoke it.

GoodbyeWorldWSService.GoodbyeWorldWSService ws = 
      new ConsoleApplication2.GoodbyeWorldWSService.GoodbyeWorldWSService();
            
GoodbyeWorldWSService.sayGoodbye input = 
     new ConsoleApplication2.GoodbyeWorldWSService.sayGoodbye();
            
input.message = "JAX WS support Body";
ws.header = new ConsoleApplication2.GoodbyeWorldWSService.@string();
ws.header.Text = new String[] { "JAX WS Supports Headers" };
            
GoodbyeWorldWSService.sayGoodbyeResponse output = ws.sayGoodbye(input);
Console.WriteLine(output.@return);

Here is how the SOAP message  looks like in server log

22:07:21,187 INFO [STDOUT]
[
<soap:Envelope xmlns:soap=http://schemas.xmlsoap.org/soap/envelope/
   xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance
   xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
  <header xmlns="http://webservice_producer/goodbyeworld">
      JAX WS Supports Headers
  </header>
</soap:Header>
<soap:Body>
  <sayGoodbye xmlns="http://webservice_producer/goodbyeworld">
     <message xmlns="">JAX WS support Body</message>
   </sayGoodbye>
</soap:Body>
</soap:Envelope>
].

Friday, July 04, 2008

Windows Live Writer

My laptop changed, so wanted to get back to the setup I had before, been through enough trouble to get Windows Live Writer to be installed on my machine. You wish it is a MS baby, single installable, double click and boom!! Everything is installed completely.

 

Otherwise Windows Live Installer uses Windows Installer, Automatic Updates and all underlying component. Not sure why?

It uses so many components and piece in background to make it work. Basically, the installable can install any or a lot more components on your machine than required. Found garmahis.com (Thanks to Michael Garmahis) where I could get a standalone installable. There is another one if you like ... here.

Friday, July 06, 2007

Disable drag and Text selection in Firefox

Firefox is known to support most of the W3C Dom standards and IE is usually to support most non standard or I would say "IE Standard". Anyways, I still like IE because my website is viewed by mostly IE users, almost over 85%.

I had seen some people copying text from website, so I wanted to implement no drag and copy text from my website. Here is what I added to the body tag of each HTML rendered page on my site. (I know there are other ways to copy. :( )

onmousedown="javascript:clickTrap();" ondragstart="return false" ondblclick="return false" onselectstart="return false"

This stopped drag and text selection for every IE visitor on my site. Easy and simple technique allowed me to achieve what I wanted. Still there were about 15% "Standard Browser" based non standard users. They could drag and select text from my site. Searching paid off after a long time. Mozilla based browsers need to you to create a javascript event handler routine to stop the drop or use this non-standard, browser specific tags. Here is what I did. You can leave them in your CSS file because IE just ignores them and Firefox will block the drag.

<style>
    .protectedText 
    {    
        -moz-user-focus: ignore;    
        -moz-user-input: disabled;    
        -moz-user-select: none;
     }
</style>
<input class="protectedText" type="text" value="Change this"> 
<span class="protectedText">sdaf</span>

Find other such tags, that mught be useful for you.
http://www.xulplanet.com/references/elemref/ref_StyleProperties.html

Monday, May 07, 2007

Windows zip folder association

Windows has built in zip files added as folders in Windows Explorer. This feature is default support by a Windows standard install. This makes it completely difficult when there are more than on file in the folder or even if there is only one large file with a lot of files and folders inside it.

 

Here is the solution, run following on Windows /DOS command prompt.

 

"regsvr31 /u zipfldr"
(offcourse with out quotes)

If you want to register it back then

"regsvr31 zipfldr"
(offcourse with out quotes)

Chow!!

Tuesday, September 05, 2006

A National Security violation

Check out this Google Maps Api based Flight Simulator. You can fly over Washington DC. You can fly over Capitol, White House. Be careful, if you cannot maintain your altitude, it can crash into anything you want.
This is a National Threat flight simulator :)... just kidding.

Thursday, August 24, 2006

Python on the .NET Framework

One of the least talked language on web is IronPython when it became available in Microsoft CLR.
Dynamic runtime languages were previously thought to run very poorly on the .NET Framework, but IronPython dismisses that idea. Microsoft is backing IronPython because it exemplifies just how well the .NET Framework can handle dynamic runtime languages. Supposedly, IronPython runs as fast as the C-based implementation of Python-2.4, if not faster. The company claims that IronPython can run 1.8x faster than Python-2.4 right now. Besides being speedy, it also allows developers to access all of the standard C Python libraries, not to mention and create their own subclasses deriving from the .NET framework.
IronPython is the codename for a new implementation of the Python programming language on the .NET Framework. It is fast - up to 1.8x faster than Python-2.4 on the standard pystone benchmark. It supports an interactive interpreter with fully dynamic compilation as well as static compilation to produce pre-compiled executables. It's well integrated with the rest of the Framework and makes all of the .NET libraries easily available to Python programmers. In this episode Jim Hugunin introduces IronPython with demos showing interactive exploration and GUI building from a command prompt as well as simple embedding as a scripting language in an existing Windows Presentation Foundation application. Via Overview at Microsft's Download website
Still, when I read this old news, I was surprised to see Microsoft's backing on Python where they will not be investing that much of money to see a dynamic language work. Anyways, as part of research found a very interesting comparision of Ruby, Java and C++ with Python by dmh2000. This comparision is just awesome.
conclusion
Java is more productive than C/C++. Use C/C++ only when speed or bare metal access is called for. Python/Ruby is more productive than Java and more pleasant to code in. There is a big question on static vs. dynamic typing. I contend that static typing has to be better for the purposes of program correctness, but the required cruft reduces productivity. If actual practice in large systems shows that in fact runtime typing errors don't occur often and are worth the productivity tradeoff, then I will bow to dynamic typing. I can't come up with a definitive answer to Python vs. Ruby. They seem very equivalent. Would choose based on practicality in a given situation. My general feeling was that Python annoyed me in ways that Ruby didn't, but I think those annoyances would disappear if I was using Python all the time.

Wednesday, August 23, 2006

log_reuse_wait_desc column in sys.databases

Having these words in your SQL Server error in SQL Server 2005 seems a little unbearable.
The transaction log for database '%.*ls' is full. To find out why space in the log cannot be reused, see the log_reuse_wait_desc column in sys.databases
SQL Server 2005 Database Properties Window There are various reason to get the error. Transaction log expansion may occur because of the following reasons or scenarios: The linked MS Technet article does not help but confuses you.
• Uncommitted Transactions
• Extremely Large Transactions
• Operations: DBCC DBREINDEX and CREATE INDEX
• While Restoring from Transaction Log Backups
• Client Applications Do Not Process All Results
• Queries Time Out Before a Transaction Log Completes the Expansion and You Receive False 'Log Full' Error Messages
• Unreplicated Transactions
Check this FORUM POST out, excellent suggestion, set transaction recovery mode to "Simple". Try that once through database properties panel, it does not work for first time. few times it definitley works. Try changing the "Auto Shrink" and "Auto Close" properties to "True"

Tuesday, August 22, 2006

Create a Thumbnail Image of web page

How do I create cached image of a webpage. I just wanted to create a thumbnail of a webpage based on URL. There is no way, you would find the right stuff to do so. I found Alan Dean's page on Generate an image of a web page. He has explained the technique very well. Described his search for such code. He wrote on his own. There are a very few people got it working. So here is the code, took me a lot of time to get it working. Read through the sample I added here very carefully before you copy the code as is. I tried my best to write all comments to make it easy readable.
Tried it in all possible ways to make it successful the way I wanted. This code works awesome but I wanted to use System.drawing very well to make it work. There is no way I could find to do this without using Win32 Api. Apart from that, I need to add the axWebBrowser control and it needs to be visible on form in order to find the image of the web page. Then how do I do it on the fly on my website. There must be a way to create a thumbnail from webpage with out adding ActiveX controls....
Good Luck!! Let me know if this works for you.
'*************************************************************************
'This is main form Class where you will add the basic functions.
'*************************************************************************


Imports
SHDocVw ' Import the shdocvw.dll from Widnows\System32 folder.
Imports mshtml  ' Import the mshtml.dll from Widnows\System32 folder.
Imports System.Runtime.InteropServices ' Need this as we added above two as Interop

Imports
System.Windows.Forms

Public
Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        'Add the axWebBrowser control from SHDocVw library to your form name it as axWebBrowser
        'Add the Event Handler as DocumentComplete, because we need to capture screen image when document is completely loaded.
        AddHandler axWebBrowser.DocumentComplete, AddressOf Me.OnDocumentComplete
        End Sub
      Private Sub OnDocumentComplete(ByVal sender As Object, ByVal e As AxSHDocVw.DWebBrowserEvents2_DocumentCompleteEvent)
 
        Dim document As IHTMLDocument2 = CType(Me.axWebBrowser.Document, IHTMLDocument2)
        If Not (document Is Nothing) Then
            Dim element As IHTMLElement = CType(document.body, IHTMLElement)
            If Not (element Is Nothing) Then
                Dim render As IHTMLElementRender = CType(element, IHTMLElementRender)
                If Not (render Is Nothing) Then
                    ' Using
                    Dim graphics As Graphics = Me.pictureBox.CreateGraphics
                    Try
                        Dim hdcDestination As IntPtr = graphics.GetHdc
                        render.DrawToDC(hdcDestination)
                        Dim hdcMemory As IntPtr = gdi32.CreateCompatibleDC(hdcDestination)
                        Dim bitmap As IntPtr = gdi32.CreateCompatibleBitmap(hdcDestination, Me.axWebBrowser.ClientRectangle.Width, Me.axWebBrowser.ClientRectangle.Height)
                        If Not (bitmap = IntPtr.Zero) Then
                            Dim hOld As IntPtr = CType(gdi32.SelectObject(hdcMemory, bitmap), IntPtr)
                            gdi32.BitBlt(hdcMemory, 0, 0, Me.axWebBrowser.ClientRectangle.Width, Me.axWebBrowser.ClientRectangle.Height, hdcDestination, 0, 0, CType(gdi32.TernaryRasterOperations.SRCCOPY, Integer))
                            gdi32.SelectObject(hdcMemory, hOld)
                            gdi32.DeleteDC(hdcMemory)
                            graphics.ReleaseHdc(hdcDestination)

                            'Add a PictureBox control to your form, named pictureBox. This way you can
                            'see the image immediately after it is generated. You can save to FS using Bitmap.Save method.
                            Me.pictureBox.Image = Image.FromHbitmap(bitmap)

                        End If

                    Finally

                        'You must dispose Graphics Object for better use.
                        CType(graphics, IDisposable).Dispose()
                    End Try
                End If
            End If
        End If
    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        ' Add a button to you form named Button1.
        ' This way we can control when we want to start Browsing.
        ' Select the URI to be browsed here.
        Me.axWebBrowser.Navigate(New Uri("http://www.google.com"))
 
    End Sub
End Class
'*************************************************************************
'This class for dummy for calling GDI Functions from Win32 Api.
'So that you can encapsulate whole GDI work outside.
'*************************************************************************
Public Class gdi32

    ' I copied all the signatures in this class from http://www.pinvoke.net 
 
    Public Declare Function DeleteDC Lib "gdi32.dll" (ByVal hdc As IntPtr) As Boolean
    Public Declare Function SelectObject Lib "gdi32.dll" (ByVal hdc As IntPtr, ByVal hgdiobj As IntPtr) As IntPtr
    Public Declare Function CreateCompatibleDC Lib "gdi32" (ByVal hDC As IntPtr) As IntPtr
    Public Declare Function CreateCompatibleBitmap Lib "gdi32" (ByVal hDC As IntPtr, ByVal nWidth As Integer, ByVal nHeight As Integer) As IntPtr
    Public Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As IntPtr, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As IntPtr, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Integer) As Integer
    Enum TernaryRasterOperations As Integer
 
        SRCCOPY = 13369376      'dest = source
        SRCPAINT = 15597702     'dest = source OR dest
        SRCAND = 8913094        'dest = source AND dest
        SRCINVERT = 6684742     'dest = source XOR dest
        SRCERASE = 4457256      'dest = source AND (NOT dest )
        NOTSRCCOPY = 3342344    'dest = (NOT source)
        NOTSRCERASE = 1114278   'dest = (NOT src) AND (NOT dest)
        MERGECOPY = 12583114    'dest = (source AND pattern)
        MERGEPAINT = 12255782   'dest = (NOT source) OR dest
        PATCOPY = 15728673      'dest = pattern
        PATPAINT = 16452105     'dest = DPSnoo
        PATINVERT = 5898313     'dest = pattern XOR dest
        DSTINVERT = 5570569     'dest = (NOT dest)
        BLACKNESS = 66          'dest = BLACK
        WHITENESS = 16711778    'dest = WHITE
    End Enum
End Class

'Check out Alan Dean's explaination, because I don;t get it. He is smarter than me, so I just believed that it works.
<Guid("3050f669-98b5-11cf-bb82-00aa00bdce0b"), System.Runtime.InteropServices.InterfaceTypeAttribute(System.Runtime.InteropServices.ComInterfaceType.InterfaceIsIUnknown), System.Runtime.InteropServices.ComVisible(True), System.Runtime.InteropServices.ComImport()> _
Interface IHTMLElementRender
    Sub DrawToDC(<System.Runtime.InteropServices.In()> ByVal hDC As IntPtr)
    Sub SetDocumentPrinter(<System.Runtime.InteropServices.In(), System.Runtime.InteropServices.MarshalAs(UnmanagedType.BStr)> ByVal bstrPrinterName As String, <System.Runtime.InteropServices.In()> ByVal hDC As IntPtr)
End Interface