Showing posts with label GNU. Show all posts
Showing posts with label GNU. Show all posts

How to setup environment for Go

Go Programming Language ဟာ ဒီဆယ္စုနွစ္အတြင္းမွာ အသစ္ထြက္ေပာ္လာတဲ့ New Programming Language တစ္ခုပါ။ Developer ကေတာ့ Google ပါ။ Authors ေတြကေတာ့ Plan9 OS project က Rob Pike, Ken Thompson အပါအဝင္ Robert Griesemer နွင့္ အျခားပုဂဿဿဂုိလ္မ်ားျဖစ္ျကျပီး BSD-style License နဲ့ Open Source Distribution ျဖစ္ပါတယ္။
Go က C/C++ တို့လို Compiled Language ျဖစ္ျပီး gc (8g,6g) နဲ့ gccgo တို့က Go အတြက္ compilers ေတြျဖစ္ျကပါတယ္။ ေလာေလာဆယ္ေတာ့ Linux နဲ့ Mac OS မွာပဲ ဒီ compilers ေတြကိုအသံုးျပုနိုင္ပါေသးတယ္။
Go ကို ေလ့လာနိုင္ဖို့အတြက္ အဓိကေနနဲ့ Go compiler နဲ့ အျခားလိုအပ္တဲ့ programming environment programs ေတြပါ။ ဒါေတြကို go source ကေန့ Build လုပ္ဖို့အတြက္ ျပင္ဆင္ရေအာင္။ က်ေနာ္ကေတာ့ Debian GNU/Linux user ဆိုေတာ့ က်ေနာ့္ Linux x86 (386) မွာ ဘယ္လို setup လုပ္လဲဆိုတာ နမူနာအေနနဲ့ေရးမွာပါ။
ပထမဦးဆံုးအေနနဲ့ က်ေနာ္တို့ ~/.bashrc ဖိုင္မွာ Environment variables ေတြကို ေရးရေအာင္ ~/.bashrc ဖိုင္ကို gedit နဲ့ပဲျဖစ္ျဖစ္ ျကိုက္နွစ္သက္ရာ editor တစ္ခုခုနဲ့ပဲျဖစ္ျဖစ္ဖြင့္ျပီး ေအာက္က Environmnet variables ေတြကို ထည့္ျဖည့္ေရးေပးျပီး .bashrc ဖိုင္ကို သိမ္းျပီး ပိတ္လိုက္ပါ။

$ gedit ~/.bashrc

## Go Environment variables ##
export GOROOT=~/hg
export GOOS=linux
export GOARCH=386
export GOBIN=~/bin

ျပီးရင္ ~/.bashrc ဖိုင္ကို save ျပီး ပိတ္လိုက္ပါ။ ျပီးရင္ ေအာက္က command ကို Terminal ထဲမွာပဲ run ေပးပါ။

$ source ~/.bashrc

ျပီးရင္ Environment Variables ေတြက memory ထဲေရာက္ျပီးလား Test လုပ္ျကည့္ပါ။

$ env | grep '^GO'
GOBIN=/home/username/bin
GOARCH=386
GOROOT=/home/username/hg
GOOS=linux

အဲလိုအေပာ္က results ကိုေတြ့မွာပါ။ ဒါေပမယ့္က်ေနာ္တို့ ~/bin folder မရွိေသးရင္ mkdir နဲ့ folder လုပ္ေပးရပါမယ္။

## making 'bin' folder under your home directory ##
$ mkdir -p ~/bin

ျပီးရင္ mercurial ကိုသံုးျပီး go source files ေတြကို fetch မွာျဖစ္ပါတယ္။ က်ေနာ့္ Linux က Debian ျဖစ္သမို့ က်ေနာ္ apt ဒါမွမဟုတ္ aptitude ကိုသံုးျပီး mercurial ကို ေအာက္ကအတိုင္း install လုပ္ပါမယ္။ ခင္ဗ်ားမွာ mercurial ရွိျပီးသားဆိုရင္ေတာ့ install လုပ္စရာမလိုတဲ့အတြက္ ဒီအဆင့္ install လုပ္တဲ့အဆင့္ကိုေက်ာ္ျပီး go source files ကို fetch လုပ္နိုင္ပါျပီ။

## installing mercurial ##
$ sudo apt-get install mercurial

mercurial ကို install လုပ္ျပီးတဲ့အခါ က်ေနာ္တို့ go source files ေတြကိုရယူဖို့အတြက္ ေအာက္က command line ကို run ေပးပါမယ္။

## fetching go source files ##
$ hg clone -r release https://go.googlecode.com/hg/ $GOROOT

source files ေတြရျပီးရင္ အဲဒါေတြကို build လုပ္ဖို့အတြက္ လိုအပ္တာေလးေတြကို install လုပ္ေပးပါမယ္။

## installing gcc and others to build go source ##
$ sudo apt-get install bison gcc libc6-dev ed make

ျပီးရင္ Go Distributions ကို က်ေနာ္တို့ build ရေအာင္ ..

## building go distribution ##
$ cd $GOROOT/src
$ ./all.bash

တေအာက္ေလာက္ေစာင့္ေပးျပီးရင္ ေအာက္က results ကိုေတြ့မွာပါ။ အဲဒါဆိုရင္ building process က အဆင္ေျပျပီး go compiler ကိုသံုးလို့ရပါျပီး ..

--- cd ../test
0 known bugs; 0 unexpected bugs

အေသးစိတ္သိခ်င္ရင္ေတာ့ ဒီလင့္ခ္ ေလးကို သြားျပီးဖတ္ပါ။

vim မွာ go syntax highlight အတြက္ ကိုစိုးမင္းရဲ့ post ကိုသြားဖတ္နိုင္ပါတယ္။
ဒီမွာပဲတဆက္တည္းျကည့္လိုက္ရေအာင္ က်ေနာ္ေရးေပးလိုက္ပါတယ္။

## adding go syntax for vim editor ##
$ mkdir ~/.vim/
$ mkdir ~/.vim/syntax/
$ cp $GOROOT/misc/vim/go.vim ~/.vim/syntax/

## making and opening ~/.vimrc file ##
$ gedit ~/.vimrc

gedit နဲ့ ~/.vimrc ဖိုင္ပြင့္လာျပီးဆိုရင္ ေအာက္ကဟာေတြကို ကူးျပီးေရးျဖည့္ေပးလိုက္ျပီး သိမ္းျပီး ပိတ္ေပးလိုက္ပါ။

autocmd BufNewFile,BufRead *.go set filetype=go
:syntax on

ခုဆိုရင္ vim editor နဲ့ go programming language ကို syntax highlight ေတြနဲ့ေလ့လာနိုင္ပါျပီ။

Enjoy learning Go!

VirtualBox runs Windows XP on my Debian Lenny

က်ေနာ့္ Debian Lenny မွာ MS Windows XP ကို Sun VirtualBox ကိုအသံုးျပုျပီး run ေနတာပါ။ Debian GNU/Linux ကတကယ့္ကို smart က်ပါတယ္။ သူ့အေပာ္မွာ အလုပ္လုပ္ရတာ အဆင္ေျပတာမို့ က်ေနာ့္အျကိုက္ဆံုး OS ထဲမွာ Debian ကထိပ္ဆံုးကပါေနတာပါ။ Perfect Debian ပါပဲဗ်ား .. ေအာက္မွာ က်ေနာ့္ screenshots ေလးပါ ..

MS Windows XP installing on Sun VirtualBox in Debian Lenny
MS Windows XP installing on Sun VirtualBox in Debian Lenny

MS Windows XP installation completing
MS Windows XP installation completing

Windows updating on Virtual Machine
Windows updating on Virtual Machine

Windows XP running on VirtualBox
Windows XP running on VirtualBox

Sun VirtualBox running on Debian Lenny
Sun VirtualBox running on Debian Lenny

အကယ္လို့ Sun VirtualBox ကို Linux မွာ install လုပ္ခ်င္ရင္ ေအာက္လင့္မွာသြားျပီးယူနိုင္ပါတယ္။

http://www.virtualbox.org/wiki/Linux_Downloads

Enjoy with it! :-)

xboard and playing online chess

ဗမာျပည္မွာ online မွာ chess ကစားတဲ့သူ ဘယ္နွစ္ေယာက္ရွိမလဲေတာ့ မသိဘူး။ ဒီပို့စ္မွာေတာ့ chess ဟာ ဘယ္ေလာက္ေပာ္ျပူလာျဖစ္ျပီး၊ ဘယ္နိုင္ငံေတြမွာ အမ်ားဆံုး ကစားျကတယ္ဆိုတာကိုေတာ့ မေျပာေတာ့ပါဘူး။ က်ေနာ္ Linux မွာ xboard နဲ့ ဘယ္လို online chess ေဆာ့တယ္ဆိုတာေလာက္ အေျခခံေလးေရးမွာပါ။ ဒီေနရာမွာ လိုအပ္တဲ့ Applications ေတြကေတာ့ xboard (chess program), crafty (chess engine) နဲ့ scid (chess database app) တို့ျဖစ္ပါတယ္။ xboard ကေတာ့အေျခခံလိုအပ္တာပါ။ crafty နဲ့ scid မရွိပဲ online chess ကစားလို့ရေပမယ့္ ေလ့လာသူေတြအတြက္ေတာ့ crafty engine နဲ့ scid က အရမ္းအသံုး၀င္ပါတယ္။ က်ေနာ့္ Debian Machine မွာ ဒီလိုေလး install လုပ္ပါတယ္။

$ sudo install xboard crafty scid

xboard နဲ့ chess ေဆာ့ဖို့အတြက္ Terminal ထဲမွာ ရိုးရိုးေလးပဲ သူ့နာမည္ကို ေခာ္လိုက္ရင္ရပါတယ္။ default size ကက်ေနာ့္အတြက္ အရမ္းျကီးေနလို့ နည္းနည္းပိုငယ္တဲ့ Bulky size ကို size option ေလးထည့္ျပီး ေခာ္တာပါ။

$ xboard -size Bulky

human vs. machine
human vs. machine

ဒါကေတာ့ online မွာမဟုတ္ပဲ Machine နဲ့ ကစားမွာျဖစ္ပါတယ္။ online မွာေဆာ့ခ်င္ရင္ free chess server တစ္ခုခုမွာ register လုပ္ဖို့လိုအပ္ပါတယ္။ ဥပမာအေနနဲ့ Free chess server ေတြကေတာ့ freechess.org နဲ့ chesspark.com တို့ကေတာ့ လူအမ်ားဆံုး register လုပ္ျပီးကစားတဲ့ေနရာေတြျဖစ္ပါတယ္။ ခုက်ေနာ္ နမူနာထဲမွာ freechess.org server ကို connect လုပ္ျပီး ကစားတာျဖစ္ပါတယ္။ Terminal မွာ ေအာက္က command line နဲ့ freechess server ကို၀င္ေရာက္ကစားနိုင္ပါတယ္။

$ xboard -ics -icshost freechess.org -size Huge

အဲဒါဆိုရင္ xboard gui chess board ေပာ္လာမယ္။

starting xboard to connect freechess.org server
starting xboard to connect freechess.org server

openning GUI and connecting to server
openning GUI and connecting to server

ဒါေပမယ့္ က်ေနာ္တို့ freechess.org server ကိုဝင္ဖို့အတြက္ user name နဲ့ password လိုအပ္ပါမယ္။ ေအာက္ကပံုမွာ က်ေနာ့္ login name: boxtwo နဲ့ password: **** တို့ကိုရိုက္သြင္းျပီး login လုပ္ေနပါတယ္။

login to freechess.org server
login to freechess.org server

အေပာ္ကပံုအတိုင္း က်ေနာ့္ login name နဲ့ password ကိုေပးျပီးတဲ့အခါ server သို့ connected ျဖစ္ျပီးဆိုတာကို ေအာက္ ပံုမွာျပထားပါတယ္။
after logging in and connected to freechess.org to start a game
after logging in and connected to freechess.org to start a game

login ၀င္ျပီးလို့ connected ျဖစ္ျပီးခ်ိန္မွာ ကိုယ္ယွဥ္ျပိုင္ကစားမယ့္သူကို seek ရမွာျဖစ္ပါတယ္။ ဒီလို seek တဲ့ေနရာမွာ time (ျကာခ်ိန္) နဲ့ rate (အဆင့္) ကိုထည့္ေပးျပီး seek ရမွာျဖစ္ပါတယ္။ chess ကစားေနက်သူဆိုရင္ ဒါကိုတန္းျပီး သိမွာပါ။ နမူနာအေနနဲ့ ျကာခ်ိန္ ၀ မိနစ္ကေန ၃ မိနစ္ျကားနဲ့ အဆင့္ ၁၀၀၀ ကေန ၁၅၀၀ ျကားကလူကို က်ေနာ္ seek မွာျဖစ္ပါတယ္။ အဲဒီအတြက္ inputs ေတြက...

seek 0 3 1000-1500
inputting times and rates to seek a person
inputting times and rates to seek a person

အဲလိုရိုက္ထည့္ေပးျပီး စကဿကန့္အနည္းငယ္ေလာက္ ေစာင့္ပါ။
seeking a person from online to play a game
seeking a person from online to play a game

အကယ္၍ အထက္ကပံုအတိုင္း ကိုယ့္ရဲ့ seeking ကိုတဖက္လူတစ္ေယာက္ေယာက္က လက္ခံရင္ ကိုယ့္ xboard gui chess board မွာလဲ ေအာက္ကပံုအတိုင္း boxtwo vs. HAL gooo ဆိုျပီး Title မွာလာျပျပီး ကိုယ္က အျဖူေရာင္ဆိုရင္ စတင္ေရြ့လို့ရပါျပီး။
playing with an online freechess.org member
playing with an online freechess.org member

ဒီလိုကစားရာမွာ Terminal နဲ့ Xboard GUI ကိုတြဲသံုးရမွာျဖစ္ပါတယ္။ အကယ္၍ ကိုယ္က ရွံုးဟန္ေပာ္ေနျပီးဆို resign လုပ္ဖို့ရာ res ကို input ေပးျပီး resign လုပ္နိုင္ျပီး နာက္တစ္ပြဲဆက္ကစားဖို့ကိုလဲ rem လို့ input ေပးျပီး rematch လုပ္ ကစားနိုင္ပါတယ္။ အကယ္၍ ကိုယ္က freechess.org server ကေနထြက္ခ်င္ျပီးဆိုရင္ Terminal မွာ ctrl + c ကိုတဲြနွိပ္ေပးလိုက္ရင္ server ကေန log out ျဖစ္သြားမွာပါ။

logout from freechess.org server
logout from freechess.org server

အထက္ကေဖာ္ျပထားတာတာ့ ကိုယ့္ xboard program နဲ့ေဆာ့တာပါ။ အကယ္၍ web browser မွာပဲ တခါတည္းေဆာ့ခ်င္တယ္ဆိုလဲ အဲဒီအတြက္ Jin Applet web application နဲ့ www.freechess.org မွာတန္းျပီး ဝင္ကစားလို့ရပါတယ္။
Jin Applet login on freechess.org
Jin Applet login on freechess.org

Jin Applet Web Application
Jin Applet Web Application

ဒီေအာက္ကပံုကေတာ့ scid application ပံုပါ။
starting scid databas app
starting scid databas app

Enjoy it, chess hobbyists! :-)

Debian GNU/Linux time-base freezes

Debian GNU/Linux distribution ဟာအရင္ကဆိုရင္ time-base အတိုင္း release မလုပ္ပါဘူး။ ခုေတာ့ Debian ဟာ 2 year cycle release ထုတ္ဖို့ new policy ကို စပိန္နိုင္ငံမွာက်င္းပတဲ့ Debian's Project Yearly conference အတြင္း တင္ျပျပီး သေဘာတူ ဆံုးျဖတ္လိုက္ပါျပီ။ မကိန္းရွိတဲ့နွစ္ (ဥပမာ 2009, 20011, 2013, ...) December လမွာ Freezes ျဖစ္ျပီးေတာ့ စံုကိန္းရွိတဲ့နွစ္ (ဥပမာ 2010, 2012, 2014, ...) ေနြဦးေလာက္မွာ release ထုတ္ပါမယ္။ ေပာ္လစီကေျပာင္းလိုက္ျပီဆိုေတာ့ ဒီနွစ္ 2009 December မွာ Debian GNU/Linux 6.0 "Squeeze" ဟာ development freezes ျဖစ္ျပီးေတာ့ 2010 Spring ေလာက္မွာ release out မယ္လို့သိရပါတယ္။ ဒါဆိုရင္ Debian 7.0 ဟာ 2011 December မွ Freezes ျဖစ္ျပီး 2012 Spring ေလာက္မွာမွာ Debian GNU/Linux 7.0 (codename မသိေသးပါ) ကို release ထုတ္မွာပါ။
ဒီ time-base freezes policy ဟာ users မ်ားအတြက္ ေရွ့ျကိုတင္ခန့္မွန္းလို့ပိုမိုေကာင္းမြန္လာသလို၊ developers မ်ားအတြက္လဲ long-term planning ကိုပိုမိုလုပ္ေဆာင္နိုင္လာမွာျဖစ္ပါတယ္။ ေနာက္ျပီး two-year cycle ဟာလဲ users မ်ားကို အေျပာင္းအလဲမ်ားအတြက္အခ်ိန္ပိုရရွိေစျပီး new release မ်ားနွင့္ပတ္သက္ျပီး အေျပာင္းအလဲလုပ္ရာမွာ ျဖစ္ရေသာ စိတ္အေနွာက္အယွက္ျဖစ္မွုမ်ားမွလဲ ေလ်ာ့နည္းေစမွာျဖစ္ပါတယ္။

အကိုးအကား

have fun !

using cygwin svn on windows xp

မေန႔ညက zawgyi keyboard package တစ္ခု google code svn ေပၚတင္ခဲ႔တယ္၊ အဲဒါ ဒီမနက္အလုပ္ကိုေရာက္ေတာ႔ office က က်ေနာ္႔ workstation pc မွာ svn update လုပ္တာတို႔ ဟိုေျပာင္းဒီေျပာင္းလုပ္တာတို႔လုပ္ရင္း screenshots ေလးလုပ္လိုက္တယ္၊ ဒီ cygwin-x "XWin Server" ဟာဘယ္ေလာက္အထိ အသံုးျပဳရလြယ္ကူတယ္၊ က်ေနာ္တို႔လို Linux crazy သမားေတြအတြက္ Windows ေပၚေရာက္ေနတဲ႔အခါမွာလဲ ဒီ cygwin ေလးဟာ က်ေနာ္တို႔အတြက္ အသက္ရႈထြက္ေပါက္ေလးတစ္ခုလို႔ အသံုး၀င္ေစပါတယ္ ..
Windows ေပၚမွာ svn သံုးဖို႔အတြက္ TortoiseSVN-1.6.* ရွိေပမယ္႔လဲ သိတယ္မဟုတ္လား ;)

[caption id="attachment_206" align="alignnone" width="480" caption="using Cygwin-x xterm for svn"]using Cygwin-x xterm for svn[/caption]

[caption id="attachment_207" align="alignnone" width="480" caption="using Cygwin-x xterm for svn"]using Cygwin-x xterm for svn[/caption]

[caption id="attachment_208" align="alignnone" width="480" caption="using xterm for svn"]using xterm for svn[/caption]

[caption id="attachment_209" align="alignnone" width="480" caption="svn delete"]svn delete[/caption]

[caption id="attachment_210" align="alignnone" width="480" caption="svn commit"]svn commit[/caption]

[caption id="attachment_214" align="alignnone" width="480" caption="Edit changelog with GNU nano"]Edit changelog with GNU nano[/caption]

[caption id="attachment_215" align="alignnone" width="480" caption="svn commit changelog file"]svn commit changelog file[/caption]

Have fun with Cygwin-x! :-)

free software song

ဒီသီခ်င္းေလးဟာ က်ေနာ္တို႔ Free Software ကမၻာကေရးထားတဲ႔ သီခ်င္းေလးတစ္ပုဒ္ပါ ..
သီခ်င္းေရးထားတဲ႔သူကေတာ႔ Richard Stallman ျဖစ္ပါတယ္ .. ခံစားၾကည့္ပါဗ်ား .. :-)
ခုက်ေနာ္တင္ထားတဲ႔ သီခ်င္းေလးက Rhythmic version ပါ ..

free software song rhythmic

[To the melody of Sadi Moma:]

Join us now and share the software;
You'll be free, hackers, you'll be free.
x2

Hoarders may get piles of money,
That is true, hackers, that is true.
But they cannot help their neighbors;
That's not good, hackers, that's not good.

When we have enough free software
At our call, hackers, at our call,
We'll throw out those dirty licenses
Ever more, hackers, ever more.

Join us now and share the software;
You'll be free, hackers, you'll be free.
x2


အကယ္၍ streamline နားေထာင္ခ်င္ပါက ေအာက္ကလင္႔ေလးကို ကူးယူၿပီး သီးသန္႔ browser tab မွာျဖစ္ျဖစ္၊ တျခား player တစ္ခုခုႏွင္႔ပဲျဖစ္ျဖစ္နားေထာင္ႏိုင္ပါတယ္ ခင္ဗ်ား ..

http://www.gnu.org/music/free-software-song-rhythmic.mp3

source: http://www.gnu.org/music/free-software-song.html

have fun! :D