Jackson's Blog

Tech Simplified

2015 in a Flash

The stats helper monkeys prepared a 2015 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 19,000 times in 2015. If it were a concert at Sydney Opera House, it would take about 7 sold-out performances for that many people to see it.

Click here to see the complete report.

[Web] Call different Servlets within a single form


While working on Net-Centric Project I came across an obstacle of creating multiple buttons and calling different servlets within the same form. This was in the login page, where we can either login or register by making use of the same form fields ‘username’ and ‘password’.

To do so you can create a button as following:

<input type="submit" id="reg" value="Register" onclick="form.action='registerServlet';">

This would call another Servlet when this button is clicked.

The form will look something like this:

<form method="post" action="loginServlet">
  <input type="text" name="username" value="Username" autofocus >
  <input type="password" name="password" value="Password" >
  <input id="login" type="submit" value="Login" >
  <input type="submit" id="reg" value="Register" onclick="form.action='registerServlet';">

Happy coding.

Let the Windows be open, and feel the Freedom.

[OpenGL] Running OpenGL program on Mac OS X

Today I am going to show how you can run OpenGL programs on your Mac OS X through command line (Terminal.App).

1. Use the header file “GLUT/glut.h” and not “GL/glut.h”

2. main function should return an integer type value.

int main(int argc, char** argv) {
    return 0;

3. Run the program by using the following command:

gcc -framework OpenGL -framework GLUT <inputfile> -o <output> -Wno-deprecated

We are passing -Wno-deprecated flag to surpress the warning generated as lot of procedures are deprecated after 10.9.x.

In Ubuntu, we pass -lm -lglut -lGL -lGLUT, but in our case we pass OpenGL and GLUT as parameters to framework option.

Happy animating.

Let the Windows be open, and feel the Freedom.

[Star Wars] Google Easter Egg


Google has an awesome treat for all the Star Wars fans :)

Open up Google Chrome and enter the following query in URL bar – “a long time ago in a galaxy far far away” and see the magic.

Here’s a small preview of the page if you the Easter egg isn’t available.

Screen Shot 2015-11-26 at 9.53.46 pm.png

May the Force be with you.

P.S.: I tried this on Mozilla Firefox but it doesn’t work for me.

Let the Windows be open, and feel the Freedom.

[Android] Fix Rendering Issues in Android Studio


While creating a new android project using Android Studio I came across a Rendering error when I try to open the ‘Design tab’ on any layout xml file.

Rendering Error
Rendering Error – Classes could not be found.

Open up the styles.xml file. It would be under res/values/ folder in your app directory.

Change the following line

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">


<style name="AppTheme" parent="Base.Theme.AppCompat.Light.DarkActionBar">

Here, we have added Base as the superclass for this particular theme as defined in the values.xml under the build/ directory.

<style name="Base.Theme.AppCompat.Light.DarkActionBar" parent="Base.Theme.AppCompat.Light">

Other Solutions:
1. Change the theme by selecting the ‘Design’ tab of your layout xml. Then click on App Theme and select the appropriate theme you want.
2. Modify the styles.xml file as following and select the appropriate API level.

<style name="AppTheme" parent="android:Theme.Holo.Light.DarkActionBar"></style>

Let the Windows be open, and feel the Freedom.

[Fedora] Add self signed certificate to list of trusted certificates


Today I am going to show you how to add a self signed certificate to the list of trusted certificates in fedora.

I was trying to install some packages on fedora and was getting SSL errors while I was connected to my university WiFi (which makes use of self signed certificate). In order to connect to my university WiFi, I need to accept and add a self-signed certificate to list of trusted certificates.

Note: Remember that adding self-signed certificates to list of trusted certificates is not recommended unless no other option is available.

We can add and trust the certificate from browser if you just want to browse the internet. But if you want connection in the complete environment i.e., terminal, browser, apps, etc. you can follow the steps mentioned below.

First we need to download the self-signed certificate from the WiFi portal or the web. For me, the certificate is available on my university intranet.

Step 1: Copy the self signed certificate to trusted certificates folder.

sudo cp /path/to/certificate.cer /etc/pki/ca-trust/source/anchors/

Remember to replace ‘/path/to’ with the folder in which your certificate is downloaded.

Step 2: Update list of trusted certificates

sudo update-ca-trust

Now you can connect to the internet via browser, terminal and other applications.

Thanks to ‘puiterwijk’ on IRC #fedora-admin on Freenode.

P.S.: Never do online transaction or other sensitive transactions on public WiFi.

Let the Windows be open, and feel the Freedom.

[GSoC 2015] Dependency calculation using libsolv


After the Mid-Term Evaluations I started working on dependency calculation module. I added a procedure mportinstall in macports.tcl file which in turn calls dep_calc procedure in macports_libsolv.tcl.

There was already a mportexec procedure which was called by port.tcl and the dependency calculation and conflict resolution was handled by mportexec. So we modified port.tcl to call mportinstall when -l (libsolv) option is passed.

The problem that we faced was port.tcl passes the portnames one by one and executes mportexec for each portname passed to ‘port install’. We didn’t want this as libsolv requires the complete list of ports to be installed. So we tweaked port.tcl where the portnames were passed one by one by iterating over the portlist (list of ports to be installed) and passed the complete list instead to mportinstall.

These portnames passed to dep_calc as associative array were then iterated over and appended to a list variable named portlist. After this, we need to use the Selection to select the appropriate solv from the pool and create list of jobs. This jobs list is then solved by the libsolv and if a conflict occurs, create a solution after conflict resolution and ask for user confirmation or create another solution.

The final stage is the transaction part which classifies the list of packages as ‘Installed’, ‘Upgraded’, ‘Erased’, ‘Downgraded’ and ‘Reinstalled’. This list was returned to mportinstall to continue with installing the ports. But this list was alphabetically sorted and we had to manually use dlist to topologically sort it so that dependencies were installed first. We achieved the desired results and it was much more efficient than the built-in engine and the conflict resolution was quite smooth. Currently we support only installation at the moment and more options to uninstall, etc. will be added soon.

There was a procedure for transaction to order the list topologically i.e., list the dependencies first that we missed out initially while working on the swig interface but that seems to be fixed by the upstream developers :).

Let the Windows be open, and feel the Freedom.

[GSoC 2015] Mid-Term Evaluations

Hola Amigos,

I was at FUDCon 2015, Pune from 25th June to 28th June, 2015. At the same time, GSoC 2015 Mid Term evaluations was scheduled which I successfully passed :). My mentor, neverpanic, was really helpful and we did schedule our timeline accordingly.

We finished up implementing search using libsolv and successfully set up libsolv pool and repo data. I also wrote a small test file for testing the search module implemented. This also included code cleanup, optimization wherever possible, adding comments for better understanding of the code and fixing bugs.

Our next objective after the Mid Term evaluation was to start working on dependency calculation and converting libsolv build from cmake to autoconf (more on this to come soon!).

Every step till now was a new experience in itself and I learnt a lot at each and every step.

Let the Windows be open, and feel the Freedom.

[GSoC 2015] Create libsolv Pool

Hola amigos,

I was busy with MacPorts work and then after MidTerm Evaluations of GSoC I got busy with academics so couldn’t enough time to update my blog and document my work. GSoC Final Evaluations are near and I have completed major part of our project. I will be posting a series of blog post documenting my work and GSoC 2015 experience.

For libsolv to work we had to create a libsolv pool, in short cache. Initially we used the PortIndex contents to create this libsolv pool. PortIndex is Macports’ cache for fast access of port information. As the project moved forward and more features were added, we realized that just the PortIndex information wasn’t enough for libsolv to work efficiently. We added another field ‘conflicts’ to PortIndex to support setting up of dependency information in the libsolv pool.

In the first few weeks when we were implementing search using libsolv, we had set up all the fields in libsolv that were available in PortIndex. We did notice that as the information increased, the overhead of creating the pool increased. But we had a check in place so that it is made sure that if the pool exists then it is not created again.

After search was implemented successfully with desired results we moved on to our main goal of dependency calculation using libsolv. We came across lot of hurdles while setting up solv information for the dependency calculation to work properly.

We needed a ‘repo’ of installed solvs in our libsolv pool. So we read this information from the registry that keeps track of all the installed ports. Then we noticed that we had set ‘obsoletes’ field in the solv with ‘replaced_by’ field in PortIndex, which later turned out to be the inverse. So we had to come up with an efficient solution to reverse map the replaced_by and obsoletes field e.g., A replaced_by B, C means B, C obsoletes A.

Now we had to set up the build-time and run-time dependencies which was a bit confusing at first. We need to pass a $marker value as the argument to the function call used to set up the dependencies(dep_array). For the time being, we just went with the default value.

Now, the libsolv pool is set up and running successfully with better results as compared to the built-in engine used for dependency and conflict resolution.

I will discuss more about dependency calculation and conflict resolution in detail in upcoming posts.

Let the Windows be open, and feel the Freedom.

[GSoC 2015] Implement libsolv Search

Hola Amigos,

Okay first I am going to show how you can clone and test my MacPorts Development branch and set it up safely so that it does not interfere with the installed MacPorts version. And then we will be setting up libsolv from upstream to test our search implemented using libsolv.

Setting up MacPorts libsolv branch.

Now we have set up MacPorts and libsolv. Time to do some testing using libsolv search. As of now I have added all the possible options that MacPorts inbuilt search provides, few of them would be –description, –name, –license, etc.

Before starting to work on dependency calculation, neverpanic asked me to start from smaller modules like setting up the solv’s (libsolv’s representation of the ports), add more information to the solvable like evr, license, vendor, category, etc. We kept adding the dependency information for later as we wanted to test if the solv’s are setup correctly or not.

After setting up this information, we implemented search module which will take the options, passed as arguments on command line, from port.tcl. We used relevant solv flag’s for searching the libsolv cache. Finally we finished everything and I made sure to follow “Commit early and commit often” motto. My mentor reviewed the commits and gave his inputs on how I can optimize the code. After getting desired results, I worked on clean-up of the codebase and optimizing wherever possible.

Once this was done we started figuring out how can we setup dependency information of the solvables. We looked into the PortIndex and libsolv-bindings manual and matched the appropriate flags to be used and drafted a plan.

You can also test out MacPorts libsolv search by passing -l option (to use libsolv engine).

Some example commands are:

portgsoc -l search libsolv
portgsoc -l search --category math
portgsoc -l search --exact --case-sensitive gcc5

P.S.: This post was lying around in my drafts for quite some time. From now, I will try to publish as much as of my pending drafts and also publish recent posts about my work.

Let the Windows be open, and feel the Freedom.

Create a free website or blog at | The Baskerville Theme.

Up ↑


Get every new post delivered to your Inbox.

Join 514 other followers

%d bloggers like this: