PHP Laravel 4 - before & after action

We may need to perform some actions before the controller function get called.

For example

Check user authentication before access to certain page.

AccountController.php

Read More

Apache Virtual Host accessed by other machines in LAN

Environment

This is tested on Ubuntu 13.04 that running on VMWare Fusion 5. Host machine is MacBookPro that running Mavericks.

Read More

PHP - Restructure multi-dimentional array into single dimention

Source

For example, we have array like this

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<?php
array(
'test_1' => array(
'msg_1' => 'this is the first desc',
'msg_2' => 'this is the second desc',
),
'test_2' => 'this is the third desc',
'test_3' => array(
'msg_1' => array(
'foo_1' => 'this is the fourth desc',
),
'msg_2' => 'this is the fifth desc',
),
'this is the sixth desc',
);

Read More

Problem with AFImageRequestOperation block not executed

Recently I’ve faced a weird bug about displaying image from URL to UIImageView. Finally I found out is the header issue.

Read More

Bring up UIPickerView when clicked on UIButton

We don’t add UIPickerView as subview. There is a trick to achieve this.

Create a dummy UITextField

This text field is not visible to user, is a hidden field

Read More

iOS - Working with MKMapView

Here I want to discuss about using map in iOS application

First, import MapKit

ViewController.h

Read More

Use custom font in iOS application

There are few steps to add custom font in your Xcode project.

Step 1: Add UIAppFonts to your Info.plist

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
<key>UIAppFonts</key>
<array>
<string>CUSTOMFONT-BLACK.TTF</string>
<string>CUSTOMFONT-BLACKIT.TTF</string>
<string>CUSTOMFONT-BOLD.TTF</string>
<string>CUSTOMFONT-BOLDIT.TTF</string>
<string>CUSTOMFONT-EXTRALIGHT.TTF</string>
<string>CUSTOMFONT-EXTRALIGHTIT.TTF</string>
<string>CUSTOMFONT-IT.TTF</string>
<string>CUSTOMFONT-LIGHT.TTF</string>
<string>CUSTOMFONT-LIGHTIT.TTF</string>
<string>CUSTOMFONT-REGULAR.TTF</string>
<string>CUSTOMFONT-SEMIBOLD.TTF</string>
<string>CUSTOMFONT-SEMIBOLDIT.TTF</string>
</array>

Read More

Wordpress form submission get 404

Have you ever face a problem, when there is GET request, it shows the form properly. However when there is POST request, there are 2 situations:

Read More

Remove unwanted/dummy character in C language

I’ve encounter this issue in RSA decryption (RSA_private_decrypt)

1
2
int result_length = RSA_private_decrypt(64, (unsigned char*)crypt_chunk, (unsigned char *)result_chunk, rsa_privateKey, RSA_PKCS1_PADDING);
printf("Result chunk: %s\nChunk length: %d\n", result_chunk, result_length);

Read More

How iPhone communicate with server in PHP

I have few friends as me about this.

How iOS can retrieve/update from/to MySQL/MSSQL database?

There are 2 parts:- Server side and Client side

Read More