首頁我是相片相簿文字
snDateCommentHit
Display 1-20, Total 26 data, 2024-03-29
page 12
留言服務開發記錄2016-04-15


留言服務開發記錄 Comment Service Development

若不意外, 一般網站留言的功能都是寫在自有的資料庫中,
不過若跨站別有太多網店需要處理得情況時, 寫起來會有點白白的啊, 一直 copy+paste 有點搞笑哦!
所以, 這次麥大叔用一個主資料庫處理所有留言。再用 json 在不同站別做資料傳遞。
在應用上只要在其它各站呼叫函式就自動生成留言了, 管理上也比較好管理哦!

目前公開的版本是 v1.0, 主要實現了留言功能 (這不廢話嗎?)
預期待開發/解決的問題如下:

1. 機器人踹開:
現在我還在觀察機器人的運作的方式, 若都是 curl 留言機器人,
就直接 ajax 把 sumbit button 處理欄位就好啦!
爬都爬不到; 除非有大師用 solenium 之類的來寫, 那也沒辦法了。
我是不太想用什麼文字啊影像之類的驗證碼, 大大降低 User Experience 的分數

2. Mobile Friendly 行動裝置最佳化
說實話, 每次寫PHP網頁, 我最花時間的就是試這些 css 的東西, 比寫code還痛苦!
所以, 這mobile friendly 永遠都是問題, 一直在我心裡隱隱作痛...

3. FB-account Login / Google-account Login
還要加個用FB/Google一鍵登入留言的機制。
這個理論不難, 一個api的轉換而已...

目前大致先降。 有想到其它後補
留言功能再開2016-04-12

留言功能再開

自從把 wordpress 關了之後, 留言功能就死掉了!!
wp_comments的資料庫放了很久, 一直沒有動力去使用它~ (笑)

不過這兩個月由於刻 streetview.cc 的關係,
PHP功力大大增進, 猶如一顆大補丸啊!!
於是就把留言的功能做起來, 時間還蠻恰好的, 正好關了將近一年的時間!

各位朋友! 麥大叔留言板再開!


功能應該會逐漸加回來, 目前通通預設驚聲尖叫當做小圖。 (我超愛這個表情的啦~)
mysql 改 mysqli 語法2016-03-30
自虐啊!!! 改什麼mysqli, 瘋了嗎?
寫mysql寫的好好的, 改個屁 mysqli!

好了, 以上發洩完畢, 為了及早準備PHP7.0的時代,
麥大叔這兩天花了點時間改了note資料庫的程式碼 (接下來還有幾個網站要改...哭哭)
主要異動是把即將缷任的mysql語句改為mysqli,

過程其實還好, 只要確定原本的輸出是什麼, mysqli 也能輸出同樣的東西即可。
比較麻煩的是取出多筆資料時要做的迴圈, 會需要一些改變。

心得
1. mysqli 語法改用物件的方式寫會比較順利

$link = @mysql_connect(DB_HOST,DB_USER,DB_PASSWORD);

$db = new mysqli(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME);


2. mysqli 多筆資料時的輸出情況, 以fetch_object做廻圈, 再用json去轉陣列

$result = $db->query($sql);
if($result){
while ($row = $result->fetch_object()){ // Cycle through results
$stdClass[] = $row;
}
$result->close(); // Free result set
}
$val = json_decode(json_encode($stdClass), true); //Transform stdClass to Array
$val = array_map('array_values', $val); //remove Key of the Array (may not required)



3. SQL語法包括UPDATE, INSERT INTO時, 宣告字碼 utf8, 避免存入亂碼

$db->set_charset("utf8");


以上, 供後人參考!
PHP curl vs file_get_contents2016-03-17
a comparison of time-consuming for curl() and file_get_contents()

1. Target: Google generated page

2. Programming: Basically string processing, apply preg_match, preg_replace, preg_split after retrieving HTML content.

3. RESULT
--
Result 1
$curl_info[size_download]: 542711

curl get contents timing => 0.5671, 0.5821, 0.7801
file_get_contents timing => 0.8851, 0.8641, 0.9081
--
Result 2
$curl_info[size_download]: 554880

curl get contents timing => 0.7771, 0.5741, 0.6331
file_get_contents timing => 0.9991, 1.2871, 0.9111
--
Result 3
$curl_info[size_download]: 561892

curl get contents timing => 0.7111, 0.7091, 0.6931
file_get_contents timing => 1.0921, 1.3880, 0.9640
--
Conclusion

Curl is 50percent faster than file_get_contents when getting a 550kb file size.
StreetView.cc Development Diary2016-03-15

Streetview.cc Development Diary

Kind of a note to memorize something that I may forget in few days after....


Ver 2.1 Released:

Public
StreetView: Display places with Google See-Inside features.
Coverage: Reveal areas which have been scanned by system.
SeeInside: SeeInside a place with the UI combines Google Maps(pegman) and its StreetView image on the same page.

Private
SECRETS

Website Version
2016/10/07 - Ver 2.1 Released. all major function revised.

2016S2S3 - Development https://Place.Report website
2016/4/13 - Revise See-Inside judgement programming (v1.1)
2016/4/12 - Comment_Service implemented
2016/4/01 - Ver 1.3 Released. mysqli implemented
2016/3/25 - Ver 1.2 Released. New function: MapScan, Providing Linear and area two types scanning.
2016/3/22 - Website Automation Test Success!!
2016/3/17 - Improve processing efficiency by using curl instead of file_get_contents
2016/3/15 - Big-Data Place Report trial. (providing Place Ranks)
2016/3/12 - Ver 1.1 Released. New functions: Coverage, PlaceRank, SeeInside
2016/3/12 - Integrated g.ymc2.com, an URL Shorten API. a JSON application
2016/3/10 - Ver 1.0 released to DOMAIN: streetview.cc HOST: netfirms.com
Function: Home, OnePageReport, PlaceSearch, MapProcess
2016/3/01 Defined three modules, placeid, cid and cbk, to figure out if a store has the SEE-INSIDE feature or not.
2016/2/15 Start Coding .........A Google Maps Javascript V3 Journey....
--
Problems/Issues/Improvements Ideas 2.1:
1. CSS Layout for mobile device. TBH, i don't really care about this for sure.
2. Google API limitation. a Major concerns
3. Facebook Graph API

Update Place.DB (Automatic and Manual)
Define a mid-term relationship for Place.DB and Seeing.DB (maybe a Pano.DB)?
Useful Statistic Data
Replace mysql to my_sqli sentence
Rethink the function: judge_seeinside, judgement see-inside...
Implement google analytic
IP rule for certain function

--
Major Fixed:
1. How to process place results generated by Google Maps API (Async) to db?
-> 1) generate a click button within the async function.
-> 2) generate an auto-run PHP page.

2. How to curl the place results generated by Google Maps API (async) to a html.element?
-> 1) Curl does not work on async page. (empty element)
-> 2) Include the Google Maps API script on the parent page

3. Improve server efficiency:
-> A test reveals that curl is 50 percent faster than file_get_contents.
-> Replace file_get_contents with curl function.

4. Website automation test solution:
-> Tried Selenium webdriver, but was unable to figure out a way to make it work on wamp server.
-> Tried Selenium IDE, Works, however it had file size limits for processing codes(20KB?), and also there was no flow control (if-else) at the moment for testing purpose.
-> Turned out a solution which is to connect the server with localhost, and write PHP pages to the server via fopen(ftp), and then automatically run these pages to process results.

5. Encode the imgurl of all pano:
-> Applied JSON to communicate with g.ymc2.com (url shorten service)

6. fopen($ftp_path): failed to open stream at certain time ?
-> It seems like the hosting server issue (connection error or what?)
-> Use curl to do ftp method. (not sure if doing this is right, but it temporally works!)

7. The owner-response-rate (Google Reviews)
-> Find the recent 10 reviews and check to see if response from the owner exists
Google Place Big Data Report2016-03-06

Google Place Big Data Report

是的, 各位朋友! 麥大叔花了我近兩周的時間, 日夜苦幹, 連遊戲都不打,
終於街景資料庫快要可以上線了!

» Read More
PHP MySQL DB 資料庫網站開發2016-02-18

最近忙著和Google Maps API奮鬥, 想寫一個跟街景有關的資料庫網站。(好痛苦啊! DOM完全不熟的說!)
不過今天突然心血來潮, 想回顧自己到底寫過幾組完整的PHP+MySQL網站,也一併回顧自己寫程式的來時路。

» Read More
縮網址開發2015-08-13

前兩天花了一點時間寫了一個縮網址+轉址的功能http://g.ymc2.com/
然後還加上了PHP QR Code的函式。雖然還不是很明白 QR Code 能有什麼幫助。
不過想想還是先準備好, 以免不時之需。

下一步想擴充一個機能: 加上網址的預覽圖。
低調, 所以離開臉書2011-07-26
Private Content
PHP 變數安全性處理2011-02-24
PHP + MySQL 變數安全性議題

開頭先寫自己還是個很弱的PHP菜鳥,

由於買的三本參考書完全沒有強調 PHP的安全性,

在搜尋一些技術後發現安全性的重要後, 筆記此文記錄用。

也歡迎更正及補充.

PHP的函式function

» Read More
30分鐘學攝影2011-01-06


30分鐘學攝影

是麥大叔在2009年時的學術沙龍分享的攝影課程。

然後在 Vocalise 社聚時又講了一次。

前幾天無聊整理資料夾, 覺得可以分享給朋友們,

所以我就在這挑重點開講啦!

投影片: 30分鐘學攝影

» Read More
如果要出一本攝影書2010-12-26


如果要出一本攝影書

攝影資料庫的整理就在最近暫告一段落, 雖然許多相片都沒有 tags,

不過總算是把過去和現在交織在一起, 心裡算是放了一顆石頭。

我最近常玩的就是在 Search 的頁面, 按下 Search...

接著頁面會跑出50張任選的相片, 然後我引著滑鼠慢慢地, 一張一張地回憶當時的情景與按下快門的情境,

» Read More
世界新聞攝影展 20102010-05-09


世界新聞攝影展 2010

今天麥大叔來介紹一下攝影展的訊息。

去年俺跑去誠品親自看了2009世界新聞攝影展, 哇天~ 就一句話形容:

「大圖在你眼前爆炸的感覺真是爽!」

可惜了今年俺回不去, 不過暑假芝加哥有布列松的影展啦~ 可是我的攝影典範呢!

OK, Let's back to 主題; 有興趣的朋友麻煩自己點個連結去一下,

題外話是這次在士林紙業加工間?

» Read More
100308-100325周記2010-04-04


Weekly Shots, 100308-100325

這陣子重溫一些文學作品, 看了幾部有深度的電影, 人生似乎是愈來愈有趣了。

然後鄭先生就來催稿囉! 所以就來很快速的 review 這陣子的 idea~

(跳轉接18張相片)

» Read More
Canon Quality Issues2009-06-08
youcantcanon >> Thank to Wendy's logo.

Canon Quality Issues

I am tired of Canon's quality problems in DSLR, so I collect a List of quality issues made by Canon itself. If possible, please forward this article to concerned person.  I wish Canon's manager will feel embarrassed after reading.

佳能的品質問題實在很讓人頭痛, 身為一個終端的消費者, 我決定開一張 QA-品質異常單 給佳能,

請用任何方式轉發, 希望佳能的管理者看到之後會覺得臉紅

* All Images are searched from photo-related forums. I have added the Orignal URL to the Links, and if you concern my use of  image, please mail me. Thank you.  *

* 所有圖片皆取材於攝影相關論壇; 除提供原始連結外, 若您對圖片的使用有異議, 請來信告之. 感謝! *

» Read More
陳氏尋根筆記2009-02-16
090216

(攝於福建省彰浦縣赤湖鎮)

陳家大姓 - 陳氏尋根筆記

多年前, 有回掃墓前夕的軍訓課讓我印象非常深刻。

一直讓我們回味軍事影片的教官, 突然問起:「有誰知道自己家的堂號?? 知道的期末分數加十分!!」

天吶!! 即使開出這麼誘惑的條件, 將近80人還是啞口無言!?

當年的掃墓, 麥大叔就因此特別注意了自己祖宗的墓埤上的堂號。

大大的兩個字寫著: " 金 浦 "

當時, 我對於堂號的概念就像唐宋八大家裡韓愈自稱韓昌黎; 柳宗元自稱柳柳州一樣。

不過陳金浦這幾個字唸起來真不順口, 不像陳姓的另一大枝-潁川, 來得好聽。

陳潁川, 多麼詩情畫意的一個名字啊~ 陳金浦就有點軟了~ (笑)

anyway, 多年後的今天; 想找出陳金浦是從那裡出發的, 然後傳到自己這一代:

以下就是一些蛛絲馬跡所拚出來的陳家大姓拚圖。

» Read More
EveryDNS2009-01-08
090109

EveryDNS - 解決 netfirms DNS 被河蟹的辦法

早先, 我架了一台 VPN server 用以解決 ymc2.com 在大陸被河蟹的方案。

不過這並不是長期的對策, 畢竟以大陸地區的華文使用人口, 在這被河蟹是蠻慘的一件事情~

就在我尋尋覓覓找尋解決之道的時候, 發現已經有用 netfirms service 的朋友找到解決辦法囉!!

所以寫一篇教學給鄭先生: 因為鄭先生的魯肉達之家也被河蟹啦!!

[零. Before Start]

1. 找到自己域名(domain name)服務的ISP, (例) ymc2.com是在hinet註冊的。

2. 先用VPN跳過長城, 在命令列 ping 自己的 domain name, 記住其對應的 IP。(如下圖)

090109b

ymc2.com = 38.113.185.70

[一. EveryDNS 設定 ]

» Read More
自行車新文化基金會2008-10-17


自行車新文化基金會

http://www.cycling-lifestyle.org.tw/Certify/hero_list.PHP?&Page=76&T=115

剛打電話去基金會客訴了一下, 怎麼沒有我的名字呢??

» Read More
ImgCode - WordPress PlugIn2006-12-19

061219.jpg


出處:http://blog.daydream.idv.tw/?p=18 from 冰樣's 白日夢


 


冰樣兄在他的blog裡把這個外掛的來龍去脈搞的非常清楚~


馬大哈就不多說使用方式, 這篇純是為眾人發洩與言踹這無賴吃留言外掛機ImgCode... (踢)


» Read More

Top10 and Views - Wordpress PlugIn2006-08-19

出處:http://weblogtoolscollection.com/archives/2005/11/25/wp-plugin-top-10-posts-and-views-per-post/


060819.gif


自從前幾天Wordpress的資料庫爆炸之後,


無聊時就開始翻翻wordpress的Plug-in(插件)~


今天開始啟用 Top10 and Views 的插件,


其功用為 計次每篇文章的閱讀人數


摘要如下~


» Read More

page 12