Sunday, July 9, 2017

Building and Running Emory Bindaas on Ubuntu 16.04 LTS

Bindaas is a data services middleware platform built utilizing the componentized architecture of OSGi. Bindaas binary could be downloaded or built from source. To test Bindaas quickly, download the binary and extract it.

Given below is a detailed transcript of what is executed in the above screencast on checking out, building, running, and developing Bindaas with Git, Maven, and IntelliJ IDEA.

Skip the step 1 below and go directly to step 2 if you do not have access to the source code of Bindaas. If you have access to the source code of Bindaas, follow step 1, followed by step 2.

Step 1: Building Emory Bindaas
Alternatively, you may choose to build Bindaas from source. I would recommend using the maven-restructure branch (or maven-restructure-dev branch, if you would like to be in the bleeding edge, though most branches are periodically synced) for that, as it consists of fixes and enhancements to Maven integration. Hence this branch enables easy integration with multiple IDEs such as IntelliJ IDEA, Eclipse, and all the Java IDEs that have Maven integration, where currently master branch supports only Eclipse IDE.
Create Project in Bindaas





Bindaas has been tested with Oracle Java 1.8.x.

Clone the source code.
$ git clone git@github.com:sharmalab/bindaas.git

$ cd bindaas

$ git checkout dev

$ mvn clean install

$ cd dist


Step 2: Running Emory Bindaas
Change to the bin directory of Bindaas distribution (either that is downloaded as binary, or that is built from the source following step 1),
$ cd bin

You may run Bindaas using one of the 3 options below:

Option 1
$ ./startup.sh

This starts Bindaas using nohup. Logs could be found at log/bindaas.log. You may stop the program later by running the shutdown.sh script.

Option 2
If you rather like to have the logs in the foreground in the terminal itself, instead of using the start up script, you may run the java command directly.

$  java -Dpid=BINDAAS_INSTANCE -Xmx1024m -jar org.eclipse.osgi_3.8.2.v20130124-134944.jar

Option 3
Alternatively, start with -console flag to have OSGi console:
$  java -Dpid=BINDAAS_INSTANCE -Xmx1024m -jar org.eclipse.osgi_3.8.2.v20130124-134944.jar -console

Now you have started Bindaas using one of the above 3 options, you may connect to the dashboard at http://localhost:8080/dashboard/ using the user name and password, "admin", "password".

Make sure to have the trailing "/" at the end of URL as shown above.

Once you have created a project using the "Create Project" command, you may define the data providers for the project at http://localhost:8080/dashboard/workspace/{project_name}

You may choose a database such as a mysql or Mongodb databases, or use an HTTP provider.

Once the data provider is defined, queries could be created from the respective listing page of the data provider, 
http://localhost:8080/dashboard/{project_name}/{data_provider_name}/createQueryEndpoint.action

The query could be a simple sql query such as,
select * from states 
"Try Me" on a simple mysql data provider.

Created queries could be viewed from http://localhost:8080/dashboard/{project_name}/{data_provider_name}/query/{query_name} 

"Try Me" option could be used to view the outputs of the query.

This is a very simple post on starting to use Bindaas. You may read further on creating a new data service using Bindaas here, or go through the wiki pages.


Developing Bindaas
First you need to download the entire source tree and build using Maven as in step 1. You may develop using any Java IDE that has Maven integration, including IntelliJ IDEA and Eclipse. I highly recommend IntelliJ IDEA. Just open the pom.xml of the root directory of bindaas source cloned from git to open the entire source hierarchy.

Happy coding!
 
P.S: The above build was tested with Maven 3.5.0 and Oracle Java version "1.8.0_121".

$ mvn -v
Apache Maven 3.5.0 (ff8f5e7444045639af65f6095c62210b5713f426; 2017-04-03T21:39:06+02:00)
Maven home: /home/pradeeban/programs/apache-maven-3.5.0
Java version: 1.8.0_121, vendor: Oracle Corporation
Java home: /home/pradeeban/programs/jdk1.8.0_121/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.8.0-58-generic", arch: "amd64", family: "unix"

$ java -version
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)


Starting Bindaas with Option 3 above is most preferred for development and debugging purposes, as you can debug into the OSGi console. For example, you may list the installed feature using the below command.
osgi>ss
"Framework is launched."


id    State       Bundle
0    ACTIVE      org.eclipse.osgi_3.8.2.v20130124-134944
1    ACTIVE      com.google.gson_2.1.0.v201203072145
2    ACTIVE      org.eclipse.equinox.console_1.0.100.v20121001-124408
3    ACTIVE      org.apache.felix.gogo.shell_0.10.0.v201211091412
4    ACTIVE      org.apache.felix.gogo.runtime_0.10.0.v201209301036
5    ACTIVE      org.apache.felix.gogo.command_0.10.0.v201209301215
6    ACTIVE      org.apache.felix.configadmin_1.6.0
7    ACTIVE      org.springframework.osgi.log4j.osgi_1.2.15.SNAPSHOT
                Fragments=46
8    ACTIVE      org.apache.felix.eventadmin_1.3.2
9    ACTIVE      org.apache.felix.fileinstall_3.2.6
11    ACTIVE      org.springframework.core_3.2.2.RELEASE
10    ACTIVE      http-datasource-provider_1.0.0
12    ACTIVE      org.apache.felix.http.jetty_2.2.0
13    ACTIVE      postgres-datasource-provider_1.0.1
14    ACTIVE      bindaas-trusted-application-manager_1.0.0
15    ACTIVE      org.eclipse.gemini.blueprint.core_1.0.2.RELEASE
16    ACTIVE      bindaas-security-api_1.0.0
17    ACTIVE      org.eclipse.orbit.mongodb_2.7.3.v20120213-1927
19    ACTIVE      org.apache.felix.http.whiteboard_2.2.0
20    ACTIVE      com.springsource.org.apache.commons.logging_1.1.1
21    ACTIVE      org.springframework.aop_3.2.2.RELEASE
22    ACTIVE      org.springframework.beans_3.2.2.RELEASE
23    ACTIVE      org.eclipse.gemini.blueprint.extender_1.0.2.RELEASE
24    ACTIVE      org.springframework.context.support_3.2.2.RELEASE
25    ACTIVE      db2jcc4-9.7_0.0.0
26    ACTIVE      com.springsource.org.aopalliance_1.0.0
27    ACTIVE      org.eclipse.gemini.blueprint.io_1.0.2.RELEASE
28    ACTIVE      com.springsource.edu.emory.mathcs.backport_3.1.0
29    ACTIVE      org.springframework.expression_3.2.2.RELEASE
30    ACTIVE      org.springframework.context_3.2.2.RELEASE
18    ACTIVE      bindaas-commons-cxf-wrapper_1.0.0
31    ACTIVE      mysql-datasource-provider_1.0.1
32    ACTIVE      mongodb-datasource-provider_1.0.0
33    ACTIVE      security-dashboard_1.0.0
34    ACTIVE      bindaas-commons-openid-helper_1.0.0
35    ACTIVE      bindaas-commons-mail_1.0.0
36    ACTIVE      bindaas-psuedo-sts_1.0.0
37    ACTIVE      ldap-bindaas-authentication-provider_1.0.0
38    ACTIVE      bindaas-web-console_1.0.0
39    ACTIVE      drill-datasource-provider_1.0.1
40    ACTIVE      db2-datasource-provider_1.0.0
41    ACTIVE      bindaas-commons-h2-hibernate_1.0.0
42    ACTIVE      bindaas-core-api_1.0.0
43    ACTIVE      bindaas-core-impl_1.0.0
44    ACTIVE      bindaas-version-manager_1.0.0
45    ACTIVE      generic-sql-datasource-provider_1.0.0
46    RESOLVED    log4j.config_1.0.0
                Master=7

Note: The screencasts may be outdated as they were taken a few months ago. In case of mismatch between the screencast and the script/text in this blog post, follow the text.

Saturday, July 1, 2017

Nobody puts Baby in a corner

KAU Library with the Quote
I found it refreshing that Karlstad University (KAU) spent a considerable amount of money to create an artwork, citing the popular quote, "Nobody puts Baby in a corner" from the movie, Dirty Dancing (1987). You may read the story behind why Karlstad University choose to spend 170,000 SEK on this artwork, which I consider romantic. Interestingly, KAU considers this phrase empowering the women.

We also attended Putte i Parken, a free musical show in Karlstad, coupled with free public transport to the venue. What is better? We even secured the first line for many of the performances. :)

ACRO summer school and KAU gave very good memories. It is probably the best of conference/meetup/summer school travel I have so far. Previously I had ICWS 2016 as my favorite. This is my first time attending a summer school. Summer school feels more relaxed than a conference where I also have a paper to present. Moreover, I met many wonderful people, and made very nice friends this time. Sweden is awesome. I have been to Sweden in 2013, 2015, and 2017. I have also been to Spain in 2013, 2015, and 2017 too. Following this pattern, I believe I will be back to Sweden and Spain again in 2019. :P

My first polygonal journey

Beautiful view of Oslo
Next time when you plan to fly somewhere for a trip, check whether you can get it cheaper by returning from a different airport. I found that this time that by choosing to go to  BRU -> OSL and then return from ARN -> BRU, I got the cheapest of all the possible options (compared with the return trips, BRU <-> OSL and BRU <-> ARN). It also worked well as my destination Karlstad was in between Oslo and Stockholm (on the way to Stockholm from Oslo). 

I presented my work at ACRO Summer School held at Karstad University. The presentation is given below:









Thursday, June 29, 2017

HP and Windows - A Jealous Affair

I bought my HP laptop 3.5 years ago. It came pre-installed with Windows 8. As a primary Linux user, I installed Ubuntu with a intention of dual-booting with using Ubuntu primarily. However, HP always showed only Windows in the bootup, and by default it goes into Windows - never letting me sign in. Boot-repair-disk helped me fix this issue. Nevertheless, every time Windows upgraded, it broke the fix, and made the computer go into Windows by default. I tried to stop Windows upgrade after fixing this several times using Boot-repair-disk, as I got fed up with this. However, Windows upgrade worked on its own for "critical system/security updates". I was unable to turn these off. Guess what? These automated updates broke my boot as usual, leaving Windows the only option. 

It was not even possible to change the boot to Ubuntu, or to bring the menu at start up. By that time, I got to know that this was a bug (or a feature?) from HP that Windows was hard-coded. I also did not have this issue in my other new laptop. Why I did not completely uninstall Windows? Sometimes I need it: printer, a few wifi configurations, and some docx, pptx files sent by others - these are the reasons behind my occasional usage of Windows. But every time I go to WIndows, it breaks my grub, leaving it as the only option to log in to.

By this time, Boot-repair-disk stopped working. However, I have an earlier version stored in my pen drive, which luckily works well. So I assume that a later "fix" in Boot-repair-disk broke it. Even efibootmgr did not work as expected. All I was able to do was to change the option for the next boot. Not forever! Eventually, I had to follow this work-around to get this running.

First, find your current status:
$ sudo efibootmgr
[sudo] password for pradeeban:
BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 0003,3003,0000,0002,0004,2001,2002,2003
Boot0000* rEFInd Boot Manager
Boot0002* ubuntu
Boot0003* Windows Boot Manager
Boot0004* ubuntu
Boot0005* EFI USB Device (General UDisk)
Boot2001* USB Drive (UEFI)
Boot2002* Internal CD/DVD ROM Drive (UEFI)
Boot3000* Internal Hard Disk or Solid State Disk
Boot3001* Internal Hard Disk or Solid State Disk
Boot3003* Internal Hard Disk or Solid State Disk

Now, ideally you should be able to do the below:
$ sudo efibootmgr -o 0002,0004,3003,0000,2001,2002,0003
BootCurrent: 0002
Timeout: 0 seconds
BootOrder: 0002,0004,3003,0000,2001,2002,0003
Boot0000* rEFInd Boot Manager
Boot0002* ubuntu
Boot0003* Windows Boot Manager
Boot0004* ubuntu
Boot0005* EFI USB Device (General UDisk)
Boot2001* USB Drive (UEFI)
Boot2002* Internal CD/DVD ROM Drive (UEFI)
Boot3000* Internal Hard Disk or Solid State Disk
Boot3001* Internal Hard Disk or Solid State Disk
Boot3003* Internal Hard Disk or Solid State Disk

But, unfortunately, it was not working as expected. Rather, I had to follow a work-around of changing the boot order just for the next boot:
$ sudo efibootmgr -n 0002

Now add this below line to /etc/rc.local to repeat this same action every time Ubuntu loads:
sudo efibootmgr -n 0002

After this work-around, the grub loads successfully, and I can choose Ubuntu (among the many other options) easily as before. I did not log in to Windows after this fix. I am sure Windows will find a way to easily break this work-around once I log in to it.

Currently this work around makes sure that every time I log in to Ubuntu, Ubuntu sets the next boot to be Ubuntu/grub option. However, if I log in using the Windows entry in the grub, this bit won't be set. So the next time, it will log in to Windows directly, and thus breaking this cycle. However, when that happens, I just need to use Esc -> F9 sequence to just log in to Ubuntu once. After that, Ubuntu will be back as long as I keep using only it. In other words, Ubuntu boot will be fine as long as I do not log in to Windows.

You do not see Ubuntu upgrades breaking my Windows boot. Windows is such a jealous affair.

Saturday, June 3, 2017

When a search giant abandons your country

Google "sri lanka news"
I am not sure what is going wrong. Is my country, Sri Lanka, just cricket, or is it something wrong with Google? When the entire country is suffering due to floods and land slides leaving up to 1/20 of the country's population affected, Google search on "Sri Lanka news" just returns news on Sri Lanka cricket.

I am not sure whether this is done systematically through some hidden involvement. It annoys me a lot. Are we really addicted to Cricket that much? Seriously? We have bigger problems and more important news at the moment. How can I trust the Internet, when the most popular search engine returns irrelevant news?

Please note that I used the private mode. So my results are not affected by my past views. So you cannot give the excuse that my search results are based on my previous clicks. If I want to read about Sri Lanka in cricket, I would search for "sri lanka cricket" instead. When I search for news, I want real news. Not stories of a certain sports or gossips about actors. This is not a one-time event. I tested Google several times for Sri Lanka news over the past years. It always disappointed me with cricket news. News is something that affects the people. At least they are the news that should pop up as the top stories. Google fails Sri Lanka miserably here.

On the other hand, duckduckgo, a newer search engine performs better, returning more relevant real news on Sri Lanka for the same search. Probably we all should switch to duckduckgo as our search engine.
duckduckgo "sri lanka news"