Programming

Just another WordPress.com weblog

ประวัติเอกสารสำหรับ ตุลาคม, 2009

วิชาแรกสำหรับ ป.โท

แสดงความเห็นโดย จั่น บน ตุลาคม 31, 2009

เรียน Software Metrics   จบ 2 บท     ต้องหาหนังสือมาอ่านด่วน  ไม่รู้เรื่องเลย

Software Metrics: A Rigorous and Practical Approach, Revised (Paperback)

~ Norman E. Fenton

Norman E. Fenton (Author)

เขียนแล้วใน Uncategorized | Leave a Comment »

Restore backup of database (.bak) using Sql Server 2005

แสดงความเห็นโดย จั่น บน ตุลาคม 22, 2009

If you intend to create a back up of your database in Server A and restore it on a Server B, here’s how to go about it. Create a .bak file (Open SSMS > Database > Right Click your database > Tasks > BackUp > Specify the destination).

To do it using script, check my blog over here.

Once the .bak is created, copy this file from Server A to a Server B. We will assume that the file has been copied at the location ”C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\” at Server B. It can any location that you desire.

How to restore the .bak file

Use this query:

RESTORE DATABASE [SouthWind]
FROM DISK = ‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\South.BAK’
WITH REPLACE,
MOVE ‘SouthWind_Data’ TO ‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\SouthWind_Data.MDF’,
MOVE ‘SouthWind_Log’ TO ‘C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\SouthWind_Log.LDF’

where FromDisk is where the .bak file is kept on Server B and MOVE specifies the location of the data and log file.

http://www.sqlservercurry.com/2008/02/restore-bak-using-sql-server-2005.html

เขียนแล้วใน Uncategorized | 2 Comments »

การเขียนโปรแกรม

แสดงความเห็นโดย จั่น บน ตุลาคม 17, 2009

อยู่ดีๆก็เข้าใจการเขียน Program อีกระดับหนึ่ง
ที่อาจารย์สอนกลับมาอีกครั้งหนึ่ง
ตอนนี้ที่ติดเขียน program แล้ว bug เสมอๆ หรือคิดไม่ออก
ไม่ใช่เราไม่ถนัดภาษานั้นๆ
แต่เราไม่ได้คิดอย่างเป็นระบบ วิธีหนึ่งที่ช่วยเราได้คือเขียน flowchart หรือฝึกออกแบบเยอะๆก่อนลงมือเขียนจริงๆ

เขียนแล้วใน Uncategorized | 1 ความคิดเห็น »

การเก็บไฟล์ Binary (เช่น pdf, gif, jpg) ลงในฐานข้อมูล MYSQL

แสดงความเห็นโดย จั่น บน ตุลาคม 16, 2009

หากต้องการเก็บ ไฟล์ binary ลง field ที่มีคอลัมน์เป็น BLOB, MEDIUMBLOB หรือ Largeblob ก็ตาม   ใน 1 Insert statement ของ SQL  มักจะมีขนาดใหญ่ไปตามไฟล์ที่ต้องการจะใส่เข้ามา

สิ่งที่ต้องทำคือ default ของ mysql  จะตั้งให้ max_allowed_packet=1M

ดังนั้นจะต้องแก้ให้ใหญ่ขึ้นมาดังนี้

Way to increase your maximum allowed packet size in your MYSQL server

  • Open your my.ini file in the MYSQL server folder.
  • Add this entry max_allowed_packet = 32M beneath the [mysqld].
  • Now restart your MYSQL server

******วิธีการตรวจว่าตอนนี้ MYSQL ของเรามี  max_allowed_packet ก่อนและหลังปรับเท่าไหร่   ให้ใช้ mysql client ใน Command prompt

C:\mysql

mysql>mysqladmin -p variables

เขียนแล้วใน Uncategorized | Leave a Comment »