Tuesday, November 22, 2011

How to Make Most Accessible Examples in The World

This video is done by Max Rydahl Andersen

Making Examples Accessible from Max Rydahl Andersen on Vimeo.

Slides as used at JUDCon 2011 for evening lightning talk. Audio was recorded later for the publishing as video.

In this video you will learn about the best way to provide examples. It is based on analysis of JBoss Tools Examples component and you'll know:
  1. Why examples are the important part of any project
  2. What is the best way to provide build support for examples
  3. What is the most usable IDE's and Operation Systems
  4. Who is installing examples and what languages would be most popular
  5. What build + IDE + OS + Language combination for examples would be most popular

Tuesday, January 4, 2011

How to get rid of .blobstore during mirroring eclipse update site using p2.mirror ant task

Mirroring eclipse p2 repositories is fairly simple. It just requires to read an article here and after that it supposed to be simple, but after it finally works I noticed that format of p2 repo it creates is not the same as downloaded from eclipse. The difference is in the way artifacts packed with pack200 are stored. Whatever you do with p2.mirror parameters all pack200 packed artifacts are published in .blobstore instead of *.jar.pack.gz files.

After digging repos available on eclipse I found a solution to controls that. Magic is in format attribute of destination tag. Documentation says: "A URL to another repository from which to copy the repository name and other properties". It gave me an idea to find p2 repo on download.eclipse.org with jar.pack.gz files and check its properties in artifacts.xml. Soon I noticed a property that controls it

<property name="publishPackFilesAsSiblings" value="true/">

So if you want to get rid of .blobstore in mirrored p2 repo just create artifacts.xml file like



  
     <property name="publishPackFilesAsSiblings" value="true"/>
  

Then in destination tag format attribute use URL to folder that contains artifacts.xml file with content provided above and p2.mirror task will copy 'publishPackFilesAsSiblings' attribute to your local mirror. This will force mirroring task to store artifacts packed with pack200 as jar.pack.gz files.

Friday, September 10, 2010

How to Get Decent Eclipse Based XML Editor Without Downloading Whole Eclipse SDK and Web Tools Binaries

If you're not going to develop Java application, plug-in or debug Eclipse based applications there is no reason to download whole bunch of archives with all eclipse features you're never going to use. So to keep your XML Editor small and free from UI clattering follow this simple steps:
  • Download Eclipse Platform 3.6.X from http://www.eclipse.org, which is only 50M instead of 170M for Classic Eclipse SDK
  • Unpack it somewhere to your local file system (this folder is referenced as ${eclipse} below in this article)
  • Start it by executing ${eclipse}/eclipse or ${eclipse}/eclipse.exe which depends on your operation system
  • Select folder that is going to be used to keep your stuff like new projects, if you're going to create something
  • Open "Install" dialog using "Help->Install New Software..." in bar menu
  • Install "Web, XML, and Java EE Development->Eclipse XML Editors and Tools" form "Helios - http://download.eclipse.org/releases/helios/" update site
  • Wait while Eclipse is downloaded selected software
  • Restart Eclipse when downloading and installation are finished and Eclipse asks you what you want to do
You're done with installation and now have fully functional XML editor with the lots features like: templates, content assist and validation based on DTD or XML Schema.

Thursday, July 29, 2010

Running RHEL 5 as a Guest Under Ubuntu 10.04 Lucid

I recently tried to run RHEL5 as guest under Ubuntu Linux 10.04 Lucid and my experiment ended with weird messages like shown below. It just popped up during running kvm and there were no way to fix it but start qemu without kvm. It helped but was so slow that almost unusable unless you have plenty of time to wait.
MP-BIOS bug: 8254 timer not connected to IO-APIC
After several attempts to fix it and get working RHEL5 for testing I found this post which has several options that works for test instance of RHEL5. It turned out simple kvm options like
-no-kvm-irqchip
-no-kvm-pit.    
can be used to make it boots like expected and it still works pretty fast versus -nokvm option.

Monday, April 26, 2010

Some CAPTCHA Says to Me: "You're a computer"

CAPTCHA is "Completely Automated Public Turing test to tell Computers and Humans Apart" as Wikipedia says here. I failed for example to recognize this sequence generated by Google and that's not the only example ;)

Friday, April 16, 2010

JDT Uses Jikes Parser Generator (jikespg)

Eclipse JDT Uses Jikes PG to generate Java Parser as it declared here in developer resources [1]. It is implements techniques that allow to reduce memory consumption, to increase speed and support automatic error recovery.

Follow the links below to get it compiled, if JDT parser generation fails with something looking like this

eskimo@dgolovin-desktop:~/Projects/jbds-build/addition/org.eclipse.jdt.core/grammar$ ~/bin/jikespg java.g

 IBM Research Jikes Parser Generator            Mon Apr 26 16:06:10 2010
%OPTIONS ACTION, AN=JavaAction.java, GP=java, 
%OPTIONS FILE-PREFIX=java, ESCAPE=$, PREFIX=TokenName, OUTPUT-SIZE=125 ,
%OPTIONS NOGOTO-DEFAULT, SINGLE-PRODUCTIONS, LALR=1 , TABLE, 
%OPTIONS ERROR_MAPS 
%OPTIONS first follow
%OPTIONS TRACE=FULL ,
%OPTIONS VERBOSE
%OPTIONS DEFERRED
%OPTIONS NAMES=MAX
%OPTIONS SCOPES
Options in effect:
    ACTION  ACTFILE-NAME=JavaAction.java  BLOCKB=/.  BLOCKE=./  BYTE  CONFLICTS
    DEFAULT=5  NODEBUG  DEFERRED  NOEDIT  ERROR-MAPS  ESCAPE=$  
    FILE-PREFIX=java  FIRST  FOLLOW  GENERATE-PARSER=JAVA  NOGOTO-DEFAULT  
    HACTFILE-NAME=javahdr.java  HBLOCKB=/:  HBLOCKE=:/  LALR=1  LIST  
    MAX-DISTANCE=30  MIN-DISTANCE=3  NAMES=MAXIMUM  NONT-CHECK  ORMARK=|  
    OUTPUT-SIZE=125  PREFIX=TokenName  READ-REDUCE  SCOPES  NOSHIFT-DEFAULT  
    SINGLE-PRODUCTIONS  STACK-SIZE=128  STATES  SUFFIX=  TABLE=SPACE  
    TRACE=FULL  VERBOSE  WARNINGS  XREF  

*** buffer overflow detected ***: /home/eskimo/bin/jikespg terminated
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)[0xb7821ed8]
/lib/tls/i686/cmov/libc.so.6[0xb7820f10]
/lib/tls/i686/cmov/libc.so.6[0xb782023a]
/home/eskimo/bin/jikespg[0x805be3a]
/home/eskimo/bin/jikespg[0x805cd7e]
/home/eskimo/bin/jikespg[0x805d4f6]
/home/eskimo/bin/jikespg[0x805dc9d]
/home/eskimo/bin/jikespg[0x805f850]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe6)[0xb7757b56]
/home/eskimo/bin/jikespg[0x8048bc1]
======= Memory map: ========
08048000-08089000 r-xp 00000000 08:03 9437834    /home/eskimo/bin/jikespg
08089000-0808a000 r--p 00040000 08:03 9437834    /home/eskimo/bin/jikespg
0808a000-0808b000 rw-p 00041000 08:03 9437834    /home/eskimo/bin/jikespg
0808b000-0808c000 rw-p 00000000 00:00 0 
086e6000-0872a000 rw-p 00000000 00:00 0          [heap]
b7710000-b772c000 r-xp 00000000 08:02 9088       /lib/libgcc_s.so.1
b772c000-b772d000 r--p 0001b000 08:02 9088       /lib/libgcc_s.so.1
b772d000-b772e000 rw-p 0001c000 08:02 9088       /lib/libgcc_s.so.1
b7740000-b7741000 rw-p 00000000 00:00 0 
b7741000-b787f000 r-xp 00000000 08:02 9011       /lib/tls/i686/cmov/libc-2.10.1.so
b787f000-b7880000 ---p 0013e000 08:02 9011       /lib/tls/i686/cmov/libc-2.10.1.so
b7880000-b7882000 r--p 0013e000 08:02 9011       /lib/tls/i686/cmov/libc-2.10.1.so
b7882000-b7883000 rw-p 00140000 08:02 9011       /lib/tls/i686/cmov/libc-2.10.1.so
b7883000-b7886000 rw-p 00000000 00:00 0 
b7895000-b789a000 rw-p 00000000 00:00 0 
b789a000-b789b000 r-xp 00000000 00:00 0          [vdso]
b789b000-b78b6000 r-xp 00000000 08:02 22970      /lib/ld-2.10.1.so
b78b6000-b78b7000 r--p 0001a000 08:02 22970      /lib/ld-2.10.1.so
b78b7000-b78b8000 rw-p 0001b000 08:02 22970      /lib/ld-2.10.1.so
bfc3f000-bfc54000 rw-p 00000000 00:00 0          [stack]
Aborted

remove optimization flag

-O1
from
jikespg/src/Makefile
and compile it again. It should be enough to fix it and get parser generated. Output for generating JDT parser based on java.g grammar should look like this:
eskimo@dgolovin-desktop:~/Projects/jbds-build/addition/org.eclipse.jdt.core/grammar$ ~/bin/jikespg java.g

 IBM Research Jikes Parser Generator            Mon Apr 26 16:18:22 2010
%OPTIONS ACTION, AN=JavaAction.java, GP=java, 
%OPTIONS FILE-PREFIX=java, ESCAPE=$, PREFIX=TokenName, OUTPUT-SIZE=125 ,
%OPTIONS NOGOTO-DEFAULT, SINGLE-PRODUCTIONS, LALR=1 , TABLE, 
%OPTIONS ERROR_MAPS 
%OPTIONS first follow
%OPTIONS TRACE=FULL ,
%OPTIONS VERBOSE
%OPTIONS DEFERRED
%OPTIONS NAMES=MAX
%OPTIONS SCOPES
Options in effect:
    ACTION  ACTFILE-NAME=JavaAction.java  BLOCKB=/.  BLOCKE=./  BYTE  CONFLICTS
    DEFAULT=5  NODEBUG  DEFERRED  NOEDIT  ERROR-MAPS  ESCAPE=$  
    FILE-PREFIX=java  FIRST  FOLLOW  GENERATE-PARSER=JAVA  NOGOTO-DEFAULT  
    HACTFILE-NAME=javahdr.java  HBLOCKB=/:  HBLOCKE=:/  LALR=1  LIST  
    MAX-DISTANCE=30  MIN-DISTANCE=3  NAMES=MAXIMUM  NONT-CHECK  ORMARK=|  
    OUTPUT-SIZE=125  PREFIX=TokenName  READ-REDUCE  SCOPES  NOSHIFT-DEFAULT  
    SINGLE-PRODUCTIONS  STACK-SIZE=128  STATES  SUFFIX=  TABLE=SPACE  
    TRACE=FULL  VERBOSE  WARNINGS  XREF  

*** The following Terminals are useless: 
        const  goto  

This grammar is LALR(1).

Number of Terminals: 110
Number of Nonterminals: 312
Number of Productions: 704
Number of Single Productions: 232
Number of Items: 2203
Number of Scopes: 134
Number of States: 970
Number of Shift actions: 6060
Number of Goto actions: 7523
Number of Shift/Reduce actions: 590
Number of Goto/Reduce actions: 1047
Number of Reduce actions: 14139
Number of Shift-Reduce conflicts: 0
Number of Reduce-Reduce conflicts: 0

Length of base Action Table: 12223
Number of entries in base Action Table: 9540
Percentage of increase: 28.1%
Storage required for base Tables: 24446 Bytes, 24K
Storage required for Rules: 2109 Bytes
Number of unique terminal states: 743
Number of Shift actions saved by merging: 4084
Number of Reduce actions saved by merging: 912
Number of Reduce saved by default: 9127

Length of Terminal Check Table: 8110
Length of Terminal Action Table: 8072
Number of entries in Terminal Action Table: 7409
Percentage of increase: 8.9%
Storage required for Terminal Tables: 24254 Bytes, 24K
Total storage required for Tables: 48700 Bytes, 48K


Actions in Compressed Tables:
     Number of Shifts: 2241
     Number of Shift/Reduces: 325
     Number of Gotos: 7523
     Number of Goto/Reduces: 1047
     Number of Reduces: 4100
     Number of Defaults: 491

Error maps storage:
    Storage required for ACTION_SYMBOLS_BASE map: 1940 Bytes
    Storage required for ACTION_SYMBOLS_RANGE map: 1707 Bytes
    Storage required for NACTION_SYMBOLS_BASE map: 1940 Bytes
    Storage required for NACTION_SYMBOLS_RANGE map: 984 Bytes
    Storage required for TERMINAL_INDEX map: 220 Bytes
    Storage required for NON_TERMINAL_INDEX map: 626 Bytes
    Storage required for STRING_BUFFER map: 12328 Bytes

***Warning: Base Check vector contains value > 127. 16-bit words used.
Escaped symbol $eof is an invalid C variable.

Escaped symbol $error is an invalid C variable.

Links:

Build XULRunner Eclipse p2 Repo with Tycho

Prerequisites

  • Maven 3.0.0.alpha7
  • Scala
  • Subversive command line client
  • Java SE 1.5+

Environment used to write this article

eskimo@desktop:~/Projects/jbt-xulrunner$ ~/Java/apache-maven-3.0-alpha-7/bin/mvn -v
Apache Maven 3.0-alpha-7 (r921173; 2010-03-09 14:31:07-0800)
Java version: 1.6.0_0
Java home: /usr/lib/jvm/java-6-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux" version: "2.6.31-21-generic-pae" arch: "i386" Family: "unix"

It is very simple process because Tycho does all work for you. All you need is to follow simple steps below.

Create separate folder for XULRunner build and make it current

eskimo@desktop:~/Projects$ mkdir jbt-xulrunner
eskimo@desktop:~/Projects$ cd jbt-xulrunner

Checkout XULRunner component from JBoss Tools Subversion repository. You need to use modular_build branch. It is temporary branch that is going to be merged to trunk next week, but I think it will stay here for a while after merge is happened.

First root only should be checked out from branch to avoid pulling out whole gigantic repository.

eskimo@desktop:~/Projects/jbt-xulrunner$ svn co --depth=files https://anonsvn.jboss.org/repos/jbosstools/branches/modular_build .

Then the same should be done for xulrunner component

eskimo@desktop:~/Projects/jbt-xulrunner$ svn co https://anonsvn.jboss.org/repos/jbosstools/branches/modular_build/xulrunner

After steps above it gets us to the JBoss Tools repository structure but with the only component.

Next step is pom.xml files generation, because this branch contains only parent-pom.xml in root. Scala is used to do it.

eskimo@desktop:~/Projects/jbt-xulrunner$ scala genpom.scala
Generate Agg for ./xulrunner
Modules: 8 Aggregator: 4

Now working copy is ready to build XULRunner Eclipse Feature and generate p2-repo for it. Make sure you are using maven3.

eskimo@desktop:~/Projects/jbt-xulrunner$ mvn install

In the end it should look like

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] trunk ............................................. SUCCESS [0.639s]
[INFO] xulrunner.all ..................................... SUCCESS [0.034s]
[INFO] xulrunner.plugins ................................. SUCCESS [0.006s]
[INFO] org.mozilla.xulrunner.cocoa.macosx ................ SUCCESS [5.637s]
[INFO] org.mozilla.xulrunner.gtk.linux.x86 ............... SUCCESS [3.595s]
[INFO] org.mozilla.xpcom ................................. SUCCESS [0.455s]
[INFO] org.mozilla.xulrunner.win32.win32.x86 ............. SUCCESS [3.238s]
[INFO] org.mozilla.xulrunner.gtk.linux.x86_64 ............ SUCCESS [4.083s]
[INFO] org.mozilla.xulrunner.carbon.macosx ............... SUCCESS [3.721s]
[INFO] site.all .......................................... SUCCESS [0.203s]
[INFO] org.mozilla.xulrunner.feature ..................... SUCCESS [0.563s]
[INFO] org.mozilla.xpcom.feature ......................... SUCCESS [0.571s]
[INFO] org.mozilla.xulrunner.site ........................ SUCCESS [4.045s]
[INFO] xulrunner.features ................................ SUCCESS [0.024s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:03.643s
[INFO] Finished at: Fri Apr 16 10:18:01 PDT 2010
[INFO] Final Memory: 89M/195M
[INFO] ------------------------------------------------------------------------

After that XULRunner Feature can be installed using p2repo from

xulrunner/site/org.mozilla.xulrunner.site/target/site

It should look in Eclipse Update dialog like on images below