Project: The qGrader

As of now, the OpenGrader is still an idea. I haven’t had any time to develop it, though its idea is evolve over time.

But hey! Look at my sentence: ‘Most user of contest environment already know how to code’. What is it again? Why do we need an easy to use contest environment with beautiful admin UI?

And there is Patta Grader, which took minimalist design with all code-base configuration.

Now the decision come when I am in need of immediate contest environment to use within two weeks (it is due on next Monday the 13th). If I have set up my server with Ubuntu 10.04LTS already, I would install cafe-grader within a blink of eyes. But since I still run Ubuntu 9.04, I can’t. (I don’t trust Ubuntu dist-upgrade) So far, I decided to take minimalist design with both web and grader, and now I present you the qGrader!

qGrader is a small and swift contest environment. Though it is very small, it is fast and I think it can handle load of hundreds users well (if run on Unix; Windows grader is far too slow). Currently the implementation uses SQLite database (I’m quite addicted to its dynamic typing), but if migrated to MySQL or larger RDBMS, it would run tons faster.

The downside of this system is that there is no central grading procedure for each task. Each task must have its own grading procedure (written in PHP, as is all the system except sandbox). There is built-in procedure for standard batch-type task for easily use, but you still have to write code.

But I consider this a very big advantage. It allow basically every type of task to be usable on this system. And I believe with a few adjustment, you could easily move the task and use system to be database-based too.

Currently I am testing it (I wrote it in past two days). I might write summary page, for all task and each task. An admin interface for managing task and user (directly writing to file). But I don’t think I will write a MySQL part for it — for me SQLite is enough and is for more easier to write and use.

Contact me if you want to try the grader. I don’t think I will ever published it. The code is real mess (the web part is coded in only one PHP file and several CSS and images and the the grader is also one big file with two of utilities file (for task grader))

Leaving the LAMP Stack

Starting from yesterday, I decided to leave the LAMP stack for better. I know LAMP stack is very famous for its simplicity and power. But it was just plain old.

New things happen everyday, and I many of existing technologies cannot follow them fast enough, bringing way for new players. For example, Apache has its event-mpm in experimental for long time, but normally we still sicks to ageing prefork or worker mpm.

I know my server I am setting this up is quite powerful. I know even with its Traditional LAMP Stack with prefork-mpm and PHP as apache module can survive at least 500 concurrent connection. But that would totally consume every little bit of resources that I can’t run other things any more.

And also, I have hatred mod_php for long time. I would prefer CGI, if it is as powerful and secure as mod_php. So far I know about FastCGI interface, but setting up on Apache with standard php-cgi.exe is plain hell for me. Another reason I set up my old server as Apache and mod_php is because my hosting provider, AppservHosting, set their server up this way. And this is requirement for most PHP scripts out there.

I just discovered PHP-FPM (PHP FastCGI Process Manager) recently, and this is really what I needed.

Now I just need more powerful server with low CPU consuming and small memory footprint, but must support FastCGI interface. So far, after a while of searching, I come up with three web servers — nginx (pronounce engine x, but I pronounce n-jinx), lighttpd and cherokee. From this list, cherokee is the only processed-based web server. Other are using non-blocking I/O. I am still surprise why a processed-based web server has such high performance.

After surfing and reading for a while longer, I decided on nginx. Lighttpd has a memory leak, and I hate admin UI (that why I hate Abyss Web Server).

I don’t know why, but it seems that Apache is a web server standard. Maybe because it is the most successful? Oh, and by standard I mean many web servers take after it.

So I settled with nginx and PGP-FPM. Right here I am waiting for ‘make test’ to complete. I build everything from source this time.

Another reason I chose nginx is that it first started as a reverse-proxy server. This is a feature I require the most. So I can proxy the request to Apache backend (yes, I still use Apache as a backend server) for tasks that can’t be done in nginx such as CGI or WSGI.

But after that my ideas goes wild. I think I will install thttpd as a CGI server, Apache for passenger and WSGI (I still don’t trust nginx on this), OpenJDK+Jetty for Java. And also install GoogleV8FastCGI and Perl FastCGI on nginx. Well, if I run these all, it would probably be the most cumbersome web server ever!

The Design of the Active-Grader system.

The Active-Grader system (previously known as OpenGrader, but due name conflict with existing open-sourced project I can’t register that name on Google Code) is a system designed to be a unified grading system for programming contest.

From my last post, Aj. Jittat (more commonly known as Aj. Manow) gave me this valuable feedback:

I think that the problem is not about open-sourcing the grading system. It’s more about configuration and documentation. Different contests have different rules. Different task types need different grading methods and submission interfaces: think about output-only tasks or interactive tasks. These clearly make the grading systems some crazy beasts.

Very thanks to him, I finally come out with final design that suite all needs I can think of programming contests.
More >

Reinventing the Wheel — The Automated Grading System for Computer Contest

There has been a paper, or more, about the automated grading system. The key point is that many, many automated system is invented, tested and use in contest and/or online judge environment — without releasing the source code.

See the problem?

There has been a try to create one, unified grading system (Mares, 2007) called MO-Eval. But due the complication of the system and lag of good documentation, it can be said that the project fail miserably. It is, though, success in establish as a Czech national grading system.

The main problem with  MO-Eval system is the project is aimed with IOI-based contest, and it makes an extensive use of shell script, make it very had to migrate to other platform. Also, the interface isn’t very clear and the set of shell scripts is very complicated (at least for newer programming, who usually code in very clean Python, Java or C#). And most importantly, each module has very high coupling rate.

So far, I will introduce you to my new Active-Grader (previously OpenGrader, but due name conflict it was changed to this name). It will only provide the grading part with configurable interface. There is no UI, so you can write your own UI and connect them the the grader. The grader will read each evaluation request, process them and store the result for the UI.

Currently it is still under heavy development, but expected to make a first release before October.

PHP Framework : Lose-Lose situation

Long time no update, huh? Well, I’m alive and well. After a couple of my love stories, now back to programming.

I have had some experience with PHP frameworks: CakePHP, CodeIgnitor and KohahaPHP. I never have used Zend Framework, though, but I think I can imagine what it like.

I know what is the propose of those frameworks: for rapid website developing. Sound good, eh? But actually it isn’t.

More >

Love : The Decision

Sometimes, you may have noticed yourself thinking of someone. But do you know that he or she whom you have been thinking about, may actually thinking about someone else?

From times, there may be someone who is thinking about you. Yet, you do not care about him or her at all…

And sometimes, dreaming alone is tons better than the fact that,
All dreams you have been wonderfully dreaming, is just a dream…

Therefore, it is not unusual at all for the majority of people choose to live in their own dream, rather than facing the cruel world of truth that you are not the first in his or her heart.

It is not a tragedy…
More >

Love and Hate: Similar reaction

Well, I just realised something important in my life.

Before I start, I have a few questions for you to answer.

1. If someone whom you hate approach you for help or any discussions, what would you do?

2. If someone whom you secretly love approach you for help or any discussions, what would you do?

If you are not very exposed person like me, I believe your answers are the same. Yes, the same, at least for me.

If someone I hate approach me, I would talk to him with only the business he originally approach me for. And I’d do it politely, very politely. I’d do that not to offence him or her. Even he or she is the person I hate the most, I’d still talked to him or her politely.

But, if someone I secretly love approach me, I’d want her to be impressed. So, I would have done things very politely to avoid doing anything wrong, and it would be very awkward situation. I may slip into other topics too, but normally I cannot think of anything to talk with her…

I think I’ll have to act differently to catch the interest of her…

My Choice of SCM: Git vs. Mercurial

If you Googled “Git vs. Mercurial”, you will see a long list of pages that compare Git and Mercurial. Well, I think I’m writing one of those too.

In past, normally when I was developing, I will just use local copy and backup and use diff/WinMerge utility to compare and merge files. My life change when I starting to know SCM/VCS.

I started using SCM for the first time when I start looking into Robocode’s source (as per Pavel Savara’s request to be a tester), which use Subversion. I know basic of the operation before (commit and checkout mostly), but I had never use any of it prior than that time. As I continue using SVN for Robocode’s source,  I slowly learned more about SVN including what is branches, tags and trunk. I learned about patch later.

Since then, every time I develop some project, I need to have a VCS repository for my code (either local or hosted), all are SVN since I don’t know others. I knew that there is CVS, but its idea really confused me. I also knew that CVS is dated, and many projects that used to use CVS have already migrated/are migrating to SVN or other VCS.

My view of VCS changed when simple-php-framework moved to GitHub. I learned that there are also Git, Mercurial and Bazaar, which are DVCS. I still perfectly happy with SVN, so I didn’t really care about them, as long as GitHub provide a tarball link for me.

My first project which I use hosted SVN is napv-ce. I use Subversive plug-in for Eclipse as my SVN client. I hosted my project on Google Code. As I develop, the commit part really annoyed me since sometimes it just fails. And sometimes I don’t want to connect to the internet. The idea of DVCS starting to get back into my head.

More >

OOP Learning Process

Three years ago, I started to learn Java and OOP. That time, I found OOP quite interesting because it is a grouped functions. I slowly learn it from time to time.

Next year, when my teacher knew that I was into OOP, he told me to search about MVC, which I found it also quite interesting.  I searched about PHP MVC and I found several PHP framework. The one which attracted my eyes the most is CakePHP, so I decided to give it a try.

At first everything seems to go well and I love it. Separation of design and code and all of it. But as I use it for a while, I started to think that by having to many DBALs to my database, I have to learn about it all. So later I use my own Module-View design for my relatively small web, which I have Module as Controller and Model together.

Recently, when I have to code real web and I use Module-View, my webpage get dirtier and dirtier with SQL request, so I remember the MVC and move things to Model. That’s how I know the real reason of MVC.

Second thing: ORM. I was never able to understand the need of ORM library until recently. I found that ORM make my life easier if I use it with light DBAL.

I wrote this all because I want ones who fall under the smiler route with me that in order to understand the reason behind each invented things, you have to use it yourself.

Post Valentine: Poems and Haiku

For her own good

There’s one who I love
Who I care about the most
Who I really want to spend time with
Who I’m going to lost.

Yet, there is still a hope;
Not much, but worth living.
I don’t want to lose her,
But I don’t know if it is a good thing

I may just being selfish,
But I’m not in the mood.
I know she has to go,
’Cause she is leaving for her own good.

But chances are, she may not leave.
Wht? — I don’t really know.
I don’t care — as long as she stayed;
I can’t afford losing her, no…
More >