Development
Android Annoying #1
Jun 25th
หลังจากบ่นๆใน Social Network มาได้พักนึง คิดไปคิดมา เอามาเขียนลงนี่เลยดีกว่า
» เริ่มมาจากบริษัทมีแนวทางจะหันไปจับตลาด ซอฟต์แวร์บนโทรศัพท์ มือถือ และขลุกอยู่กับการเลือกค่ายมาหลายสัปดาห์ ตอนนี้ก็เลยมาลงตัวที่ Android เนื่องจากถ้าทำบน iOS ก็จะต้องเสียค่าใช้จ่ายในการเริ่มต้นที่สูงเกินไป (ทั้งเครื่อง Mac ทั้งเครื่อง iPhone/iPad สำหรับใช้เทสอีก)
» เรื่องง่ายๆที่ต้องเริ่มกันก็คือ Hello Android ซึ่งก็๋ไม่มีอะไรมากครับผ่านไปได้ด้วยดี ทำ Widget แปะขึ้นหน้าแรกสนอง Need ก่อนหน้านี้ช่วยไปได้ในระดับนึง (ซึ่งอันนั้นมีแค่ UI กับ Component นาฬิกา เท่านั้น) มาคราวนี้่มันมีข้อมูลเพิ่มขึ้นมาด้วย ทำให้มีหลายๆองค์ประกอบที่เปลี่ยนไป รายละเอียดต่างๆที่เพิ่มมากขึ้น นี่ผมยังไม่ได้บอกสินะครับว่านี่แค่ทำ Mock up เอง
The Theme
Apr 2nd
หลังจากลง Wordpress มาได้สักพักนึง ก็อย่างที่เห็น URL ยังเป็น beta อยู่ก็แสดงว่ายังไม่ Released เสียที (แต่ก็รู้สึกเท่ห์ๆอยู่เล็กๆนะ) ที่ตรงนี้ก็เลยเป็นเหมือนกับที่ลองของไปซะอย่างนั้น วันนี้เปิดไปเห็นหน้าเว็บของพี่ @PatSonic สวยดีก็เลยอยากได้มั่งก็เลยลากไปลากมาในหน้าเว็บพี่เค้าก็แอบเห็นว่าใช้ Theme นี้อยู่ก็เลยเอามาใช้มั่ง
ก็ค่อนข้างจะมีรายละเอียดเยอะมากเลยทีเดียว กว่าจะทำให้เป็นอย่างที่เห็นได้ก็ลองผิดลองถูกกันอยู่เป็นชั่วโมงเลยทีเดียวครับ ตอนนี้ก็รู้สึกว่า Logo มันไม่เข้ากับ Theme เลยแฮะ เหมือนสติ๊กเกอร์แปะท้ายรถแข่งมาแปะอยู่บนกล่อง macbook ซะงั้น
ก็สนุกดีครับ มีอะไรแปลกใหม่เยอะกว่า Theme เก่าเยอะเลยทีเดียว
Page Redirection
Dec 16th
เมื่อวันก่อนมีน้องมาถามเกี่ยวกับเรื่อง Page Redirection ก็เลยคิดว่าจะเอามาเป็นพูดถึงเสียหน่อย
การ redirect หน้าเว็บ คือการส่งหน้าเว็บที่เปิดอยู่ปัจจุบันไปยังหน้าอื่น สามารถทำได้ 3 ระดับดังนี้
- ระดับ HTTP Header
- ระดับ HTML Header
- ระดับ Script
Javascript GetElementsByClass
Jan 27th
today, i have any reason to search HTML element by class name but javascript is not have support function. so i found somethings in the internet but not as good as i need. but i can modify it as i want. so it’s be like this.
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ”); };Document.prototype.getElementsByClass = function( searchClass, tagName) {if (tagName == null) tagName = ‘*’;var el = new Array();var tags = this.getElementsByTagName(tagName);var tcl = ” “+searchClass.trim()+” “;for(i=0,j=0; ivar test = ” ” + tags[i].className + ” “;if (test.indexOf(tcl) != -1)el[j++] = tags[i];}return el;};
I’m noob
Mar 6th
It’s closely to 10 years that i coding web application in PHP. The advantage of its is the text management, easy to read and write code, and power of hash array.
I usually use array in many program or library to store data. And have one case that I never know about it, The “Array node removing”. I usually loop the array and move keep node into new array. Yes! it’s too waste.. but I don’t know how can i do for remove node. It have array_pop() and array_shift() but cannot remove specific node.
Today I found the way to do that!!! it just use unset()!!! it never bring up in my brain. Actually unexpected … and it work !!!!
Regular Expression — In Thai
Nov 28th
I used to use Regular Expression since first year of my web programming experience in perl and continually use in other languages (e.g. PHP, JavaScript and Java). It’s useful for matching text. I usually got question for its patterns. Many people said it’s too difficult to make understand on it. It just a easy pattern to check your string!!
Today, I saw a web that writing about this topic (in Thai) and I thought it’s too many useful for any people who’re coder/programmer or interesting.
PHP lite-weight themes
Nov 8th
Hello! It’s too long time that I didnt update this blog. Today I have new custom lib for php programmer. It’s lite-weight themes system (for anyone who dont want to use smarty). It may not as good as smarty can do but it’s easy for designer, They didnt know any structure. just mark where is for content with “${}”.
<?php
/*write by. mrKrich (Bhanu Thangpulphol)email: mrkrich@msn.com*/
class themes{
private $filename = "";private $rawdata = "";private $cache = "";private $cachemd5 = "";private $mapping = Array();
public function __construct($filename){ $this->setTemplate($filename);}
public function setTemplate($filename){ $this->filename = $filename; $this->rawdata = join("", file($filename)); $this->cachemd5 = md5($this->rawdata); preg_match_all("/\\$\{([^\}]+)\}/Ui", $this->rawdata, $res); foreach($res[1] as $r){ $this->mapping[$r] = ""; }}
public function setMap($key, $value){ $this->mapping[$key] = $value;}
public function clearMap(){ $this->mapping = Array();}
public function clearCache(){ $this->cache = ""; $this->cachemd5 = "";}
private function map(){ $res = $this->rawdata; foreach($this->mapping as $i=>$d){ $res = str_replace("\${" . $i . "}", $d, $res); } return $res;}
private function checkversion(){ $md5 = md5($this->rawdata . print_r($this->mapping, true)); return ($this->cachemd5 == $md5);}
private function merge(){ if(!$this->checkversion() && $this->cache==""){ $res = $this->map(); $this->cache = $res; $this->cachemd5 = md5($this->rawdata . print_r($this->mapping, true)); } return $this->cache;}
public function __toString(){ return $this->merge();}
}
?>
you also can download , modify or use anywhere but please reference to me (for the based code) and you (for your changed code).
lets create flash by program
Jul 4th
too many years ago, I see flash animation source file and I said
How can you make this flash with single frame!!!
As your guess! It’s Flash action script. It may confuse when you start. so you can put “F1″ for read its help and reference.
Action script version 1 like javascript, version 2 is like java
Which version That suitable for me?
It up to your skill, but I usally use version 2. because we can code it both in same code.
If I have more time, I’ll said it later
Dojo Toolkit
Feb 15th
When I try to learn more about Dojo Toolkit. I found some problem of its script. such as uncompatible of javascript and css style sheet. And on downloaded demo, It have too many debug message. No downloadable manual or document. (It have just wiki for manual.)
But its script is too excellence and so exciting with easy way. just like ‘taglib’ in Java. (Or another language)
today I waste too much time to find and read manual. But you can found sample in demo section.
Dynamic HTML tips
Feb 14th
Hello it’s valentine again, Last 4 valentine ago. I used to have new web diary. 4 years later I have new one. “Dynamic HTML tips” is it.
It talk about HTML, Javascript and CSS Style Sheet tips. That may help newbie to create his/her own website with text editor. (I think manually coding HTML code is more beautiful.)
