Posts tagged with tips

  • My first spider :)

    Just write my very first web spider which will first crawl mangafox and mangastream websites. Then, it emails me automatically about new mangas that I am currently following. This is fun :)

    I basically make use of simple parsing functions, and the CURL and tidy extensions:

    1) Get the HTML using the curl

    1.  public static function http($target, $ref, $method, $data_array, $incl_head)
    2.      {
    3.          # Initialize PHP/CURL handle
    4.          $ch = curl_init();
    6.          # Prcess data, if presented
    7.          if(is_array($data_array))
    8.          {
    9.  ...
    Read More
  • Create a simple Highcharts bar chart with real time update

    I need to use Highcharts for one of my recent projects to show the voting results. The library is very easy to use and flexible :)

    Below is an example of how to set it up to create a simple bar chart and customize its labels:

    1.  var pollChart;
    2.      $(document).ready(function() {
    3.          var colors = Highcharts.getOptions().colors;
    4.          var teamsJson = [{"name":"Team A","voteCount":"98"},
    5.                                {"name":"Team B","voteCount":"32"},
    6.                        {"name":"Team C ","voteCount":"45"}] ;
    7.          // use...
    Read More
  • Node.js deployment in production settings

    While node.js is exciting, it is clear that it is not a solution for everything. In particular, it would be a very bad idea to use node.js for content management systems. It would take too much efforts to write a CMS based in Node.js from scratch comparing to other mature CMS in PHP/Java/.Net/Python. Personally, I also feel Node.js is not suited for the standard CRUD apps yet. There is no big frameworks built on top of Node.js which give you features such as ORM for multiple databases, code generation, security handling, user management and...

    Read More
  • Centos Apache SSL setup note

    Further instructions can be found here:

    Key steps:

    # instal Apache mod ssl
    $ yum install mod_ssl
    # create folder for certs
    $ mkdir /etc/httpd/ssl
    # generate cert signing request
    # take note of the Common Name. It must be the domain name e.g.
    $ sudo openssl req -new -days 365 -nodes -keyout -out
    # either self signed the cert or send to CA authority
    # update ssl.conf under conf.d about the cert files locations
    Read More