For SALE: iOS Donut Progress Bar

The iOS Donut Progress Bar is an iOS library that you can integrate in your project to present data in a graphical way. Furthermore, it will allow you to get a live preview of the design right in the Interface Builder.

Sunday, April 17, 2016

Wordpress cannot add menu item SOLVED

Recently we encountered a problem wherein we cannot add anymore menu-items to our wordpress main navigation menu. On top of that the theme's menu assignment is unchecked whenever we tried to add a menu-item and hit save.

Add the following php property to your php.ini
max_input_nesting_levels = 500
max_input_vars = 6000

Common issues:

  1. max_input_vars does not take effect when you look into php properties using script.
    1. Solution: if you have several domains on one hosting package, make sure that you duplicate php.ini to the root of your other domain
  2. Values are already updated, phpinfo is already showing the correct values but still I can't add a menu-item.
    1. Solution: copy the php.ini inside your wp-admin folder.

Sunday, April 10, 2016

How to align a Polarie Camera Tracker using a Polar Meter

The following article will guide you on how to setup and configure your Camera on a Polarie Camera Tracker using Polarie Polar Meter.

Gadgets Used:

  • Vixen Polarie Camera Tracker
  • Vixen Polarie Polar Meter
  • Canon 50D
  • Ballhead

Setup and configuration the Camera and Polarie

  1. Mount your ball-head to the Polarie Tracker rotator
  2. Mount the rotator to the Polarie Tracker body
  3. Make sure that the Polarie Meter is pointing to 14.6degree (Philippines)
  4. Mount the Polarie Meter to the Polarie Tracker
  5. Mount the Camera to the Polarie Tracker
Remember to align the compass to North. After that you can point the ballhead of the camera anywhere, but be aware of the rotation so the camera will not tangle up with the Polarie Tracker and Meter.

Thursday, March 24, 2016

How to set Authorization header in all SoapUI test cases via Script

To set the Authorization header in each test case of a testSuite, we run the script below.

import com.eviware.soapui.impl.wsdl.teststeps.*

StringToStringMap headers = new StringToStringMap();
StringToStringMap headersForSuper = new StringToStringMap();
String userPass = testCase.testSuite.project.getPropertyValue("username")+":"+testCase.testSuite.project.getPropertyValue("password");"userPass=" + userPass);

headers.put("Authorization","Basic "+userPass.getBytes().encodeBase64());

for(testSuiteItem in  testCase.testSuite.project.getTestSuiteList()){
 for( testCaseItem in testSuiteItem.getTestCaseList() ) {"Setting basic auth for all WSDL test requests in test case ["+testCaseItem.getName()+"]")
     for( testStep in testCaseItem.getTestStepsOfType(com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep) ) {

Thursday, March 10, 2016

How to output mysql query result into a file

See sql script below:

SELECT code, name, continent, region 
INTO OUTFILE 'c:/temp/countries.csv' 

Thursday, December 10, 2015

Swift Sliding Menu

Swift Sliding Menu

1.) First, Download the SWRevealViewController library from github

2.) Inside the folder, move the SWRevealViewController.h and SWRevealViewController.m to your project. Create a header file and insert the following line

#import "SWRevealViewController.h"

3.) You'll be needing the following ViewControllers

4.) In the storyboard, select the view which has a label SWRevealViewController and change its class to SWRevealViewController. Next, control-drag from SWRevealViewController to sw_rear.

Select the "reveal view controller set segue". Select the segue and change its identifier to "sw_rear" under the identity inspector.

Next, repeat the same procedures to connect SWRevealViewController with the navigation controller of the news view controller. Again, select “reveal view controller set segue” when prompted.Set the identifier of the segue to “sw_front”.

5.) Inside the viewdidload of the swift file of sw_front, insert the following lines of code:

if self.revealViewController() != nil { = self.revealViewController()
    menuButton.action = "revealToggle:"

6.) To be able to switch to different cell, drag to the navigation controller of the view controllers and select the “reveal view controller push controller” segue under Selection Segue.

Monday, November 02, 2015

How to handle an xmlrcp wordpress attack on nginx server

I'm not really a system administrator and these steps are just based on my personal experience in securing our own wordpress websites.

Lately there has been a lot of attacks on wordpress sites (since it's a popular framework) specially on windows machine. So we decided to migrate on a linux machine. Obviously got a lot of attacks still, one of the nasty one is a DoS (denial of service), and here's how we handled it:

  1. Install akismet plugin.
  2. Install wordfence plugin - this one is really good.
  3. If you know how to type commands on linux, run tail -f /var/log/nginx/access.log. This will should the most frequent request together with its IP take note of it and under WordFence->Blocked IPs, add it.
  4. Install and configure ip tables. 
  5. Block the ip in ip tables (INPUT section):
    sudo iptables -A INPUT -s [IP ADDRESS] -j DROP
    //or insert as a first rule
    sudo iptables -I INPUT 1 -s [IP ADDRESS] -j DROP
    //check if configured correctly
    sudo iptables -L --line-numbers
    //to remove a rule
    iptables -D INPUT [line-number]
  6. Configure nginx.conf to block xmlrpc request (make sure that you are not using it). Normally you don't. Create nginx.conf in your webroot with the following contents:
    # nginx configuration
    location /xmlrpc.php {
    deny all;
    Here's an htaccess to nginx converter, just in case you need:
  7. Setup fail2ban. Google on how-to. Here's my favorite:

How to setup a subdomain in your nginx server

Lately I've created a sub-domain for one of my website. I hope you follow this blog on how to setup your nginx wordpress site. In the same server where I host my, I've added a And here is how:

  1. I created a new folder in /var/www/subdomain where I install a new copy of wordpress. Note that /var/www/html contains my maindomain.
  2. The duplicate the config site in the blog I mentioned above (my-site), so now I have subdomain ni /etc/nginx/sites-available.
  3. Make the following modifications (first 2 lines):
    listen 80;
    listen [::]:80;
  4. Basically, you can't have 2 virtual configurations with default_server marker.
  5. Your sub domain should now be accessible.

How to setup your wordpress website in nginx server

Long ago I learned of the advantages of nginx over apache, just google it. Planned to migrate our sites but didn't manage to do it until last weekend. So here's what I did to do that:

I'm assuming you already have a functional wordpress with mysql setup and html / php files in /var/www/html (the usual).

First we need to install nginx and php:

sudo apt-get install nginx php5-fpm

Next, configure nginx virtual config, like in apache. Default config file is at /etc/nginx/sites-available/default, copy it and edit like below:

cp /etc/nginx/sites-available/default /etc/nginx/sites-available/my-site

//modify my-site
server {
        listen 80 default_server;
        listen [::]:80 default_server ipv6only=on;

        root /var/www/html;
        index index.php index.html index.htm;


        location / {
                # try_files $uri $uri/ =404;
                try_files $uri $uri/ /index.php?q=$uri&$args;

        error_page 404 /404.html;

        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;

        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params;

//remove default enabled site
rm /etc/nginx/sites-enabled/default

//enable my-site
ln -s /etc/nginx/sites-available/my-site /etc/nginx/sites-enabled/

//restart or reload
sudo service nginx restart
sudo service php5-fpm restart

Your website should now be up and running in nginx.

*Keep your eye on missing comma ;.

Saturday, October 24, 2015

How to copy a folder from jboss deployment to your local machine

The code below will copy a folder from a deployed application in jboss to a local folder in your machine. This is useful if you want to deploy something, perhaps a set of configuration files on your local machine on deployment.

File destinationDir = new File(destinationFolder);
if (!destinationDir.exists()) {

 //get the folder path from resource
 String sourcePath = Thread.currentThread().getContextClassLoader().getResource("./jasper").getPath();
 File sourceFile = new File(sourcePath);
 if (!sourceFile.exists()) {
  //get the vfs path
  VirtualFile vfDir = VFS.getChild("/content/"
    + ParamBean.getInstance().getProperty("meveo.moduleName", "meveo")
    + ".war/WEB-INF/classes/jasper");
  URL vfPath = VFSUtils.getPhysicalURL(vfDir);
  sourceFile = new File(vfPath.getPath());
  if (!sourceFile.exists()) {
   throw new Exception("missing source");
 //copy the resource files to local machine
 FileUtils.copyDirectory(sourceFile, destinationDir);

Friday, October 23, 2015

How to download a file from the server using javaEE

The following snippet will accept a filename in the server's directory, set it as the content of the FacesContext for the user to download.

public String downloadXMLInvoice(String fileName) {
 File file = new File(getXmlInvoiceDir().getAbsolutePath() + File.separator + fileName);
 try {
  FacesContext context = FacesContext.getCurrentInstance();
  HttpServletResponse res = (HttpServletResponse) context.getExternalContext().getResponse();
  res.setContentLength((int) file.length());
  res.addHeader("Content-disposition", "attachment;filename=\"" + fileName + "\"");

  OutputStream out = res.getOutputStream();
  InputStream fin = new FileInputStream(file);

  byte[] buf = new byte[1024];
  int sig = 0;
  while ((sig =, 0, 1024)) != -1) {
   out.write(buf, 0, sig);
 } catch (Exception e) {
  log.error(Epic failed :-) ", e.getMessage(), file.getAbsolutePath());
 return null;