Friday, October 07, 2011

How-To: Run Google Directory Sync on OS X

Currently, Google does not support running the Google Directory Sync tool on OS X - at least out-of-the-box. However, given that it is a Java tool, it is indeed possible to hack the installer file, run the installation and run the tool itself.

To see is to believe, so here a screenshot of the tool running on Lion ;)

Here the steps to make it work:

1) Download the Linux Distribution:
http://dl.google.com/dirsync/dirsync-linux.sh

The version I obtained was 2.1.3:
googleappsdirsync_linux_2_1_3.sh
(Comment: My working directory is dirsync)

2) Extract the installer:
tail -c 20361629 googleappsdirsync_linux_2_1_3.sh > sfx_archive.tar.gz

(Comment: For other versions, open the file with a capable editor, and search for the tail -c line to obtain the right line offset)
tar -xvzf sfx_archive.tar.gz

3) Now we need an install script to run the installer:

i4j_classpath="i4jruntime.jar:user.jar"
local_classpath="$i4j_classpath"
app_java_home=$(/usr/libexec/java_home)

java -Dinstall4j.jvmDir="$app_java_home" \
     -Dexe4j.moduleName="googleappsdirsync_linux_2_1_3.sh" \
     -Dexe4j.totalDataLength=25649094 \
     -Dinstall4j.cwd="." \
     -Djava.ext.dirs="$app_java_home/lib/ext" \
     "-Dsun.java2d.noddraw=true" \
     $INSTALL4J_ADD_VM_PARAMS \
     -classpath "$local_classpath" \
     com.install4j.runtime.Launcher launch com.install4j.runtime.installer.Installer false false "" "" false true false "" true true 0 0 "" 20 20 "Arial" "0,0,0" 8 500 "version 2.1.3" 20 40 "Arial" "0,0,0" 8 500 -1  "$@"
(Comment: For other versions, open the file with a capable editor and search for the -Dexe4j.totalDataLength to obtain the right data length)
Now run the script to install :)

sh install.sh

Remember, you won't need to install any symbolic links, so just don't.

4) Run the config-manager
The standard install will be in /Applications/GoogleAppsDirSync and you can just double click the script with this name to run the manager.

Et voilà

Enjoy!

Saturday, March 19, 2011

How-To: Configure GMail on Bamboo Standalone (3.0)

Actually, it is possible to configure Bamboo Standalone to use GMail for mail notifications.
Bamboo standalone is running on top of Jetty, which can be configured with the jetty.xml file.

If starting from the bamboo.sh script, then what needs to be done is a change of the run command.

RUN_CMD="$JAVA_HOME/bin/java -server -Xms256m -Xmx512m -XX:MaxPermSize=256m -Djava.awt.headless=true -classpath $CLASSPATH -Dorg.eclipse.jetty.xml.XmlParser.NotValidating=true com.atlassian.bamboo.server.Server webapp/WEB-INF/classes/jetty.xml"

Then edit the webapp/WEB-INF/classes/jetty.xml within the <Configure id="Server" class="org.eclipse.jetty.server.Server"> as follows:
1) Add the plusConfig to enable JNDI
<!-- =========================================================== -->
<!-- Configurations for WebAppContexts                           -->
<!-- Sequence of configurations to enable Plus features.         -->
<!-- =========================================================== -->
<Array id="plusConfig" type="java.lang.String">
   <Item>org.eclipse.jetty.webapp.WebInfConfiguration</Item>
   <Item>org.eclipse.jetty.webapp.WebXmlConfiguration</Item>
   <Item>org.eclipse.jetty.webapp.MetaInfConfiguration</Item>
   <Item>org.eclipse.jetty.webapp.FragmentConfiguration</Item>
   <Item>org.eclipse.jetty.plus.webapp.EnvConfiguration</Item>
   <Item>org.eclipse.jetty.plus.webapp.PlusConfiguration</Item>
   <Item>org.eclipse.jetty.webapp.JettyWebXmlConfiguration</Item>
   <Item>org.eclipse.jetty.webapp.TagLibConfiguration</Item>
</Array>
2) In the web application context for Bamboo
  <Call name="setHandler">
        <Arg>
            <New class="org.eclipse.jetty.webapp.WebAppContext">
Add the plusConfig Set:
<Set name="configurationClasses"><Ref id="plusConfig"/></Set>
3) Finally, in the section for JNDI resources
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
<!-- Add Any JNDI Resources                                           -->
<!-- The default location can be changed using: java -Dbamboo.webapp= -->
<!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  -->
Add the Resource for your GMail Account:
<New id="mail" class="org.eclipse.jetty.plus.jndi.Resource">
   <Arg></Arg>
   <Arg>mail/Session</Arg>
   <Arg>
     <New class="org.eclipse.jetty.jndi.factories.MailSessionReference">
       <Set name="user">[GMail User]</Set>
       <Set name="password">[Password]</Set>
       <Set name="properties">
         <New class="java.util.Properties">
           <Put name="mail.smtp.host">smtp.gmail.com</Put>
           <Put name="mail.smtp.auth">true</Put>
           <Put name="mail.smtp.port">465</Put>
           <Put name="mail.smtp.user">[GMail User]</Put>
           <Put name="mail.smtp.starttls.enable">true</Put>
           <Put name="mail.from">[From Address]</Put>
           <Put name="mail.smtp.socketFactory.class">javax.net.ssl.SSLSocketFactory</Put>
         </New>
       </Set>
     </New>
   </Arg>
</New>

Side note:
You may also add a JDBC Resource here; here as an example a simple PostgreSQL Resource:
<New id="datasource" class="org.eclipse.jetty.plus.jndi.Resource">
  <Arg></Arg>
  <Arg>jdbc/BambooDS</Arg>
  <Arg>
    <New class="org.postgresql.ds.PGSimpleDataSource">
      <Set name="User">[Username]</Set>
      <Set name="Password">[Password]</Set>
      <Set name="DatabaseName">bamboo</Set>
      <Set name="ServerName">localhost</Set>
      <Set name="PortNumber">5432</Set>
   </New>
  </Arg>
</New>

That's it, with this Jetty configuration, it's now possible to configure Bamboo to use the corresponding JNDI resource for the Mail configuration.

Enjoy.

Note for older versions:
It's also possible to make the same configuration in older Bamboo standalone versions. Mostly all that needs to be done is explained above, except that the class names have to be changed to match the ones from the older Jetty version.

Note for the wrapper:
It should be possible to configure the wrapper to start with the jetty.xml configuration, using the file as second parameter and uncommenting the rest:
wrapper.app.parameter.2=../webapp/WEB-INF/classes/jetty.xml.

Thursday, August 26, 2010

Visiting Semantic Search: Thesaurus based related searches

Recently I have seen and heard a lot of the words "semantic search". Most of the time, it's used as "yet another hype term", so I wanted to explore a little bit in this direction.

Initializing from Wikipedia I found this article that tries to establish some categories:
Breakthrough Analysis: Two + Nine Types of Semantic Search

Now, the spot where I started my exploration is "related searches/queries". This is how I understand that "related searches/queries" is supposed to work:


While it may be quite challenging to find an answer to "How do you know a carrot is a vegetable?" it is not as easy as it may seem at the first glimpse.

Thus, I thought an interesting place to start was an approach based on synonyms. After looking a little bit into WordNet I realized I could try the following:
1) grab an available Thesaurus in the German language
2) transform it into a simple graph database with full-text index functionality
3) query for terms and look at visualizations of the result to see if the approach would actually work.

Surprisingly it worked out pretty well and gives interesting results (terms are green, the traversal depth is colored 1=red, 2=orange, 3=yellow).

Mond:











Krieger:










Results look promising for a simple demo, I hope I find some more time to keep exploring the concept and more of the world of semantic search in future posts.