Archive for July, 2011

nginx rewrite rules with php-fpm for WordPress

 

Start by CentOS support php 5.3, I start to migrate from php-cgi to php-fpm.

Previously, I just use this rewrite rules for my WordPress setting:

    location / {
        #if (!-f $request-filename) { return 404; break; }
        rewrite "^/([^\.]*)$" /index.php?q=$1 last;
        root   /home/v/vaksin/;
        index  index.php index.html;
    }

 

But know since I use php-fpm, the rewrite rules above is not running well.

Now, I changed the configuration like this:

    location / {
        #if (!-f $request-filename) { return 404; break; }
        root   /home/v/vaksin/;
        index  index.php index.html;
            rewrite ^.*/files/(.*)$ /wp-includes/ms-files.php?file=$1 last;
            if (!-e $request_filename) {
                  rewrite ^.+/?(/wp-.*) $1 last;
                  rewrite ^.+/?(/.*\.php)$ $1 last;
                  rewrite ^(.+)$ /index.php?q=$1 last;
            }
    }

 

and this website now is back online :-)

*previously the problem is we can’t see the article detail, because it redirected to 404 (page not found).

 


Create Customized Field to Show Graphs on BlackBerry

 

Sometimes you need to show Graphs on BlackBerry Applications, instead of using Google chart as image on the Applications,

you can use the Blackberry Charts samples below.

The following sample code demonstrates how to create custom graph fields. The sample contains the following classes:

  • BarGraphField – A custom field that draws a bar graph
  • BarScreen – A screen demonstrating the use of BarGraphField
  • BlackBerryGraphs – The main application
  • GraphDemoScreen – The introductory screen for the sample application that allows a BlackBerry smartphone user to choose the type of graph to preview
  • GraphField – The base class that the other *GraphFields extend
  • LegendField – A custom field that draws a legend
  • LineGraphField – A custom field that draws a line or scatter graph
  • LineScreen – A screen demonstrating the use of LineGraphField
  • PieGraphField – A custom field that draws a pie chart
  • PieScreen – A screen demonstrating the use of PieGraphField and LegendField

The entire sample can be downloaded here. The following are some sample screen shots that illustrate the custom graph fields.

To access the sample code, download the attached BlackBerryGraphs.download-pdf-renameto.zip file.

Bar Graph Demo on BlackBerry App

Line/Scatter Graph Demo on BlackBerry App

Pie Graph Demo on BlackBerry App

[1] http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800345/How_To_-_Create_graph_fields.html?nodeid=1889634&vernum=0


  • Copyright © 1996-2010 vaks.in. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress