提升分頁搜尋效能


拿 45000 筆資料
搜尋分頁 1500 , 每頁 100
比較搜尋所需時間


 $sql="Select * from table  limit 1500 , 100";
 //傳桶寫法 




 $sql = "Select * From table Where uuid >=( Select uuid From table Order By uuid limit 1500,1) limit 100 ";
 //排除某一範圍以外的uuid ,再做一次搜尋

利用JS 模擬 php timer 觸發事件



<script type="text/javascript">

var milliSeconds = 2000;
//milliSeconds 設定定時觸發毫秒數
setInterval( function() {

 var xmlhttp;

 if (window.XMLHttpRequest) // code for IE7+, Firefox, Chrome, Opera, Safari
 {
         xmlhttp=new XMLHttpRequest();
 }
 else{
         xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); // code for IE6, IE5
        }

 xmlhttp.onreadystatechange=function()
 {
  if (xmlhttp.readyState==4 && xmlhttp.status==200)
  {
   console.log ( xmlhttp.responseText );
  } 
 }

 xmlhttp.open("POST","http://your.url.php",true);
        //要觸發開啟的php位置
 xmlhttp.send();

        }, milliSeconds);
  
</script>

websocket for SmartFoxServer




底下要介紹 SmartFoxServer 支援多種各種不同的 client(客戶單)提供使用
再接下來部份 , 介紹其中 SFS for websocket(html5)使用時,整個環境安裝


1.首先到官網下載適合自己os(作業系統)SFS版本
http://www.smartfoxserver.com/download/sfs2x#p=installer




































2.下載 websocket for SFS 範例 , 在同頁找到example頁籤
找到 HTML5 examples pack 選擇 Download







































3.安裝 SFServer , 將下載下來的 SFS2X_windows-x64_2_9_0.exe
 
 進行安裝



4.安裝
webService
   這裡可以自行選擇想使用的webservice 
   這裡提供最簡單作法直接安裝 apache 

   http://www.appservnetwork.com/


5.若您是使用apache安裝完後會在C:\AppServ (視當時安裝目錄調整路逕 )
將剛才的websocket 範例放置在網頁目錄下(參考下圖)





















6.在瀏覽器測試一下,剛才放置的範例是否正常顯示
http://127.0.0.1/AdvancedChat/
若正確,應該如下圖所呈現


























7.接著進入 SFS 後台對 webSocket 服務開啟
   在瀏覽器輸入 http://127.0.0.1:8080/admin/ 進入控制後台
   帳密預設都是 sfsadmin


















8.點擊左側 Admin modul , 再選擇 Server Configurator



































9.選擇進入 HTML5 websocket 頁籤
   將 Activate WebSocket Protocol 開啟 , 再點擊 Submit 提交
  註 : 無法透過 websocket 連接 gameserver , 大多原因都是 webSocket listener 沒有開啟
  The great majority  Could't connect smartfox Server by websocket ,
   cause webSocket listener has not open 























提交後 , 記得再點擊右側 restart 重啟 sfs 服務




10.再到控制台服務開啟 sfs2x - service







11.再嘗試 進 http://127.0.0.1/AdvancedChat/
   
 試著登入,與是否能連接上 server 



將 win-flash 發佈(publish) dmg on Mac



原檔若是在windows製作,

1.先在mac版 flash 開新專案(for destop)桌面專案

2.複製內容至mac版flash貼上

3,在file -> publish 發佈為 dmg (下拉選擇格式) 可選 air

設定MariaDB語系UTF8




參考文章 :

http://codex.wiki/post/101589-424


http://bunkera.pixnet.net/blog/post/24326115-mysql%E8%AA%BF%E6%95%B4%E6%88%90%E5%85%A8utf-8%E8%AA%9E%E7%B3%BB

無法透過遠端連至MariaDB , Configuring MariaDB for Remote Client Access

MariaDB packages bind MariaDB to 127.0.0.1 (the loopback IP address) by default as a security measure using the bind-addressconfiguration directive. Old MySQL packages sometimes disabled TCP/IP networking altogether using the skip-networking directive. Before going in to how to configure these, let's explain what each of them actually does:
  • skip-networking is fairly simple. It just tells MariaDB to run without any of the TCP/IP networking options.
  • bind-address requires a little bit of background information. A given server usually has at least two networking interfaces (although this is not required) and can easily have more. The two most common are a Loopback network device and a physical Network Interface Card (NIC) which allows you to communicate with the network. MariaDB is bound to the loopback interface by default because it makes it impossible to connect to the TCP port on the server from a remote host (the bind-address must refer to a local IP address, or you will receive a fatal error and MariaDB will not start). This of course is not desirable if you want to use the TCP port from a remote host, so you must remove this bind-address directive (MariaDB only supports one bind-address, but binds to 0.0.0.0, or :: (every IP) if the bind-address directive is left out).

Finding the defaults file

To enable MariaDB to listen to remote connections, you need to edit your defaults file. See Configuring MariaDB with my.cnf for more detail.
Common locations for defaults files:
  * /etc/my.cnf                              (*nix/BSD)
  * $MYSQL_HOME/my.cnf                       (*nix/BSD) *Most Notably /etc/mysql/my.cnf
  * SYSCONFDIR/my.cnf                        (*nix/BSD)
  * DATADIR\my.ini                           (Windows)

Editing the defaults file

Once you have located the defaults file, use a text editor to open the file and try to find lines like this under the [mysqld] section:
 [mysqld]
    ...
    skip-networking
    ...
    bind-address = <some ip-address>
    ...
(The lines may not be in this order, and the order doesn't matter.)
If you are able to locate these lines, make sure they are both commented out (prefaced with hash (#) characters), so that they look like this:
 [mysqld]
    ...
    #skip-networking
    ...
    #bind-address = <some ip-address>
    ...
(Again, the order of these lines don't matter)
Save the file and restart the mysqld daemon or service (see Starting and Stopping MariaDB).

Granting user connections from remote hosts

Now that your MariaDB server installation is setup to accept connections from remote hosts, we have to add a user that is allowed to connect from something other than 'localhost' (Users in MariaDB are defined as 'user'@'host', so 'chadmaynard'@'localhost' and 'chadmaynard'@'1.1.1.1' (or 'chadmaynard'@'server.domain.local') are different users that can have completely different permissions and/or passwords.
To create a new user:
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 36
Server version: 5.5.28-MariaDB-mariadb1~lucid mariadb.org binary distribution

Copyright (c) 2000, 2012, Oracle, Monty Program Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>
  • if you are interested in viewing any existing remote users, issue the following SQL statement on the mysql.user table:
SELECT User, Host FROM mysql.user WHERE Host <> 'localhost';
+--------+-----------+
| User   | Host      |
+--------+-----------+
| daniel | %         |
| root   | 127.0.0.1 |
| root   | ::1       |
| root   | gandalf   |
+--------+-----------+
4 rows in set (0.00 sec)
(If you have a fresh install, it is normal for no rows to be returned)
Now you have some decisions to make. At the heart of every grant statement you have these things:
  • list of allowed privileges
  • what database/tables these privileges apply to
  • username
  • host this user can connect from
  • and optionally a password
It is common for people to want to create a "root" user that can connect from anywhere, so as an example, we'll do just that, but to improve on it we'll create a root user that can connect from anywhere on my local area network (LAN), which has addresses in the subnet 192.168.100.0/24. This is an improvement because opening a MariaDB server up to the Internet and granting access to all hosts is bad practice.
GRANT ALL PRIVILEGES ON *.* TO 'root'@'192.168.100.%' IDENTIFIED BY 'my-new-password' WITH GRANT OPTION;
(% is a wildcard)
At this point we have accomplished our goal and we have a user 'root' that can connect from anywhere on the 192.168.100.0/24 LAN.
For more information about how to use GRANT, please see the GRANT page.

Caveats

  • if your system is running a software firewall (or behind a hardware firewall or NAT) you must allow connections destined to TCP port that MariaDB runs on (by default and almost always 3306).
  • to undo this change, simply uncomment the bind-address line in your defaults file.
The initial version of this article was copied, with permission, from http://hashmysql.org/wiki/Remote_Clients_Cannot_Connect on 2012-10-30.
configuring-mariadb-for-remote-client-access(原文連結)

AdobeMediaServer 使用 H264 儲存



備忘錄 , 若使用 Adobe Meida Server4 (5) , 要做錄影(store ,record )
要儲存H264遇到的問題


Code path : //Adobe Media Server 5//applications//xtdRecorder//scriptlib//


( use vp6 )
NetStream.publish(fileName,"append");

( use h264 )
NetStream.publish("mp4:"+fileName+".flv","append");


flash 轉 html5


目前測試
 1.as2.0, as3.0基本語法(按紐動作都可被正常轉換)
2.限制1MB以下大小才可轉換


目前兩種方法:

1.使用google web線上轉換
developers.google.com/swiffy )


2.下載Adobe 輔助外掛在flash內轉換
(參考以下步驟)



步驟1.至 google develop  ( swiffy download )





步驟2.安裝Adobe Extension Manager CS6













步驟3.開啟flash,在 Commands 下拉選擇 HTML5轉換