The First Week of GSoC

So ended the first week of GSoC2014. It’s been exciting and funny, though there is some exam pressure on me :/

What I Have Done


Refactoring

I’ve broken the routing strategies into small pieces of files. Instead of placing all routes in app.js, now each router is placed in its own files . E.G. get(/login) and post(/login) is placed under login.js. Above that there is an index.js requires all those files.

Besides these files were put into different modules as well, different module handle different business, and they are independent from each other. I’m trying to keep to make everything a module. Nevertheless some basic router were kept by the main project.

So now the whole are structure like these,

1
2
3
4
5
6
7
8
9
10
11
app.js                    # requires all modules specified in conf.js, and the router folder
routes
| index.js # requires router file
| login.js
| logout.js
modules
| index.js # requires lib
| lib
| | index.js # requires routes and controller
| | routes # organized as the former one
| | | ...

Setteled the disagreement on code style

We now officially adopted the Felix’s as the project’s code style standard. Due to some historical problems, there isn’t, at least for javascript, a code convention for OpenMRS. So maybe in the future, we’ll have our own formal code convention as well :D

For the sake of efficiency. I’m now using SublimeLinter to detect the potential problems and JsFormat to format my code.

However, in the process of refactoring, I had to be very very careful. Cause this project is somehow lack of unit testing. That’s to say, another to-do added on the list. Bonjour Mocha.

What I Will Do


I think I’ll stick to my old plan, thus:

  1. Continue the refactoring work, move different views into their respective modules.
  2. Clean-up a step further.
  3. Learning the db stuff, starting to make some beta designs.
  4. Completing the issue-tracking page.

Be hardworking, and be active on community.

All for delivering the best work!

OpenLDAP Problem

var/run/slapd Problem

Today when I tried to start my OpenLDAP server by directly using slapd command, it’s surprisingly failed. It logged this

unable to open file "/var/run/slapd/slapd.pid": 2 (No such file or directory)

It seems the var/run/slapd folder is missing.

But if I use service slapd start it will succeed, and generate var/run/slapd correctly. However, after reboot this folder will once again disappear.

After some search, I found that every time when Ubuntu boot, the var/run are empty at first, and each folder will be created dynamically by individual service as they start.

And then I remembered that some time before I’ve used chkconfig to disable slapd from auto startup.

So the solution is simple, just use chkconfig slapd on to enable it.

Service problem

But after that I encountered the old slapd service problem again, that is the slapd service don’t have right permission to access the db file because of some problems related with Ubuntu’s Apparmor mechanism(SELinux).

And it’s the exact reson I disabled slapd service.

Now I have to sudo service slapd stop first and then use the command below to start slapd manually.

sudo slapd -d 1 -f /etc/ldap/slapd.conf

GSoC2014 Prepost

The exciting GSoC work time is coming soon!!!

But still, there is 5 contests and waiting for me…Hope everything will be fine.

About GSoC Works

What I Have Done

  • Implemented a Multipass SSO for OpenMRS HelpDesk.
  • Chatted with Elliott about the future plan. I’ve got a clearer image about my walk, and made a initial rough work schedule.
  • Got more familiar with OpenMRS-ID

What I Will Do

  • Currently, I’m working on OpenID-Connect, in order to build a OpenID server for OpenMRS-ID.
  • According to my proposal, I’ll only do the refactor works in first few weeks.
  • Continue learn things about the DB, and make some testing prototype try.

This year’s summer will be a great and fun one.

Build This Site

The reasons I abandon my oringinal ghost blog are the slowness (for poor connection of my university) and the capacitance limitaion of OpenShift.

After messing around with Github Pages and Jekyll for a whole day, I finally found the amazing Hexo.

So here is what I have done to make this site available.

Jekyll Attempt

First, I used Jekyll to build my site.

But later I found it somehow hard to handle. Here are few reasons,

  • It’s hard to switch themes.
  • It’s written in Ruby, which I have little knowledge of.
  • Though Jekyll has built-in syntax highlighting, it doesn’t support Markdown style codeblocks. And the Github-Pages has limited the gem plugins, so I can’t use kramdown with coderay either.
  • I don’t like Liquid, and prefer to use mere Markdown for better portability.

Though after some google work, I found Google Code Prettify and make it work with Markdown. But the whole process are just painful to me, I hate it.

Hexo

So I turned to Hexo.

Like Jekyll, Hexo is a static website generator, but written in Node.js. So it’s faster and simpler.

It’s much easier to switch themes in Hexo, and I choosed Light theme designed by the Hexo author.

Howerver when I choose the theme, I encountered some problems. Though I changed the theme in config.yml, when I hexo generate, hexo won’t generate new css file. It seems that the generate will cache the css file.

Solutions are simple, run hexo clean, and then hexo generate. That will clear the cache and generate grand new files for you.

And now, Let’s say a colorful hello to the world.

1
2
3
4
5
6
7
#include <stdio.h>

int main(int argc, char const *argv[])
{

printf("Hello world!");
return 0;
}

Nevertheless, this site is still under construction. I’ll enhance categories and tags functionalities. But I suppose, it should fit my bisic needs currently.

hello world

First trial post

Asterisk line below


italic

bold

italic bold

quote here

Below is a codeblock

1
var a = function(req, res) {};
1
2
3
4
5
6
7
8
9
10
11
int gcd(int a, int b) {
if (b)
return gcd(b,a%b);
return a;
}
int main(int argc, char const *argv[]) {
int a, b;
scanf("%d%d", &a, &b);
printf("%d\n", gcd(a,b));
return 0;
}

A link here

  1. First
  2. Second
    1. Sublist
      • Sub-sublist
      • one more
  3. End

Paragraph 1

Paragraph 2

Paragraph 3

Paragraph 4

Paragraph 5