16 Jun
Posted by Ultra MCU as Programming, SQL/Database
พอดีวันนี้ต้องลองทดสอบดูว่า PHP สามารถใช้ฐานข้อมูลของ SQL Server ได้ไม๊
ไปอ่านเจอ ว่าให้ Un Comment ในไฟล์ php.ini บรรทัด extension=php_mssql.dll ออก จากนั้น Reboot Apache
แต่ปรากฏว่ามันเกิด Error นี้ขึ้นครับ
Fatal error: Call to undefined function: mssql_connect()
ไปเปิดเจอในเว็ป เค้าให้ copy file “ntwdblib.dll” ไปใส่ไว้ใน c:\\windows\system32 ครับ เท่านี้ก็เรียบร้อย ^^
พอดีวันนี้ เจอปัญหาว่า เอาแผ่น Ubuntu Live CD ไป Mount Drive ใน Windows(Windows พังเปิดไม่ได้) แล้ว Mount ไม่ได้มันขึ้นแบบนี้
“$MFTMirr does not match $MFT(record3). Failed to mount ‘/dev/sdb5′: Input/output error NTFS is either inconsistent, or there is a hardware fault, or it’s softRAID/FakeRAID hardware. In the first case run chkdsk /f on Windows then reboot into Windows twice. The usage of the /f parameter is very important! If the device is SoftRAID/FakeRAID then first activate it and mount a different device under the /dev/mapper directory, (e.g. /dev/mapper/nvidia_eahaabcc1). Please see the ‘dmraid’ documentation for more details.”
ในเว็ปเค้าแนะน้ำให้ลง ntfs tool ของ linux ลงไปครับ ชื่อ ntfsprogs เพื่อไป Fix MFT (Master File Table)
เนื่องจากการปิดเครื่องครั้งสุดท้าย ของ Windows เครื่องนี้ ทำโดยการ จิ้มจุ่ม ค้างที่สวิตซ์ในขณะที่ Drive นี้ยังคงถูกเขียนอยู่ตลอดเวลา (เลยอาจจะเป็นสาเหตุให้ MFT มีปัญหา)
Install Package นี้โดย โหลด Online โดย
$ sudo apt-get install ntfsprogs หรือ โหลด Package นี้มาในเครื่องแล้ว สั่ง Install โดย $ sudo dpkg -i package_name แล้วจากนั้น Fix ด้วย Command นี้$ sudo ntfsfix /dev/sdb5 จบแล้วครับ อ้างอิงจาก http://ubuntuforums.org/showthread.php?t=1144175
13 Jun
Posted by Ultra MCU as Computer, SQL/Database, Server
เมื่อเช้าผมเจอปัญหาว่า Database Server(Windows 2003) ตัวหนึ่งในประเทศ เกิดบูตไม่ติดขึ้นมา มันก็เลยเป็นปัญหา ที่ต้องเข้าไปแก้
ตอนแรกคิดว่าเป็นที่ Windows พังกะว่าลง WIndows หรือ Repair ใหม่ก็น่าจะหาย แต่พอไปถึงมันไม่ใช่แบบนี้ ปัญหามันอยู่ที่ Hardware
ก็เลยตัดสินใจว่า ต้องหาวิธีเอาไฟล์ Backup Database ออกมาให้ได้่ก่อน แล้วไปรันในเครื่องสำรอง เพราะ ไฟล์ ถูกเก็บอยู่ในอีก Partition นึงด้วย Harddisk 4 ลูกและทำ RAID 5 ไว้ ก็เลยใช้วิธี ใช้ แผ่น Ubuntu Live Cd Boot เข้าไปก่อน แล้วจากนั้นก็ไป Copy ไฟล์ออกมาจาก Drive แค่นี้ก็เรียบร้อย
#date [MM][DD][hh][mi][YY]
[MM] คือเดือน (month)
[DD] คือวัน (date)
[hh] คือชั่วโมง (Hour)
[mi] คือนาที (Minute)
[YY] คือปี (Year)
Ex. date 0612024110 // 12-06-2010 02:41
22 Apr
Posted by Ultra MCU as Computer, Programming
พอดีว่าง ๆ เลยหาโหลด IPhone SDK มาลองเล่น ๆ ดู เขียนไปมึน ๆ ไปก็มัน ๆ ดี
สมมุติว่า เรามี TextField(Windows เรียก TextBox) อันนึง TagId = 1
แล้วเราต้องการ Convert ไปใส่ในตัวแปล Int หรือ Float
UITextField *txtNumber = (UITextField *)[window viewWithTag:1];
float fNumber;
fNumber = [[txtNumber text] floatValue];
float nNumber;
nNumber = [[txtNumber text] intValue];
และถ้าเราอยาก Convert จาก Int/Float เป็น String ลงใน text field
txtShowF.text = [NSString stringWithFormat:@"%f", fNumber];
txtShowN.text = [NSString stringWithFormat:@"%n", nNumber];
Reference :
select concat(‘Imnuke’,’ ’,'Im-AI’) = Imnuke Im-AI
select concat(‘Imnuke’,’ ’,'Im-AI’,NULL) = NULL
วันนี้เจอปัญหาโปรแกรมดึงข้อมูลวิธีการใช้ยาแล้วไม่ยอมแสดง
หลังจากตรวจสอบพบว่า มีการนำค่ามา Concat กัน ซึ่งเวลา Query ข้อมูลออกมาดู
โปรแกรมไม่แสดงบอกว่าเป็น NULL หรือ ” ก็ไล่ไปไล่มาว่าทำไมข้อมูลไม่ยอมออก
และแล้วก็พบว่า select concat String กับ NULL = NULL
มีอยู่ 1 ฟิลที่มีค่าเป็น NULL โอ้วววววววว
แล้วก็ไม่บอกตั้งแต่แรกว่าเป็น null เพราะแสดงออกมาเป็นค่าว่างเหมือนกัน
วิธีตรวจสอบ การใช้ CPU และ RAm ใน Solaris
#prstat -a -s rss
Ex. —————————————————————————————
bash-3.00# prstat -a -s rss
PID USERNAME SIZE RSS STATE PRI NICE TIME CPU PROCESS/NLWP
422 root 26M 9032K sleep 59 0 0:01:12 0.1% Xorg/1
9 root 8636K 7604K sleep 59 0 0:00:15 0.0% svc.configd/16
7 root 9292K 6832K sleep 59 0 0:00:16 0.0% svc.startd/12
457 root 6380K 4588K sleep 59 0 0:00:01 0.0% snmpd/1
504 root 6660K 3988K sleep 59 0 0:00:34 0.0% dtgreet/1
6223 root 7396K 3532K sleep 59 0 0:00:00 0.0% sshd/1
5933 root 7396K 3520K sleep 59 0 0:00:00 0.0% sshd/1
5782 root 7396K 3472K sleep 59 0 0:00:00 0.0% sshd/1
215 root 3920K 3000K sleep 59 0 0:00:03 0.0% inetd/3
335 root 3844K 2952K sleep 59 0 0:00:00 0.0% fmd/10
28835 root 5336K 2948K run 49 0 0:00:52 0.7% smbd/1
474 root 7636K 2836K sleep 59 0 0:00:00 0.0% dtlogin/1
110 root 3068K 2068K sleep 59 0 0:00:05 0.0% nscd/23
300 root 4676K 2036K sleep 59 0 0:00:00 0.0% automountd/3
6264 root 4908K 1960K run 49 0 0:00:00 0.1% smbd/1
6226 root 7260K 1904K sleep 59 0 0:00:00 0.0% sshd/1
5943 root 7260K 1904K sleep 59 0 0:00:00 0.0% sshd/1
5795 root 7260K 1900K sleep 59 0 0:00:00 0.0% sshd/1
105 daemon 3600K 1896K sleep 59 0 0:00:00 0.0% kcfd/3
440 root 2388K 1792K sleep 59 0 0:00:00 0.0% vold/3
434 root 2884K 1764K sleep 59 0 0:00:00 0.0% dmispd/1
NPROC USERNAME SIZE RSS MEMORY TIME CPU
46 root 191M 97M 19% 0:03:47 1.2%
4 daemon 10M 5960K 1.2% 0:00:00 0.0%
1 adm 2520K 1568K 0.3% 1:30:57 97%
1 smmsp 5408K 1220K 0.2% 0:00:00 0.0%
1 lp 1576K 596K 0.1% 0:00:00 0.0%
Total: 53 processes, 215 lwps, load averages: 66.68, 67.12, 67.06
—————————————————————————————–
วิธีตรวจสอบ Memory Size
prtconf | grep Memory
วิธีใช้ charAt
charAt คือการ Access เข้าไปใน string แบบ array (string คือ array of char)
ถ้าใน C++ เราใช้แบบนี้ได้เลย
string str
str = “0123456789″;
printf(“%c”,str[0]);
แต่ถ้าเป็น Javascript ต้องใช้แบบนี้
var str;
str = “0123456789″;
print(str.charAt[0]);
วิชีการใช้ length ใช้สำหรับหาความยาว string อันนี้ใช้เหมือนภาษาอื่น คือ .length ได้เลย
การเพิ่ม method เข้าไปใน Obj ของ Javascript
จากตัวอย่างจะเป็นการ trim
String.prototype.trim = function () { return this.replace(/^\s*/, "").replace(/\s*$/, ""); } var str; str = "123456789 "; str.trim();
อ้างอิง
: http://www.quirksmode.org/js/strings.html
: http://www.delphifaq.com/faq/f1031.shtml
เมื่อก่อนเคยเห็น Adapter Notebook ทั่วไปจะมีสายสำหรับรัดเก็บสาย Adapter
แต่พอมาใช้ mac เห็นมีแต่ตัวล็อคเล็ก ๆ เวลาเก็บสายทีไรก็ม้วน ๆ ไว้
พอจะเอามาใช้ทีไรก็พันตลอดเลย 555
ทีนี้มาดูกันว่าจะเก็บสายยังไงดี
| S | M | T | W | T | F | S |
|---|---|---|---|---|---|---|
| « Jun | ||||||
| 1 | 2 | 3 | ||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 |
| 11 | 12 | 13 | 14 | 15 | 16 | 17 |
| 18 | 19 | 20 | 21 | 22 | 23 | 24 |
| 25 | 26 | 27 | 28 | 29 | 30 | 31 |