Quantcast
Channel: Tags
Viewing all 18 articles
Browse latest View live

เรามาทำความรู้จัก binascii หรือ รหัส ASCII

$
0
0

เรามาทำความรู้จัก binascii (บิน แอส กี)หรือ รหัส ASCII (แอส กี)

ASCII (แอส กี) เพื่อใช้ในการแลกเปลี่ยนสื่อสาร (อังกฤษ: ASCII: American Standard Code for Information Interchange) เป็นรหัสอักขระที่ประกอบด้วยอักษรละติน เลขอารบิก เครื่องหมายวรรคตอน และสัญลักษณ์ต่างๆ โดยแต่ละรหัสจะแทนด้วยตัวอักขระหนึ่งตัว เช่น รหัส 6D (เลขฐานสิบ) ใช้แทนอักษรเอ็ม (m) พิมพ์เล็ก เป็นต้น

ประวัติ รหัส ASCII

รหัสแอสกีมีใช้ในระบบคอมพิวเตอร์ และเครื่องมือสื่อสารแบบดิจิทัลต่างๆ พัฒนาขึ้นโดยคณะกรรมการ X3 ซึ่งอยู่ภายใต้การดูแลของสมาคมมาตรฐานอเมริกา (American Standards Association) ภายหลังกลายเป็น สถาบันมาตรฐานแห่งชาติอเมริกา (American National Standard Institute : ANSI) ในปี ค.ศ. 1969 โดยเริ่มต้นใช้ครั้งแรกในปี ค.ศ. 1967 ซึ่งมีอักขระทั้งหมด 128 ตัว (7 บิต)

  • ระบบ ปฏิบัติการ UNIX และ DOS ใช้ ASCII สำหรับไฟล์ข้อความ
  • ระบบ ปฏิบัติการ Windows ใช้รหัสแบบใหม่ คือ Unicode (ยูนิโค๊ด) 
  • ระบบ ปฏิบัติการ IBM 390 ใช้รหัส 8 หลัก เรียกว่า extended binary-decimal interchange code

ตัวอย่าง การแทนข้อมูลในเครื่องคอมพิวเตอร์

A

0100 0001

X

0101 1000

B

0100 0010

Y

0101 1001

C

0100 0011

Z

0101 1010

D

0100 0100

0

0011 0000

E

0100 0101

1

0011 0001

F

0100 0110

2

0011 0010

G

0100 0111

3

0011 0011

H

0100 1000

4

0011 0100

I

0100 1001

5

0011 0101

J

0100 1010

6

0011 0110

K

0100 1011

7

0011 0111

L

0100 1100

8

0011 1000

M

0100 1101

9

0011 1001

N

0100 1110

.

0010 1110

O

0100 1111

(

0010 1000

P

0101 0000

+

0010 1011

Q

0101 0001

$

0010 0100

R

0101 0010

*

0010 1010

S

0101 0011

)

0010 1001

T

0101 0100

-

0010 1101

U

0101 0101

/

0010 1111

V

0101 0110

'

0010 1100

W

0101 0111

=

0010 1101

ตัวอย่าง การแปลงรหัส

ข้อความ : MINDPHP

แปลงรหัส : 0100 1101 0100 1001 0100 1110 0100 0100 0101 0000 0100 1000 0101 0000

ใช้พื้นที่ 56 bit 7 byte

M I N D P H P
0100 1101 0100 1001 0100 1110 0100 0100 0101 0000 0100 1000  0101 0000

รหัส  ASCII เป็น รหัสคอมพิวเตอร์ หรือเรียกว่า ภาษาคอมพิวเตอร์ บทความนี้เป็น ส่วนหนึ่งของรหัสของคอมพิวเตอร์ ยังมีอีกมากมาย เช่น MB5, Unicode เป็นต้น

 


วิธีการเข้ารหัส และถอดรหัส BASE64

$
0
0

วิธีการเข้ารหัส และถอดรหัส BASE64

 

BASE64 (เบส 64) คือ วิธีการเข้ารหัสข้อมูลรูปแบบหนึ่ง ที่จะเปลี่ยนข้อความ หรือข้อมูลต้นฉบับไปเป็นข้อความ หรือข้อมูลชุดใหม่ ที่ไม่สามารถอ่าน หรือรู้ว่าข้อมูลชุดนี้คืออะไร ซึ่งการเข้ารหัสชนิดนี้จะแทนที่ข้อมูลด้วยตัวอักษร 64 ตัว นั่นคือที่มาของ BASE64 ตามตัวอย่างต่อไปนี้

Table ASCII - Binary Character (เทเบิ้ล แอสกี้ ไบนารี่ ชาเรคเจอร์)

Table ASCII - Binary Character
Table ASCII - Binary Character

Table BASE64  (เทเบิ้ลเบส 64)

Table BASE64
Table BASE64

วิธีการเข้ารหัส BASE64

ยกตัวอย่าง
ต้องการเข้ารหัสข้อความนี้ "mind" จะมีขั้นตอนคือ

1. นําข้อมูลที่ต้องการเข้ารหัสมาแปลงเป็นเลขฐานสอง 8 bit ดูตามตาราง Table ASCII - Binary Character
m = 01101101
i = 01101001
m = 01101101
d = 01100100

01101101    01101001    01101101     01100100

2. จากนั้น เรียงบิตใหม่จากทางด้านซ้าย แบ่งเลขฐานสองออกเป็นชุด ชุดละ 6 bit กรณีที่ชุดสุดท้ายไม่ครบ ให้เติม 0 ไปจนครบ จะได้ดังนี้

011011  010110  100101  101101  011001  000000

** bit ที่ถูกเติมเข้าไปที่เป็น 00 แทนด้วย "="
กรณี bit สุดท้าย เป็น 000000 ก็จะได้ == สองตัวต่อ

3. แปลงเลขฐาน 2 แบบ 6 bit เป็นเลขฐาน 10
จำนวนบิต จะเริ่มจากขวาไปซ้าย สูตรการคำนวณบิต n^2

ผลการแปลง
ผลการแปลง

 

เมื่อนำไปเปรียบเทียบกับตาราง Table BASE64 จะได้ดังนี้

bWltZA==

วิธีการถอดรหัส BASE64
     วิธีการถอดรหัส BASE64 ทําย้อนกลับครับให้นําข้อมูลมาแปลงเป็นฐานสอง 6 bit มาเรียงต่อกันก่อน แล้วนํามาจัดกลุ่ม กลุ่มละ 8 bit โดย bit สุดท้ายที่เหลือไม่ครบ 8 bit ให้ตัดทิ้ง หลังจากนั้นก็แปลงเลขฐานสอง 8 bit แต่ละชุดเป็นข้อมูล {--mlinkarticle=170--}ASCII{--mlinkarticle--} เท่านี้ก็จะได้ข้อมูลต้นฉบับแล้ว


อ้างอิง
view.officeapps.live.com
thitiblog.com

 

 

 

Unicode คืออะไร ยูนิโค๊ด คือ รหัสคอมพิวเตอร์ ซึ่งใช้แทนตัวอักษร ตัวเลข และ สัญลักษณ์ต่างๆ

$
0
0

Unicode คืออะไร
     ยูนิโค๊ด คือ รหัสคอมพิวเตอร์ใช้แทนตัวอักขระ สามารถใช้แทน ตัวอักษร,ตัวเลข,สัญลักษณ์ต่างๆ ได้มากกว่ารหัสแบบเก่าอย่าง  ASCII ซึ่งเก็บตัวอักษรได้สูงสุดเพียง 256 ตัว(รูปแบบ) โดย Unicdoe รุ่นปัจจุบันสามารถเก็บตัวอักษรได้ถึง 34,168 ตัวจากภาษาทั้งหมดทั่วโลก 24 ภาษา โดยไม่สนใจว่าเป็นแพลตฟอร์มใด ไม่ขึ้นกับโปรแกรมใด หรือภาษาใด unicode ได้ถูกนำไปใช้โดยผู้นำในอุตสาหกรรม เช่น Apple, HP, IBM, Microsoft, Unix ฯลฯ และเป็นแนวทางอย่างเป็นทางการในการทำ {--mlinkarticle=2186--}ISO {--mlinkarticle--}/IEC 10646 ดังนั้น Unicode จึงถือเป็นมาตรฐานในการกำหนดรหัส สำหรับทุกตัวอักษร ทุกอักขระ  unicode ทำให้ข้อมูลสามารถเคลื่อนย้ายไปมาในหลายๆ ระบบ ข้ามแพลตฟอร์มไปมา หรือข้ามโปรแกรมได้อย่างสะดวก โดยไร้ข้อจำกัด
Unicode ต่างจาก ASCII
คือ ASCII เก็บ byte เดียว แต่ Unicode เก็บ 2 byte ซึ่งข้อมูล 2 byte เก็บข้อมูลได้มากมายมหาศาล สามารถเก็บข้อมูลได้มากมายหลายภาษาในโลก
อย่างภาษาไทยก็อยู่ใน Unicode นี้ด้วยเหมือนกัน ดังนั้นรหัสภาษาไทยเอาไปเปิดในภาษาจีน ก็ยังเป็นภาษาไทยอยู่ ไม่ออกมาเป็นภาษาจีน เพราะว่ามี code ตายตัวอยู่ว่า code นี้จองไว้สำหรับภาษาไทย แล้ว code ตรงช่วงนั้นเป็นภาษาจีน ตรงโน่นเป็นภาษาญี่ปุ่น จะไม่ใช้ที่ซ้ำกัน เป็นต้น

Unicode คืออะไร ยูนิโค๊ด คือ รหัสคอมพิวเตอร์ ซึ่งใช้แทนตัวอักษร ตัวเลข และ สัญลักษณ์ต่างๆ

ตัวอย่าง Unicode

ข้อมูลอิ้างอิง
http://www.thaigoodview.com
http://www.pyayam.com
http://th.wikipedia.org

IDN Domain หรือ Internationalized Domain Name คืออะไร

$
0
0

IDN Domain (ไอดีเอ็น โดเมน) หรือ Internationalized Domain Name (อินเทอะเนชั่นเนลไลซ โดเมน เนม)  คืออะไร

IDN Domain หรือ Internationalized Domain Name คืออะไร
IDN Domain หรือ Internationalized Domain Name คืออะไร

Internationalized Domain Name (IDN) คือ
Internationalized Domain Name (IDN) คือชื่อ{--mlinkarticle=4015--}โดเมน{--mlinkarticle--}ที่ประกอบด้วยอักขระ (character (ชาแลคเตอร์)) อื่นๆที่นอกเหนือไปจาก 37 อักขระในรหัส ASCII (แอสกี) ซึ่งได้แก่ตัวอักษรภาษาอังกฤษ A-Z, ตัวเลขอารบิก 0-9 และเครื่องหมาย (-)
ซึ่งแต่เดิมการจดโดเมนนั้นจะถูกกำหนดให้จดในรูปแบบของอักขระ {--mlinkarticle=170--} ASCII{--mlinkarticle--} เท่านั้น ต่อมามี IDN จึงสามารถใช้ตัวอักษรถาษาไทยได้ทั้งพยัญชนะ สระ วรรณยุกต์ และเครื่องหมายอื่นๆในการตั้งชื่อโดนเมน แต่ยังคงลักษณะโดเมนเป็นภาษาอักฤษ เช่น {--mlinkarticle=3918--}.com (ดอทคอม){--mlinkarticle--}, .net (ดอทเน็ต)
ความเป็นมาของ IDN
IDN Domain มีมานานแล้ว แต่พึ่งจริงจังเมื่อปี 1996 พัฒนามาและนำมาใช้เมื่อปี 1998 และนำเป็นมาตราฐานเมื่อปี 2005 โดยหลักการของ IDN คือการแปลง label (เลเบ็ล) ให้เป็น ASCII เพื่อให้ระบบทั่วโลกสามารถทำงานร่วมกันได้ ซึ่งการแปลงรูปแบบนี้เป็นการแปลงให้อยู่ในรูปแบบ PunyCode
PunyCode คือ
PunyCode คือรหัส IDN จะขึ้นต้นด้วย xn-- แล้วจึงตามด้วยตัวหนังสือภาษาอักฤษ เช่น จดโดเมนภาษาไทย.com จะได้ PunyCode เป็น xn--82cyamja3cfcm9e9eb2qc1a9b.com
การจดทะเบียนใช้งาน IDN
การจดโดเมนภาษาไทยเป็นมาตราฐานใหม่ ซึ่งปัจจุบันสามารถใช้งานได้อย่างสากลและมี {--mlinkarticle=1849--}browser (เบราว์เซอร์){--mlinkarticle--}ต่างๆที่รองรับการทำงานและสนับสนุนที่จะเปลี่ยนเป็นภาษาไทยอัตโนมัติ
วิธีการทำงาน
เมื่อทำการเปิดเว็บไซต์ กรอกชื่อโดเมนภาษาไทย เช่น http://จดโดเมนเนมภาษาไทย.com browser จะแปลงข้อมูลชื่อโดเมนภาษาไทยนี้ให้เป็นระบบมาตราฐาน คือในรูปแบบ xn--82cyamja3cfcm9e9eb2qc1a9b.com ที่เป็นรูปแบบในภาษาอังกฤษแบบเดิมที่ใช้กันทั่วไป

รูปภาพและที่มา : http://www.iamdesignweb.com
http://www.i-creativeweb.com/index.php

 

Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

$
0
0

 

Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

 

Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)
Unicode (ยูนิโค้ต)

 

 

                 ปัจจุบันการใช้ภาษาตัวอักษรในการสื่อสารในระบบคอมพิวเตอร์มีหลากหลายรูปแบบ ไม่ว่าจะเป็นภาษาไทย ภาษาอังกฤษ กลไกในระบบ{--mlinkarticle=5043--}เครือข่าย{--mlinkarticle--}ต่าง ๆ มีการประมวลผลการทำงานให้เกิดมีอักษรขึ้นมาให้เกิดลายลักษณ์อักษรต่าง ๆ โดยมีการแปลเป็นรหัส{--mlinkarticle=2022--}คอมพิวเตอร์{--mlinkarticle--} เพื่อให้คอมพิวเตอร์อ่านได้ จะพูดถึง Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

 

              Unicode (ยูนิโค้ต) เป็นความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code) การใช้รหัสคอมพิวเตอร์แทนอักษร ตัวเลข สัญลักษณ์ และสามารถแปลรหัสได้มากกว่าหรัสเก่าด้วย ASCII  Unicode ใช้เพื่อให้เป็นระบบ การแลกเปลี่ยนการประมวลผลและแสดงอักษรต่าง ๆ ขึ้นมาอย่างมากมาย การใช้งานได้ไร้ขีดจำกัดมากขึ้น

 

               Unicode ต่างกับ ASCII คือ ASCII เก็บได้แค่ {--mlinkarticle=2303--}byte{--mlinkarticle--} เดียว แต่ Unicode เก็บได้ 2 byte ซึ่งทำให้เก็บข้อมูลได้มากกว่า และทำให้สามารถเก็บข้อมูลภาษาได้อย่างมากมาย การนำมาเป็นประโยชน์จึงมีการนำ Unicode มาใช้งานได้มากกว่า นำมาใช้งานได้กว้างกว่า  ASCII

 

ภาพประกอบจาก : http://www.clubic.com

ช่องทางศึกษาเพิ่มเติมข่าวที่น่าสนใจเกี่ยวกับ : Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

 

 

 

เรามาทำความรู้จัก binascii หรือ รหัส ASCII

$
0
0

เรามาทำความรู้จัก binascii (บิน แอส กี)หรือ รหัส ASCII (แอส กี)

ASCII (แอส กี) เพื่อใช้ในการแลกเปลี่ยนสื่อสาร (อังกฤษ: ASCII: American Standard Code for Information Interchange) เป็นรหัสอักขระที่ประกอบด้วยอักษรละติน เลขอารบิก เครื่องหมายวรรคตอน และสัญลักษณ์ต่างๆ โดยแต่ละรหัสจะแทนด้วยตัวอักขระหนึ่งตัว เช่น รหัส 6D (เลขฐานสิบ) ใช้แทนอักษรเอ็ม (m) พิมพ์เล็ก เป็นต้น

ประวัติ รหัส ASCII

รหัสแอสกีมีใช้ในระบบคอมพิวเตอร์ และเครื่องมือสื่อสารแบบดิจิทัลต่างๆ พัฒนาขึ้นโดยคณะกรรมการ X3 ซึ่งอยู่ภายใต้การดูแลของสมาคมมาตรฐานอเมริกา (American Standards Association) ภายหลังกลายเป็น สถาบันมาตรฐานแห่งชาติอเมริกา (American National Standard Institute : ANSI) ในปี ค.ศ. 1969 โดยเริ่มต้นใช้ครั้งแรกในปี ค.ศ. 1967 ซึ่งมีอักขระทั้งหมด 128 ตัว (7 บิต)

  • ระบบ ปฏิบัติการ UNIX และ DOS ใช้ ASCII สำหรับไฟล์ข้อความ
  • ระบบ ปฏิบัติการ Windows ใช้รหัสแบบใหม่ คือ Unicode (ยูนิโค๊ด) 
  • ระบบ ปฏิบัติการ IBM 390 ใช้รหัส 8 หลัก เรียกว่า extended binary-decimal interchange code

ตัวอย่าง การแทนข้อมูลในเครื่องคอมพิวเตอร์

A

0100 0001

X

0101 1000

B

0100 0010

Y

0101 1001

C

0100 0011

Z

0101 1010

D

0100 0100

0

0011 0000

E

0100 0101

1

0011 0001

F

0100 0110

2

0011 0010

G

0100 0111

3

0011 0011

H

0100 1000

4

0011 0100

I

0100 1001

5

0011 0101

J

0100 1010

6

0011 0110

K

0100 1011

7

0011 0111

L

0100 1100

8

0011 1000

M

0100 1101

9

0011 1001

N

0100 1110

.

0010 1110

O

0100 1111

(

0010 1000

P

0101 0000

+

0010 1011

Q

0101 0001

$

0010 0100

R

0101 0010

*

0010 1010

S

0101 0011

)

0010 1001

T

0101 0100

-

0010 1101

U

0101 0101

/

0010 1111

V

0101 0110

'

0010 1100

W

0101 0111

=

0010 1101

ตัวอย่าง การแปลงรหัส

ข้อความ : MINDPHP

แปลงรหัส : 0100 1101 0100 1001 0100 1110 0100 0100 0101 0000 0100 1000 0101 0000

ใช้พื้นที่ 56 bit 7 byte

M I N D P H P
0100 1101 0100 1001 0100 1110 0100 0100 0101 0000 0100 1000  0101 0000

รหัส  ASCII เป็น รหัสคอมพิวเตอร์ หรือเรียกว่า ภาษาคอมพิวเตอร์ บทความนี้เป็น ส่วนหนึ่งของรหัสของคอมพิวเตอร์ ยังมีอีกมากมาย เช่น MB5, Unicode เป็นต้น

 

วิธีการเข้ารหัส และถอดรหัส BASE64

$
0
0

วิธีการเข้ารหัส และถอดรหัส BASE64

 

BASE64 (เบส 64) คือ วิธีการเข้ารหัสข้อมูลรูปแบบหนึ่ง ที่จะเปลี่ยนข้อความ หรือข้อมูลต้นฉบับไปเป็นข้อความ หรือข้อมูลชุดใหม่ ที่ไม่สามารถอ่าน หรือรู้ว่าข้อมูลชุดนี้คืออะไร ซึ่งการเข้ารหัสชนิดนี้จะแทนที่ข้อมูลด้วยตัวอักษร 64 ตัว นั่นคือที่มาของ BASE64 ตามตัวอย่างต่อไปนี้

Table ASCII - Binary Character (เทเบิ้ล แอสกี้ ไบนารี่ ชาเรคเจอร์)

Table ASCII - Binary Character
Table ASCII - Binary Character

Table BASE64  (เทเบิ้ลเบส 64)

Table BASE64
Table BASE64

วิธีการเข้ารหัส BASE64

ยกตัวอย่าง
ต้องการเข้ารหัสข้อความนี้ "mind" จะมีขั้นตอนคือ

1. นําข้อมูลที่ต้องการเข้ารหัสมาแปลงเป็นเลขฐานสอง 8 bit ดูตามตาราง Table ASCII - Binary Character
m = 01101101
i = 01101001
m = 01101101
d = 01100100

01101101    01101001    01101101     01100100

2. จากนั้น เรียงบิตใหม่จากทางด้านซ้าย แบ่งเลขฐานสองออกเป็นชุด ชุดละ 6 bit กรณีที่ชุดสุดท้ายไม่ครบ ให้เติม 0 ไปจนครบ จะได้ดังนี้

011011  010110  100101  101101  011001  000000

** bit ที่ถูกเติมเข้าไปที่เป็น 00 แทนด้วย "="
กรณี bit สุดท้าย เป็น 000000 ก็จะได้ == สองตัวต่อ

3. แปลงเลขฐาน 2 แบบ 6 bit เป็นเลขฐาน 10
จำนวนบิต จะเริ่มจากขวาไปซ้าย สูตรการคำนวณบิต n^2

ผลการแปลง
ผลการแปลง

 

เมื่อนำไปเปรียบเทียบกับตาราง Table BASE64 จะได้ดังนี้

bWltZA==

วิธีการถอดรหัส BASE64
     วิธีการถอดรหัส BASE64 ทําย้อนกลับครับให้นําข้อมูลมาแปลงเป็นฐานสอง 6 bit มาเรียงต่อกันก่อน แล้วนํามาจัดกลุ่ม กลุ่มละ 8 bit โดย bit สุดท้ายที่เหลือไม่ครบ 8 bit ให้ตัดทิ้ง หลังจากนั้นก็แปลงเลขฐานสอง 8 bit แต่ละชุดเป็นข้อมูล {--mlinkarticle=170--}ASCII{--mlinkarticle--} เท่านี้ก็จะได้ข้อมูลต้นฉบับแล้ว


อ้างอิง
view.officeapps.live.com
thitiblog.com

 

 

 

Unicode คืออะไร ยูนิโค๊ด คือ รหัสคอมพิวเตอร์ ซึ่งใช้แทนตัวอักษร ตัวเลข และ สัญลักษณ์ต่างๆ

$
0
0

Unicode คืออะไร
     ยูนิโค๊ด คือ รหัสคอมพิวเตอร์ใช้แทนตัวอักขระ สามารถใช้แทน ตัวอักษร,ตัวเลข,สัญลักษณ์ต่างๆ ได้มากกว่ารหัสแบบเก่าอย่าง  ASCII ซึ่งเก็บตัวอักษรได้สูงสุดเพียง 256 ตัว(รูปแบบ) โดย Unicdoe รุ่นปัจจุบันสามารถเก็บตัวอักษรได้ถึง 34,168 ตัวจากภาษาทั้งหมดทั่วโลก 24 ภาษา โดยไม่สนใจว่าเป็นแพลตฟอร์มใด ไม่ขึ้นกับโปรแกรมใด หรือภาษาใด unicode ได้ถูกนำไปใช้โดยผู้นำในอุตสาหกรรม เช่น Apple, HP, IBM, Microsoft, Unix ฯลฯ และเป็นแนวทางอย่างเป็นทางการในการทำ {--mlinkarticle=2186--}ISO {--mlinkarticle--}/IEC 10646 ดังนั้น Unicode จึงถือเป็นมาตรฐานในการกำหนดรหัส สำหรับทุกตัวอักษร ทุกอักขระ  unicode ทำให้ข้อมูลสามารถเคลื่อนย้ายไปมาในหลายๆ ระบบ ข้ามแพลตฟอร์มไปมา หรือข้ามโปรแกรมได้อย่างสะดวก โดยไร้ข้อจำกัด
Unicode ต่างจาก ASCII
คือ ASCII เก็บ byte เดียว แต่ Unicode เก็บ 2 byte ซึ่งข้อมูล 2 byte เก็บข้อมูลได้มากมายมหาศาล สามารถเก็บข้อมูลได้มากมายหลายภาษาในโลก
อย่างภาษาไทยก็อยู่ใน Unicode นี้ด้วยเหมือนกัน ดังนั้นรหัสภาษาไทยเอาไปเปิดในภาษาจีน ก็ยังเป็นภาษาไทยอยู่ ไม่ออกมาเป็นภาษาจีน เพราะว่ามี code ตายตัวอยู่ว่า code นี้จองไว้สำหรับภาษาไทย แล้ว code ตรงช่วงนั้นเป็นภาษาจีน ตรงโน่นเป็นภาษาญี่ปุ่น จะไม่ใช้ที่ซ้ำกัน เป็นต้น

Unicode คืออะไร ยูนิโค๊ด คือ รหัสคอมพิวเตอร์ ซึ่งใช้แทนตัวอักษร ตัวเลข และ สัญลักษณ์ต่างๆ

ตัวอย่าง Unicode

ข้อมูลอิ้างอิง
http://www.thaigoodview.com
http://www.pyayam.com
http://th.wikipedia.org

Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

$
0
0

 

Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

 

Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)
Unicode (ยูนิโค้ต)

 

 

                 ปัจจุบันการใช้ภาษาตัวอักษรในการสื่อสารในระบบคอมพิวเตอร์มีหลากหลายรูปแบบ ไม่ว่าจะเป็นภาษาไทย ภาษาอังกฤษ กลไกในระบบ{--mlinkarticle=5043--}เครือข่าย{--mlinkarticle--}ต่าง ๆ มีการประมวลผลการทำงานให้เกิดมีอักษรขึ้นมาให้เกิดลายลักษณ์อักษรต่าง ๆ โดยมีการแปลเป็นรหัส{--mlinkarticle=2022--}คอมพิวเตอร์{--mlinkarticle--} เพื่อให้คอมพิวเตอร์อ่านได้ จะพูดถึง Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

 

              Unicode (ยูนิโค้ต) เป็นความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code) การใช้รหัสคอมพิวเตอร์แทนอักษร ตัวเลข สัญลักษณ์ และสามารถแปลรหัสได้มากกว่าหรัสเก่าด้วย ASCII  Unicode ใช้เพื่อให้เป็นระบบ การแลกเปลี่ยนการประมวลผลและแสดงอักษรต่าง ๆ ขึ้นมาอย่างมากมาย การใช้งานได้ไร้ขีดจำกัดมากขึ้น

 

               Unicode ต่างกับ ASCII คือ ASCII เก็บได้แค่ {--mlinkarticle=2303--}byte{--mlinkarticle--} เดียว แต่ Unicode เก็บได้ 2 byte ซึ่งทำให้เก็บข้อมูลได้มากกว่า และทำให้สามารถเก็บข้อมูลภาษาได้อย่างมากมาย การนำมาเป็นประโยชน์จึงมีการนำ Unicode มาใช้งานได้มากกว่า นำมาใช้งานได้กว้างกว่า  ASCII

 

ภาพประกอบจาก : http://www.clubic.com

ช่องทางศึกษาเพิ่มเติมข่าวที่น่าสนใจเกี่ยวกับ : Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

 

 

 

IDN Domain หรือ Internationalized Domain Name คืออะไร

$
0
0

IDN Domain (ไอดีเอ็น โดเมน) หรือ Internationalized Domain Name (อินเทอะเนชั่นเนลไลซ โดเมน เนม)  คืออะไร

IDN Domain หรือ Internationalized Domain Name คืออะไร
IDN Domain หรือ Internationalized Domain Name คืออะไร

Internationalized Domain Name (IDN) คือ
Internationalized Domain Name (IDN) คือชื่อ{--mlinkarticle=4015--}โดเมน{--mlinkarticle--}ที่ประกอบด้วยอักขระ (character (ชาแลคเตอร์)) อื่นๆที่นอกเหนือไปจาก 37 อักขระในรหัส ASCII (แอสกี) ซึ่งได้แก่ตัวอักษรภาษาอังกฤษ A-Z, ตัวเลขอารบิก 0-9 และเครื่องหมาย (-)
ซึ่งแต่เดิมการจดโดเมนนั้นจะถูกกำหนดให้จดในรูปแบบของอักขระ {--mlinkarticle=170--} ASCII{--mlinkarticle--} เท่านั้น ต่อมามี IDN จึงสามารถใช้ตัวอักษรถาษาไทยได้ทั้งพยัญชนะ สระ วรรณยุกต์ และเครื่องหมายอื่นๆในการตั้งชื่อโดนเมน แต่ยังคงลักษณะโดเมนเป็นภาษาอักฤษ เช่น {--mlinkarticle=3918--}.com (ดอทคอม){--mlinkarticle--}, .net (ดอทเน็ต)
ความเป็นมาของ IDN
IDN Domain มีมานานแล้ว แต่พึ่งจริงจังเมื่อปี 1996 พัฒนามาและนำมาใช้เมื่อปี 1998 และนำเป็นมาตราฐานเมื่อปี 2005 โดยหลักการของ IDN คือการแปลง label (เลเบ็ล) ให้เป็น ASCII เพื่อให้ระบบทั่วโลกสามารถทำงานร่วมกันได้ ซึ่งการแปลงรูปแบบนี้เป็นการแปลงให้อยู่ในรูปแบบ PunyCode
PunyCode คือ
PunyCode คือรหัส IDN จะขึ้นต้นด้วย xn-- แล้วจึงตามด้วยตัวหนังสือภาษาอักฤษ เช่น จดโดเมนภาษาไทย.com จะได้ PunyCode เป็น xn--82cyamja3cfcm9e9eb2qc1a9b.com
การจดทะเบียนใช้งาน IDN
การจดโดเมนภาษาไทยเป็นมาตราฐานใหม่ ซึ่งปัจจุบันสามารถใช้งานได้อย่างสากลและมี {--mlinkarticle=1849--}browser (เบราว์เซอร์){--mlinkarticle--}ต่างๆที่รองรับการทำงานและสนับสนุนที่จะเปลี่ยนเป็นภาษาไทยอัตโนมัติ
วิธีการทำงาน
เมื่อทำการเปิดเว็บไซต์ กรอกชื่อโดเมนภาษาไทย เช่น http://จดโดเมนเนมภาษาไทย.com browser จะแปลงข้อมูลชื่อโดเมนภาษาไทยนี้ให้เป็นระบบมาตราฐาน คือในรูปแบบ xn--82cyamja3cfcm9e9eb2qc1a9b.com ที่เป็นรูปแบบในภาษาอังกฤษแบบเดิมที่ใช้กันทั่วไป

รูปภาพและที่มา : http://www.iamdesignweb.com
http://www.i-creativeweb.com/index.php

 

เรามาทำความรู้จัก binascii หรือ รหัส ASCII

$
0
0

เรามาทำความรู้จัก binascii (บิน แอส กี)หรือ รหัส ASCII (แอส กี)

ASCII (แอส กี) เพื่อใช้ในการแลกเปลี่ยนสื่อสาร (อังกฤษ: ASCII: American Standard Code for Information Interchange) เป็นรหัสอักขระที่ประกอบด้วยอักษรละติน เลขอารบิก เครื่องหมายวรรคตอน และสัญลักษณ์ต่างๆ โดยแต่ละรหัสจะแทนด้วยตัวอักขระหนึ่งตัว เช่น รหัส 6D (เลขฐานสิบ) ใช้แทนอักษรเอ็ม (m) พิมพ์เล็ก เป็นต้น

ประวัติ รหัส ASCII

รหัสแอสกีมีใช้ในระบบคอมพิวเตอร์ และเครื่องมือสื่อสารแบบดิจิทัลต่างๆ พัฒนาขึ้นโดยคณะกรรมการ X3 ซึ่งอยู่ภายใต้การดูแลของสมาคมมาตรฐานอเมริกา (American Standards Association) ภายหลังกลายเป็น สถาบันมาตรฐานแห่งชาติอเมริกา (American National Standard Institute : ANSI) ในปี ค.ศ. 1969 โดยเริ่มต้นใช้ครั้งแรกในปี ค.ศ. 1967 ซึ่งมีอักขระทั้งหมด 128 ตัว (7 บิต)

  • ระบบ ปฏิบัติการ UNIX และ DOS ใช้ ASCII สำหรับไฟล์ข้อความ
  • ระบบ ปฏิบัติการ Windows ใช้รหัสแบบใหม่ คือ Unicode (ยูนิโค๊ด) 
  • ระบบ ปฏิบัติการ IBM 390 ใช้รหัส 8 หลัก เรียกว่า extended binary-decimal interchange code

ตัวอย่าง การแทนข้อมูลในเครื่องคอมพิวเตอร์

A

0100 0001

X

0101 1000

B

0100 0010

Y

0101 1001

C

0100 0011

Z

0101 1010

D

0100 0100

0

0011 0000

E

0100 0101

1

0011 0001

F

0100 0110

2

0011 0010

G

0100 0111

3

0011 0011

H

0100 1000

4

0011 0100

I

0100 1001

5

0011 0101

J

0100 1010

6

0011 0110

K

0100 1011

7

0011 0111

L

0100 1100

8

0011 1000

M

0100 1101

9

0011 1001

N

0100 1110

.

0010 1110

O

0100 1111

(

0010 1000

P

0101 0000

+

0010 1011

Q

0101 0001

$

0010 0100

R

0101 0010

*

0010 1010

S

0101 0011

)

0010 1001

T

0101 0100

-

0010 1101

U

0101 0101

/

0010 1111

V

0101 0110

'

0010 1100

W

0101 0111

=

0010 1101

ตัวอย่าง การแปลงรหัส

ข้อความ : MINDPHP

แปลงรหัส : 0100 1101 0100 1001 0100 1110 0100 0100 0101 0000 0100 1000 0101 0000

ใช้พื้นที่ 56 bit 7 byte

M I N D P H P
0100 1101 0100 1001 0100 1110 0100 0100 0101 0000 0100 1000  0101 0000

รหัส  ASCII เป็น รหัสคอมพิวเตอร์ หรือเรียกว่า ภาษาคอมพิวเตอร์ บทความนี้เป็น ส่วนหนึ่งของรหัสของคอมพิวเตอร์ ยังมีอีกมากมาย เช่น MB5, Unicode เป็นต้น

 

วิธีการเข้ารหัส และถอดรหัส BASE64

$
0
0

วิธีการเข้ารหัส และถอดรหัส BASE64

 

BASE64 (เบส 64) คือ วิธีการเข้ารหัสข้อมูลรูปแบบหนึ่ง ที่จะเปลี่ยนข้อความ หรือข้อมูลต้นฉบับไปเป็นข้อความ หรือข้อมูลชุดใหม่ ที่ไม่สามารถอ่าน หรือรู้ว่าข้อมูลชุดนี้คืออะไร ซึ่งการเข้ารหัสชนิดนี้จะแทนที่ข้อมูลด้วยตัวอักษร 64 ตัว นั่นคือที่มาของ BASE64 ตามตัวอย่างต่อไปนี้

Table ASCII - Binary Character (เทเบิ้ล แอสกี้ ไบนารี่ ชาเรคเจอร์)

Table ASCII - Binary Character
Table ASCII - Binary Character

Table BASE64  (เทเบิ้ลเบส 64)

Table BASE64
Table BASE64

วิธีการเข้ารหัส BASE64

ยกตัวอย่าง
ต้องการเข้ารหัสข้อความนี้ "mind" จะมีขั้นตอนคือ

1. นําข้อมูลที่ต้องการเข้ารหัสมาแปลงเป็นเลขฐานสอง 8 bit ดูตามตาราง Table ASCII - Binary Character
m = 01101101
i = 01101001
m = 01101101
d = 01100100

01101101    01101001    01101101     01100100

2. จากนั้น เรียงบิตใหม่จากทางด้านซ้าย แบ่งเลขฐานสองออกเป็นชุด ชุดละ 6 bit กรณีที่ชุดสุดท้ายไม่ครบ ให้เติม 0 ไปจนครบ จะได้ดังนี้

011011  010110  100101  101101  011001  000000

** bit ที่ถูกเติมเข้าไปที่เป็น 00 แทนด้วย "="
กรณี bit สุดท้าย เป็น 000000 ก็จะได้ == สองตัวต่อ

3. แปลงเลขฐาน 2 แบบ 6 bit เป็นเลขฐาน 10
จำนวนบิต จะเริ่มจากขวาไปซ้าย สูตรการคำนวณบิต n^2

ผลการแปลง
ผลการแปลง

 

เมื่อนำไปเปรียบเทียบกับตาราง Table BASE64 จะได้ดังนี้

bWltZA==

วิธีการถอดรหัส BASE64
     วิธีการถอดรหัส BASE64 ทําย้อนกลับครับให้นําข้อมูลมาแปลงเป็นฐานสอง 6 bit มาเรียงต่อกันก่อน แล้วนํามาจัดกลุ่ม กลุ่มละ 8 bit โดย bit สุดท้ายที่เหลือไม่ครบ 8 bit ให้ตัดทิ้ง หลังจากนั้นก็แปลงเลขฐานสอง 8 bit แต่ละชุดเป็นข้อมูล {--mlinkarticle=170--}ASCII{--mlinkarticle--} เท่านี้ก็จะได้ข้อมูลต้นฉบับแล้ว


อ้างอิง
view.officeapps.live.com
thitiblog.com

 

 

 

Unicode คืออะไร ยูนิโค๊ด คือ รหัสคอมพิวเตอร์ ซึ่งใช้แทนตัวอักษร ตัวเลข และ สัญลักษณ์ต่างๆ

$
0
0

Unicode คืออะไร
     ยูนิโค๊ด คือ รหัสคอมพิวเตอร์ใช้แทนตัวอักขระ สามารถใช้แทน ตัวอักษร,ตัวเลข,สัญลักษณ์ต่างๆ ได้มากกว่ารหัสแบบเก่าอย่าง  ASCII ซึ่งเก็บตัวอักษรได้สูงสุดเพียง 256 ตัว(รูปแบบ) โดย Unicdoe รุ่นปัจจุบันสามารถเก็บตัวอักษรได้ถึง 34,168 ตัวจากภาษาทั้งหมดทั่วโลก 24 ภาษา โดยไม่สนใจว่าเป็นแพลตฟอร์มใด ไม่ขึ้นกับโปรแกรมใด หรือภาษาใด unicode ได้ถูกนำไปใช้โดยผู้นำในอุตสาหกรรม เช่น Apple, HP, IBM, Microsoft, Unix ฯลฯ และเป็นแนวทางอย่างเป็นทางการในการทำ {--mlinkarticle=2186--}ISO {--mlinkarticle--}/IEC 10646 ดังนั้น Unicode จึงถือเป็นมาตรฐานในการกำหนดรหัส สำหรับทุกตัวอักษร ทุกอักขระ  unicode ทำให้ข้อมูลสามารถเคลื่อนย้ายไปมาในหลายๆ ระบบ ข้ามแพลตฟอร์มไปมา หรือข้ามโปรแกรมได้อย่างสะดวก โดยไร้ข้อจำกัด
Unicode ต่างจาก ASCII
คือ ASCII เก็บ byte เดียว แต่ Unicode เก็บ 2 byte ซึ่งข้อมูล 2 byte เก็บข้อมูลได้มากมายมหาศาล สามารถเก็บข้อมูลได้มากมายหลายภาษาในโลก
อย่างภาษาไทยก็อยู่ใน Unicode นี้ด้วยเหมือนกัน ดังนั้นรหัสภาษาไทยเอาไปเปิดในภาษาจีน ก็ยังเป็นภาษาไทยอยู่ ไม่ออกมาเป็นภาษาจีน เพราะว่ามี code ตายตัวอยู่ว่า code นี้จองไว้สำหรับภาษาไทย แล้ว code ตรงช่วงนั้นเป็นภาษาจีน ตรงโน่นเป็นภาษาญี่ปุ่น จะไม่ใช้ที่ซ้ำกัน เป็นต้น

Unicode คืออะไร ยูนิโค๊ด คือ รหัสคอมพิวเตอร์ ซึ่งใช้แทนตัวอักษร ตัวเลข และ สัญลักษณ์ต่างๆ

ตัวอย่าง Unicode

ข้อมูลอิ้างอิง
http://www.thaigoodview.com
http://www.pyayam.com
http://th.wikipedia.org

Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

$
0
0

 

Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

 

Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)
Unicode (ยูนิโค้ต)

 

 

                 ปัจจุบันการใช้ภาษาตัวอักษรในการสื่อสารในระบบคอมพิวเตอร์มีหลากหลายรูปแบบ ไม่ว่าจะเป็นภาษาไทย ภาษาอังกฤษ กลไกในระบบ{--mlinkarticle=5043--}เครือข่าย{--mlinkarticle--}ต่าง ๆ มีการประมวลผลการทำงานให้เกิดมีอักษรขึ้นมาให้เกิดลายลักษณ์อักษรต่าง ๆ โดยมีการแปลเป็นรหัส{--mlinkarticle=2022--}คอมพิวเตอร์{--mlinkarticle--} เพื่อให้คอมพิวเตอร์อ่านได้ จะพูดถึง Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

 

              Unicode (ยูนิโค้ต) เป็นความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code) การใช้รหัสคอมพิวเตอร์แทนอักษร ตัวเลข สัญลักษณ์ และสามารถแปลรหัสได้มากกว่าหรัสเก่าด้วย ASCII  Unicode ใช้เพื่อให้เป็นระบบ การแลกเปลี่ยนการประมวลผลและแสดงอักษรต่าง ๆ ขึ้นมาอย่างมากมาย การใช้งานได้ไร้ขีดจำกัดมากขึ้น

 

               Unicode ต่างกับ ASCII คือ ASCII เก็บได้แค่ {--mlinkarticle=2303--}byte{--mlinkarticle--} เดียว แต่ Unicode เก็บได้ 2 byte ซึ่งทำให้เก็บข้อมูลได้มากกว่า และทำให้สามารถเก็บข้อมูลภาษาได้อย่างมากมาย การนำมาเป็นประโยชน์จึงมีการนำ Unicode มาใช้งานได้มากกว่า นำมาใช้งานได้กว้างกว่า  ASCII

 

ภาพประกอบจาก : http://www.clubic.com

ช่องทางศึกษาเพิ่มเติมข่าวที่น่าสนใจเกี่ยวกับ : Unicode (ยูนิโค้ต) ความคิดใหม่ในการกำหนดรหัสแบบไบนารี่ (Binary code)

 

 

 

IDN Domain หรือ Internationalized Domain Name คืออะไร

$
0
0

IDN Domain (ไอดีเอ็น โดเมน) หรือ Internationalized Domain Name (อินเทอะเนชั่นเนลไลซ โดเมน เนม)  คืออะไร

IDN Domain หรือ Internationalized Domain Name คืออะไร
IDN Domain หรือ Internationalized Domain Name คืออะไร

Internationalized Domain Name (IDN) คือ
Internationalized Domain Name (IDN) คือชื่อ{--mlinkarticle=4015--}โดเมน{--mlinkarticle--}ที่ประกอบด้วยอักขระ (character (ชาแลคเตอร์)) อื่นๆที่นอกเหนือไปจาก 37 อักขระในรหัส ASCII (แอสกี) ซึ่งได้แก่ตัวอักษรภาษาอังกฤษ A-Z, ตัวเลขอารบิก 0-9 และเครื่องหมาย (-)
ซึ่งแต่เดิมการจดโดเมนนั้นจะถูกกำหนดให้จดในรูปแบบของอักขระ {--mlinkarticle=170--} ASCII{--mlinkarticle--} เท่านั้น ต่อมามี IDN จึงสามารถใช้ตัวอักษรถาษาไทยได้ทั้งพยัญชนะ สระ วรรณยุกต์ และเครื่องหมายอื่นๆในการตั้งชื่อโดนเมน แต่ยังคงลักษณะโดเมนเป็นภาษาอักฤษ เช่น {--mlinkarticle=3918--}.com (ดอทคอม){--mlinkarticle--}, .net (ดอทเน็ต)
ความเป็นมาของ IDN
IDN Domain มีมานานแล้ว แต่พึ่งจริงจังเมื่อปี 1996 พัฒนามาและนำมาใช้เมื่อปี 1998 และนำเป็นมาตราฐานเมื่อปี 2005 โดยหลักการของ IDN คือการแปลง label (เลเบ็ล) ให้เป็น ASCII เพื่อให้ระบบทั่วโลกสามารถทำงานร่วมกันได้ ซึ่งการแปลงรูปแบบนี้เป็นการแปลงให้อยู่ในรูปแบบ PunyCode
PunyCode คือ
PunyCode คือรหัส IDN จะขึ้นต้นด้วย xn-- แล้วจึงตามด้วยตัวหนังสือภาษาอักฤษ เช่น จดโดเมนภาษาไทย.com จะได้ PunyCode เป็น xn--82cyamja3cfcm9e9eb2qc1a9b.com
การจดทะเบียนใช้งาน IDN
การจดโดเมนภาษาไทยเป็นมาตราฐานใหม่ ซึ่งปัจจุบันสามารถใช้งานได้อย่างสากลและมี {--mlinkarticle=1849--}browser (เบราว์เซอร์){--mlinkarticle--}ต่างๆที่รองรับการทำงานและสนับสนุนที่จะเปลี่ยนเป็นภาษาไทยอัตโนมัติ
วิธีการทำงาน
เมื่อทำการเปิดเว็บไซต์ กรอกชื่อโดเมนภาษาไทย เช่น http://จดโดเมนเนมภาษาไทย.com browser จะแปลงข้อมูลชื่อโดเมนภาษาไทยนี้ให้เป็นระบบมาตราฐาน คือในรูปแบบ xn--82cyamja3cfcm9e9eb2qc1a9b.com ที่เป็นรูปแบบในภาษาอังกฤษแบบเดิมที่ใช้กันทั่วไป

รูปภาพและที่มา : http://www.iamdesignweb.com
http://www.i-creativeweb.com/index.php

 


การรับค่าเพื่อเปลี่ยนหน่วยไบต์ เป็นหน่วยที่ใหญ่กว่า เปลี่ยนหน่วย ด้วย Python

$
0
0

     Byte (ไบต์) หมายถึง หน่วยของข้อมูลที่เป็นเลขฐานสองจำนวน 8 หลัก หรือ 8 บิต ใช้แทนข้อมูลที่เป็นตัวอักษร ตัวเลข หรือสัญลักษณ์ต่างๆ เพียง 1 ตัว ตาม{--mlinkarticle=4395--}รหัส ASCII{--mlinkarticle--} เช่น A B C ก ข ค ง ฯลฯ  เป็นต้น โดย 8 บิตเท่ากับ 1 ไบต์ ไบต์จึงเป็นหน่วยข้อมูลที่มีขนาดใหญ่กว่าบิทและนิยมใช้เป็นหน่วยวัดความจุในการเก็บข้อมูลในคอมพิวเตอร์หรือสื่อบันทึกข้อมูลด้วย หน่วยความจำของคอมพิวเตอร์ นิยมวัดเป็น Kilobyte (กิโลไบต์)  Megabyte(เมกะไบต์) {--mlinkarticle=2168--}Gigabyte (จิกะไบต์){--mlinkarticle--} และ Terabyte (เทระไบต์) และในบทความนี้เราจะมาพูดถึงการเปลี่ยนหน่วยของขนาดไฟล์ให้เหมาะสม โดยรับข้อมูลเข้ามาในหน่วยไบต์ แล้วเปรียบเทียบว่าสามารถเปลี่ยนเป็นหน่วยใหญ่ที่สุดหน่วยใดได้ บน {--mlinkarticle=2417--}Python{--mlinkarticle--} กัน

โดยจำนวนไบต์ของแต่ละหน่วยจะเป็นดังตารางนี้

หน่วย จำนวนไบต์
KB 1,024
MB 1,048,576
GB 1,073,741,824
TB 1,099,511,627,776

     นอกจากนี้แล้วยังมี  Petabyte(เพตะไบต์)  Exabyte(เอกซะไบต์)  Zettabyte(เซตตะไบต์) และ Yottabyte(ยอตตะไบต์) แต่ในปัจจุบันยังไม่มีสื่อบันทึกข้อมูลใดที่สามารถเก็บข้อมูลได้มากขนาดนั้น

 

ตัวอย่างโค้ดในการคำนวณ

เพื่อทำการเปรียบเทียบวว่าสามารถเปลี่ยนเป็นหน่วยที่ใหญ่ที่สุดใดได้บ้าง

# -*- coding=utf8 -*-
size = float(input('ขนาดของไฟล์(ไบต์):'))
unit = ''

if size >= 1099511627776:   #ถ้าขนาดมากกว่าหรือเท่ากับ 1,099,511,627,776 ให้แปลงเป็นหน่วย TB
    size /= 1099511627776
    unit = 'TB'
elif size >= 1073741824:    #ถ้าขนาดมากกว่าหรือเท่ากับ 1,073,741,824 ให้แปลงเป็นหน่วย GB
    size /= 1073741824
    unit = 'GB'
elif size >= 1048576:      #ถ้าขนาดมากกว่าหรือเท่ากับ 1,048,576 ให้แปลงเป็นหน่วย MB
    size /= 1048576
    unit = 'MB'
elif size >= 1024:      #ถ้าขนาดมากกว่าหรือเท่ากับ 1024 ให้แปลงเป็นหน่วย KB
    size /= 1024
    unit = 'KB'
else:
    unit = 'Byte'
print 'แปลงเป็นหน่วยที่เหมาะสมได้ประมาณ :',format(size,'.2f'),unit

 

ตัวอย่าง

ผลลัพธ์จากการคำนวณ
ผลลัพธ์ที่ได้เท่ากับ 1.09 TB

     เมื่อเราได้ทำการใส่ข้อมูลเข้าไป ระบบก็จะทำการคำนวณจากตัวเลขเหล่านั้น ซึ่งในตัวอย่างจะเป็นการใส่ค่า 1,199,511,627,776  ก็จะตรงกับเงื่อนไขแรกที่เรากำหนด คือ ถ้ามีขนาดมากกว่า 1,099,511,627,776  ก็จะทำการแปลงเป็นหน่วย TB และหารตัวเลขด้วยค่านั้นๆ

     เพียงเท่านี้เราก็สามารถแปลงตัวเลขของขนาด เช่น ขนาดไฟล์ จากหน่วยไบต์ให้เป็นหน่วยให้เป็นหน่วยที่ใหญ่กว่า เพื่อจะได้เหมาะสมกับข้อมูลต่างๆ และทำให้เราสามารถอ่านค่าของพื้นที่นั้นได้ง่ายมากยิ่งขึ้นอีกด้วย

 

ช่องทางการศึกษาเพิ่มเติมเกี่ยวกับ : Python

การรับค่าจากแป้นพิมพ์ใน Python (ไพทอน)

คำสั่งขึ้นบรรทัดใหม่ (\n) ในภาษาโปรแกรม Python (ไพธอน)

ช่วงการทำงาน IF ในไพทอน Statement block if Statement Selection

เทคนิดการเขียนไพทอน

Python เขียนเทสเคสด้วย selenium

Advantages of a unit converter

$
0
0

The first electronic {--mlinkarticle=6724--}computers{--mlinkarticle--} were created in the mid-twentieth century, between 1940 and 1945. Originally, computers the size of a large room consumed the same amount of energy as many modern personal computers (PCs) hundreds of machines working together . Today's computers are built with integrated circuits (ICs), which have a capacity millions and billions of times greater than in the past because technology has advanced significantly. People were not very popular back then. Computers are thus designed to have sufficient capacity per computer; if the capacity of the machine is insufficient, we should increase the capacity or store data in other ways, such as a {--mlinkarticle=5276--}flash drive{--mlinkarticle--}. We use computers and electronic tools more and more these days. We should understand the computer's {--mlinkarticle=2047--}unit{--mlinkarticle--} and the program's benefits and what the measurements are.

white and blue background with Thai characters
Unit conversion program illustration

How to calculate units using a unit converter.

  1.  In the unit conversion program, it consists of username, number of units and units.
    - Username is to enter your name or enter the name of the person you want to calculate.
    - Number of Units Enter the number of units you have chosen, e.g. 10 units.
    - In the unit section, put the unit that we want to be another unit, such as Kilobyte , Megabyte , GigaByte , TeraByte , etc.

  2. After entering the unit data that we want to convert is done, press to calculate and don't forget to click "I'm not a computer program" to prove that we are not a computer program. Then you can calculate.
  3. After pressing calculate successfully, it will show us the result for example we want to calculate 10 MB. The result will be displayed in other units equal to 10 MB.
  4. In the section of recent access information , we can click to see the latest information of the person who converted the unit by pressing show results. The results of all users who came to the unit will be displayed.

For example ,

No.
1343

username

M

number of units

10

units

MB

Byte

1048

Kilobyte

1024

Megabyte

10

GigaByte

0.00

TeraByte

0.00
saved on
2022-07-07 12:11:50

Number of IP Address

183.88.184.***

 

Advantages of a unit converter

  • We don't waste time in calculating unit conversion because if we calculate by ourselves, the procedure will be very complicated because we need to find units to divide and raise power.
  • Make unit conversion values ​​stable and accurate because if we convert the units ourselves, we may be wrong.
  • We don't have to pay for the cost of the calculation.
  • The quick unit conversion makes us more convenient.
  • It does not allow us to calculate the unit multiple times because the unit we select to convert the result of this unit converter program will appear alongside all other units.
  • This Convert Unit program can let us know Using the most recent user data, we determined which units and days to calculate.
  • This enables us to determine who has used this program and whether the number of units and units are the same. We are not going to waste time recalculating.

 

For this Unit Converter is called {--mlinkarticle=7502--}Program Convert Unit{--mlinkarticle--}. For anyone who is studying {--mlinkarticle=1--}Science {--mlinkarticle--}or just finished Science , you can probably tell that this string is related to numbers. There's a lot of and there are so many different formulas it makes calculating unit conversions a huge headache. This program is a program that has been developed for you to be able to use in various tasks and reduce the time of work more. In addition, this program also facilitates users who want to convert units quickly. The program can also convert to other units in one conversion cycle. The principle of use is not difficult because there are few steps to work by entering the username, number of units and the units you want to convert. You can easily convert units by going to the website and typing in mindphp.com/tools/convert-unit

 

 

Program Convert Unit

Online Tools

 

reference

Program Convert Unit ,[online], accessible from https://www.mindphp.com/tools/convert-unit/index.php?lang=en

Memory KB,MB,GB,TB So what next, let's talk about memory ,[online], accessible from https://www.modify.in.th/15215

The unit used to call the computer's capacity, speed ,[online], accessible from https://www.it-guides.com/training-a-tutorial/basic-computer/basic-computer

  

What does unit conversion mean ?

$
0
0

Unit conversion is the process of converting units from one base to another, such as converting from GB to TB. The base number system is related to {--mlinkarticle=3584--}computer{--mlinkarticle--} and is used to aid in the manipulation of digital or {--mlinkarticle=3052--}electronic{--mlinkarticle--} systems in computers or to represent unit codes of information in BCD, EBCDIC, and ASCII systems. Most of the number systems used in computers are binary. The octal number system and the hexadecimal number system must also be used to calculate the result. {--mlinkarticle=3999--}Mathematical{--mlinkarticle--} operators until changing the base number system in order to allow humans to understand each system unit of a computer

 yellow background with dark brown border white text box with chess lettersAn illustration of the conversion 

Computer and device capacity Each device has a different capacity, and how much we use it depends on how much we use it. A capacity such as a mobile phone's Micro-SD Card, a camera's SD- Card, or even a hard disk or SSD (SSD: Solid State Drive), as we see and are familiar with today, has a total of MB, GB, and TB. Examples of computer units that we are familiar with are 3MB image files, 128GB SSD capacity, 1TB HDD capacity, etc. With modern technology, we can create more storage capacity. As the size of the device gets smaller as it is a binary system, memory is often counted multiplied by 2. For example 8GB x 2 = 16GB and 16GB x 2 = 32GB will keep multiplying like this. Most of us see the capacity of hard disk or SSD will see it as 128GB, 256GB, 512GB or 1 TB etc.

What is the binary number system?
The Binary Number System, or Binary Number System, consists of only 0 and 1, with Bi meaning two. The binary system was first coined by Gottfried Leibniz in the 17th century, around 1601 Christian era (2144 B.E.) to 1700 Christian era (2243 B.E.). This binary number system is something that is invisible to the naked eye, but is a system that exists in various parts of the device such as processing system, storage memory, etc. The binary system is the source of the "bits" (Bit) and "bytes" (Byte), where one 0 or 1 replaces the bit value of 1 bit. All 8 positions, or 8 bits, get 1 byte, and this leads to other numbering systems such as the ASCII system, and that causes the binary numbers to be translated into letters to store data in the computer's memory (Storage) because Binary has only 0 and 1 digits. As a result, both of these are symbols that only support two commands. The binary system is not restricted to computers. However, other IT equipment with a processing system Memory, such as mobile phones, calculators, theft signals, and so on, is also binary.

 

The basic computer storage capacity consists of KB (Kilobyte), kilobyte, MB (Megabyte), megabyte, GB (Gigabyte), gigabyte, and TB (Terabyte).

KB (Kilobyte) Kilobyte

Kilobyte (KB) is a computer unit used to count data larger than a byte (Byte), and is commonly found in documents such as Microsoft Word or PDF. The file will grow in size as the number of characters increases.

MB (Megabyte) is a unit that can be seen in everyday life and is a unit that people see often, such as a picture file, currently 1MB or more, audio or music files in a single .MP3 song will be 3MB or more in size. As for Video files, if the camera has a high resolution, it will have a larger file size depending on the length of each video file as well such as 1 song MV is about 3 minutes long, resolution at Full HD 1080p, file size will be around 300MB or more depending on the length of the video and the video quality. If the quality is low, we will have more space.

GB (Gigabyte) Gigabyte is a computer unit that is often seen together in the form of movie files. and installation files of various software or games and on storage media such as USB Flash Drive, SD-Card, SSD and HDD, etc.

Terabytes are storage capacity of SSDs and HDDs due to their large storage capacity, such as 1TB SSDs and 9TB HDDs.

How can we convert units?

We can easily convert computer units through the unit converter in this section, we just enter the data of the numbers that we want to convert and then select the starting unit to the ending unit. Unit conversion through the program will help us more convenient. If we calculate it ourselves, it can be confusing because the calculation is very complicated and also needs to be raised or calculated as the base of that number.

 

Examples of unit conversion that are converted from the program are as follows.

1 gigabyte   equals to 1,048,576 kilobytes
2 gigabytes equals to 2,097,152 kilobytes
3 gigabytes equals to 3,145,728 kilobytes
4 gigabytes equals to 4,194,304 kilobytes
5 gigabytes equals to 5,242,880 kilobytes

 

Unit conversions allow us to better manage each area. We can make space for other parts as well. Unit conversion allows us to compare and know the difference between units. This article is written to provide a guideline for everyone to understand what each computer unit is, how they differ and how to convert a computer unit. I hope the readers will recognize and understand more computer units, which is important for measuring memory and storage capacity of many important {--mlinkarticle=6394--}files{--mlinkarticle--} and devices. We can convert computer units at Mindphp. This unit conversion program will be able to convert instantly just enter a {--mlinkarticle=54--}number{--mlinkarticle--} and then select the unit you want to convert, the program will calculate and show the result for us which the resulting table, Bytes, KB, MB, GB, and TB are displayed. Computer memory is currently expressed in kilobytes, megabytes, gigabytes, and terabytes, with each unit having a multiplier value. Different from 1024, but in general, when doing calculations, many people tend to estimate the multiplier value of 1000 to make it easier to calculate, but to get the correct number, we should use a program to convert the units.

 

 

 

Program Convert Unit

Online Tools

 

 

reference

Program Convert Unit ,[online], accessible fromhttps://www.mindphp.com/tools/convert-unit/index.php?page=2 

Binary number system ,[online], accessible from https://sites.google.com/site/computerbcyschool/home/com_m_3/binary-digit

Measuring data or memory metrics ,[online], accessible from https://sites.google.com/site/twelaof/smrrthna-praca-hnwy

 

 

 




Viewing all 18 articles
Browse latest View live