Friday, May 24, 2013

[Solution] Wordpress "An error occurred in the upload. Please try again later" error.

Got this weird "An error occurred in the upload. Please try again later" error whenever I try to do media uploads in Wordpress.



I've checked the folder permission, its correct. In fact, the files were uploaded successfully to wp-content > upload folder.

I've tried all kinds of suggestion in forums (disable all plugins, enable them one by one... etc), but still no avail.

In the end, I decided to do a "Re-install", and that... worked!



And all the uploaded files were intact.


-----

Didn't dig deep into finding out what causes the issue.

But a wild guess would be something to do with the PHP codes. Because the uploaded files were stored in DB, although the upload status indicated "failed".

Most likely something to do with the permission issue highlighted in this blog post.

Tuesday, May 14, 2013

List of Brainwave Headbands



Melon
Melon - $79 on Kickstarter

Webpage: http://www.usemelon.com/
Kickstarter: http://www.kickstarter.com/projects/806146824/melon-a-headband-and-mobile-app-to-measure-your-fo



Muse
Muse - $199

Webpage: http://www.interaxon.ca/muse/


PayDollar Test Credit Cards

Was looking for Test Credit cards to test integration with AsiaPay/PayDollar via Google but couldn't find any. But manage to find one in the PHP sample source code.
Card number: 4918914107195005
CCV: 123
Expiry Date: 07 2015
Card Holder: Test Card

Extras.

For first timer like me, I find PayDollar website & documentation slightly messy, and sometimes, the links on the site are broken.

Integration Guide
Home Page, v3.21

Sample Source Codes

Can be found in
Merchant Administration page > Support > Developer Corner
The direct links are as follow:
Client Post: PHP
Direct Client Side: PHP
Direct Server Side: PHP

Monday, December 10, 2012

GitHub Wiki - Anchor link for page headers

Example "Table of Content" on "markdown-here"


Was trying to do a table of content in Github Wiki just now and realize there aren't much guide on that. After searching for a while, I found this comment on Github that shows how to do it.

1. Add anchor for the header that you want to link to
# <a name="heading1"/> Heading 1

2. Add the link to the anchor
[link to heading 1](#wiki-heading1)


Example usage:

Sunday, August 19, 2012

Amazon AMI install MongoDB Driver

Did an installation of MongoDB driver for PHP on my Amazon EC2 AMI just now. And thought of noting the steps down.


Prerequisites 

Make sure the following packages are installed.
$ sudo yum install gcc
$ sudo yum install make

$ sudo yum install httpd mod_ssl
$ sudo yum install php
$ sudo yum install php-devel php-pear
$ sudo yum install pcre-devel

Install MongoDB driver for Amazon Linux

Installing Mongo driver.
$ sudo pecl install mongo


Enable the driver
$ sudo vi /etc/php.d/mongo.ini
$ extension=mongo.so
$ sudo  /sbin/service httpd restart


Testing

The simplest way to check whether the installation is successful is via phpinfo().
<?php
  phpinfo();
?>
And you should see the following section:



Or test the connection using the code snippet below :)
<?php
 // connect
 $m = new Mongo("mongodb://mongodb-user:mongodb-password@ds031087.mongolab.com:31087/sample-test-mongodb");
 
 // select a database
 $db = $m->{"sample-test-mongodb"};
 
 // select a collection (analogous to a relational database's table)
 $collection = $db->cartoons;
 
 // add a record
 $obj = array( "title" => "Calvin and Hobbes", "author" => "Bill Watterson" );
 // $collection->insert($obj);
 
 // add another record, with a different "shape"
 $obj = array( "title" => "XKCD", "online" => true );
 // $collection->insert($obj);
 
 // find everything in the collection
 $cursor = $collection->find();
 
 // iterate through the results
 foreach ($cursor as $obj) {
     echo $obj["title"] . "\n";
 }
?>
And you should see following output in browser:



Its quite simple, but hope this help beginners out there :)