Recent Works [HTML Javascript] Province Bengkulu Educational Profile

This works is just a simple web app using analytic style (I don’t know spesifically what it called) like belitung, it has some charts like pie charts, bar charts, searchable and sortable data, login system, and using real time data, I use Mariadb as the database. It’s still not finished yet, still so much todo, like create custom charts, custom reporting, custom templating, and easy depolyment. Still so much todo.

Demo

Continue Reading

Recent Works [WordPress] – Saidikmen dot org

wp-header-logo php
[RW3] Saidikmen dot org

This web is already online at saidikmen.org
I work for this wordpress web for 3 months (including learn), I do this job in my free time, it took about 3 hours a day.
Searching plugin, template, and make the perfect web is not that easy (even I’m php dev, but still need to learn wordpress), it has an event calendar, and forums too.

Python [snippet/benchmark] : Redis test insert php vs python

I have a test script about redis, 1 in PHP, and 1 in Python. I want to test which one is faster.

Here is the PHP code :

<?php

$redis = new Redis();
$redis->connect('127.0.0.1');
$counter = 0;

for ($i = 1; $i <= 100000; $i++){
    if ($redis->sadd("php:key_test",$i)){
        $counter += 1;
    }
}

echo "Added $counter data\n";

$count = $redis->scard('php:key_test');

echo "count_data = $count \n";

/*
root@fajri-laptop:/home/fajri/php_project/php_redis# time php redis_test_insert.php
Added 100000 data
count_data = 100000

real    0m12.093s
user    0m1.672s
sys    0m2.488s

root@fajri-laptop:/home/fajri/php_project/php_redis# php -v
PHP 5.3.2-1ubuntu4.17 with Suhosin-Patch (cli) (built: Jun 19 2012 01:35:33)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
*/

Here is the Python code :

import redis

redis_server = redis.Redis("127.0.0.1")
counter = 0

for i in range(100000):
    if redis_server.sadd('python:key_test',i):
        counter +=1

print "added %s data" % (counter)

count = redis_server.scard('python:key_test')

print "count_data = %s" % (count)

'''
fajri@fajri-laptop:~/python_project/py_redis$ time python redis_test_insert.py
added 100000 data
count_data = 100000

real    0m14.914s
user    0m6.100s
sys    0m2.104s

fajri@fajri-laptop:~/python_project/py_redis$ python -V
Python 2.6.5
'''

You can see, PHP is faster. So I googling & chat on ##python-friendly @ freenode, and got an idea, it should use xrange instead range.
So, I change to xrange, and it really works. Now Python is faster than PHP.
Why it could be? because range is just a list and xrange is Generator, which generator is using less memory than list, so it can be faster than before.
Finally it took only 10 seconds.

Hope this simple snippet is useful for you ūüėÄ

Recent Works [JAVA PHP] – Reporting engine (server side render highcharts)

Last 3 months, i have a request to create reporting engine with pptx (powerpoint) as an output. The chart library I used is highcharts, highcharts is usually use in html document, just to show some interactive charts, i.e clickable, animation, and the type like line charts, pie charts, column / bar charts and scatter charts. Because highcharts is render the graphic in html using SVG, we can get raw SVG for those charts, please refer to highcharts ref.

The client ask me, “Can i get the powerpoint contains all charts, just using 1 click only?”. Then I replied, “Yes, You can”. Continue Reading