Friday, November 27, 2015

Abandon git local branch

I've merged, I've commited changes locally, but I have not decided to push it or not, so I leave it there. After several days, I want to totally abandon my local branch.

I would do below:

  1. git checkout master
    It will just tell you that your local branch is different from remote.
  2. git reset --hard origin/master
    This is the real effect command, it will force your local to be exactly same as remote.

Friday, October 30, 2015

Wordpress posts show question marks

I installed Wordpress on my local server, when I moved it onto remote server, all posts show just question marks like this:

?????

What I did was: mysqldump, then mysql in.

Later after lots of search, inspired by this post:

https://mathiasbynens.be/notes/mysql-utf8mb4 

I found all I need to do is to set remote database server to use utf8mb4.

Be careful, all database, tables and columns by the newest Wordpress are already utf8mb4, so I did not touch them. Just to this to change your mysql database server to use utf8mb4. Every line is needed:

[client]
default-character-set=utf8mb4

[mysql]
default-character-set=utf8mb4

[mysqld]
character-set-client-handshake=FALSE
character-set-server=utf8mb4
collation-server=utf8mb4_unicode_ci

Especially this line:
character-set-client-handshake=FALSE

I don't know why Wordpress php need this line, but it do have effect. If someone know, please let me know. Thanks!

Wednesday, February 15, 2012

Install Hiphop on CentOS 5.4 64

On a clean CentOS 5.4 64 environment, all you need to do is following 5 steps:

1. rpm -ivh http://epel.osuosl.org/5/x86_64/epel-release-5-4.noarch.rpm
2. rpm -ivh http://dl.iuscommunity.org/pub/ius/stable/Redhat/5/x86_64/ius-release-1.0-9.ius.el5.noarch.rpm
3. rpm -ivh http://pkg.tag1consulting.com/hphp/x86_64/hphp-release-1.0-2.el5.noarch.rpm
4. yum install php52
5. yum install hiphop-php

Addition:

1. mv /usr/bin/gcc44 /usr/bin/gcc
2. mv /usr/bin/g++44 /usr/bin/g++
3. cd /usr/lib64; rm -f libz.so; ln -s libz.so.1.2.3 libz.so
4. cd /lib64; rm -f libz.so; ln -s /usr/lib64/libz.so.1.2.3 libz.so

Then you can run:
hphp test.php --keep-tempdir=1 --log=3

Tuesday, May 11, 2010

Windows XP Quick Launch Bar Always Disappear

For some unknown reason (this reason is still unknown until now), my Windows XP quick launch bar will not be shown everytime after restart. I can right click the task bar and make it shown again, but after restart, it disappear again.

The solutions are variable, but no one can solve my issue. At last, by studying this post line by line, I got the issue solved by doing the following thing (actually just one thing):

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]
"NoSaveSettings"=dword:00000000

This is the only useful solution, all other solutions like creating folders, setting other registry keys are all useless, and may potentially damage your system. So just use this one line and no need to try others.

Thursday, July 16, 2009

SimpleTest Eclipse Plugin Issue

SimpleTest is a TDD template for PHP, I feel interest to it is because it provides a plugin for Eclipse which I use for my PHP development. There is an installation guide provided by SimpleTest official website: http://www.simpletest.org/en/extension_eclipse.html, but the problem is when I tried to follow it, there are several steps not match.

Firstly, it says you can "new" a SimpleTest project, but actually there is no SimpleTest project type for you to choose. This is actually not a big deal, you can just create a normal project, it will have no bad impact.

The most frustrating thing happen later is when you run your first test, it will complain cannot find eclipse.php. Several other users complain about this issue too, see here. To solve this issue, I searched in whole package for the file, and finally got it in a file of simpletest_php.zip, once I extracted it to a folder, and in Windows->Preferences->SimpleTest, set SimpleTest folder to that extracted folder, everything solved.

Friday, June 19, 2009

Eclipse can not debug PHP web page (session terminated)

When using Eclipse with PDT to debug PHP, it can successfully debug PHP script, but everytime when tring to debug PHP webpage, it will terminated quickly with information saying of "session terminated".

The reason is because there are 3 lines must be added in php.ini.

zend_extension_ts="C:\Program Files\PHP\ext\ZendDebugger.dll" (You need to search in your Eclipse folder to find out where the file exists and use the full path to it.)
zend_debugger.allow_hosts=127.0.0.1
zend_debugger.expose_remotely=always

After adding these 3 lines, restart Apache, then it works.

Monday, June 15, 2009

Fatal error: Call to undefined function mysql_connect()

Well, I've long time not used PHP, and now I am back.

I installed the newest Apache, the newest PHP, the newest Mysql, and everything is smooth. Seems the UIs are much better than 4 years ago. I took pretty caution to the PHP configuration, and choosed to install mysql support at beginning, so everything seems ok at first.

But I met issue soon. When I call mysql_connect, it immediately says:

Fatal error: Call to undefined function mysql_connect() ...

As I am experienced engineer, I don't worry about this, checked all website for this issue, but everyone just repeatedly saying: check your php.ini file to remove the semicolon before the line of extension=php_mysql.dll, or check your extension_dir setting to make sure it's correct, something like that, blah, blah, blah... I checked again at my php.ini setting, it's pretty correct, because when I install php I already choose to have mysql support installed, so everything already correctly setting for me. I tried many other ways, to copy php.ini file into windows folder, to copy php_mysql.dll into windows folder, and also tried windows system32 folder, and also checked the environment variable of PHPRC, the problem just still be there.

Finally I got the problem solved. Now let me tell you the truth, this IS the exactly quite important step, but the PHP installation program did not do it correctly.

Very simple, that is: to copy the file libmysql.dll from your PHP folder into Windows folder. Very simple, right? But that's it.

Now we know, there are 3 files related to mysql support in php:

1. libmysql.dll (this by default is in ext folder, you can leave it there)
2. php_mysql.dll (this be default is in your php folder, you need to manually copy it into windows folder)
3. php.ini (this by default is in your php folder, you can leave it there)

You made them in correct folder, you got it.

Search

Google