<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2366790494689646605</id><updated>2024-08-31T11:08:44.115+02:00</updated><category term="spring"/><category term="compass"/><category term="eclipse"/><category term="experience"/><category term="farsi"/><category term="hibernate"/><category term="lucene"/><category term="pdf"/><category term="persian"/><category term="poi"/><category term="software"/><category term="acegi"/><category term="arabic"/><category term="birt"/><category term="cache"/><category term="calendar"/><category term="cas"/><category term="contextor"/><category term="date"/><category term="date pattern"/><category term="django"/><category term="dojo"/><category term="gwt"/><category term="ibm"/><category term="icu"/><category term="jalali"/><category term="javascript"/><category term="jsni"/><category term="json"/><category term="locale"/><category term="localized"/><category term="lucid"/><category term="lucid lynx"/><category term="management"/><category term="myisam"/><category term="mysql"/><category term="object"/><category term="oc4j"/><category term="pdfbox"/><category term="performance"/><category term="project"/><category term="project-management"/><category term="python"/><category term="rest"/><category term="restful"/><category term="roo"/><category term="sdpl"/><category term="shaping"/><category term="software-process"/><category term="static"/><category term="swt"/><category term="ticket"/><category term="trust"/><category term="tune"/><category term="ubuntu"/><category term="widget"/><category term="xul"/><category term="تجربه"/><category term="تقویم"/><category term="طراحی"/><category term="فارسی"/><category term="مدیریت"/><category term="نرم افزار"/><title type='text'>Tech Scribbling</title><subtitle type='html'>A bit of everything in software development.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>14</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-5672590577601543779</id><published>2011-09-02T17:01:00.000+02:00</published><updated>2011-09-02T17:01:40.382+02:00</updated><title type='text'>I&#39;ve moved</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
It&#39;s been a while since I&#39;ve been writing at narmnevis.com &lt;a href=&quot;http://blog.narmnevis.com/&quot;&gt;blog&lt;/a&gt;.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/5672590577601543779/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2011/09/ive-moved.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/5672590577601543779'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/5672590577601543779'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2011/09/ive-moved.html' title='I&#39;ve moved'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-1349932299741972708</id><published>2010-07-02T14:35:00.000+02:00</published><updated>2010-07-02T14:35:46.861+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="json"/><category scheme="http://www.blogger.com/atom/ns#" term="rest"/><category scheme="http://www.blogger.com/atom/ns#" term="restful"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Custom JSON serialization with Spring MVC</title><content type='html'>With the rise of Spring RESTful support and the existence of JSON libraries in Java, there could come up the problem of JSON serialization of custom domain models to views. In this article, through the example, I want to share my experience on how to serialize some custom model with JSON through Spring MVC configuration.&lt;br /&gt;
&lt;br /&gt;
Spring 3.0 introduces the notion of &lt;a href=&quot;http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/servlet/view/ContentNegotiatingViewResolver.html&quot;&gt;ContentNegotiatingViewResolver&lt;/a&gt; that is a way to configure Spring to respond to certain media types such &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;application/xml&lt;/span&gt; or &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;application/json&lt;/span&gt; while letting others do their routine job. More details on this could be found at &lt;a href=&quot;http://www.jroller.com/eyallupu/entry/content_negotiation_using_spring_mvc&quot;&gt;here&lt;/a&gt; and &lt;a href=&quot;http://www.rickherrick.com/?q=node/63&quot;&gt;here&lt;/a&gt;.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
In this sample, I am going to serialize the instances of the model &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;Customer&lt;/span&gt; to be used in an AJAX-based combo box. There are some steps to go through:&lt;br /&gt;
&lt;br /&gt;
&lt;ol&gt;
&lt;li&gt;Write the custom JSON serializer&lt;/li&gt;
&lt;li&gt;Define and configure the JSON serializer factories in configuration files&lt;/li&gt;
&lt;li&gt;Configure the content negotiating view resolver to take care of the JSON requests&lt;/li&gt;
&lt;/ol&gt;
&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Step One&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The JSON library that I using in this project is &lt;a href=&quot;http://wiki.fasterxml.com/JacksonDocumentation&quot;&gt;Jackson JSON&lt;/a&gt;. Simply, we write a custom serializer for Customer model:&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public class CustomerSerializer extends JsonSerializer&lt;customer&gt; {

 protected final Log logger = LogFactory.getLog(getClass());

 @Override
 public void serialize(Customer value, JsonGenerator jgen, SerializerProvider provider) throws IOException,
   JsonProcessingException {
  jgen.writeStartObject();
  jgen.writeFieldName(&quot;id&quot;);
  jgen.writeNumber(value.getId());
  jgen.writeFieldName(&quot;name&quot;);
  jgen.writeString(value.toString());
  jgen.writeEndObject();
  logger.debug(&quot;Customer [&quot; + value + &quot;] mapped to JSON&quot;);
 }

}
&lt;/customer&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step Two&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Now, I need some configurable factory bean in Spring that would hold my custom domain models for JSON serialization and also it is an instance of &lt;a href=&quot;http://jackson.codehaus.org/1.5.1/javadoc/org/codehaus/jackson/map/ser/CustomSerializerFactory.html&quot;&gt;CustomSerializerFactory&lt;/a&gt;. Simply, I extend it:&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public class CustomSerializerFactoryRegistry extends CustomSerializerFactory implements InitializingBean {

 protected final Log logger = LogFactory.getLog(getClass());

 private Map&amp;lt;Class, JsonSerializer&amp;gt; serializers = new HashMap&amp;lt;Class, JsonSerializer&amp;gt;();

 @Override
 public &amp;lt;T&amp;gt; JsonSerializer&amp;lt;T&amp;gt; createSerializer(Class&amp;lt;T&amp;gt; type, SerializationConfig config) {
  JsonSerializer&amp;lt;T&amp;gt; serializer = super.createSerializer(type, config);
  logger.debug(&quot;Found serializer [&quot; + serializer + &quot;] for type [&quot; + type + &quot;].&quot;);
  return serializer;
 }

 @Override
 public void afterPropertiesSet() throws Exception {
  for (Map.Entry&amp;lt;Class, JsonSerializer&amp;gt; e : serializers.entrySet()) {
   addGenericMapping(e.getKey(), e.getValue());
  }
  logger.info(&quot;Registered all serializers: &quot; + serializers);
 }

 public void setSerializers(Map&amp;lt;Class, JsonSerializer&amp;gt; serializers) {
  this.serializers = serializers;
 }

}
&lt;/pre&gt;
&lt;br /&gt;
With my CustomSerializerFactoryRegistry, I can easily register all the custom JSON serializers that I define for my application.&lt;br /&gt;
&lt;br /&gt;
However, there is a slight tweak in configuration. To configure JSON in Spring configurations, normally, we define a bean of type &lt;a href=&quot;http://jackson.codehaus.org/1.5.1/javadoc/org/codehaus/jackson/map/ObjectMapper.html&quot;&gt;ObjectMapper&lt;/a&gt;. By default this object mapper bean, initializes some serializer factory, however, we need to inject our own serializer factory instance. The problem is that the Object Mapper defines the setter method that does not have a void return type (required by Spring IoC), so, I define a CustomObjectMapper:&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public class CustomObjectMapper extends ObjectMapper {

 protected final Log logger = LogFactory.getLog(getClass());

 public void setCustomSerializerFactory(SerializerFactory factory) {
  setSerializerFactory(factory);
  logger.debug(&quot;Using [&quot; + factory + &quot;] as the custom Jackson JSON serializer factory.&quot;);
 }

}
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, glueing step one and two, I can write some configuration for the custom JSON serialization beans:&lt;br /&gt;
&lt;pre class=&quot;brush: xml&quot;&gt; &amp;lt;bean id=&quot;jacksonJsonObjectMapper&quot; class=&quot;nl.hajari.wha.service.json.CustomObjectMapper&quot;&amp;gt;
  &amp;lt;property name=&quot;customSerializerFactory&quot; ref=&quot;jacksonJsonCustomSerializerFactory&quot; /&amp;gt;
 &amp;lt;/bean&amp;gt;

 &amp;lt;bean id=&quot;jacksonJsonCustomSerializerFactory&quot;
  class=&quot;nl.hajari.wha.service.json.CustomSerializerFactoryRegistry&quot;&amp;gt;
  &amp;lt;property name=&quot;serializers&quot;&amp;gt;
   &amp;lt;map&amp;gt;
    &amp;lt;entry key=&quot;nl.hajari.wha.domain.Customer&quot; value-ref=&quot;customerSerializer&quot; /&amp;gt;
   &amp;lt;/map&amp;gt;
  &amp;lt;/property&amp;gt;
 &amp;lt;/bean&amp;gt;

 &amp;lt;bean id=&quot;customerSerializer&quot; class=&quot;nl.hajari.wha.service.json.CustomerSerializer&quot; /&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step Three&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
The last step is to configure the content negotiating view resolver. The most important point on this view resolver is that it should be highest order of processing in Spring MVC chain since it automatically delegates to other view resolvers when the media type does not apply, so:&lt;br /&gt;
&lt;pre class=&quot;brush: xml&quot;&gt; &amp;lt;bean
  class=&quot;org.springframework.web.servlet.view.ContentNegotiatingViewResolver&quot;&amp;gt;
  &amp;lt;property name=&quot;order&quot; value=&quot;1&quot; /&amp;gt;
  &amp;lt;property name=&quot;mediaTypes&quot;&amp;gt;
   &amp;lt;map&amp;gt;
    &amp;lt;entry key=&quot;json&quot; value=&quot;application/vnd.com.mobilivity+json&quot; /&amp;gt;
   &amp;lt;/map&amp;gt;
  &amp;lt;/property&amp;gt;
  &amp;lt;property name=&quot;defaultViews&quot;&amp;gt;
   &amp;lt;list&amp;gt;
    &amp;lt;bean
     class=&quot;org.springframework.web.servlet.view.json.MappingJacksonJsonView&quot;&amp;gt;
     &amp;lt;property name=&quot;contentType&quot; value=&quot;application/vnd.com.mobilivity+json&quot; /&amp;gt;
     &amp;lt;property name=&quot;objectMapper&quot; ref=&quot;jacksonJsonObjectMapper&quot; /&amp;gt;
     &amp;lt;property name=&quot;renderedAttributes&quot;&amp;gt;
      &amp;lt;set&amp;gt;
       &amp;lt;value&amp;gt;items&amp;lt;/value&amp;gt;
      &amp;lt;/set&amp;gt;
     &amp;lt;/property&amp;gt;

    &amp;lt;/bean&amp;gt;
   &amp;lt;/list&amp;gt;
  &amp;lt;/property&amp;gt;
 &amp;lt;/bean&amp;gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, I can serialize my custom domain model such as Customer through Spring MVC REST requests:&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;@RequestMapping(value = &quot;/customer/list/all&quot;, method = RequestMethod.GET)
&lt;/pre&gt;
that can be used for instance in Dojo widgets for a combo box in a view page.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/1349932299741972708/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2010/07/custom-json-serialization-with-spring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/1349932299741972708'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/1349932299741972708'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2010/07/custom-json-serialization-with-spring.html' title='Custom JSON serialization with Spring MVC'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-7004264458805420069</id><published>2010-06-21T23:52:00.000+02:00</published><updated>2010-06-21T23:52:39.737+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="calendar"/><category scheme="http://www.blogger.com/atom/ns#" term="django"/><category scheme="http://www.blogger.com/atom/ns#" term="farsi"/><category scheme="http://www.blogger.com/atom/ns#" term="jalali"/><category scheme="http://www.blogger.com/atom/ns#" term="persian"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><category scheme="http://www.blogger.com/atom/ns#" term="widget"/><category scheme="http://www.blogger.com/atom/ns#" term="تقویم"/><category scheme="http://www.blogger.com/atom/ns#" term="فارسی"/><title type='text'>Django Jalali Calendar Widget</title><content type='html'>Using the original &lt;a href=&quot;http://www.dynarch.com/projects/calendar/&quot;&gt;JSCal&lt;/a&gt; and the &lt;a href=&quot;http://farhadi.ir/works/jalalijscalendar&quot;&gt;Jalali&lt;/a&gt; version for it, I managed to create a simple Django widget that displays a Jalali calendar in view layer but actually uses the Gregorian server side:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: python&quot;&gt;calbtn = u&#39;&#39;&#39;&lt;img alt=&quot;calendar&quot; id=&quot;%s_btn&quot; src=&quot;/static/images/cal.png&quot; style=&quot;cursor: pointer; float: none; height: 18px; vertical-align: middle; width: 18px;&quot; title=&quot;Select date&quot; /&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
    function onJalaliDateSelected(calendar, date) {
        var e = document.getElementById(&quot;%s&quot;);
        var str = calendar.date.getFullYear() + &quot;-&quot; + (calendar.date.getMonth() + 1) + &quot;-&quot; + calendar.date.getDate();
        e.value = str;
    }
    Calendar.setup({
        inputField     :    &quot;%s_display&quot;,   
        button         :    &quot;%s_btn&quot;,
        ifFormat       :    &quot;%s&quot;,
        dateType       :    &quot;jalali&quot;,
        weekNumbers    :     false,
        onUpdate       :     onJalaliDateSelected
    });
&lt;/script&gt;&#39;&#39;&#39;

class DateTimeWidget(forms.widgets.TextInput):
    class Media:
        css = {
            &#39;all&#39;: (&#39;/static/styles/jscalendar/skins/calendar-system.css&#39;,)
        }
        js = (
              &#39;/static/js/jscalendar/jalali.js&#39;,
              &#39;/static/js/jscalendar/calendar.js&#39;,
              &#39;/static/js/jscalendar/calendar-setup.js&#39;,
              &#39;/static/js/jscalendar/lang/calendar-fa.js&#39;,
        )

    dformat = &#39;%Y-%m-%d&#39;
    def render(self, name, value, attrs=None):
        if value is None: value = &#39;&#39;
        final_attrs = self.build_attrs(attrs, type=self.input_type, name=name)
        if value != &#39;&#39;:
            try:
                final_attrs[&#39;value&#39;] = \
                                   force_unicode(value.strftime(self.dformat))
            except:
                final_attrs[&#39;value&#39;] = \
                                   force_unicode(value)
        if not final_attrs.has_key(&#39;id&#39;):
            final_attrs[&#39;id&#39;] = u&#39;%s_id&#39; % (name)
        id = final_attrs[&#39;id&#39;]

        jsdformat = self.dformat #.replace(&#39;%&#39;, &#39;%%&#39;)
        cal = calbtn % (id, id, id, id, jsdformat)
        parsed_atts = forms.util.flatatt(final_attrs)
        a = u&#39;&lt;input id=&quot;%s_display&quot; type=&quot;text&quot; /&gt;&lt;input %s=&quot;&quot; type=&quot;hidden&quot; /&gt; %s%s&#39; % (id, parsed_atts, self.media, cal)
        return mark_safe(a)

    def value_from_datadict(self, data, files, name):
        dtf = forms.fields.DEFAULT_DATETIME_INPUT_FORMATS
        empty_values = forms.fields.EMPTY_VALUES

        value = data.get(name, None)
        if value in empty_values:
            return None
        if isinstance(value, datetime.datetime):
            return value
        if isinstance(value, datetime.date):
            return datetime.datetime(value.year, value.month, value.day)
        for format in dtf:
            try:
                return datetime.datetime(*time.strptime(value, format)[:6])
            except ValueError:
                continue
        return None

    def _has_changed(self, initial, data):
        &quot;&quot;&quot;
        Return True if data differs from initial.
        Copy of parent&#39;s method, but modify value with strftime function before final comparsion
        &quot;&quot;&quot;
        if data is None:
            data_value = u&#39;&#39;
        else:
            data_value = data

        if initial is None:
            initial_value = u&#39;&#39;
        else:
            initial_value = initial

        try:
            if force_unicode(initial_value.strftime(self.dformat)) != force_unicode(data_value.strftime(self.dformat)):
                return True
        except:
            if force_unicode(initial_value) != force_unicode(data_value):
                return True
        return False
&lt;/pre&gt;
&lt;br /&gt;
Also, if you need to do manipulations on the date object in server-side, you can use the utility written in &lt;a href=&quot;http://home.gna.org/jalali-calendar/&quot;&gt;GNU Jalali Calendar&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/7004264458805420069/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2010/06/django-jalali-calendar-widget.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/7004264458805420069'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/7004264458805420069'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2010/06/django-jalali-calendar-widget.html' title='Django Jalali Calendar Widget'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-896016327528123163</id><published>2010-05-18T19:13:00.000+02:00</published><updated>2010-05-18T19:13:55.755+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="lucid"/><category scheme="http://www.blogger.com/atom/ns#" term="lucid lynx"/><category scheme="http://www.blogger.com/atom/ns#" term="swt"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="xul"/><title type='text'>Eclipse 3.5+ Internal Browser/Flash on Ubuntu 10.04 Lucix Lynx</title><content type='html'>I am developing an eclipse plugin for the test of which I need the support of eclipse internal browser with Flash support enabled. As I upgraded to Ubuntu 10.04 Lucid Lynx, there seems to be a bug introduced in understanding the &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;swt-mozilla-gtk-xxxx.so&lt;/span&gt; plugin for eclipse in connection with XUL Runner. It also complains about a &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;MOZILA_FIVE_HOME&lt;/span&gt; environment variable.&lt;br /&gt;
&lt;br /&gt;
My configuration is:
&lt;br /&gt;
&lt;pre class=&quot;brush: plain&quot;&gt;eclipse: 3.5.2
XUL Runner 1.9.1.9
&lt;/pre&gt;
&lt;br /&gt;
There is also a complete discussion on the same topic &lt;a href=&quot;https://bugs.launchpad.net/ubuntu/+source/eclipse/+bug/553779&quot;&gt;here&lt;/a&gt;. But this would be useful if you&#39;re using eclipse as a bundle in Ubuntu. I am using an eclipse package downloaded from eclipse web site.&lt;br /&gt;
&lt;br /&gt;
My workaround to this was run eclipse through the following script:
&lt;br /&gt;
&lt;pre class=&quot;brush: bash&quot;&gt;xuldir=/usr/lib/xulrunner-$(/usr/bin/xulrunner --gre-version)
LD_LIBRARY_PATH=$xuldir${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} exec /path/to/eclipse/eclipse &quot;$@&quot; &lt;/pre&gt;
&lt;br /&gt;
Also, I added the following VM options to &lt;i&gt;eclipse.ini&lt;/i&gt; after &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;-vm&lt;/span&gt; segment:
&lt;br /&gt;
&lt;pre class=&quot;brush: plain&quot;&gt;-Dorg.eclipse.swt.browser.XULRunnerPath=/usr/lib/xulrunner-1.9.1.9
&lt;/pre&gt;
&lt;br /&gt;
Before applying, make sure you have the same configuration.</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/896016327528123163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2010/05/eclipse-35-internal-browserflash-on.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/896016327528123163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/896016327528123163'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2010/05/eclipse-35-internal-browserflash-on.html' title='Eclipse 3.5+ Internal Browser/Flash on Ubuntu 10.04 Lucix Lynx'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-6475736863222726106</id><published>2010-03-17T18:55:00.000+01:00</published><updated>2010-03-17T18:55:25.064+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="contextor"/><title type='text'>Contextor 0.2 released</title><content type='html'>After a couple of months of redesign and coding, I released &lt;a href=&quot;http://contextor.sf.net/&quot;&gt;Contextor 0.2&lt;/a&gt;.&lt;span style=&quot;font-family: inherit;&quot;&gt; It is still somehow beta but it works rather nice.&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/6475736863222726106/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2010/03/contextor-02-released.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/6475736863222726106'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/6475736863222726106'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2010/03/contextor-02-released.html' title='Contextor 0.2 released'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-4298903332024898736</id><published>2010-03-10T23:31:00.001+01:00</published><updated>2010-03-10T23:44:14.833+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="experience"/><category scheme="http://www.blogger.com/atom/ns#" term="project-management"/><category scheme="http://www.blogger.com/atom/ns#" term="sdpl"/><category scheme="http://www.blogger.com/atom/ns#" term="software"/><category scheme="http://www.blogger.com/atom/ns#" term="software-process"/><category scheme="http://www.blogger.com/atom/ns#" term="trust"/><title type='text'>Software Experience - Trust</title><content type='html'>&lt;div style=&quot;text-align: left;&quot;&gt;
Trivially simple and obvious yet effective and fundamental. The primary goal in every software development process is to deliver a specified application in an acceptable qualitative operational state. Apart from all the technical issues, activities and concerns in every software project, there are many others usually referred to umbrella activities. The umbrella ones usually include project management and environmental activities both to lead and support the development process in all phases. Talking of project management, here emerges the simple practice of &lt;b&gt;trust&lt;/b&gt;. I have experienced different aspects of trust recently as in:&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;The customer does not know exactly what he wants.&lt;/b&gt; They hold some informal meetings with the contractor to reach a conclusion yet not so promising. The contractor initiates some development moves letting the customer know of. Customer adaptively accepts some general impressions and issues an OK to start the work. This also may happen when the customer has some legacy system and desires to create and build a new one with more exciting features; still, the customer is unsure of what he wants. Alongside this mutual trust, comes the &lt;i&gt;flexibility&lt;/i&gt; of the contractor. Usually, the contractor is abound to being firm and fixed on the rules and scope exactly mentioned in the contract not to lose time or extra costs on something that will not be paid for. When trust gets some more credit in communications between the customer and the contractor, the flexibility of the contractor also rises; it seems that trust can act as a catalyst to bond the tie between two sides. As a personal experience, trust makes me happier when I&#39;m in either sides of this communication. The trust gives me the feeling that this work will sure end in a &lt;i&gt;win-win situation&lt;/i&gt;. And, I admit that there are many projects in very very very larger scales that require some official bureaucracy before any start; still I firmly believe that still some form of trust should be established and grounded during any negotiations in initiative phases of any such project. More formally, considering the scalability and supplementary requirements of a software project, there can still be ways to inject the trust in different levels of communication between the customer and the contractor to boost the process and ultimate quality.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;What about the money?&lt;/b&gt; On one side: &lt;i&gt;no trust, no software&lt;/i&gt;. And, on the other: &lt;i&gt;no trust, no money&lt;/i&gt;. Simply chemically, the mood seems to be conveyed to either side of the project. On one hand, when the contractor comes to the vision (even if false) that the customer is not willing and determined to pay off for the work done, he becomes more and more reluctant and carefree of the concerns in the project trying to just and just abide to the scope of the contract and not a single bit more. The same atmosphere gets provoked on the customer side observing that the contractor is not so willingly doing his job and duties according to the contract; leading to critical faultfinding mannerism. Though, when two sides have confident trust in one another, the financial matters on one side and software ones on the other tend to resolve more smoothly and automatically. There are situations in which, due to any reasons, the customer is not ready to do the finances; the contractor with the trust will sure continue the quality work as before with no hesitation. There are situations in which the contractor has financial needs or requirements in some period; why not and why not the customer shouldn&#39;t help him out if possible?! Sadly, this is not happening very often that could be a point of attention for managers in organizations and companies to cultivate the culture. The finance departments in many organizations usually play a crucial and ruling role that tends to be less flexible and adaptable; however, managers at the customer side should have authority to cope with situations in which their finances should be more flexible.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;b&gt;The Social Trust Culture.&lt;/b&gt; All the trust that we&#39;re talking about roots in the social and cultural foundations common and norm to a society. It is disappointing to admit that the trust in software project management will comply to the social common concept; if trust is not virtuous in the daily life in a society, it would be so hard and weary to create a base on which both sides could build their relationship upon mutual trust. In other words, we should have trust in daily communications, relationships, and interactions so that we can take this trust to some other level to the software project management and development process. If, for instance, lying is common in a society, it could be bitterly sadly factual that customers and contractors would not act upon trust in the other side. One other issue that should be considered is that if under any situation, cause, or justification, one side of the customer-contractor tie breaks the relationship trust or distrust the other side, the relationship is ill and, effectively annulled. When there is no pivot of trust in the software project management and process, each side will act upon his own priorities and concerns.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
The views expressed in this post are all based on personal hands-on experiences in a couple of software projects all of which interestingly were and still are managed completely remote.&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
Related:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://texscribbles.blogspot.com/2010/03/software-experience-introduction.html&quot;&gt;Software Experience - Introduction&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/4298903332024898736/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2010/03/software-experience-trust.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/4298903332024898736'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/4298903332024898736'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2010/03/software-experience-trust.html' title='Software Experience - Trust'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-1158141820093185717</id><published>2010-03-07T23:16:00.003+01:00</published><updated>2010-03-10T23:45:08.122+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="experience"/><category scheme="http://www.blogger.com/atom/ns#" term="management"/><category scheme="http://www.blogger.com/atom/ns#" term="project"/><category scheme="http://www.blogger.com/atom/ns#" term="software"/><category scheme="http://www.blogger.com/atom/ns#" term="تجربه"/><category scheme="http://www.blogger.com/atom/ns#" term="طراحی"/><category scheme="http://www.blogger.com/atom/ns#" term="مدیریت"/><category scheme="http://www.blogger.com/atom/ns#" term="نرم افزار"/><title type='text'>Software Experience - Introduction</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
To start with, I am Iranian (Persian). I left home to do stuff in Computer Science. I have couple of years of experience in software development and project management in a small company in Tehran; &lt;a href=&quot;http://www.asta.ir/&quot;&gt;ASTA&lt;/a&gt;. Currently, I&#39;m in the Netherlands, and out of many reasons I had to start some part-time co-operations in software sector here. During the period, there&#39;s been a lot of contrasts and comparisons to my previous impressions, I&#39;ve interestingly come across that I&#39;d like to share (thanks to &lt;a href=&quot;http://asta.ir/avan/index.php?option=com_avanmanagers&amp;amp;view=avanmanager&amp;amp;Itemid=60&quot;&gt;Seyyed Jamal&lt;/a&gt; for his great idea to share these). Still, before that, I&#39;d like to mention a few things:&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;ul style=&quot;text-align: justify;&quot;&gt;
&lt;li&gt;I am using English language rather than Persian (Farsi); I believe in &lt;b&gt;&lt;i&gt;true&lt;/i&gt;&lt;/b&gt; open source as in GPL; not the type that one says he supports and then ridiculously bans the resources to people around the world based on some witless rules and regulations. Also, using Persian may somehow lower the possibility of future collaborations.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;I also admit that the main target audience will be Persian specialists in software, however, we&#39;ll be happy to share ideas with peers from around the world.&lt;/li&gt;
&lt;li&gt;The related posts are based on &lt;i&gt;my personal&lt;/i&gt; background, experiences and viewpoints in software design, development, and project management; so, not necessarily based on scientific or proved theories in software.&lt;/li&gt;
&lt;li&gt;&lt;b&gt;No&lt;/b&gt; comparison or differences mentioned in the related posts are meant &lt;i&gt;at all&lt;/i&gt; to disrespect or disregard different people&#39;s attitudes, skills, or profession. They are only based on personal observations for discussions and analysis.&lt;/li&gt;
&lt;li&gt;Feedbacks in &lt;i&gt;any language&lt;/i&gt; will be most welcome.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;br /&gt;
Related Posts:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;http://texscribbles.blogspot.com/2010/03/software-experience-trust.html&quot;&gt;Software Experience - Trust&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/1158141820093185717/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2010/03/software-experience-introduction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/1158141820093185717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/1158141820093185717'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2010/03/software-experience-introduction.html' title='Software Experience - Introduction'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-4797878792628723841</id><published>2010-02-22T01:18:00.004+01:00</published><updated>2010-02-22T01:45:47.441+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="date"/><category scheme="http://www.blogger.com/atom/ns#" term="date pattern"/><category scheme="http://www.blogger.com/atom/ns#" term="dojo"/><category scheme="http://www.blogger.com/atom/ns#" term="locale"/><category scheme="http://www.blogger.com/atom/ns#" term="localized"/><category scheme="http://www.blogger.com/atom/ns#" term="roo"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Localized Date with Dojo and Spring</title><content type='html'>We have developed a simple application in which we need to have localized date objects with Dojo &lt;a href=&quot;http://docs.dojocampus.org/dijit/form/DateTextBox&quot;&gt;DateTextBox&lt;/a&gt; on &lt;a href=&quot;http://www.springsource.org/roo&quot;&gt;Spring Roo&lt;/a&gt;. The problem is that Spring JS does not completely honor the original widget attributes of Dojo considering the date patterns that are specified. To specific, we need to have date patterns of &lt;b&gt;MM/dd/yyyy&lt;/b&gt; on English locales and &lt;b&gt;dd-MM-yyyy&lt;/b&gt; on Dutch locales.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Localized Date Patterns&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
We have two property files, namely, &lt;i style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;application.properties&lt;/i&gt; and &lt;i style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;application_nl.properties&lt;/i&gt; to hold the localized messages. Using the two, we added a key to the files holding the localized date pattern:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: plain&quot;&gt;date.pattern=MM/dd/yyyy
&lt;/pre&gt;&lt;br /&gt;
and&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: plain&quot;&gt;date.pattern=dd-MM-yyyy
&lt;/pre&gt;&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Configuring a localized &lt;a href=&quot;http://static.springsource.org/spring/docs/2.5.6/api/org/springframework/beans/propertyeditors/CustomDateEditor.html&quot;&gt;CustomDateEditor&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;
To achieve this, first, we need a controller which is aware of localized date patterns defined above; simply, we make the controller an instance of &lt;a href=&quot;http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/context/MessageSourceAware.html&quot;&gt;MessageSourceAware&lt;/a&gt; so that the applications&#39;s localized message source is injected.&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;public class AbstractController implements MessageSourceAware {

 protected final Log logger = LogFactory.getLog(getClass());

 @Resource
 @Qualifier(&quot;messageSource&quot;)
 protected MessageSource messages;

 @InitBinder
 public void initBinder(WebDataBinder binder) {
  binder.registerCustomEditor(Date.class, getCustomDateEditor());
 }

 protected CustomDateEditor getCustomDateEditor() {
  String datePattern = messages.getMessage(Constants.DATE_PATTERN_KEY, new Object[] {}, getLocale());
  logger.debug(&quot;Customer editor for date pattern: &quot; + datePattern);
  return new CustomDateEditor(new SimpleDateFormat(datePattern), true);
 }

 protected Locale getLocale() {
  Locale locale = getDefaultLocale();
  try {
   locale = LocaleContextHolder.getLocale();
  } catch (Exception e) {
  }
  logger.debug(&quot;Current Locale: &quot; + locale);
  return locale;
 }
 
 protected Locale getDefaultLocale() {
  return Locale.US;
 }

 @Override
 public void setMessageSource(MessageSource messageSource) {
  this.messages = messageSource;
 }

}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
So, when the controller is initializing the MVC, it registers a custom date editor which is based on the current locale. The use of &lt;a href=&quot;http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/context/i18n/LocaleContextHolder.html&quot;&gt;LocaleContextHolder&lt;/a&gt; is interesting as it holds (through &lt;a href=&quot;http://java.sun.com/j2se/1.4.2/docs/api/java/lang/ThreadLocal.html&quot;&gt;ThreadLocal&lt;/a&gt;) the locale currently set for the &lt;a href=&quot;http://static.springsource.org/spring/docs/3.0.x/javadoc-api/org/springframework/web/servlet/FrameworkServlet.html&quot;&gt;FrameworkServlet&lt;/a&gt; in the current thread.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Customizing Dojo DateTextBox&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
Now, we can simply add a localized DateTextBox to a form:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: xml&quot;&gt;&amp;lt;spring:message code=&quot;date.pattern&quot; var=&quot;datePattern&quot; /&amp;gt;
&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;
 Spring.addDecoration(new Spring.ElementDecoration({
  elementId : &#39;myFormInputId&#39;,
  widgetType : &#39;dijit.form.DateTextBox&#39;,
  widgetAttrs : {
   constraints: {min: new Date().setDate(0), max: new Date().setDate(31), datePattern: &#39;${datePattern}&#39;},
   promptMessage : &#39;Prompt Message&#39;,
   invalidMessage : &#39;Validation Message&#39;,
   required : true,
   datePattern : &#39;${datePattern}&#39;,
  }
 }));
&amp;lt;/script&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
Note that, originally, the second &lt;b style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;datePattern&lt;/b&gt; is enough, however, as integration of Spring JS and Dojo is not complete, so you need the additional constraint on the &lt;b style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;datePattern&lt;/b&gt;.</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/4797878792628723841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2010/02/localized-date-with-dojo-and-spring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/4797878792628723841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/4797878792628723841'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2010/02/localized-date-with-dojo-and-spring.html' title='Localized Date with Dojo and Spring'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-2451420195288428172</id><published>2010-02-07T21:50:00.001+01:00</published><updated>2010-02-07T21:52:24.078+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="cache"/><category scheme="http://www.blogger.com/atom/ns#" term="myisam"/><category scheme="http://www.blogger.com/atom/ns#" term="mysql"/><category scheme="http://www.blogger.com/atom/ns#" term="performance"/><category scheme="http://www.blogger.com/atom/ns#" term="tune"/><title type='text'>MySQL MyISAM Tuning</title><content type='html'>&lt;a href=&quot;http://dev.mysql.com/doc/refman/5.0/en/myisam-storage-engine.html&quot;&gt;MySQL MyISAM&lt;/a&gt; is known to be good for large text indexing and fast retrieval. Still, it can create bottlenecks if not tuned properly. In my case, I need to run many SQL operations on a database of around 500`000 URL&#39;s with text on this engine. A little of bit searching and tuning, I used the following configuration for my.cnf on MySQL 5+:&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;brush: plain&quot;&gt;# key buffer size
key_buffer          = 512M
# table caching
table_cache         = 128
# query caching
query_cache_limit   = 512M
query_cache_size    = 512M
&lt;/pre&gt;&lt;br /&gt;
The configurations proposed are also based on the machine you&#39;re using; so if you have no problem at resources you can go higher.</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/2451420195288428172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2010/02/mysql-myisam-tuning.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/2451420195288428172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/2451420195288428172'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2010/02/mysql-myisam-tuning.html' title='MySQL MyISAM Tuning'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-2352298338387017904</id><published>2009-06-07T10:55:00.014+02:00</published><updated>2010-03-11T00:06:19.987+01:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gwt"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="jsni"/><category scheme="http://www.blogger.com/atom/ns#" term="object"/><category scheme="http://www.blogger.com/atom/ns#" term="static"/><title type='text'>Object Reference and Method Call in JavaScript with GWT JSNI</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
There are times we need to call JavaScript functions from the hosted page in GWT that would use the runtime objects of the GWT compiled code. Put it in another way, there are situations the in the middle of the JavaScript, you may need the real object from GWT code. This means that we cannot use the &lt;span style=&quot;font-family: courier new; font-weight: bold;&quot;&gt;native static&lt;/span&gt; methods in JSNI.

Thanks to JavaScript, there could be a solution to this:
&lt;br/&gt;

1- Define a JavaScript variable that would actually hold a reference to a function. And, define a JavaScript function that would set this reference (This code is written in your index.html GWT page):
&lt;br /&gt;
&lt;pre class=&quot;brush: javascript&quot; style=&quot;font-family: Courier; font-size: smaller;&quot;&gt;
var functionReference;

function setFunctionReference(fr) {
     functionReference = fr;
}



&lt;/pre&gt;
2- Use GWT JSNI (JavaScript Native API) to set the object reference for the function:

&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot; style=&quot;font-family: Courier; font-size: smaller;&quot;&gt;
public class MyEntryPoint implements EntryPoint{

public void onModuleLoad() {

// BLAH BLAH CODE

setFunctionReferenceForMe(this);

// BLAH BLAH CODE
}

public native void setFunctionReferenceForMe(MyEntryPoint ep)/*- {
   $wnd.setFunctionReference(funtion(param) {
      if (param == 0) {
         ep.@com.myworld.edu.gwt.client.MyEntryPoint
         ::method1();
      } else {
         ep.@com.myworld.edu.gwt.client.MyEntryPoint
         ::method2(Ljava/lang/String;)(param);
      }
    });
}-*/;

public void method1() {
// A non-static method called from JavaScript
}

public void method2(String param) {
// A non-static method called from JavaScript
}

}

&lt;/pre&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-size: 100%;&quot;&gt;&lt;span style=&quot;font-family: georgia;&quot;&gt;Through this piece of code, you see that we can actually call a non-static &lt;/span&gt;&lt;/span&gt;method of an object in GWT using a trick with JSNI and some JavaScript in hosted page. Alongside, we are actually passing parameter from JavaScrip to that object, too. So, now we can call the method wherever we want through JavaScript:

&lt;br /&gt;
&lt;pre class=&quot;brush: javascript&quot; style=&quot;font-family: Courier; font-size: smaller;&quot;&gt;
functionReference.call(this, 0)
&lt;/pre&gt;
And, sure it knows about the object reference from GWT.

&lt;/div&gt;
&lt;pre style=&quot;font-family: Courier; font-size: smaller;&quot;&gt;&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/2352298338387017904/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2009/06/there-are-times-we-need-to-call.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/2352298338387017904'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/2352298338387017904'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2009/06/there-are-times-we-need-to-call.html' title='Object Reference and Method Call in JavaScript with GWT JSNI'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-1560199512272181520</id><published>2009-05-27T09:05:00.004+02:00</published><updated>2010-06-20T20:38:41.668+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="compass"/><category scheme="http://www.blogger.com/atom/ns#" term="hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="lucene"/><category scheme="http://www.blogger.com/atom/ns#" term="pdf"/><category scheme="http://www.blogger.com/atom/ns#" term="poi"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Compass - Lucene - Hibernate - PDF / Document (2)</title><content type='html'>In a previous &lt;a href=&quot;http://texscribbles.blogspot.com/2009/05/compass-lucene-spring-hibernate-1.html&quot;&gt;post&lt;/a&gt;, I just discussed what would be needed for bring up the combination of Compass - Lucence - Spring - Hibernate. Now, I want to plug in some functionality for indexing and searching BLOB contents of PDF and documents. In Compass bean settings in Spring context, we had a configuration:


&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;prop key=&quot;compass.converter.blobConverter.registerClass&quot;&amp;gt;java.sql.Blob&amp;lt;/prop&amp;gt;
&amp;lt;prop key=&quot;compass.converter.blobConverter.type&quot;&amp;gt;BlobConverter&amp;lt;/prop&amp;gt;
&lt;/pre&gt;


This is required to, first, tell Compass that we are registering a converter for type &lt;span style=&quot;font-family:courier new;&quot;&gt;java.sql.Blob&lt;/span&gt;, and second, the fully-qualified converter class is provided. Here, we are trying to index PDF files with Compass with JdbcDirectory. I chose &lt;a href=&quot;http://incubator.apache.org/pdfbox/&quot;&gt;PDFBox&lt;/a&gt; for stripping text out of the PDF content; so the coverter would like this:


&lt;pre class=&quot;brush: java&quot;&gt;
public boolean marshall(Resource resource, Blob root, Mapping mapping, MarshallingContext context) throws ConversionException {
        if (root == null) {
            return false;
        }
        try {

            byte[] bytes = root.getBytes(1, (int) root.length());
            parser = new PDFParser(new ByteArrayInputStream(bytes));
            parser.parse();
            COSDocument document = parser.getDocument();
            logger.warn(&quot;Parsed an instance BLOB with PDF content type: &quot; + document);
            String pdfText = stripper.getText(new PDDocument(document));
            logger.warn(&quot;Extracted text from PDF: &quot; + pdfText);

            Property p = context.getResourceFactory().createProperty(mapping.getPath().getPath(), pdfText.getBytes(), Store.YES);
            logger.warn(&quot;Created a Compass property on PDF text: &quot; + p);

            resource.addProperty(p);

            return true;

        } catch (IOException e) {
            throw new ConversionException(&quot;Failed to initialize a PDF Parser: &quot;, e);
        } catch (SQLException e) {
            throw new ConversionException(&quot;Failed to initialize a PDF Parser: &quot;, e);
        }
    }
&lt;/pre&gt;

&lt;span style=&quot;font-weight: bold; font-style: italic;&quot;&gt;Remember&lt;/span&gt; that this may not be complete as to retrieve something from the index you may need another piece of data such as the ID of the model or entity of which this PDF content is a part. And, if you&#39;d like to index and search document formats in this way, you may want to use &lt;a href=&quot;http://poi.apache.org/&quot;&gt;Apache POI&lt;/a&gt;.

To wrap it up, using Compass&#39;s feature on JdbcDirectory and its extension on using Hibernated models and configuring it with Spring, you&#39;d have a high-level API to index and search content
that is stored in database.</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/1560199512272181520/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2009/05/compass-lucene-hibernate-pdf-document-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/1560199512272181520'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/1560199512272181520'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2009/05/compass-lucene-hibernate-pdf-document-2.html' title='Compass - Lucene - Hibernate - PDF / Document (2)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-1879300053336829668</id><published>2009-05-21T11:33:00.005+02:00</published><updated>2009-05-31T12:00:42.940+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="arabic"/><category scheme="http://www.blogger.com/atom/ns#" term="birt"/><category scheme="http://www.blogger.com/atom/ns#" term="eclipse"/><category scheme="http://www.blogger.com/atom/ns#" term="farsi"/><category scheme="http://www.blogger.com/atom/ns#" term="ibm"/><category scheme="http://www.blogger.com/atom/ns#" term="icu"/><category scheme="http://www.blogger.com/atom/ns#" term="persian"/><category scheme="http://www.blogger.com/atom/ns#" term="shaping"/><title type='text'>IBM ICU Persian (Farsi) / Arabic Shaping Bug Fix</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;Courtesy of &lt;a href=&quot;http://cad.ece.ut.ac.ir/%7Enima/&quot;&gt;Nima Honarmand&lt;/a&gt; and &lt;a href=&quot;http://asta.ir/avan/index.php?option=com_avanmanagers&amp;amp;view=avanmanager&amp;amp;Itemid=60&quot;&gt;Seyyed Jamal Pishvayi&lt;/a&gt;, there is now a patch that fixes IBM&#39;s &lt;a href=&quot;http://site.icu-project.org/&quot;&gt;ICU&lt;/a&gt; project &lt;a href=&quot;http://bugs.icu-project.org/trac/ticket/6169&quot;&gt;issue 6169&lt;/a&gt;. This issue addresses the Persian/Arabic Shaping Support of FB50 block.
Hope this contribution would help resolve the issue faster.

The patch source: &lt;a href=&quot;http://groups.google.com/group/asta-development-list/web/ArabicShaping.java&quot;&gt;ArabicShaping.java&lt;/a&gt;

&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/1879300053336829668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2009/05/ibm-icu-persianarabic-shaping-bug-fix.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/1879300053336829668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/1879300053336829668'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2009/05/ibm-icu-persianarabic-shaping-bug-fix.html' title='IBM ICU Persian (Farsi) / Arabic Shaping Bug Fix'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-3343735827259324148</id><published>2009-05-19T10:08:00.007+02:00</published><updated>2010-06-20T21:25:20.188+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="compass"/><category scheme="http://www.blogger.com/atom/ns#" term="hibernate"/><category scheme="http://www.blogger.com/atom/ns#" term="lucene"/><category scheme="http://www.blogger.com/atom/ns#" term="pdf"/><category scheme="http://www.blogger.com/atom/ns#" term="pdfbox"/><category scheme="http://www.blogger.com/atom/ns#" term="poi"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><title type='text'>Compass - Lucene - Spring - Hibernate (1)</title><content type='html'>&lt;a href=&quot;http://www.compass-project.org/&quot;&gt;Compass&lt;/a&gt; is a framework over &lt;a href=&quot;http://lucene.apache.org/&quot;&gt;Apache Lucene&lt;/a&gt; delivering robust and useful services. Besides, it provides pluggable points for frameworks such as &lt;a href=&quot;http://www.springsource.org/&quot;&gt;Spring&lt;/a&gt; and &lt;a href=&quot;http://www.hibernate.org/&quot;&gt;Hibernate&lt;/a&gt;. Though having a reference manual, putting it all together is somehow complicated and cumbersome. This would be probably multi-part how-to on this issue.

Consider this scenario: we are developing a web application with all the stuff that I do not delve into. The main focus here is rotating around an entity called &quot;&lt;span style=&quot;font-weight: bold;&quot;&gt;Story&lt;/span&gt;&quot;. So, we&#39;d have an HBM:

&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;hibernate-mapping package=&quot;ir.asta.wise.core.datamanagement.textsearch.sample.story&quot;&amp;gt;
&amp;lt;class name=&quot;StoryEntity&quot; table=&quot;LUC_STORY&quot;&amp;gt;
  &amp;lt;id name=&quot;id&quot; column=&quot;STORY_ID&quot; type=&quot;java.lang.String&quot;&amp;gt;
   &amp;lt;generator class=&quot;uuid&quot;&amp;gt;&amp;lt;/generator&amp;gt;
               &amp;lt;/id&amp;gt;
  &amp;lt;property name=&quot;name&quot; type=&quot;java.lang.String&quot; column=&quot;NAME&quot; null=&quot;true&quot;&amp;gt;&amp;lt;/property&amp;gt;
               &amp;lt;property name=&quot;content&quot; type=&quot;java.lang.String&quot; column=&quot;CONTENT&quot; null=&quot;true&quot; length=&quot;4096&quot;&amp;gt;&amp;lt;/property&amp;gt;
  &amp;lt;property name=&quot;blobContent&quot; type=&quot;java.sql.Blob&quot; column=&quot;BLOB_CONTENT&quot;&amp;gt;  &amp;lt;/property&amp;gt;
&amp;lt;/class&amp;gt;
&lt;/pre&gt;

The first step is to tell Compass to index Story: we create a file named &lt;span style=&quot;font-weight: bold;&quot;&gt;Story.cpm.xml&lt;/span&gt;; the Core Mapping for Story:


&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;compass-core-mapping package=&quot;ir.asta.wise.core.datamanagement.textsearch.sample.story&quot;&amp;gt;
    &amp;lt;class name=&quot;StoryEntity&quot; alias=&quot;StoryEntity&quot;&amp;gt;
        &amp;lt;id name=&quot;id&quot; /&amp;gt;
        &amp;lt;property name=&quot;content&quot;&amp;gt;
            &amp;lt;meta-data&amp;gt;${wiseCompass.story}&amp;lt;/meta-data&amp;gt;
        &amp;lt;/property&amp;gt;
        &amp;lt;property name=&quot;blobContent&quot; converter=&quot;blobConverter&quot;&amp;gt;
            &amp;lt;meta-data&amp;gt;${wiseCompass.story}&amp;lt;/meta-data&amp;gt;
        &amp;lt;/property&amp;gt;
&amp;lt;/class&amp;gt;
&amp;lt;/compass-core-mapping&amp;gt;
&lt;/pre&gt;


Along this mapping, we need to introduce Story to compass through a meta-data descriptor, call it &lt;span style=&quot;font-weight: bold;&quot;&gt;compass.cmd.xml&lt;/span&gt; that provides a big picture of all indexables:
&lt;pre class=&quot;brush: xml&quot;&gt;
&amp;lt;compass-core-meta-data&amp;gt;
    &amp;lt;meta-data-group id=&quot;wiseCompass&quot; displayName=&quot;WiSE Core Lucene/Compasss&quot;&amp;gt;
        &amp;lt;description&amp;gt;WiSE Core Lucene/Compass Core Meta Data&amp;lt;/description&amp;gt;
        &amp;lt;uri&amp;gt;http://wise/compass&amp;lt;/uri&amp;gt;
        &amp;lt;meta-data id=&quot;story&quot; displayName=&quot;Story Metadata&quot;&amp;gt;
            &amp;lt;description&amp;gt;Story Entity Compass Metadata&amp;lt;/description&amp;gt;
            &amp;lt;uri&amp;gt;http://wise/compass/story&amp;lt;/uri&amp;gt;
            &amp;lt;name&amp;gt;story&amp;lt;/name&amp;gt;
        &amp;lt;/meta-data&amp;gt;
        &amp;lt;meta-data id=&quot;file&quot; displayName=&quot;File Entity Content Metadata&quot;&amp;gt;
            &amp;lt;description&amp;gt;File Entity Content Metadata&amp;lt;/description&amp;gt;
            &amp;lt;uri&amp;gt;http://wise/compass/file&amp;lt;/uri&amp;gt;
            &amp;lt;name&amp;gt;file&amp;lt;/name&amp;gt;
        &amp;lt;/meta-data&amp;gt;
    &amp;lt;/meta-data-group&amp;gt;
&amp;lt;/compass-core-meta-data&amp;gt;
&lt;/pre&gt;

Now, let&#39;s get to Spring configuration. First, we need to create a bean to be the Compass object:

&lt;pre class=&quot;brush: xml&quot;&gt;
    &amp;lt;bean id=&quot;compass&quot; class=&quot;org.compass.spring.LocalCompassBean&quot;&amp;gt;
        &amp;lt;property name=&quot;dataSource&quot; ref=&quot;dataSource&quot; /&amp;gt
        &amp;lt;property name=&quot;transactionManager&quot; ref=&quot;transactionManager&quot; /&amp;gt;
        &amp;lt;property name=&quot;resourceLocations&quot;&amp;gt;
            &amp;lt;list&amp;gt;
                &amp;lt;value&amp;gt;classpath:config/lucene/compass/*.xml&amp;lt;/value&amp;gt;
            &amp;lt;/list&amp;gt;
        &amp;lt;/property&amp;gt;
        &amp;lt;property name=&quot;compassSettings&quot;&amp;gt;
            &amp;lt;props&amp;gt;
                &amp;lt;prop key=&quot;compass.name&quot;&amp;gt;compass&amp;lt;/prop&amp;gt;
                &amp;lt;prop key=&quot;compass.engine.connection&quot;&amp;gt;jdbc://&amp;lt;/prop&amp;gt;
                &amp;lt;prop key=&quot;compass.converter.blobConverter.registerClass&quot;&amp;gt;java.sql.Blob&amp;lt;/prop&amp;gt;
                &amp;lt;prop key=&quot;compass.converter.blobConverter.type&quot;&amp;gt;BlobConverter&amp;lt;/prop&amp;gt;
            &amp;lt;/props&amp;gt;
        &amp;lt;/property&amp;gt;
    &amp;lt;/bean&amp;gt;
&lt;/pre&gt;


Some comments on the &#39;compass&#39; bean configuration:

&lt;ul&gt;&lt;li&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;transactionManager &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;is the reference to your bean of Spring that is the actual transaction manager that is also used for Hibernate.&lt;/li&gt;&lt;li&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;resourceLocations&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; is an option to tell where all the &lt;span style=&quot;font-weight: bold;&quot;&gt;*.cpm.xml&lt;/span&gt; and &lt;span style=&quot;font-weight: bold;&quot;&gt;*.cmd.xml&lt;/span&gt; files are.&lt;/li&gt;&lt;li&gt;As pure Lucene does not implement the JDBC Directory concept, through &lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;jdbc:// &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;we are telling Compass that we&#39;re using JdbcDirectory implementation of Compass and for that &lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;dataSource &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;is injected.&lt;/li&gt;&lt;li&gt;In this example, we aim to index and search BLOB types (such as PDF or Document). So we need to configure Compass for our BLOB converters. I&#39;d discuss this more in the second part of the tutorial.&lt;/li&gt;&lt;/ul&gt;The next steps fall into two parts: &lt;span style=&quot;font-weight: bold;&quot;&gt;saving the index&lt;/span&gt; and &lt;span style=&quot;font-weight: bold;&quot;&gt;searching it&lt;/span&gt;. For both, we need a &lt;span style=&quot;font-weight: bold;&quot;&gt;Compass Session&lt;/span&gt; that is also bound to the Compass bean with all the Hibernate bindings.
To do so, we need to define two other beans for adding Hibernate collaboration for Compass:

&lt;pre class=&quot;brush: xml&quot;&gt;
    &amp;lt;bean id=&quot;hibernateGpsDevice&quot; class=&quot;org.compass.gps.device.hibernate.HibernateGpsDevice&quot;&amp;gt;
        &amp;lt;property name=&quot;name&quot;&amp;gt;
            &amp;lt;value&amp;gt;Hibernate-GPS-Device&amp;lt;/value&amp;gt;
        &amp;lt;/property&amp;gt;
        &amp;lt;property name=&quot;sessionFactory&quot; ref=&quot;sessionFactory&quot; /&amp;gt;
        &amp;lt;property name=&quot;nativeExtractor&quot;&amp;gt;
            &amp;lt;bean class=&quot;org.compass.spring.device.hibernate.SpringNativeHibernateExtractor&quot; /&amp;gt;
        &amp;lt;/property&amp;gt;
    &amp;lt;/bean&amp;gt;
&lt;/pre&gt;

And:


&lt;pre class=&quot;brush: xml&quot;&gt;
    &amp;lt;bean id=&quot;hibernateGps&quot; class=&quot;org.compass.gps.impl.SingleCompassGps&quot; init-method=&quot;start&quot; destroy-method=&quot;stop&quot;&amp;gt;
        &amp;lt;property name=&quot;compass&quot; ref=&quot;compass&quot; /&amp;gt;
        &amp;lt;property name=&quot;gpsDevices&quot;&amp;gt;
            &amp;lt;list&amp;gt;
                &amp;lt;ref bean=&quot;hibernateGpsDevice&quot; /&amp;gt;
            &amp;lt;/list&amp;gt;
        &amp;lt;/property&amp;gt;
    &amp;lt;/bean&amp;gt;
&lt;/pre&gt;

Now, we can use the &lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;hibernateGps &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;bean&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;font-size:85%;&quot;&gt;&lt;span style=&quot;font-family:courier new;&quot;&gt;&lt;span style=&quot;font-weight: bold;&quot;&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt; to for using Compass Session API. To save an index, we assume that a StoryEntity has been saved and we want to save the index:


&lt;pre class=&quot;brush: java&quot;&gt;
    @Transactional(readOnly = false)
    private void saveStoryIndex(StoryEntity s) {
        CompassIndexSession session = hibernateGps.getIndexCompass().openIndexSession();
        session.save(s);
        session.commit();
        logger.warn(&quot;Index saved.&quot;);
        session.close();
    }
&lt;/pre&gt;

And, to search:

&lt;pre class=&quot;brush: java&quot;&gt;
    @Transactional(readOnly = false)
    private void searchSomeStory() {
        logger.warn(&quot;Searching....&quot;);
        CompassSearchSession session = hibernateGps.getIndexCompass().openSearchSession();
        CompassHits hits = session.find(&quot;sample&quot;);
        logger.warn(&quot;Hits: &quot; + hits.getLength());
        logger.warn(&quot;First result: &quot; + hits.hit(0).data());
        session.close();
    }
&lt;/pre&gt;

This is a brief overview on what the integration needs. On the next part, I&#39;d discuss on how indexing and converting of PDF&#39;s and Document&#39;s could be handled.

Hope this would help.</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/3343735827259324148/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2009/05/compass-lucene-spring-hibernate-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/3343735827259324148'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/3343735827259324148'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2009/05/compass-lucene-spring-hibernate-1.html' title='Compass - Lucene - Spring - Hibernate (1)'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2366790494689646605.post-4399226476741316205</id><published>2009-05-18T11:23:00.002+02:00</published><updated>2010-06-20T19:18:36.955+02:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="acegi"/><category scheme="http://www.blogger.com/atom/ns#" term="cas"/><category scheme="http://www.blogger.com/atom/ns#" term="oc4j"/><category scheme="http://www.blogger.com/atom/ns#" term="spring"/><category scheme="http://www.blogger.com/atom/ns#" term="ticket"/><title type='text'>Acegi - CAS - Service Ticket - OC4J 10.1.3.*?! - Ticket lost</title><content type='html'>&lt;div style=&quot;text-align: justify;&quot;&gt;
Thanks to Oracle OC4J (Standalone/Embedded) that from time to time, reminds me that we still can break the rules in software collaboration.

The problem begins where you have a CAS - Acegi integrated SSO solution on some application server on a machine along with another application server with some applications on it using Oracle OC4J Standalone 10.1.3.*?! to host the applications. Now, when a client application goes to the CAS server and the SSO does the sing-in process, Acegi now should return to the client application using targetting the CasProcessingFilter:

&lt;pre class=&quot;brush: plain;&quot;&gt;https://oc4japphost:8443/myapp/j_acegi_security_check?ticket=[CAS SERVICE TICKET]&lt;/pre&gt;

Here comes our here OC4J that, it seems, takes it as an offence that some referrer is going to some of its hosted applications with a Query String and a request parameter. So, very logically(!!!), the OC4J container just truncates the query string and this is how the CAS ticket gets lost in the midlle of nowhere.

Thanks to &lt;a href=&quot;http://forum.springsource.org/member.php?u=48563&quot;&gt;Seyyed Jamal&lt;/a&gt;, a great friend, the idea is to pass the ticket through CAS using CLEAN URL&#39;s instead of query strings such as:

&lt;pre class=&quot;brush: plain&quot;&gt;https://oc4japphost:8443/myapp/j_acegi_security_check/ticket/[CAS SERVICE TICKET]&lt;/pre&gt;

This way the OC4J container is actually unaware of what&#39;s going on. To implement the solution:


&lt;ol style=&quot;text-align: justify;&quot;&gt;
&lt;li&gt;CAS login-webflow.xml should edited for external redirection after successful sing-in.&lt;/li&gt;
&lt;li&gt;Acegi&#39;s CasProcessingFilter need be edited for CAS ticket lookup based on clean URL&#39;s.&lt;/li&gt;
&lt;/ol&gt;

&lt;span style=&quot;font-weight: bold;&quot;&gt;CAS: login-webflow.xml&lt;/span&gt;

The &lt;span style=&quot;font-family: courier new; font-style: italic;&quot;&gt;end-state&lt;/span&gt; should be edited so that the value for its &lt;span style=&quot;font-family: courier new;&quot;&gt;view&lt;/span&gt; would be:&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;

&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;


&lt;pre class=&quot;brush: xml&quot;&gt;

&amp;lt;end-state id=&quot;redirect&quot; view=&quot;externalRedirect:${externalContext.requestParameterMap[&#39;service&#39;]}${requestScope.ticket== null ? &#39;&#39; : &#39;/ticket/&#39; + requestScope.ticket}&quot;&amp;gt;&amp;lt;/end-state&amp;gt;
&lt;/pre&gt;

&lt;span style=&quot;font-weight: bold;&quot;&gt;Acegi: &lt;span style=&quot;font-family: courier new;&quot;&gt;CasProcessingFilter&lt;/span&gt;&lt;/span&gt;

&lt;br /&gt;
&lt;pre class=&quot;brush: java&quot;&gt;
public Authentication attemptAuthentication(HttpServletRequest request) throws AuthenticationException {
        String username = CAS_STATEFUL_IDENTIFIER;
        String password = extractTicket(request);

        logger.warn(&quot;[ CUSTOMIZED OC4J CAS Processing Filter ] Found CAS ticket: &quot; + password);

        if (password == null) {
            password = &quot;&quot;;
        }
UsernamePasswordAuthenticationToken authRequest = new UsernamePasswordAuthenticationToken(username, password);

authRequest.setDetails(authenticationDetailsSource.buildDetails((HttpServletRequest) request));

        Authentication authenticationResult = this.getAuthenticationManager().authenticate(authRequest);

        if (authenticationResult != null) {
           logger.warn(&quot;[ CUSTOMIZED OC4J CAS Processing Filter ] CAS authentication completed. Its success will be decided afterwards.&quot;);
        }
        return authenticationResult;
    }
&lt;/pre&gt;

&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;span style=&quot;font-size: 100%;&quot;&gt;&lt;span style=&quot;font-family: times new roman;&quot;&gt;And, now:&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;

&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-family: courier new;&quot;&gt;&lt;/span&gt;&lt;/span&gt;

&lt;pre class=&quot;brush: java&quot;&gt;
    protected String extractTicket(HttpServletRequest request) {
        String ticket = request.getParameter(&quot;ticket&quot;);
        if (StringUtils.hasText(ticket)) {
            logger.warn(&quot;Service TICKET found on query string: &quot; + ticket);
            return ticket;
        }
        String uri = request.getRequestURI();
        if (uri.indexOf(&quot;/ticket/&quot;) &amp;gt; 0) {
            ticket = uri.substring(uri.lastIndexOf(&#39;/&#39;) + 1);
            if (StringUtils.hasText(ticket)) {
                logger.warn(&quot;Service TICKET found on clean URL: &quot; + ticket);
                return ticket;
            }
        }
        logger.error(&quot;No SERVICE TICKET FOUND on request: &quot; + uri);
        return null;
    }
&lt;/pre&gt;

Then, remeber to edit you Acegi&#39;s bean of &lt;span style=&quot;font-family: courier new;&quot;&gt;org.acegisecurity.util.FilterChainProxy&lt;/span&gt; and it property &lt;span style=&quot;font-family: courier new;&quot;&gt;filterInvocationDefinitionSource&lt;/span&gt; so that the value for &lt;span style=&quot;font-family: courier new;&quot;&gt;j_acegi_security_check &lt;/span&gt;would be:

&lt;pre class=&quot;brush: plain&quot;&gt;
/j_acegi_security_check*/**=httpSessionContextIntegrationFilter,casProcessingFilter
&lt;/pre&gt;


&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-size: 100%;&quot;&gt;It seems that OC4J is working through this solution on separate CAS server and its applications get singed in through.&lt;/span&gt;&lt;/span&gt;

&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-size: 100%;&quot;&gt;This issue has also been discussed in Spring Forums:&lt;/span&gt;&lt;/span&gt;
&lt;a href=&quot;http://forum.springsource.org/showthread.php?t=38897&quot;&gt;&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-size: 100%;&quot;&gt;http://forum.springsource.org/showthread.php?t=38897&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;

&lt;span style=&quot;font-size: 85%;&quot;&gt;&lt;span style=&quot;font-size: 100%;&quot;&gt;Hope this would help.&lt;/span&gt;&lt;/span&gt;



&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://texscribbles.blogspot.com/feeds/4399226476741316205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://texscribbles.blogspot.com/2009/05/acegi-cas-service-ticket-oc4j-1013.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/4399226476741316205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2366790494689646605/posts/default/4399226476741316205'/><link rel='alternate' type='text/html' href='http://texscribbles.blogspot.com/2009/05/acegi-cas-service-ticket-oc4j-1013.html' title='Acegi - CAS - Service Ticket - OC4J 10.1.3.*?! - Ticket lost'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>