Powered By Blogger

25 November 2008

เปลี่ยน port mysql ใน AppServ

ในที่นี้ เนื่องจาก ติดตั้ง mysql 2 instance บนเครื่องเดียวกัน
และ มีการ ใช้ port ชนกันจึงต้องเปลี่ยน ที่ ตัวหนึ่้ง
( หลังจาก มีการเปลี่ยน port ของ apache web server ไปแล้ว )
โดยให้ instance ตัวหนึ่ง ใช้ port 3306 ปกติ
และอีกตัว ใช้ port 3307

ต้องการเปลี่ยน port ก็ แก้โดย
C:\AppServ\MySQL\my.ini

เปลี่ยน section
[client]
port=3306

ให้กลายเป็น
[client]
port=3307

และต้องเปลี่ยน phpMyAdmin อีกให้ มองเห็นตัวนี้ รวมทั้ง เมื่อจะติดต่อด้วย php
ต้องเรียกด้วย
$link = mysql_connect('127.0.0.1:3307', 'mysql_user', 'mysql_password');
หรือ
$link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');


แก้ไข ที่ phpMyAdmin ดังนี้
C:\AppServ\www\phpMyAdmin
config.inc.php แก้ไข จาก

cfg['Servers'][$i]['port'] = '';

ให้เป็น
cfg['Servers'][$i]['port'] = '3307';

แล้ว ลอง start mysql ใหม่
และ start phpmyadmin ใหม่ จาก browser

ถ้าทำการเปลี่ยน port ของ apache ต้อง restart apache ใหม่ด้วยครับ

Apache เพิ่ม Services และ uninstall services

View Help apache with :
>Apache.exe /?


Install Apache as Services
>apache.exe -n "Apache Web Server (Test)" -k install
-n คือชื่อที่จะเห็น ใน Services ของ Windows

สามารถ ลงได้ หลาย Service เช่น
apache.exe -n "Apache2(Test)" -k install
apache.exe -n "Apache2(Test 2)" -k install
apache.exe -n "Apache2(Test 3)" -k install
จะเห็นว่ามี 3 Services เมื่อ เปิด หน้าต่าง Services ใน Admin Tools
แต่ทั้ง สาม จะมี property ว่า เป็น .exe ตัวเดียวกัน
สามารถ แยก รันได้ อิสระ แต่มีปัญหาว่า มันใช้ port 80 เหมือนกัน มันเลย
รัน ให้พร้อมกันจริงๆไม่ได้ ในตอนนี้

apache.exe -k uninstall -n "Apache Web Server"
-n คือชื่อ

จาก ทั้ง 3 services ที่เห็น จะสามารถ uninstall ทั้ง 3 ได้ โดย
apache.exe -n "Apache2(Test)" -k uninstall
apache.exe -n "Apache2(Test 2)" -k uninstall
apache.exe -n "Apache2(Test 3)" -k uninstall

การ uninstall จะทำไม่สำเร็จ ถ้า service ยังรันอยู่
แต่ว่าจะโดนมาร์ค ไว้ว่า ให้ลบ เมื่อ มีการ stop services

mysql and mysqladmin

ดู help ของ mysql.exe
ได้โดย
>mysql.exe --help
>mysqld-nt.exe --help
>mysqld.exe --help


connect database
mysql.exe --user=myuser --pass=mypassword --host=myhost.com
mysql.exe --user=myuser --pass=mypassword --host=localhost
mysql.exe --user=myuser --pass=mypassword --host=127.0.0.1

connect database at localhost
mysql.exe

query data
>show databases
>use mydatabase
>show tables
>select count(*) from table1

mysql is active status
mysqladmin.exe ping ----- view status of mysql at localhost
mysqladmin --host=192.168.0.10 --user=root --pass=mmppst ping
mysqladmin --host=myhostname --user=root --pass=mmppst ping

show current mysql server variable (with path )
mysqladmin --host=myhostname.com --user=root --pass=mmppst variables
mysqladmin --host=myhostname.com --user=root --pass=mmppst variables more

shutdown mysql server
mysqladmin --host=myhostname.com --user=root --pass=mmppst shutdown

view version
mysqladmin.exe --host=myhostname.com --user=root --pass=mmppst version

การ์ตูน ตอนเด็ก

Locke the Superman



คำพูด ใน Red Alert (Games PC)
http://www.gamefaqs.com/computer/doswin/file/476890/20018

เขี้ยวงาสีแดง Crimson Fang Blue Sonnet
เขี้ยวงาสีแดง Crimson Fang/Red Fang โดย อ. Shibata Masahiro
http://www.bloggang.com/viewdiary.php?id=pookpui&month=10-2006&date=25&group=7&gblog=26

22 November 2008

ruby sketchup export to *.x ( for directx)

exportx.rb
place in folder Plugins
C:\Program Files\Google\Google SketchUp 6\Plugins

# add item if menu is not already loaded
if( $directxExport_loaded != true ) then
UI.menu("PlugIns").add_item("Export DirectX...") { export_directx3 }
$directxExport_loaded = true
end

#Collect objects and explode group or components, apply transformation
def get_all_model_faces(entities, trans)
# get the array of entities
if entities.class == Sketchup::ComponentInstance
entity_list=entities.definition.entities
elsif entities.class == Sketchup::Group
entity_list=entities.entities
else
entity_list=entities
end
# for each element
for e in entity_list
# if the element is a Group or a Component
if (e.layer.visible? and (e.class == Sketchup::Group or e.class == Sketchup::ComponentInstance)) then
$groups +=1 if e.class == Sketchup::Group
$components += 1 if e.class == Sketchup::ComponentInstance
#check for material to set it to the children on next recusive call
if e.material != nil
$parent_mat.push(e.material)
else
$parent_mat.push($parent_mat.last)
end
# recurs call on the group or component
get_all_model_faces(e, trans*e.transformation)
$parent_mat.pop
end
# if the object is a simple Face
if( e.class == Sketchup::Face and e.layer.visible?) then
# check for material
if e.material == nil
mat=$parent_mat.last
else
mat = e.material
end
# add object to the global collection
$face_trans_collection.push([e,trans,mat])
#print e.to_s + "#" + trans.to_s + "\n"
$faces += 1
end
end
end

# Main entry point
def export_directx3()
# display ruby panel for messages
Sketchup.send_action "showRubyPanel:"
# call Save Dialog function
filename = get_filename
if filename == nil then # exit if cancel was choosen
return
end
print "Saving to : #{filename} \n"

# get the active sketchup model
model = Sketchup.active_model
# get a new writer for textures export
texturewriter = Sketchup.create_texture_writer

#global array that stores each individual text mesh
meshes = []
vertex_collection = []
normal_objects = []
normal_collection = []
normal_faces = []
texture_coords = []
face_collection = []
material_collection = []
material_face = []
# array to store material
all_materials = []
# add a default material when nothing special is specified for a face
material_collection += ["{ Default_Material }"]

# global push/pop array for children material propagation
$parent_mat = []
# global collection that stores a triplet [face, transformation, material]
$face_trans_collection = []
$faces = 0
$groups = 0
$components = 0

#get model entities
entities = model.entities

$parent_mat.push(nil)
# collect faces
get_all_model_faces(entities, Geom::Transformation.new)

print "#{$groups} group(s), #{$components} component(s), #{$faces} faces."

startindex = 0
# for all Faces
for ft in $face_trans_collection
entity = ft[0]
trans = ft[1]
mat = ft[2]
if(entity.typename == "Face") then
# Get a the MeshPolygon from the Face
#0 (Include PolygonMeshPoints), 1 (Include PolygonMeshUVQFront), 2 (Include PolygonMeshUVQBack), 4 (Include PolygonMeshNormals).
mesh = entity.mesh 1 4
# apply transformation when the object was in a group or in a component
mesh.transform! trans
# For all points
#print "mesh\n"
for p in (1..mesh.count_points)
# get the 3D point
pos = mesh.point_at(p).to_a
# get the normal at this point
norm = mesh.normal_at(p)
normal_objects +=[norm]
norm = norm.to_a
# default texture size
texsize = Geom::Point3d.new(1,1,1)

# if the material was obtained from the group or component
if mat!=nil and mat.texture!=nil and entity.material==nil then
# get the texture size
texsize = Geom::Point3d.new(mat.texture.width, mat.texture.height, 1)
end
# get the mesh texture coords (texture deformation: texture can only be streshed, rotated, translated (no parallel deformation)
uv = [mesh.uv_at(p,1).x/texsize.x, mesh.uv_at(p,1).y/texsize.y, mesh.uv_at(p,1).z/texsize.z]
# change to left hand counter clockwise
pos = counterclockwise(pos)
v = "#{"%.4f" %(pos[0])};#{"%.4f" %(pos[1])};#{"%.4f" %(pos[2])};"
vertex_collection += [v]
# change to left hand counter clockwise
norm = counterclockwise(norm)
n = "#{"%.4f" %(norm[0])};#{"%.4f" %(norm[1])};#{"%.4f" %(norm[2])};"
normal_collection += [n]
u = "#{"%.4f" %(uv[0]+1)},#{"%.4f" %(-uv[1])};"
texture_coords += [u]
end

# for each polygon
for poly in mesh.polygons
v1 = (poly[0]>=0?poly[0]:-poly[0])+startindex
v2 = (poly[1]>=0?poly[1]:-poly[1])+startindex
v3 = (poly[2]>=0?poly[2]:-poly[2])+startindex
f = "3;#{v3-1},#{v2-1},#{v1-1}"
face_collection += [f]

mat_index = 0
# get the material
material = mat
if material then
# add the material to the global list if this is a new one
# ! only export texture on front faces (back faces are ignored)
if !(all_materials.index(material)) then
all_materials += [material]
if material.texture then
# build a filename based on the targetfilename and the texture name
f = filename + File.basename(material.texture.filename)
# load the texture of the entity into the texture writer object
texturewriter.load entity, true
# serialize the texture to disk
texturewriter.write entity, true, f
end
m = material.name.gsub(/[^a-zA-Z0-9]/, "_")
material_collection += ["{ " + m + " }"]
end
# get the index for the future added material
mat_index = all_materials.index(material)+1
end
# add the index of the material in the list
material_face += [mat_index.to_s]
end
startindex = startindex + mesh.count_points
end
end

text = "xof 0303txt 0032
// SketchUp 6 -> DirectX (c)2008 edecadoudal, supports: faces, normals and textures
Material Default_Material{
1.0;1.0;1.0;1.0;;
3.2;
0.000000;0.000000;0.000000;;
0.000000;0.000000;0.000000;;
}
"
#model.materials.purge_unused

all_materials.each{mat
# replace '[' and ']' in name by a '_'
n = mat.name.gsub(/[^a-zA-Z0-9]/, "_")
mat_string = "Material " + n + "{ \n"
# faceColor
mat_string += (mat.color.red/255.0).to_s + ";" +(mat.color.green/255.0).to_s + ";" + (mat.color.blue/255.0).to_s + ";"
# Alpha
mat_string += mat.alpha.to_s + ";;\n"
#power
mat_string += "3.2;\n"
# specularColor ColorRGB
mat_string += "0.000000;0.000000;0.000000;;\n"
# emissiveColor ColorRGB
mat_string += "0.000000;0.000000;0.000000;;\n"
if mat.texture && mat.texture.filename != "" then
mat_string += " TextureFilename { "
mat_string += "\"" + File.basename(filename) + File.basename(mat.texture.filename) + "\";"
mat_string += " } \n"
end
mat_string += "} \n"
text += mat_string
}
text+= "Mesh {\n"
text+= " #{vertex_collection.length};\n"
stxt = vertex_collection.to_a.join(",\n ")
text+= " #{stxt};\n"
text+= " #{face_collection.length};\n"
stxt = face_collection.to_a.join(",\n ")
text+= " #{stxt};;\n"
text+= " MeshMaterialList {\n"
text+= " #{material_collection.length};\n"
text+= " #{material_face.length};\n"
stxt = material_face.to_a.join(",\n ")
text+= " #{stxt};\n"
stxt = material_collection.to_a.join("\n ")
text+= " #{stxt}\n"
text+= " }\n"
text+= " MeshTextureCoords {\n"
text+= " #{texture_coords.length};\n"
stxt = texture_coords.to_a.join("\n ")
text+= " #{stxt};\n"
text+= " }\n"
text+= " MeshNormals {\n"
text+= " #{normal_collection.length};\n "
stxt = normal_collection.to_a.join("\n")
text+= " #{stxt};\n"
text+= " #{face_collection.length};\n"
stxt = face_collection.to_a.join(";\n ")
text+= " #{stxt};;\n"

text+= " }\n"
text+= " }\n"

write_file(filename, text)
print "end.\n"
end

def get_filename
model = Sketchup.active_model
model_filename = File.basename(model.path)
if model_filename != ""
model_name = model_filename.split(".")[0]
model_name += ".x"
else
model_name = "Untitled.x"
end
my_str = UI.savepanel("Export as", "", model_name)
end

#convert a clockwise vector in a counterclockwise vector
def counterclockwise(v)
v2 = Array.new
v2 += [-v.to_a[1]]
v2 += [v.to_a[2]]
v2 += [v.to_a[0]]
my_a = v2
end

def write_file(filename, text)
fout = File.open(filename, "w")
fout.puts text
fout.close
end

21 November 2008

เพลง

Mary MacGregor - Torn Between Two Lovers


Mary Macgregor - SAYONARA
http://www.youtube.com/watch?v=goMuRq9Z9Mk

Enigma- Push the Limits


Enya . The River Sings *by valerio ottaviani*


Crimson tide soundtrack-Main theme


COBRA THE ANIMATION - Ending + Vol.2 preview

คัดลอก ข้อมูล ,xcopy , with exclude option

การคัดลอก ข้อมูล โดยใช้ batch xcopy
อาจใช้
xcopy
และหากต้องการ ไม่รวม ไฟล์ใดๆ ใน xcopy ให้ใช้ /exclude:ชื่อไฟล์ที่เก็บข้อมูล exclude
http://www.tech-recipes.com/rx/2682/xcopy_command_using_the_exclude_flag/

ส่วนการ สร้าง file exclude
น่าจะสร้างได้โดย dir /s /b
เช่น

dir myexcludepath /s /b >> d:\exclude.txt
แล้ว รัน xcopy คล้ายๆ ต่อไปนี้

xcopy.exe pathที่จะคัดลอก pathปลายทาง /exclude:d:exclude.txt
ตัวอย่าง จริงๆ เช่น
XCOPY C:\DATA\*.* C:\BKUP /S /I /Y /EXCLUDE:c:\excludelist.txt

หรือ
xcopy.exe D:\ms4w\apps\myapp\*.* d:\backup1\ /S /I /Y /exclude:d:\exclude2.txt
โดยใน exclude2.txt มี
ข้อมูล
D:\ms4w\apps\myapp\data\picture\path1
D:\ms4w\apps\myapp\data\picture\path2
D:\ms4w\apps\myapp\data\picture\path3
D:\ms4w\apps\myapp\data\picture\path4

รายชื่อแฟ้ม ที่ Exclude อาจใช้โปรแกรม ช่วย หาให้โดย
การ ใช้ Backup utility ของ windows เอง
แล้ว เลือก Job > Save Selection As ...
แล้ว เปิดด้วย notepad ก็จะเห็น ชื่อ ไฟล์ที่จะเป็น exclude นำมาใส่ใน exclude2.txt

สมมุติว่า ข้อมูล ทั้ง folder ของ myapp = 150GB
แต่เป็นข้อมูลใน picture path1 ,path2 ,path3,path4 รวม 145 GB
ดังนั้น ถ้าคัดลอก ปกติ ต้อง มีเนื้อที่ 150 GB แล้วลบ ออกเหลือ 5 GB คือต้องหา HardDisk ใหม่มาอีก 1ลูก และ อาจต้องใช้เวลา ยาวนาน หลาย ชั่วโมง อาจถึง 4 ขม ถ้า ผ่าน network
รวมทั้ง อาจต้อง ทำในช่วงเวลาเย็นๆ หลัง จาก เครื่อง server ไม่ได้ ใช้งานแล้วนานๆ

แต่ ถ้า เป็นวิธีนี้ ก็ จะใช้เนื่อที่ เพียง 5 GB ในการคัดลอก
รวมทั้งเวลา ที่น้อยกว่า ลดความจำเป็นที่จะต้องเบิก HardDisk ใหม่

19 November 2008

เปลี่ยน port mysql ใน AppServ

ในที่นี้ เนื่องจาก ติดตั้ง mysql 2 instance บนเครื่องเดียวกัน
และ มีการ ใช้ port ชนกันจึงต้องเปลี่ยน ที่ ตัวหนึ่้ง
( หลังจาก มีการเปลี่ยน port ของ apache web server ไปแล้ว )
โดยให้ instance ตัวหนึ่ง ใช้ port 3306 ปกติ
และอีกตัว ใช้ port 3307

ต้องการเปลี่ยน port ก็ แก้โดย
C:\AppServ\MySQL\my.ini

เปลี่ยน section
[client]
port=3306

ให้กลายเป็น
[client]
port=3307

หมายเหตุ ในส่วน [client] อาจไม่ต้องแก้ไขก็ได้ เพราะจะ ใช้กับ mysql.exe ซึ่งเป็น client
แต่ server ส่วนใหญ่จะเป็น 3306 อยู่แล้ว อาจแก้ไขเฉพาะ [mysqld] ก็พอ

และต้องเปลี่ยน section mysqld จาก
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3306

ไปเป็น
[mysqld]
# The TCP/IP Port the MySQL Server will listen on
port=3307

แล้ว restart mysql
แล้วอาจทดสอบด้วยการ telnet localhost 3307 ดู

และต้องเปลี่ยน phpMyAdmin อีกให้ มองเห็นตัวนี้ รวมทั้ง เมื่อจะติดต่อด้วย php
ต้องเรียกด้วย
$link = mysql_connect('127.0.0.1:3307', 'mysql_user', 'mysql_password');
หรือ
$link = mysql_connect('example.com:3307', 'mysql_user', 'mysql_password');


แก้ไข ที่ phpMyAdmin ดังนี้
C:\AppServ\www\phpMyAdmin
config.inc.php แก้ไข จาก

cfg['Servers'][$i]['port'] = '';

ให้เป็น
cfg['Servers'][$i]['port'] = '3307';



แล้ว ลอง start mysql ใหม่
และ start phpmyadmin ใหม่ จาก browser

ถ้าทำการเปลี่ยน port ของ apache ต้อง restart apache ใหม่ด้วยครับ

17 November 2008

Apache Virtual Path

set Apache Virtaul Path by
edit httpd.conf
(for AppServe software bundle ( http://www.appservnetwork.com/ )
edit c:\Appserv\Apache2.2\httpd.conf


for : browse file , download
data path : c:\checkCPU
virtual path : /download/check_cpu
url : http:/127.0.0.1/download/check_cpu

Add this text to httpd.conf .

Alias /download/check_cpu "C:/checkCPU"
<directory>
Options Indexes FollowSymLinks MultiViews ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</directory>
ref from
http://www.amenco.com/golivein24//tips/dynamic_content/03_apache_alias.html
http://www.google.co.th/search?hl=th&q=apache++virtual+path&meta=

31 October 2008

SMS Gateway

ช่วงนี้ ศึกษา เกี่ยวกับ SMS Gateway ครับ
ยังไม่ชัดเจนนัก

ได้แนวคิดคร่าวๆ มา นิดนึง
จากเว็ป http://www.thaiseoboard.com/index.php?topic=22476.0
(Thai SEO Board )

SMS Gateway ต่อง่ายครับ แต่ติดต่อผู้ให้บริการยาก 555+

จะถูกแบ่งออกเป็น 2 แบบก็คือ

Bulk Messsage และ Short Code

โดยแบบ Bulk message นี่ง่ายโครต คือแค่ยิงข้อความไปตาม url ที่กำหนดโดยส่ง parameters ไปให้ครบ message ก็จะถูกส่งผ่าน API ของ ผู้ห้บริการเอง เช่น

$attr['msisdn'] = '086xxxxxxx';
$attr['operatorId'] = 14;
$attr['body'] = 'message';

$pass = http_build_query($attr);

file_get_contents('http://www.gatewayurlapi.php?'.$pass);
และระบบจะคืนค่้า มาให้เราตรวจสอบ
-------------------------------------------

ส่วนแบบ Short Code คือให้ user พิมพ์ ข้อความแล้วส่ง sms เช่น 45211 อันนี้เราจะต้องตั้งค่าที่ gateway ว่าจะให้ยิงกลับมาที่ไหน แล้วก็ไปเขียน Script รับไว้ เท่านั้นเอง มักจะใช้กับพวกที่ activate ผ่านระบบ


ส่วนที่ลำบากของระบบ ไม่ใช่ Code เลยครับ แต่เป็นการติดต่อ ผู้ให้บริการที่มี API ดีๆ ครบทุกค่ายไว้รองรับ และ Config Gateway ง่ายๆ




อธิบาย SMS Gateway
http://sms.vianett.com/kat/000358.asp
http://www.developershome.com/sms/howToReceiveSMSUsingPC.asp

30 October 2008

php Studs + eventum

พอดี ช่วงนี้ต้องพยายาม ทำความเข้าใจ Struts ให้ดี
แต่ ความรู้เดิมก็เป็น php และไม่ค่อยมี เวลาว่างไปอ่าน นัก
เลย คิดว่า เล่น php แนว struts หน่อย เผื่อว่าจะ ได้ทั้งสองอย่าง
คือ php เร็วขึ้นและ ได้ แนวคิด Struts ในส่วนของ concept บ้าง
http://www.mojavelinux.com/projects/studs/
http://www.mojavelinux.com/articles/studs_quickstart.html

และที่สำคัญ คือ ต้องโหลด studs_basic ที่นี่ครับ
http://sourceforge.net/project/showfiles.php?group_id=76836&package_id=77681
แล้ววางใน www ( appserv )
แล้ว เข้าลองด้วย
http://localhost/studs-basic/index.php
จะ ได้ url เช่น
http://localhost/studs-basic/index.php/example.do
http://localhost/studs-basic/index.php/welcome.do

แต่หลังจาก แก้ไข และพยายายามหา Model แล้ว พบว่า Documentไม่ดีเลย
เลย คิดว่า จะลอง
phpMVC แทน
http://www.phpmvc.net/docs/docsIdx.php?doc=features
เห็น เขาว่า
The php.MVC framework is based on Jakarta Struts application framework design. Struts has proven to be reliable, extendable and well supported.
ซึ่ง ถ้าเป็น จริง คือ ตาม Jakarta Struts ได้ ก็ น่าจะลองดู น่ะ
เห็น Help ของ php.MVC เยอะดีด้วย น่าจะดี มั้ง .... ... ..



ยังไม่เคยลอง นะครับ

ส่วนอันนี้ เป้น software PHP + MySQL ใช้กับ AppServ ได้
เพื่อ เป็น จัดกการ Help Desk ต่างๆ พวก Issue Traking
อันนี้เป็น English หมด แต่เก็บมาไว้เผื่อใคร จะลองใช้ดู ชื่อโปรแกรม eventum
http://dev.mysql.com/downloads/other/eventum/index.html
โปรแกรม นี้ถูกใช้โดยทีม ของ MySQL นะครับ
ติดตั้งโปรแกรมง่าย แต่ว่า ยัง ทำ Admin ไม่เป็นเลย

28 October 2008

Environment Variable


ตัวอย่างการใช้ ตัวแปร HomeDrive และ HomePath
D:\>
D:\>%HOMEDRIVE%
C:\>cd %HOMEDRIVE%%HOMEPATH%
C:\Users\user>

environment path อื่นๆ สำหรับ ใช้ในการเขียน Batch File ครับ
ก็น่าจะใช้กับ Vista ,XP ได้ แต่กับ 98 ไม่แน่นะครับ
ข้อมูลเพิ่มเติม หาเพิ่มมาเจอที่นี่ครับ  เยอะมากดี 
http://www.wilsonmar.com/1envvars.htm
และ 
http://kennethhunt.com/archives/000933.html
 

Map network drive in Vista

map network drive in Vista

สมมุติ แม็ปไปที่ IP 192.168.0.2
user = user1
password = password1

net use Z: /persistent:yes \\192.168.0.2\path /u:user1 password1
ก็จะได้ Drive Z: มา
ส่วน สิทธิ์ ก็จะตาม user

source from:
http://www.groovypost.com/howto/microsoft/vista/map-a-network-drive-using-windows-vista-or-windows-server-2008/

06 October 2008

ช่วงนี้ปรับปรุง เว็ปครับ

ปรับปรุงแล้ว และก็
ปรับมาเป็น CMS แทนแล้ว

แม้ว่า ทำเองจะดีกว่า เพราะ ขนาดเล็ก และก็ปลอดภัยกว่า
แต่ คงไม่มีเวลา
ทำมากนักครับ

เวลา ผ่านไป ไวเหมือนโกหก

อ้าว ดึกแล้ว ไปนอนก่อนละ ครับ หุหุ

30 August 2008

stupidity , and war , special war , ศาสนาพุทธ

"Two things are infinite: the universe and human stupidity
...and I'm not sure about the universe." --
Albert Einstein
"สองอย่างที่ไม่มีที่สิ้นสุด ได้แก่ จักรวาล และความงี่เง่าของมนุษย์
...และผมก็ยังไม่มั่นใจเกี่ยวกับจักรวาลนัก" ( แปลว่าน่าจะมั่นใจในเรื่องเกี่ยวกับมนุษย์ )
อัลเบิร์ต ไอสไตน์


พุทธศาสนากับสงคราม
http://www.skyd.org/html/sekhi/56/62-Buddhism_and_War.html

สงครามกองโจร Guerrilla warfare
http://en.wikipedia.org/wiki/Guerrilla_warfare

การรบในเมือง
http://www.thaiairsoftgun.com/?name=knowledge&file=readknowledge&id=25

สงครามพิเศษ
หลักพื้นฐานการปฏิบัติการจิตวิทยา (PDF )
น่าอ่านมากช่วงนี้ เพราะ เห็นตัวอย่างชัดเจน เข้าใจง่ายกว่า
http://www.geocities.com/cgscsos/psyop-1.pdf
http://www.geocities.com/cgscsos/psyop-2.pdf

การปฏิบัติการพิเศษ
http://www.geocities.com/cgscsos/

29 August 2008

ข้อมูลภาพยนต์ The Last Samurai

เรื่องเกี่ยวกับ ซามูไร คนสุดท้าย
จาก Pantip/ภาพยนตร์


และ ความรู้ เกี่ยวกับ ดาบไทย และ ดาบญี่ปุ่นครับ
http://zeus.cp.eng.chula.ac.th/~u45tkb/PhpBB/viewtopic.php?f=1&t=162


เฮ้อ การเมืองหนอการเมือง
จะปิดรถ ปิดไฟ ปิดน้ำ ปิดเมือง
ก็เชิญตามสบาย
เพราะมันไม่รบกวนสิทธิคนอื่นอยู่แล้ว มันไม่มีสิทธิ์
พูดหลบเลี่ยงได้นิดหน่อย เพื่ออุดมการณ์ ไม่มีความผิด เพราะเราเป็นทหาร เราทำสงครามศักดิสิทธิ์

อืม เราก็มีความรู้น้อย ก็ได้ แต่มองตาปริบๆ

ข้อมูล Feature ใหม่ๆของ Visual Studio.NET 2008 แล้วอะ

มันรวมถึง Spec เครื่องที่ต้องการด้วยนะครับ
LINQ และก็ อื่นๆ อีกมากมาย
เช่น Foundation ต่างๆ
ก็ คงแค่ แสดงคร่าวๆ ให้พอรู้ ส่วนอื่นๆ คงต้องหาอ่านเพิ่ม

Visual Studio .NET รวมทั้ง Visual Studio.NET 2008
http://en.wikipedia.org/wiki/Microsoft_Visual_Studio

ภาษาไทย
http://www.microsoft.com/thailand/visualstudio/what_news.aspx
http://www.blognone.com/node/6351

27 August 2008

วันนี้มียึด ที่ต่างๆ กทม

ตะกี้ ดู ข่าว
เขายึด NBT แล้ว ก็ เฉยๆ แล้วอย่างอื่น ก็เฉยๆ

แต่ เห็น ตอนลำเลียงนักข่าว ออกมา
คิดว่า เพิ่งเคยเห็น คนไทย อยากทำร้าย คนไทยด้วยกันเองขนาดนี้

ถ้า เหยียบกันได้ คงเหยียบกันให้ตายกันไปแล้ว
เกือบออกมาไม่ได้ ใครเจอแบบนี้ คงหน้าซีด เดินมา มีคนเดินตามด่า ข้างหลัง
แล้ว ข้างๆ ก็มีคนตะโกนด่า อยากจะ ให้ตายๆ ซะ
แล้ วก็ รุมมาจนชิดประชิด ดีที่มี คน บอกว่า คนไทยด้วยกันๆๆ
ไม่งั้น ตายไปแล้ว ม้าง

ป้าๆ ทั้งหลาย คงอยาก ถีบ เด็กๆ รุ่นหลานๆสาวๆ ให้ตายคาเท้า มั้ง เห็นเดินตามมาด่า
เมืองไทย ของเรา เบียร์ไทยของเรา จริงๆ ..... เอ้า เมาๆๆๆ

21 August 2008

ADS scripting

เกี่ยวกับ การเขียน Script สำหรับ Admin

มีทั้ง Logon Script
http://www.rlmueller.net/LogonScriptFAQ.htm
ซึ่งก็คือ script ที่ทำงานเมื่อมีการ logon นั่นเอง อาจเขียนด้วย vbscript หรือ อื่นๆ แม้แต่ exe
และ
Name Translate
http://www.rlmueller.net/NameTranslateFAQ.htm
ตรงนี้ ก็ยังไม่ค่อยแน่ใจว่าคืออะไร แต่คงเกี่ยวกับ LDAP ด้วย
(LDAP ก็คือคล้ายๆ ActiveDirectory,AD ใน WindowsServer แหละครับ )
การแปลงชื่อ NT Name

ส่วนอันนี้เป็น Resource จาก TechRepublic สำหรับเรื่อง เกี่ยวกับ logon script และ group policy
http://search.techrepublic.com.com/search/group+policy+script.html

และ จากเว็ป microsoft จะมี Script Center สำหรับเรื่อง เกี่ยวกับ group policy โดยเฉพาะ ที่นี่ครับ

(MS)/technet/scriptcenter/hubs/gp.mspx


ส่วนอันนี้ เป็น การเช็คข้อมูลพื้นฐาน ของเครื่อง computer ด้วย script

(MS.com)web



-------------------------------------------------------------------------------
ตัวอย่าง script copy folder โดยมี progress dialog ด้วย
Const FOF_CREATEPROGRESSDLG = &H0&
ParentFolder = "D:\Archive"
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(ParentFolder)
objFolder.CopyHere "C:\Scripts", FOF_CREATEPROGRESSDLG

เป็น การ copy จาก C:\scripts ไปยัง D:\Archive
-------------------------------------------------------------------------------
รวมถึงการใช้ cscript.exe และ wscript.exe (default)
(MS.com)/en-us/library/bb490887.aspx

install sharpdeveloper

เมื่อวาน ลง XP ใหม่
แล้วพยายาม ลง SharpDeveloper
พบว่า ลงไม่ได้ มันแจ้งให้ ServicePack ใหม่ ที่มี new version of Windows Installer Service
เนื่องจาก เป็น ServicePack1

บทความนี้จึง เน้นเฉพาะเครื่องที่ ลง XP แล้วเป็น แค่ Service Pack1
ส่วนเครื่องที่เป็น Service Pack2 (SP2) แล้วคงไม่มีปัญหาอะไร

ก็เลยต้องมาดูว่า Windows Installer Services จริงๆแล้วมันคืออะไร
ตอนแรกก็เข้าใจ ว่ามันเป็น service ที่ช่วยในการติดตั้ง โปรแกรมนั่นเองแต่ไม่ค่อยแน่ใจนัก
เลย หาลิงค์มาเพิ่ม ดังนี้
หน้าหลัก
http://msdn.microsoft.com/en-us/library/aa372866.aspx

download Runtime หรือ Redistributable
ปกติแล้ว แค่โหลดตัวนี้ก็น่าจะพอแล้ว และ มีให้หลายๆเวอร์ชัน มีวิธีการ setup ด้วย
http://msdn.microsoft.com/en-us/library/aa372856(VS.85).aspx

หน้าdownload สำหรับ SDK สำหรับนักพัฒนา (Developer)
http://www.microsoft.com/downloads/details.aspx?FamilyId=6A35AC14-2626-4846-BB51-DDCE49D6FFB6&displaylang=en

ส่วน Windows Installer Team Blog หรือ คือ Blog ของทีมที่พัฒนา Windows Installer
ของ Microsoft นั่นเอง
จะบอกข่าวสารใหม่ๆและ รายละเอียด เกี่ยวกับ โปรดักได้หรือแม้แต่ ส่ง comment ให้ได้ด้วย
http://blogs.msdn.com/windows_installer_team/default.aspx

ตอนนี้ ที่ทำก็แค่ โหลด Redistribution แล้วจะค่อยมาอ่าน ต่ออีกที
หรือ อาจจะลง Services Pack ใหม่ๆก็ได้ เช่น

---------------------------------------------------------
หลังจาก คลิกขวาที่ MyComputer Icon แล้ว
พบว่า เป็น XP Service 1
เลยตัดสินใจ ว่าจะไม่โหลด Windows Installer แล้ว
โหลด XP Service Pack 3 ดีกว่า

http://www.microsoft.com/downloads/details.aspx?familyid=5B33B5A8-5E76-401F-BE08-1E1555D4F3D4&displaylang=en
316.4 MB

ส่วน SP2 นั้นอยู่ที่
http://www.microsoft.com/downloads/details.aspx?FamilyID=049C9DBE-3B8E-4F30-8245-9E368D3CDB5A&displaylang=en 266 MB

----------------------------------------------------------------------------------------------
Windows Installer ,Redistributable ก่อนจากที่
http://www.microsoft.com/downloads/details.aspx?FamilyId=5A58B56F-60B6-4412-95B9-54D056D6F9F4&displaylang=en
ไปก่อนก็ได้ ครับ แค่ 2 MB หรือ อย่างมากไม่เกิน 43MB
เพื่อเฉพาะลงโปรแกรมบางตัวให้ได้ก่อน
แล้วค่อยไปติดตั้ง SP2 เพื่อให้ XP ปลอดภัยมากขึ้น
ส่วนเครื่องที่ลง SP2 แล้วน่าจะไม่มีปัญหาอะไร
แล้วก็พบปัญหา อีก .... ว่า
พบปัญหาว่า โหลด *.msu แล้ว ไม่มี โปรแกรมที่จะผูกเพื่อเรียกมารัน
ก็เลยไม่สามารถรันได้
File *.msu นี้จริงๆแล้วคือ ไฟล์ Windows Update Standalone
ซึ่งปกติต้องผูกกับ โปรแกรม wusa.exe ใน C:\Windows\System32 ใน Vista
หรือ หากจะโหลด *.exe มาลงก็มีปัญหาว่า ที่ทำงาน Firewall ไม่มียอมให้โหลด *.exe

สุดท้าย กลับไปโหลด SP2 มาใช้ดีกว่า ง่ายกว่าเยอะ -__- " หมดเวลาปายหลายชั่วโมง เลย

ถ้าในที่ทำงาน มี การ ติดตั้ง update server ไว้ก็ จะเร็วหน่อย
ก็ทำโดยเข้า
Start --> Run --> gpedit.msc
แล้ว เข้า local policy > Computer Configuration > Administrator Templates > System
แล้วเลือกหัวข้อ Specify Windows Service Pack Installation file location
แล้ว จะมี Dialog ให้ป้อน แบบ http:// ip : port
อันนี้ ก็ได้รับคำแนะนำมาอีกที น่ะครับ

กรณีนี้เป็น SP1 ไปเป็น SP2

19 August 2008

ลองใช้ jQuery

แล้วก็ ลองโค้ดดู
มา โพส ที่ blogspot
โค้ดมัน ก็มั่วๆๆ
เลยหาทาง ลองโพสที่ myspace แทนครับ

นี่ link ครับ ... รอ มาแก้ link อีกททีน่ะ ..

คงต้อง ใช้ function http://th2.php.net/manual/en/function.highlight-file.php
hilight_file ของ php เพื่อที่จะปรับให้ code สามารถ post บน Blogger ได้
ตัวอย่าง นี้ครับ

ใช้ $s = hightlight_file("file1.php",true); echo $s ;
โดยให้ ครอบ tag code ไว้ด้วย tag PRE อีกชั้นหนึ่ง
จะได้ผลดังนี้ ครับ





<?

$db 
mysql_connect"localhost" "aa" 

,"123a" ) ; 


mysql_select_db("db1" ) ; 

$rs =  mysql_query"select * from table1  ") ; 

$num =  mysql_num_rows($rs) ; 

echo  
"<BR>row  num  =  $num " ;

mysql_close($db ) ;

for (
$i $i 10 $i ++) {

        echo 
"Test $i " 



?>

<script  language=javascript >

function test(){

    alert( "abc") ;

}

</script> 






หรือหากไม่อยาก hilight อาจใช้วิธีนี้
<?
$s = file_get_contents( "hili2.php") ;
$s = htmlentities($s ) ;
echo "<PRE>$s</PRE>" ;
?>


ซึ่งก็จะได้ผล เป็น plain Text ซึ่งแสดง ข้อมูล
แบบที่เป็น TextFile ธรรมดา แต่มีการ ย่อหน้าได้ ด้วย
แต่ปัญหา ที่พบคือ คนที่มา copy code จะได้ ข้อความติดกัน เป็นพืดๆ ไม่มีการย่อหน้าเว้นบรรทัดอยู่ดี ตรงนี้คือ
จะอ่านได้อย่างเดียวแต่ยังก้อบปี้ยังไม่ได้ง่ายๆ ยังหาวิธีที่ดีกว่านี้ไม่ได้ ครับ

-------------------------------------------------------------------------------
แล้วในที่สุด ก็หาตัวอย่างง่ายๆ ของ jQuery มาได้
ว่าจะทำไง ให้โพสบนเว็ป
พอดีที่เครื่องไม่ได้ลง php / apache ไว้
ก็เลย ใช้โปรแกรมที่เขียนเอง แหละชื่อ Form Basic HTML version 1.03
โพสโค้ดที่ หน้าต่างซ้าย แล้ว ก็ เลือกเมนู Edit --> Convert To String in Language --> HTML
แล้วก็ก้อบโค้ดมา ง่ายๆ
เพียงแต่ ช่องว่างมันจะแสดงเป็น nbsp เท่านั้นเอง
แล้วต้องมา replace
ออก ด้วย notepad แล้ว เติม PRE ครอบไว้


<html>
  <head>
    <script type="text/javascript"
 src="jquery-1.2.6.js"></script>
    <script type="text/javascript">
      // Your code goes here
      $(document).ready(function(){
       alert("a");
       $("#sp1").addClass("red");
      
        $("#list1 li").hover(function(){
$(this).addClass("green");
     },function(){
$(this).removeClass("green");
  });    
      
      });


      </script>
 <style >
 .red     {background-color:red;}
 .green     {background-color:lightgreen;}
 </style>
   
  </head>
  <body>
    <a href="http://jquery.com/">jQuery</a>
    <button id=bt1 >aa</button>
    <span id=sp1 >aa</span>
    <ol id=list1>
     <li>aaa1</li>
     <li>aaa2</li>
     <li>aaa3s</li>
    </ol>
  </body>
  </html>

การใช้ jQuery


ตัวอย่าง jQuery ลองเล่นวันนี้

เพราะได้รับคำแนะนำ มาว่า ใช้แล้วง่าย สบายกับ DOM

ลองใช้ดู ก็จริงด้วย ใช้แล้ว ไม่ต้อง เชียน Javascript getElementById("") ให้เมื่อย ตุ้ม


18 August 2008

เวลามาตรฐาน

เนื่องจากข่าวนี้ครับ
http://news.sanook.com/social/social_296418.php
สรุปย่อๆได้ดังนี้
พระราชบัญญัติว่าด้วยการกระทำความผิดโดยมีผลบังคับใช้ในวันที่ 23 สิงหาคมนี้ โดยกำหนดให้ผู้ประกอบ 4 ประเภท ต้องปรับเปลี่ยนเวลาให้ได้มาตรฐาน เพื่อประโยชน์ต่อการรักษาข้อมูลทางคอมพิวเตอร์ ประกอบด้วย ผู้ประกอบกิจการโทรคมนาคมและกิจการกระจายภาพและเสียง ผู้ให้บริการการเข้าถึงระบบเครือข่ายคอมพิวเตอร์ ผู้ให้บริการเช่าระบบคอมพิวเตอร์ และผู้ให้บริการร้านอินเตอร์เน็ตต่างๆ หากไม่ปฏิบัติตามจะมีโทษปรับประมาณ 1-5 แสนบาท

อีกข่าวที่เกี่ยวข้อง และอาจมีข้อมูลต่างกันเล็กน้อย
http://hilight.kapook.com/view/27719

จึงจะอธิบายวิธีซะหน่อย และ ก็ Server ด้วย

วิธีการปรับเวลาของเครื่อง Windows XP ให้เชื่อมต่อไปยัง TimeServer ได้
พร้อมเบอร์โทรศัพท์ และคำแนะนำในการใช้งานการเชื่อมต่อ ต่างๆ
http://www.nimt.or.th/nimt/Service/index.php?menuName=time

ตามข่าวทางสถาบันได้ซื้อนาฬิกาซีเซียมมาใหม่ ดังนี้


ตัวอย่างเว็ป เวลามาตรฐานของไทย
ได้แก่

สถาบันมาตรวิทยาแห่งชาติ
time1.nimt.or.th
time2.nimt.or.th
time3.nimt.or.th

เวลามาตรฐานโดย nectec
clock.nectec.or.th
clock2.nectec.or.th


เวลามาตราฐานประเทศไทย โดย กรมอุทกศาสตร์ กองทัพเรือ
time.navy.mi.th

13 August 2008

tfs2008 ( 2008.08.12 )

ทำโปรแกรม ตรวจ folder เสร็จแบบ คร่าวๆแล้ว
ตั้งชื่อง่าย ๆ

ทำหลายๆ Thread จะมีปัญหาก็ในส่วน GUI กับ Thread ที่ UI
มันไม่ยอมให้ Thread อื่นแก้ไขข้อมูล เลยต้องหาวิธีเลี่ยงด้วย Invoke

คิดว่าน่าจะเพิ่ม Feature อื่นๆเช่น Export XML , CSV ไว้วันหลัง
เผื่อจะได้ เอาไว้ทำ Graph ด้วย Excel ได้ อีกทีหลัง อิอิ

ลอง ติด AdSense ดูด้วยครับด้านล่าง

http://www.thaisoftbox.com/thaifs/tfs20080812.zip

ถ้ายังไม่มี .NET Framework 2.0 ก็สามารถโหลดได้จากที่นี่ครับ
http://www.microsoft.com/downloads/details.aspx?familyid=0856EACB-4362-4B0D-8EDD-AAB15C5E04F5&displaylang=en

คิดว่าน่าจะทำงานได้เร็วกว่าเดิมมาก อาจจะช้ากว่า version c++ หน่อยแต่ว่า
ก็น่าจะพอรับได้
ระหว่างที่รัน อาจจะมี ข้อความแจ้งว่า Create ๆๆ ที่หน้าจอ ไม่ต้องตกใจครับ
มันแค่เป็นการ สร้าง Thread ในหน่วยความจำ เฉยๆ ไม่ไดสร้างอะไรใหม่เลยใน Folder

แตกไฟล์มาแล้ว ก็ คลิกเลือกปุ่ม ... เพื่อเลือก Folder
แล้วก็ค่อยกดปุ่ม ดึงข้อมูล
แล้วรอ ......
จะมี Tree มา ให้คลิกแต่ละ Tree จะมีตัวบอกว่า ขนาด กี่ byte/MB เมื่อเทียบกับ Parent Folder
และก็ จะมีการบอกด้วย ว่า เมื่อเทียบกับ Folder ย่อยๆทั้งหมดนั้น Folder นั้งมีเฉพาะไฟล์ เยอะไหม

วันหลัง จะมาอัพเดทต่อ
ว่าอยากจะทำ Wiki เหมือนกัน กับ WebBoard เพื่อจะได้ ให้คนที่ลองใช้โพสว่า ควรแก้ไขปรับแต่งที่ไหนอีก หรือ มี บักที่ไหนบ้าง ไว้ ก่อนๆๆๆ

ส่วน โฆษณาด้านล่างของโปรแกรม นั้นก็คือ Adsense นั่นเอง
จริงๆเป็นแค่ ไฟล์ ไฟล์นี้ครับ
http://www.thaisoftbox.com/banner/tfs20080812.htm

30 July 2008

การใช้กาน Thread + UI ของ Windows

ช่วงนี้ SMF webbord ที่ใช้โพสก็เข้าไม่ได้ ไม่ได้ติดตั้งใหม่
ไม่มีเวลา เข้าไปกู้ระบบ เลย จะลงใหม่ก็กลัวข้อมูลเก่าหาย นี่แหละหนา ปัญหาของการใช้ CMS

ส่วน WebPage ก็ update ไม่ค่อยได้ง่ายๆแล้ว
เพราะว่า เขาเปลี่ยนมาใช้ port ไม่มาตรฐาน ซึ่งก็คาดว่าทางที่ทำงาน block เรียบร้อย

ส่วน ThaiFolderSize โปรแกรม ตัวนั้นรู้สึกผมจะทำผิดเอง
ไป ซ่อนไว้ ทำให้เข้าใช้งานไม่ได้เลย

ก็เลยคิดจะเขียนใหม่อยู่เหมือนกัน ว่าจะเร่งความเร็วการค้นหา
แต่เพราะ C# มันไม่ใช่ C++ เลยลองหลายครั้งก็ช้าๆๆๆๆ
(จริงๆใช้ของ ยี่ห้ออื่น เขาก็ได้ แต่อยากลองเขียนดู )

เมื่อวานกับวันนี้ ทำโปรแกรม นำเข้าข้อมูล ใช้ Thread รัน SQL
ก็ เลย คิดว่า คงจะดี ถ้าการค้น Recursive ทุกครั้ง แยกๆๆ กันเป็น Thread
เลย ค้นหาและลองทำ

พบว่า Thread มันมีปัญหา กับ GUI พอควรเพราะคนละ Thread มันไม่ยอมให้ update GUI
เลยลอง มาหาวิธี กันต่อไป
ที่ Link นี้ครั บ

เขียนด้วย C# แหละเพราะว่ามีโค้ดเก่าอยู่ เขียนไว้นานแล้ว ของตัวเองเอามาโมดิฟายยย
ทั้งๆที่ช่วงนี้ ตั้งใจแล้วว่าจะเขียน แต่ VB.NET เพราะจะได้ไม่งง มาก หลายภาษาตีกันวุ่น
แต่ก็ โอเค นะ
Error แจ้งว่า ให้ ใช้ Control.Invoke หรือ Control.BeginInvoke แทน

ยังไม่แน่ใจเลยครับ ว่าจะทำได้ไหม ก็ลองๆดู พยายามๆๆ เผื่อจะได้โปรแกรมใหม่แรงๆ ขึ้นๆๆ


http://weblogs.asp.net/justin_rogers/pages/126345.aspx
http://weblogs.asp.net/psteele/archive/2007/08/26/anonymous-methods-and-control-invoke.aspx
http://codebetter.com/blogs/jeremy.miller/archive/2006/11/05/Using-Anonymous-Methods-with-Control.Invoke_28002900_.aspx