Liberty Reserve – XML API with SSL error fix

February 3rd, 2010 by neobie No comments »

Back to few days ago, Liberty Reserve (LR) XML API is not working in my PHP script, when I try to retrieve the transaction history. If you do not know what is LR, it is one of the largest E-currency payment gateway.

I have been using CURL to retrieve the information for since few months ago. By using curl_error function, PHP output the following error:

SSL read: error:00000000:lib(0):func(0):reason(0), errno 104

It seem like is the SSL is causing the problem. Ignoring the CURL, I use file_get_contents to fetch the URL information without luck. However, the information can be retrieved if I paste the long XML encoded URL directly into the browser. By doing some research on Google on SSL with CURL, finally I fixed the problem with my own.

The solution is just to add another line of code curl_setopt if you have not done so:

// $ch - initialized CURL resource
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)"

Normally user agent is set if the site allow legit browser only. Not sure why LR is changing this all of sudden, but at least the fix is working for me.

pixelstats trackingpixel
  • Share/Bookmark

Import large database in remote server

January 10th, 2010 by neobie No comments »

If you owned slow internet connection, it would be headache if you have large database to be imported in a remote server. Either you import the database through MySQL GUI or phpMyAdmin, the execution time is mostly will exceed the maximum execution time allowed, resulting in an script timeout problem. It would be same if you manually paste the queries and execute it in remote server. The server simply doesn’t have enough time to capture your bulk records of “INSERT”.

So is there another alternative?

Actually, it is. You can upload your sql file to your remote server, and then use the PHP script to parse the sql file and then run the query line by line.

Fortunately, there is an open source code which ease our job to write our own script. You may visit “BigDump“, and download its source code, bigdump.php, which is zipped as  archive sized at only 10KB zip archive.

Before using BigDump, you need to upload your sql file into your remote server. Be sure not to upload your file to somewhere people may access it, such as your /public_html folder. Normally, you would upload the file at the parent folder of /public_html, such as, /home/<username>/

Bigdump also allow import the records from CSV file. You may refer the following configuration source code, foundat the beginning of bigdump.php.


// Database configuration

$db_server   = 'localhost';
$db_name     = '';
$db_username = '';
$db_password = '';

// Other settings (optional)

$filename           = '';     // Specify the dump filename to suppress the file selection dialog
$csv_insert_table   = '';     // Destination table for CSV files
$csv_preempty_table = false;  // true: delete all entries from table specified in $csv_insert_table before processing
$ajax               = true;   // AJAX mode: import will be done without refreshing the website
$linespersession    = 3000;   // Lines to be executed per one import session
$delaypersession    = 0;      // You can specify a sleep time in milliseconds after each session
// Works only if JavaScript is activated. Use to reduce server overrun

// Allowed comment delimiters: lines starting with these strings will be dropped by BigDump

$comment[]='#';                       // Standard comment lines are dropped by default
$comment[]='-- ';
// $comment[]='---';                  // Uncomment this line if using proprietary dump created by outdated mysqldump
// $comment[]='CREATE DATABASE';      // Uncomment this line if your dump contains create database queries in order to ignore them
$comment[]='/*!';                  // Or add your own string to leave out other proprietary things
// Connection character set should be the same as the dump file character set (utf8, latin1, cp1251, koi8r etc.)
// See http://dev.mysql.com/doc/refman/5.0/en/charset-charsets.html for the full list

$db_connection_charset = '';

Visit BigDump Official Website!

pixelstats trackingpixel
  • Share/Bookmark

Malaysia Web Hosting Review (2)

January 8th, 2010 by neobie 1 comment »

It has been a terrible week for me since the beginning 1st January.

The web hosting service I am using – HIVE, is having problem since 1st of January, when the website is frequently facing problem of database inaccessible. It took 2 days for HIVE to realise that the problem might be caused by part of the harddisk failure. They make an announcement saying that the server is estimated to be back online on the next day (4th January). However, the estimation is delayed for a few times, and the server is able to be back online until evening of 6th January. However, due to 2 hard disks of them are having problem at the same time, they can only retrieve the database backdated to 20th December. This means that more than 10 days of data is gone!

Furthermore, their support is unsatisfied as always. I was having hard time contacting them through e-mail, as when I replied them through e-mail, I could not get any replies. I have to go to their website to open ticket in order to reach them. I asked them for several times what is reason that I cannot reach them by replying their support mail, and the question was simply ignored. Furthermore, if you can get a reply from them in a few hours, that is considered as a fast response for them. Their technical support is always MIA.

My personal thought on HIVE is that, they have limited staffs and resources, possible a small organization with limited budget. This is the impression they imprinted on my mind, as a customer being 3 years with them.

Alternatively, I look for internet-webhosting again. They have a promotion with greater specification at lower price plan. As you know, internet-webhosting has great support team. Though not all the support personals have great knowledge, but they can response you in a short time. Mostly in less than 10-30 minutes. If you are in luck, you may reach their Level 3 technical assistant to solve the problem. I decided to subscribe to their Surfers Plan which allow me to host 15 domains at lower price and greater bandwidth (50GB/month). This is incomparable among the hosting packages  in Malaysia, base on my research.

Of course not all the things are perfect; internet-webhosting have to train their technical support to be more technical aware, or pass to a more capable person if they can’t solved the problem. I have bad experience as my IP was blocked from viewing my own website. They claimed that it is caused by the IP is connecting to FTP without port number. However, I never connect to FTP with the two IPs I am using last time.

I questioned them if the IPs are simply blocked. There is no reason for me to host my website on the server which simply block visitors. Unfortunately their level 2 technical support failed to give explanation for me.

pixelstats trackingpixel
  • Share/Bookmark

PPStream 流氓软件?

December 24th, 2009 by neobie No comments »

看来 PPSTREAM 也要被我列入流氓软件列表了。之前就觉得奇怪,为什么开ppstream 竟然比开迅雷还要吃带宽。如果内网有任何人看ppstream,其他人根本不用做东西了。

多亏 netlimiter , 我才发现原来ppstream是多么可恶的。。。

下载的速度 = 19.91 kB/s
上载的速度 = 72.50 kB/s

难快看ppstream不觉得很顺,但是整个上传的带宽却被它占用。如果只是刚开机的时候这么跑法还ok,但跑了20-30分钟还是这样,只好把ppstream关掉。

关掉就没事了吗?问题还没解决呢。还有一个 PPS 网络加速器,也在占用您的宽频,即使你关掉PPS!加速加速,听它放屁,把我的带宽变成龟速就有。都没看PPS了还要PPS加速来干什么?上传竟然搞到 22.37 kB/s!

PPStream 利用普通视窗用户不能测查流量的弱点,进行如此不道德的勾当,真是没天理。

pixelstats trackingpixel
  • Share/Bookmark

简单快速自制伴奏 – Part 1

December 22nd, 2009 by neobie No comments »

有一首你很喜欢的歌曲,偏偏这首歌并不是该原唱歌手的主打歌之一,不论有没有受其歌迷的注目,该歌曲的KTV 始终没被唱片公司考虑在内。这时候如何呢?

运气好的话,到网上搜一搜,可以找到歌曲的消音伴奏。但若没有好心人制作该伴奏,又应当如何?

这里提供一个简单容易上手制作消音伴奏的方法。开始前,请先准备以下的软件/插件:

  1. 歌曲的mp3
  2. 安装 Winamp - 音乐播放器的始祖
  3. 安装 Winamp 插件 - DeFX 0.97

安装之后,打开 Winamp,从菜单中点选 Options > Preference 。相同地你也可用 Ctrl + P 。

在设定选项视窗中,点击 Plug-in >

winamp_dsp

在插件选项中,点选DeFX v0.97。

DeFX0.97

要消音,点选Karaoke的 【On】按钮,所播放的歌曲即刻就被消音了。你可以在 【level】、【filter】、【band】、【width】调整所适合的消音程度。

千千静听的使用者也可用类似上述的方法达到消音的效果。

pixelstats trackingpixel
  • Share/Bookmark

Solution: notepad++ langs.xml not found

December 21st, 2009 by neobie No comments »

I have been using notepad++ for around 2 year and recently notepad++ with the latest version is having problem on my Windows 7 operating system. Whenever I start the program, and error message appears: “Load langs.xml failed”. With such problem, all the syntax colour are gone. If you wish to use show the syntax, you have to manually define the syntax on your own, on every documents that you opnened. It is so troublesome when you are a heavy developer!

There is some posts which ask user to change the langs.model.xml to replace the original file, langs.xml. The location of langs.xml is something similar to this:

C:/Program Files/Notepad++/

It works temporary for me, but after sometimes, the problem comes back again. Now I don’t even have the back up file for langs.xml, so I have to uninstall and install notepad++ back again.

Solution

I come across with another solution, which at least it works for a few days without any issues. Notice that the langs.xml file would become zero bytes in size after the problem. Now, before the problem happens, right click the langs.xml file and tick “Read Only”. With such option, the content of langs.xml will remain intact and therefore, notepad++ would have no problem in reading langs.xml for the correct colour to be used!

pixelstats trackingpixel
  • Share/Bookmark

Transferring money abroad: Malaysia to China

November 15th, 2009 by neobie No comments »

To transfer money from Malaysia local bank to one of the China Bank, there are several ways that I found on how to do it:

  1. Through the bank Foreign Telegraph Transfer (FTT)
  2. Online services such as Paypal
  3. 3rd party agent, such as Western Union, Xoom
  4. Of course there are other ways that I am not really looking into it, such as through ikobo, moneygram, etc

Most people would recommend Paypal to transfer the money. Paypal the most popular way to make online payment. However, the charges on the receiving side in China to withdraw money to their local bank is USD35.00 per transaction! That is unbelievable, as if compare to Malaysia, it costs only RM3.00 to withdraw the money.

How about FTT? I personally owned a Maybank & CIMB accounts. Maybank charges RM10.00, while CIMB charges RM30.00. It seem like an good option. There are some netizen comments that there will be intermediary charges and also charges from China local bank, which will normally cost around USD10 to USD25. There is no problem for me, as this could be the safest way. However, the FORM in the bank do not allow special characters to be filled in. Meaning, Chinese characters are totally disallowed as they are not A-Z letters. As you know, China main language is Mandarin and they use Chinese characters for their full name, home address, etc for any official purpose. Consequencely I gave up FTT method as I am unhappy with how the Form was designed. Furthermore, after each transaction you would leave trail behind in National Bank. I do not want to myself into any trouble which might come in the future.

Western Union, indeed is the fastest way to send the money in just a few minutes – few hours. They have built their reputation since long time ago. However I wish to do the transaction Online without going out to find WU agent located in somewhere else. Furthermore, the transaction fee is expensive.

Xoom is yet another way to transfer the money abroad. If you are transferring from US Bank, the fee would be USD4.99 and capped at maximum of USD9.99 for any amount of transaction. If you use credit card, debit card or paypal, the fees rise corresponding to your transaction amount. The form design of XOOM also do not allow Chinese characters to be filled.

My own experience

I decided to do the transaction using Snapgold + Liberty Reserve + Gold2Ex. Liberty Reserve (LR) is the largest digital currency service company due to some legal trouble that strikes E-gold. If you haven’t heard of LR, LR works like Paypal and you can fund your LR account through the Agents in local country. Gold2ex is the exchanger service located in China. I used it to convert LR to RMB funded into China local bank.

Here is the exact steps on how I do it: (Providing I have an account in Maybank2u, Liberty Reserve, Gold2Ex)

  1. Funds LR via Snapgold (I was funded in3 hours time)
  2. Transfer my LR funds to Gold2ex LR account (Register the transaction details first on gold2ex website)
  3. Gold2ex transferred the funds to Recipient’s China local bank ( in 1+ hour time)

Overall, I completed the transferring process in 4+ hours. By comparing the money I paid and the funds recipient received in China, I get the Forex RATE of 1USD = 1.84556 RMB.

pixelstats trackingpixel
  • Share/Bookmark

Bullion and Bandits: The Improbable Rise and Fall of E-Gold

November 14th, 2009 by neobie No comments »

dougjackson07

MELBOURNE, Florida — In a sparsely decorated office suite two floors above a neighborhood of strip malls and car dealerships, former oncologist Douglas Jackson is struggling to resuscitate a dying dream.

Jackson, 51, is the maverick founder of E-Gold, the first-of-its-kind digital currency that was once used by millions of people in more than a hundred countries. Today the currency is barely alive.

Stacks of cardboard evidence boxes in the office, marked “U.S. Secret Service,” help explain why, as does the pager-sized black box strapped to Jackson’s ankle: a tracking device that tells his probation officer whenever he leaves or enters his home.

“It’s supposed to be jail,” he says. “Only it’s self-administered.”

Jackson, whose six-month house arrest ends this month, recently met with Wired.com for his first in-depth interview since pleading guilty last year to money laundering-related crimes, and to operating an unlicensed money transmitting service. His tale is one of countless upstarts and entrepreneurs who approached the internet with big dreams, only to be chastened by sobering realities. But his rise and fall also offers a unique glimpse at the web’s frontier halcyon days, and the wilderness landscape that still covers much of the unregulated and un-policed web, where fraud artists prospect for riches alongside pioneers, and sometimes stake, and win, a claim on their territory.

Despite the shackle, Jackson’s conviction isn’t black and white. In a twist still unacknowledged by prosecutors, Jackson turned E-Gold for a time into one of law enforcement’s most productive honey pots, providing information that helped lead to the arrest and conviction of some of the web’s most wanted credit card thieves and hackers. He’s now working with regulatory agencies to try to bring back E-Gold, steps he says he would have taken voluntarily years ago if authorities had given him a chance.


Following his story, the picture that emerges of Jackson is not a portrait of a calculating criminal. Rather it is one of a naive visionary who thought his dream was bigger than any financial regulations, who got in over his head, and who finally struggled, too late, to make up for his missteps.

“There was no indication at all that anyone had a problem with what he was doing,” says Richard Timberlake, a former economics professor at the University of Georgia and author of several books on U.S. banking. Timberlake visited Jackson at his E-Gold office in 1997 and vouches for Jackson’s innocent intentions. “He was always very honest and very forthright in what he was trying to do as a business. Even the Federal Reserve believed it was legitimate.”

The story of the first digital currency backed entirely by gold and silver began in 1995, while Jackson was still treating cancer patients. A longtime student of economic history, Jackson was convinced that gold was a superior currency to paper money, despite the consensus among professional economists that a gold-standard prevented governments from responding quickly to monetary crises; when an economy faltered, treasuries couldn’t easily manufacture gold bars to stimulate it.

The United States dropped its reliance on gold in 1971, but Jackson doubted the wisdom of this move. “Many a paper currency has spun out of orbit in a calamitous trajectory,” he once wrote. “There has never been an instance of gold or silver being discarded as worthless.”

It was time, Jackson mused, for a radical rethink of money. Had he been born in another era, he could scarcely have acted on his beliefs. But the nascent internet changed everything. The international, 24-hour churn of e-commerce cried out for a monetary system that transcended borders and time zones. So in early 1996, Jackson began programming a back-end system for a new electronic currency, practicing medicine by day, and coding by night.

» Read more: Bullion and Bandits: The Improbable Rise and Fall of E-Gold

pixelstats trackingpixel
  • Share/Bookmark

Wordpress Plugin API error during installation

November 12th, 2009 by neobie No comments »

When I was logged into WP (2.8.5) and I tried to install a new plugin (from the dashboard), I would get the following error:

“An Unexpected HTTP Error occured during the API request.”

Basically, according to WP user efree_unix,

The cause of error is too long in the process of requesting the API plugin in the wordpress server so that the operation timed out. By default, wordpress give 5 seconds time limit to request a plugin. If within 5 seconds does not get a replay, then the process will be stopped and displayed an error “An Unexpected HTTP error occurred during the API request.”

THE SOLUTION:

Open wp_include/http.php file on line 223

‘timeout’ => apply_filters( ‘http_request_timeout’, 5),

change the script above into

‘timeout’ => apply_filters( ‘http_request_timeout’, 30),

You may refer to efree_unix’s post at here. At least it works for me :D

pixelstats trackingpixel
  • Share/Bookmark

Passing Object from Flash AS3 to PHP

October 22nd, 2009 by neobie 3 comments »

In previous post, we learnt how to pass an JSON encoded object from PHP to AS3. How about passing an Object from AS3 to PHP?

This example will show you how to do it. Take a look at the Flash ActionScript.

import flash.net.URLRequest;
import flash.net.URLLoader;
import com.adobe.serialization.json.JSON;

var people:Array = new Array();
var person:Object = new Object();
person.firstname = "Kobe";
person.lastname = "Bryant";
people.push(person);

var url:String = "http://localhost/getJSON.php";
var request:URLRequest = new URLRequest(url);
request.method = URLRequestMethod.POST;

var requestVars:URLVariables = new URLVariables();
requestVars.myObject = JSON.encode(people);
request.data = requestVars;

var loader:URLLoader = new URLLoader();
loader.load(request);

The script above encode the Object people with JSON, and pass it to variable name “myObject”. “myObject” will be passed to PHP script using POST method.

Next we will take a look at the PHP script, getJSON.php

$object = JSON_decode($_POST['myObject']);

$fp = fopen('data.txt', 'w');
fwrite($fp, $_POST['abc']);
fwrite($fp, $object[0]->firstname . " ");
fwrite($fp, $object[0]->lastname . chr(13) . chr(10));
fwrite($fp, $_POST['myObject']);
fclose($fp);

The script decode the JSON Object, $_POST['myObject'] passed from the AS3. Then it output the data to data.txt with the following output:

Kobe Bryant
[{"firstname":"Kobe","lastname":"Bryant"}]

The 2nd line is the encoded JSON object which is not decoded yet.

Remember that ascorelib is needed for JSON encoding & decoding in ActionScript. Extract the ascorelib zip file, locate the src\com folder and copy it to your Flash CS4 project folder.

Example files is provided. Download here.

pixelstats trackingpixel
  • Share/Bookmark