Could not load file or assembly ‘SAP.Connector, Version=2.0.0.0

I was doing fine in Visual Studio (VS 2013) with a piece of SAP integrated code. Somehow, when I deployed the web application to IIS 6. I got the following error.

“Could not load file or assembly ‘SAP.Connector, Version=2.0.0.0, Culture=neutral, PublicKeyToken=50436dca5c7f7d23′ or one of its dependencies. The system cannot find the file specified.”

What you need to do is download the SAP.Connect.dll and put into bin folder of your web application. You can download the dll from SAP site.

I actually found the dll here http://www.codeproject.com/Articles/18187/SAP-connector-for-Microsoft-NET.

Posted in .Net | Tagged , , , | Leave a comment

Refection using Java

This short article show how Reflection works using Java.

I am extract the source from http://examples.javacodegeeks.com/core-java/reflection/java-reflection-example/.

First you need to import the following namespace.

import java.lang.reflect.*;

You have a class with a method in RentCar

public class RentCar {

private int rate;

 

public void computeRentalCost(int numDays) {

            price = numDays * rate;

            System.out

                        .println(“The cost of your rental car is “ + price + ” euros”);

      }

}

To do Reflection (code fragment below).

Class rental = RentCar.class;

// get method with specific name and parameters

Method oneMethod = rental.getMethod(“computeRentalCost”,

    new Class[] { Integer.TYPE });

System.out.println(“Method is: “ + oneMethod);

 

// call computeRentalCost method with parameter int

oneMethod.invoke(rent, 4);

 

// get all the parameters of computeRentalCost

Class[] parameterTypes = oneMethod.getParameterTypes();

System.out.println(“Parameter types of computeRentalCost() are: “

                              + Arrays.toString(parameterTypes));

The re-upload the project to http://skydrive.live.com. The sample file name is JavaReflectionExample2.zip My MSN ID is chanmmn@hotmail.com.

Posted in Java, Oracle | Tagged , | Leave a comment

java was started by returned exit code=13 when starting eclipse

I believe some of you have hit the below error.

“java was started by returned exit code=13”

 javaerror

This could due to your eclipse version and java version. Especial when your eclipse is 32 bit and your jdk is 64 bit.

For me my eclipse and java both 64 bit but I still get the error. I uninstall jdk 1.7 update 11 and installed jdk 1.7 update 75 then the problem solved.

Posted in Java, Oracle | Tagged , , | 1 Comment

Convert PDF to Microsoft Word

Microsoft Word is able to convert the pdf file and open for reading. I am using Word 2013 so not sure whether the version earlier than 2013 can do that.

In Microsoft Word choose File – Open then select the pdf. You will get the screen below.

pdftoword 

Posted in Community, Microsoft Office | Tagged , , | Leave a comment

Microsoft OneNote is free

I have seen quite a number of people like to use OneNote. Microsoft OneNote comes with Office anyway. Probably Mac users can use it without getting Microsoft Office, have a try.

Follow this link to download OneNote: http://blogs.office.com/2015/02/13/onenote-now-even-free/

Posted in Community, Microsoft Office | Tagged , | Leave a comment

Java EE 6 running sample Pet Catalog

Last Friday I bought The Java EE 6 Tutorial: Basic Concepts (4th Edition) (Java Series) (http://www.amazon.com/dp/0137081855/ref=dra_a_rv_ff_fx_it_P2000_1000?tag=dradisplay-20&ascsubtag=867a2d757c497c5dc77446d43be3025f_S&dra_hfr=1&dra_ohs=0-0) for revision.

The bad thing are

1. The source code of the book cannot be downloaded.

2. The book is asking you to use NetBean and not Eclipse.

I ended installing NetBean and got the Pet Catalog example to try. You can do that by choosing File -> New Project… -> Samples.

 nb0

The sample will automatically downloaded into your local drive. Something tricky in the setup instruction.

You cannot setup the JDBC resources in NetBean.

 nb

You need go to GlassFish Admin Console if order to add the JDBC Connection Pools and JDBC Resources.

 nb1

nb2 

My personal opinion. NetBean IDE is friendlier than Eclipse. At least there are many samples you can download from the NetBean IDE itself.

Resources:

https://netbeans.org/kb/docs/javaee/ecommerce/setup.html

https://netbeans.org/kb/samples/pet-catalog.html

https://weblogs.java.net/blog/caroljmcdonald/archive/2009/08/java_ee_6_pet_c.html

Posted in Java | Tagged , , , , | Leave a comment

Façade Design Pattern

This article shows how to create a code using Façade Design Pattern in C#.

As discussed in dofactory.com Façade is a single class that represents an entire subsystem.     

The article that is easier to understand is http://www.dofactory.com/net/facade-design-pattern. My source code is based on this article.

Logical diagram of Façade Design Pattern.

clip_image001

First, create all the subsystem. In this example, we have 4 subsystems.

class SubSystemOne

{

  public void MethodOne()

  {

    Console.WriteLine(” SubSystemOne Method”);

  }

}

 

class SubSystemTwo

{

  public void MethodTwo()

  {

    Console.WriteLine(” SubSystemTwo Method”);

  }

}

 

class SubSystemThree

{

  public void MethodThree()

  {

    Console.WriteLine(” SubSystemThree Method”);

  }

}

 

{

  public void MethodFour()

  {

    Console.WriteLine(” SubSystemFour Method”);

  }

}

 Then, create a Façade class.

class Facade

{

  private SubSystemOne _one;

  private SubSystemTwo _two;

  private SubSystemThree _three;

  private SubSystemFour _four;

 

  public Facade()

  {

    _one = new SubSystemOne();

    _two = new SubSystemTwo();

    _three = new SubSystemThree();

    _four = new SubSystemFour();

  }

 

  public void MethodA()

  {

    Console.WriteLine(“\nMethodA() —- “);

    _one.MethodOne();

    _two.MethodTwo();

    _four.MethodFour();

  }

 

  public void MethodB()

  {

    Console.WriteLine(“\nMethodB() —- “);

    _two.MethodTwo();

    _three.MethodThree();

  }

}

 

Finally, below is how the main method will look.

public static void Main()

{

  Facade facade = new Facade();

 

  facade.MethodA();

  facade.MethodB();

 

  // Wait for user

  Console.ReadKey();

} 

You can also download a single solution from http://skydrive.live.com. The sample file name is ConAppFacade.zip My MSN ID is chanmmn@hotmail.com.

Posted in .Net | Tagged , , | Leave a comment