google-sheet2Html

/*! * * Google Sheets To HTML v0.9a * * To use, simply replace the "tq?key=" value in the * URL below with your own unique Google document ID * * The Google document's sharing must be set to public * */ google.load('visualization', '1', { packages: ['table'] }); var visualization; function drawVisualization() { var query = new google.visualization.Query('https://spreadsheets.google.com/tq?key=https://docs.google.com/spreadsheets/d/1-vUEZ9tae5C_OXzSi0dQPWwUrO3H5S-gImB5afFgqDg/edit?usp=sharing'); query.setQuery('SELECT A, B, C, D label A "Duration", B "Song", C "Requested By", D "URL"'); query.send(handleQueryResponse); } function handleQueryResponse(response) { if (response.isError()) { alert('There was a problem with your query: ' + response.getMessage() + ' ' + response.getDetailedMessage()); return; } var data = response.getDataTable(); visualization = new google.visualization.Table(document.getElementById('table')); visualization.draw(data, { legend: 'bottom' }); } google.setOnLoadCallback(drawVisualization);

Tuesday, February 14, 2017

กู้ไฟล์ USB Drive ที่โดน Format

กู้ไฟล์ บน SD card หรือ USB drive


 วิธีกู้ไฟล์ข้อมูลที่ถูกลบ หรือ format แล้ว มีหลายโปรแกรม แต่ในที่จะใช้โปรแกรมใน Linux ที่ชื่อ photorec   ถ้ายังไม่ได้ติดตั้งให้ใช้ คำสั่ง ติดตั้งดังนี้

 sudo apt-get install testdisk


เมื่อทำการติดตั้งโปรแกรมเสร็จแล้ว ให้เริ่มจาก การหาชื่อของ usb drive ด้วยการกู้ข้อมูล เปิด เทอร์มินอล แล้วพิมพ์คำสั่ง

 lsblk



 จากในภาพ จะทำการกู้ไฟล์ ในตำแหน่ง sdb1
การเรียกใช้โปรแกรม ให้พิมพ์คำสั่ง

sudo photorec /dev/sdb1



เลือก ไดร์ฟ ที่ต้องการจะกู้ข้อมูล โดยใช้ Arrow Key จากนั้นเลือก [Proceed]

หากต้องการกู้ข้อมูล จาก ไดรฟ์ ที่มี หลาย พาร์ติชั่นให้ทำการเลือกตำแหน่งที่ต้องการ ในตัวอย่างเลือกกู้ข้อมูลใน FAT 32 

ให้กด s เพื่อลบรายการทั้งหมด จากนั้นใช้ Arrow Key เลื่อนไปตำแหน่งชนิดไฟล์ที่ต้องการ กด space bar เพื่อทำการเลือก เมื่อเสร็จให้กด b เพื่อบันทึก ในตัวอย่างต้องการกู้รูปภาพ เลือก ชนิด ไฟล์ jpg (หากต้องการ ไฟล์ชนิดอื่นให้ ทำการเลือกเพิ่มเติม) 

เมื่อทำการบันทึกแล้ว จะปรากฎดังภาพ

ต่อไป กด enter เพื่อย้อนกลับไป เมนูก่อนหน้า


เลือก [Search] จะให้เลือกตำแหน่งที่ต้องการบันทึกไฟล์ ที่กู้มาได้ ว่าจะบันทึกไว้ที่ไหน


เลือกตำแหน่งที่ต้องการ ให้ ตรวจสอบ เลือก [ Free] หรือ [ Whole ] ตามที่ต้องการ              
ในตัวอย่างเลือก [ Free ] FAT 32

กำหนดตำแหน่ง ที่จะบันทึก ไฟล์ ที่กู้มาได้ 
 
เมื่อกำหนดตำแหน่งที่ต้องการแล้ว กด C
โปรแกรมจะทำการกู้ไฟล์ ตามที่ต้องการ

  Cr. http://www.tecmint.com/photorec-recover-deleted-lost-files-in-linux/

Thursday, February 2, 2017

ซิมเพล็กซ์ รีพีทเตอร์ simplex repeater

โปรแกรม simplex repeater ทำเองก็ได้

บทความนี้ แสดงวิธีการ สร้างสถานนีทวนสัญญาณ เพื่อศึกษา การเขียนโปรแกรมเท่านั้น โปรดขอคำแนะนำกับ ศูนย์ควบคุมข่าย ประจำจังหวัด ก่อน ทดสอบ ครับ

โปรแกรม ซิเพล็ก รีพีทเตอร์ ในบทความนี้ใช้ ภาษาไพทอน ร่วมกัน sound meter  ถ้าอ่านแล้วไม่เข้าใจ ขอให้ย้อน ไปดู โพสท์ เก่าๆ ก่อน  โปรแกรมนี้ จะเป็นการเรียกใช้ สคริป ให้ทำงานเมื่อมีระดับเสียงดังในระดับที่กำหนด โดยจะทำการ บันทึกเสียง 10 วินาที จากนั้น จะส่ง สัญญาณ จาก Pyserial ควบคุม ปุ่ม PTT ของวิทยุสื่อสาร ออกอากาศ ด้วยเสียงที่บันทึกไว้โดย สคริป ที่ควบคุม ชื่อ repeater.sh มีรายละเอียดังในภาพ


 เมื่อ soundMeter ได้รับสัญญาณ เสียงจาก ไมโครโฟน ดังกว่าระดับที่ตั้งไว้ จะทำการบันทึกเสียงในไฟล์ชื่อ simplex.wav 
โดยทำการบันทึกเสียง แชนแนลเดียว ด้วย คำสั่ง rec -c 1 โดยกำหนดความยาวเป็นเวลา 10 วินาที่ ด้วย พารามิเตอร์ trim 0 10
คำสั่ง sleep 0.5 ให้ หยุด 0.5 วินาที เพื่อ ให้ pyserial ทำงาน แล้วจึง ส่งเสียงออกมาด้วย คำสั่ง play simplex.wav
 
ในการใช้งาน window  กับ linux การเรียกใช้ Pyserial ต่างกันเล็กน้อย ไปดูโพสท์ เก่าๆ แล้วแก้ไข การควบคุมที่ บรรทัด #insert PTT on กับ #insert PTT off

ดูวีดีโอตัวอย่างใช้งาน https://youtu.be/z5jsPE5CeDg





ในส่วน GUI ด้วย Tkinter Python 2 มีรายละเอียดดังนี้
#!/usr/bin/python
# coding: utf-8

#program radio+computer  by HS1ZFK
#last modify 2/02/2560 ConchRepeater#  version 2.0 Sox

import os
from Tkinter import *





def SetSerial():
    print "set usb serial converter"



def RepeaterOn():
    #repeater Start
    print "start repeater"
    #print ( tiggerValue.get())
    tig = str(tiggerValue.get())
    command = "soundmeter --trigger +" + tig +" 1 --action exec-stop --exec repeater.sh"
    print command
    os.system(command)

def About():
    Message(Mwin, text="Simplex Repeater by HSZFK"
            "set Mic noise Levea ""and time then click start", bg="royalblue", fg="ivory",relief=GROOVE).pack(padx=10, pady=10)

Mwin = Tk()  #Main Window

#set Menu bar
menubar = Menu(Mwin)


#create pulldown menu
ModeMenu = Menu(menubar,tearoff=0)
ModeMenu.add_command(label="Exit ", command=Mwin.quit)
menubar.add_command(label="Set up serial port", command=SetSerial)

menubar.add_command(label="Quit!", command=Mwin.quit)
menubar.add_command(label="About", command=About)


#display menu
Mwin.config(menu=menubar, bg="light cyan")

Mwin.geometry("450x350+300+300")        #set size and position of window
Mwin.title('Simplex_Sox v2.0 by HS1ZFK')




tiggerValue = Scale(Mwin, from_=300, to=500, length=600,label="trigger",bg="light cyan", troughcolor="blue", tickinterval=25, orient=HORIZONTAL)
tiggerValue.set(370)
tiggerValue.pack()

# set button
Btn1 = Button(Mwin,text=" Start Repeater ", bg="pale green",command=RepeaterOn)
Btn1.pack()

Mwin.mainloop()     #start the event loop