Archive

Archive for March, 2006

Ruby iteractive debugging

30 March, 2006 Comments off

Buggy code, me? Never! If you have a problem with buggy code though your in luck ruby has a debugger baked in:

Simply run ruby with the debug flag:

ruby –r debug test.rb

USEFUL COMMANDS

list – List the source code, pass in a number range to filter the list. For example to list the lines 1 to 9:

list 1-9

b – Set a break point, pass a line number to break on. For example to break on line 7:

b 7

c – Continue program until breakpoint or end of program

disp – Display the contents of a variable. For example to see the contents of the look_at_me variable:

display look_at_me

watch – Set a watchpoint on a variable. For example to break when the variable meaning_of_life equals 42:

watch meaning_of_life=42
c

del – Delete a breakpoint or watchpoint. For example to delete the first breakpoint we created:

del 1
Categories: Ruby

Ruby unit testing – Setting up your project folder for testing

30 March, 2006 Comments off

Its a good idea to keep your test cases seperate from your production code:

  myproject
      lib/
          workomatic.rb
      test/
          test_workomatic.rb

When you have your project setup in this way add the following line to the top of your test cases:

Inside test_workomatic.rb

  $:.unshift File.join(File.dirname(__FILE__), "..", "lib")
  require workomatic.rb

Now when you run this test case the workomatic.rb file and all supporting files in the lib folder will be picked up.

Categories: General

Ruby unit tests – run only one test method

30 March, 2006 Comments off

What if you don’t wish to run all the unit tests in your test case?

You can tell ruby to run only one test method by passing in the name of the test:

  ruby test_mytestcase.rb --name test_just_this_method
Categories: Ruby, Testing, Watir

SAP Portal: How do I reference a Javascript file in my iView?

28 March, 2006 Comments off

Easy when you know how

public void doInitialization(){
  request = (IPortalComponentRequest)this.getRequest();
  response = (IPortalComponentResponse)this.getResponse();
  IResource jsResource = request.getResource(IResource.SCRIPT, “scripts/myscript.js”);
  response.addResource(jsResource);
}
Categories: SAP Enterprise Portal

How do I find the url of my SAP Portal Component?

22 March, 2006 Comments off

Try this…

In SAP Netweaver Developer Studio

Open your project

Open the file:

MyPortalProject
    dist
        PORTAL-INF
            Portalapp.xml

You should now see a “Run…” button for each portal component in your project

Click the “Run…” button and the dev studio will open up a new browser window with the url to your component.

Categories: SAP Enterprise Portal

Installing Subclipse for SAP NetWeaver Developer Studio 2.0.13

20 March, 2006 2 comments

First download the correct version of Subclipse:

Download the Eclipse 2.x version

Extract the zip file and copy the two folders:

org.tigris.subversion.subclipse.core_0.9.3.3
org.tigris.subversion.subclipse.ui_0.9.3.3

To your plugins folder, in my case:

C:\\Program Files\\SAP\\JDT\\eclipse\\plugins

Fire up the developer studio and you should now have the subversion perspective available.

Menu: Window => Open Perspective => Other…

Select SVN Repository Exploring from the dialog.

Right click on the SVN Repository windows to add a new repository:

Menu: New => Repository Location…

You will now see the following dialog:

New Repository Dialog

Simply enter your subversion server address and user/password if required.

You should now see your source code, right click on the Trunk folder of a project and select Check Out as Project.

Cogs will start turning and when finished you will have a shiny new project to play with.

Categories: SAP Enterprise Portal

Installing SAP Netweaver Developer studio

16 March, 2006 1 comment

Before installing the studio you must first install the Java SDK:

j2sdk-1_4_2_06-windows-i586-p.exe

Just accept the defaults.

Now install Netweaver Depeloper studio (SP13 in my case)

NWDS_SP13\J2EE-RUNT-CD\IDE\JDTsetup.exe

Install all components.

You will be asked for the location of the Java SDK which if you accepted the default should be:

C:\j2sdk1.4.2_06

Next enter your proxy settings, wwwcache:8080 in my case.

Now sit back, relax and wait for the long install to finish!

Categories: SAP Enterprise Portal