Posts

IIS 8.5 PHP Cannot Upload File - Permission Denied

If you have problem of not able to upload file and the error log said: permission denied/Unable to create file at line 0 (something like that), here is my suggestion: Go to your IIS, right click your application and select: Edit Permission In the "Security" screen where you can select a list of users and set permission, try to find if you have a user group called IUSR or IIS_IUSR. If you don't have it, use "Add" to add them in Assign "Full control" for those two groups and click "OK" Now here comes to the crucial part: Since PHP will first upload your file to a temporary folder first, then copy the file from temp folder to destination folder.   THE TEMPORARY FOLDER MUST ALSO BE WRITABLE BY IIS!!! So find that temporary folder out, add permission in that folder to allow IUSR and IIS_IUSR to have "full control" That would be OK. Hope that helps someone.

Drupal 7 How to clear login cache after changing admin password

To people who are looking for way to login to drupal 7 after changing password of admin account with the following command: php scripts\password-hash.sh <some password text> Please login to your DB and find a table called: <prefix>_flood and clear all the records inside.  You can refer to this post and under the section "Clear flood table" to find the description. I tested it and it works! Another way to do it is to repair <prefix>_session table, coming from this post . Haven't tried that, and use it at your own risk. Hope that helps someone.

Wordpress ERROR CONNECTION RESET Fix, Reinstall Wordpress

To people who are having the ERROR_CONNECTION_RESET problem when they are using Chrome to do wordpress development. Occasionally developer may have problem above, but no clue how to solve it. Actually, I don't know how to solve it either after doing all the Google search. So the only valid method is to re-install Wordpress, but still keep database content (including all config values) exists. Here is how I did, it works for me (My wordpress version is 4.1.1): Download latest version of Wordpress  and unzip for later use In your existing wordpress installation, backup wp-content/ folder and wp-config.php by copying it into another places Remove all existing wordpress files (make the whole directory empty) Copy all files from the latest copy of WP you just downloaded and place it into this empty folder Re-visit your WP site using a browser.  At this point you will be able to connect to the site, and require you to install WP.  Follow all the steps. At the en...

PHP Array to CSV in UTF-8 read by MS Excel

To people who are looking for a PHP script that can convert an array (mostly multi-dimensional array) to CSV in UTF-8, here is the code and file for you to download: PHP Array To CSV Read By MS Excel in UTF-8 Credit to Jérôme Jaglale , what I am looking for is a CodeIgniter solution to convert array to CSV, but it can also be used in non-CI PHP application. This is not a class, just a function (Helper). The full code below: if(!function_exists('array_to_csv')){ function array_to_csv($array, $download = ""){ // http://stackoverflow.com/questions/13108157/php-array-to-csv if(empty($download)){ $res = array(); foreach($array as $arr) { $res[] = implode(',', $arr); } return $res; }else{ $output = fopen("php://output",'w') or die("Can't open php://output"); // http://stackoverflow.com/questions/4348802/how-can-i-output-a-utf-8-csv-in-php-that-excel-will-read-properly header('Content-En...

PHP陽曆轉陰曆(農曆),陰曆轉陽曆的方法/Western Calendar To Chinese Lunar Calendar

Reference:  PHP阳历转阴历(农历),阴历转阳历的方法 Due to the recent project, we need a PHP function that convert a Western calendar to Chinese Lunar Calendar. Upon searching on the web, we found the resource above (In Simplified Chinese) that demonstrate how to do the conversion. But there is a limit: the range is from Year 1891 to 2100. There is also a bug in the class that, when there is a leap month, the calculation on month will be wrong. Fortunately I (think) I solve the problem by issuing a simple "If" statement.  The full source code can be downloaded here: https://www.mediafire.com/?6jsplf03pwpwp07 There is only 1 PHP file.  The class name is lunar.class.php To use this class, follow the same instruction at the reference page, or here: <?php header("Content-Type:text/html;charset=utf-8"); $lunar=new Lunar();//http://www.phpernote.com/php-function/867.html $month=$lunar->convertSolarToLunar(2013,07,08);//将阳历转换为阴历 echo '<pre>'; print_r($m...

NLP: The meaning of communication is the response you get.

The meaning of communication is the response you get. Meaning = Response Eben Pagan - Get Altitude #129

XAMPP Run SSI (Server Side Include) with PHP 5

I have a very stupid website. This website is developed by someone who use PHP 5.4 (FastCGI), Apache 2.4.9, MySQL 5.1. The most important thing is, this person is using SSI (Server Side Include) with PHP.... Which means, when page load, visitor will be redirected from index.php to somedir/start.html. And in the .html file, this person is using SSI. The start.html will look something like this: <td width="650" rowspan="2" align="left" valign="top" style="padding-top:16px;"> <a href="3dcreative.html" target="_blank">                     <img src="common/homepage/201408/3dcake.jpg" border="0" width="390" height="200" style="padding-right:10px; float:left"/></a>                 <!--#include virtual="main_cake_series.php"--> <!--#include virtual="main_ssi_banner.html"--> </td> Don't as...

Transparent PNG overlays another image

I was struggled by the problem of overlaying a transparent image with another image. until I read this: http://www.cssmojo.com/png_overlay_with_no_extra_markup/ This idea is great and for people who are struggling, there is an answer out there above. Hope it helps someone.

Inspiration from "The Fabulous Dr. Jacobson" by Glenn Livingston

Today's inspiration from interview done by Glenn Livingston with Dr. Jacobson. Money is a way to say "Thank you" Money has to be an expression of gratitude.

Perry Belcher 21 Steps Sales Letter

Image
Here is the link to the original post:  Salesletter Formula: 21 Effective Ways and Guides to a good Sales Piece Here is the info-graphic thanks to  21 Step Salesletter Formula – Perry Belcher [Infographic] Original: Salesletter Formula: 21 Effective Ways and Guides to a good Sales piece The Salesletter Formula can be a big help with your marketing plan, when you know exactly how to follow. This is an important tool to write a good salesletter, and video letters as well. Let me share some of these. Over the years , I’ve added a few points today to the Salesletter Formula, and I’d like to share this with you now. I read an article by David Frey called the 12 step foolproof Salesletter formula, a few years ago. This formula has made me millions of dollars over the last few years. Many thanks go to David, a brilliant marketer from San Antonio, Texas, a credit for opening to me the effective Salesletter Formula. I kind of feel like I’m painting a mustache on the Mona L...

Ryan Deiss - 3X Conversion Cheat Sheet

Image

Linux LVS Load balance on Fedora 5: My experience

Reference: http://www.austintek.com/LVS/LVS-HOWTO/ Before doing LVS, readers are required to read the HowTo and MiniHowTo of this site. This site explains the basic and the way load balance work. My architecture is as follow: Router(192.168.1.1) |---------------------|----------------------------| | | | Client Load balancer (LB) Real Server (RS) 192.168.1.5 eth0/DIP:192.168.1.2 192.168.1.4 VIP:192.168.1.3 Client - Windows machine Load balancer/Real Server - Fedora 5 - Kernel 2.6.18 Points to note: LB - I use 1 network card only, i.e. I hosted 2 IPs on 1 network card. I used the basic configuration script created by LVS site: http://www.linuxvirtualserver.org/software/index.html For those who don't know: DIP = Director IP: Director can be seen as load balancer, this is the IP of this load balancer. VIP = Virtual IP: This is the IP which can be seen as an "access point...

Woocommerce + WPML: Product 404 Not found when switch language?

Image
If you are using WPML  + Woocommerce and found that, usually when you trashed and recreate a product, you may find that when you switch language from one to another, the other language will show "404 Not found". This problem exists because your slug (Red underline: the last part of your URL if you are using permalink) is not the same across all products. My URL for all 3 languages are: English:    Traditional Chinese: Simplified Chinese: This is how I construct my URL in different language.  Notice the last part of the URL (the product name) is the same in all 3 languages.  You just need to make sure that you have different URL (identified by language name). This would solve your product 404 not found problem. Hope it helps someone.

[Solved] Magento: Login Redirect to Home Page, even if remove var/cache

Update: This paeg also solved my problem: http://www.aschroder.com/2009/05/fixing-magento-login-problem-after-a-fresh-installation/ Situation:  I download a copy of magento from production server to local machine (Win 7 + XAMPP 1.8.2) and try to set it up. After setting it up and load the home page (index.php), it redirected me to the old, production URL. This is the first problem, and you can follow this and this to solve it. Problem: However, there are times when it still did not work (still redirect to index.php when go to admin/), even you have already remove/delete the var/ folder, which contains cache/ and sessions/. So how to solve this problem? Solution: URL redirection is not only controlled by setting in DB, but also it is controlled by mod_rewrite/.htaccess. This is my .htaccess: <IfModule mod_rewrite.c> ############################################ ## enable rewrites     Options +FollowSymLinks ...

Swift in WWDC 2014

I just wrote a new post about what Swift in WWDC 2014 means to programmers and project manager: Blog:  What Apple “Swift” means to Programmer and Project Manager? Enjoy!

enets UMAPI V 1.3 NETSConfig.get NullPointerException Solve

I am setting up UMAPI v 1.3 from eNETs under Tomcat 7.0.21, Windows 7. If you encounter this error: java.lang.NullPointerException at com.wiz.enets2.transaction.umapi.NETSConfig.get(NETSConfig.java:69) The problem is that your CLASSPATH does not include the config files (which is strange, as CLASSPATH is used to set CLASS, not config...) So in your setenv.bat, I enter the following: set CATALINA_OPTS=-server -Xms256m -Xmx256m set CLASSPATH= C:\xampp\tomcat\webapps\ROOT\CLIENT\config ;C:\xampp\tomcat\webapps\ROOT\CLIENT\lib\* You should be fine, and I guess the same setting can be applied to Linux also. Hope it helps someone. I hate eNETs.

JMeter on Wordpress and Woocommerce

Image
I am using Apache JMeter  to do some stress tests on my server. (I am using ver 2.11) However, when I load and run the .jmx file generated from BadBoy , even if it runs smoothly the first few times, you will see "Session expired" message from JMeter later on. To fix this problem, I read this article about JMeter and found that if I add HTTP Cookie Manager : And configure like this: You will not see any session expired problem. Another message: "Action failed. Please refresh the page and retry." may be caused by Force SSL problem, you may see this thread in wordpress for details.

今晚放了小龜

今晚放了小龜 養了都有10多年了,關了這麼久,就當贖了前世的罪,今世獲得自由吧。 與你同住的大龜,沒來得及放生就去了,今次,就讓你走吧。 之後,就要看你自己的造化了。 再見了,小龜。

My prouduct launch notes

Surprisingly I spent a lot of time playing around with OptimizePress 2.0 Do a split test on sales page Driving FB PPC traffic to sales page.  And finally I understand this statement: You do not have any traffic problem.  It is true because you can always buy traffic from different source. Set your daily PPC budget at the maximum of your product price so that, if you have one sale a day, you just cover your PPC expense.  My product is $9.95 so that my daily PPC budget is $10. Later on it seems that it would be a good idea to create a free report first, then drive traffic to squeeze page, then create 3 email follow up on client. Using Ryan Deiss free email follow up as a template, you can rewrite it to deliver some value on your email, and at the end of email you add a link to your sales page.  E.g. if you want to learn more tips and tricks about this, you can go to website here. Frank Kern recently released an "article" promoting his advance training.  Th...

Linux Installing APR and Tomcat Native Library on Tomcat 7.0

Key notes: The objective: install APR and Tomcat Native Library on Tomcat 7.0.41.  I am using Icetea java 1.6 open JDK as when I download JAVA from Oracle, it has rt.jar missing on 1.6 and 1.7 The linux platform is RHEL 6.3 I download and compile tar source of APR (1.5) and APR util (1.5.3).  I found that when I use yum install, the apr library is incompleted. Need to yum install java openjdk.  I am using 1.6. Untar APR and follow readme to configure and compile.  make && make install Follow this (Eng) and this (S.Chi) to configure, compile and install Tomcat Native Library The command I use is: ./configure --with-apr=/usr/local/apr --with-java-home=/usr/lib/jvm/java-openjdk/ In setenv.sh (under <tomcat_dir>/bin, if not exists, create one), I set the following:  export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/apr/lib JAVA_HOME=/usr/lib/jvm/java-openjdk CLASSPATH=$CLASSPATH:/usr/local/tomcat7/webapps/ CATALINA_OPTS="-server ...