2012/03/27

[wordpress] Deprecated: Assigning the return value of new by reference is deprecated

在搬移空間後,如果有這個問題,是因為新的伺服器PHP版本是5.3.0以上版本的緣故。
如果你的程式版本沒有更新,使用的語法太舊。就會出現類似這樣的警告提示,wordpress的訊息:
Deprecated: Assigning the return value of new by reference is deprecated in /home/xxx/public_html/wp-settings.php on line 264

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxx/public_html/wp-settings.php on line 266

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxx/public_html/wp-settings.php on line 267

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxx/public_html/wp-settings.php on line 284

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxx/public_html/wp-includes/cache.php on line 36

Deprecated: Assigning the return value of new by reference is deprecated in /home/xxx/public_html/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/exxx/public_html/wp-includes/theme.php on line 540
解決方法:
找到警告訊息的程式,將程式修改,例如上面的提示是wp-settings.php檔案的第264列
原本是以下,將&刪除
$wp_locale = & new WP_Locale();
修改成為
$wp_locale = new WP_Locale();

這樣應該就不會出現這個訊息了。

http://www.php.net/manual/en/oop4.newref.php

2012/03/23

將Facebook iFrame Tab 設定高度大於 800 Pixels


One of the best things to happen in Facebook development lately was to enable iframe application tabs. This was widely welcomed by developers. However many blog posts wrongly assumed there was a 800 pixel limit on the tab height. Behold, here is the 5000 pixel tab.

New Tab is iFrame Canvas Application

New tab works the same way as iframe canvas application. First load the JavaScript SDK. Easiest is to load it synchronously using a script tag (for production you want to load SDK asynchronously since it gives impression of faster loading page).
<script type="text/javascript" src="http://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript" charset="utf-8">
    /* Resizing code will be here. */
</script>  
When JavaScript SDK is loaded you have access to FB.Canvas.setSize and FB.Canvas.setAutoResize methods. If you know the content size wont change later resize the frame only once when page loads.
FB.Canvas.setSize();
You can also pass the desired size as parameter.
FB.Canvas.setSize({ width: 520, height: 600 });
If content is dynamic and size might change tell Facebook to resize the iframe periodically.
FB.Canvas.setAutoResize();
Default is to try resizing every 100ms. If you want to force resizing more often you can pass desired interval as parameter.
FB.Canvas.setAutoResize(50);

Is There a Maximum Limit?

Quick search on Google did not reveal any browser limitation. Theoretically on 32 bit machines maximum page length would be 4 294 967 295 pixels. On 64 bit machines theoretical limit would be 8 446 744 073 709 551 615 pixels. Now I’m sure real limit is smaller but the bottom line is: there is enough pixels for marketers to create their next Facebook campaign…

2012/03/21

Adding/Removing Items from header top links



To edit top links content, we need to access the xml files

1. app/design/frontend/default/default/layout/checkout.xml
2. app/design/frontend/default/default/layout/customer.xml

[code]

<!--
Default layout, loads most of the pages
-->

    <default>

        <!-- Mage_Customer -->
        <reference name="top.links">
            <action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
<action method="addLink" translate="label title" module="customer"><label>Contact
Us</label><url>contacts</url><title>Contact
Us</title><prepare/><urlParams/><position>999</position></action>
</reference>
    </default>
[/code]

2012/03/12

use SSH connection for MYSQL


 Do I need to open the port 3306 for MySQL server to accept outside connections if I use SSH connection?
Answer: No, you don’t need. The reason is you are making an SSH connection to the SSH server at your Amazon EC2 from your local computer (where the HeidiSQL is), not directly making a connection to MySQL server anymore. More precisely, you have to make sure your SSH is running (this is as I know the default config of Amazon), opening the default port for SSH to accept outside connections: port 22 and that’s it.
HeidiSQL specific question: How do I enter the params in the Heidi?

Answer:
In the ‘Settings’ tab
1. In the dropdown list of ‘Network type’, please select SSH tunnel
2. Hostname/IP: localhost (even you are connecting remotely)
3. Username & Password: your mysql user and password
Next, in the tab SSH Tunnel:
1. specify plink.exe or you need to download it and specify where it’s located
2. Host + port: the remote IP of your SSH server(should be MySQL server as well), port 22 if you don’t change anything
3. Username & password: SSH username (not MySQL users)
4. You might ignore the password in the above step if you have the .ppk file.
After that, you can test the connection. Hope it works!