คลังบทความของบล็อก

วันศุกร์ที่ 14 มีนาคม พ.ศ. 2551

TTY linux (ตัวเล็กๆ)

www.minimalinux.org/ttylinux
เป็น linux ขนาด 5 MB Run จาก cdrom

แต่มีวิธี move to hdd

Note: This is an unofficial howto.
First, you need a system capable of compiling packages. Due to the 4MB size limit of ttylinux, it doesn't contain such tools. I myself, use KUbuntu or Slackware for these tasks.
Second, this HOWTO is not guaranteed to work for each and every packages out there since every package has its own installation process. In this example, we will install "links" a CLI browser which uses the popular "./configure && make && make install" installation procedures.
Notation: In this HOWTO, the "#" symbol indicates a comment. When you encounter a "#" the rest of that line is a comment; don't type it. The commands specific to the creation of a ttylinux package (9 to 15) are followed by "# ! ttylinux specific !"
Also, all commands - everything you need to type - are in blue.
1) Download links hereIn this HOWTO we will use version 0.99
2) Unpack the tarball.tar zxvf links-0.99.tar.gz
3) Change to the newly created directory.cd links-0.99
4) Configure links../configure --prefix=/usr --without-ssl
Note that we pass the "--without-ssl" argument to the configure script since ttylinux doesn't have SSL installed. A consequence is that you will not be able to navigate to https websites. If you want to add SSL support to ttylinux, you can install OpenSSL, for example. Once you've configured OpenSSL, you can follow the step from 5 to 15 to make it a ttylinux package.
5) Compile links.
make
6) Create a temporary directory to store the installed files.
mkdir ../linksTmp
7) Install links into the temporary directory.
make DESTDIR=../linksTmp install
8) Change to the temporary directory.
cd ../linksTmp
9) Create the list of files and symbolic links installed. # ! ttylinux specific !
find . -type f > ../temp.filelist
find . -type l >> ../temp.filelist
10) Create the directory where we will move the above file. # ! ttylinux specific !
mkdir -pv var/log/packages
11) Parse temp.filelist to remove "./" prefix and save the result in the ttylinux package # ! ttylinux specific !
sort ../temp.filelist sed s%./%% > var/log/packages/links-0.99
12) Archive and compress the package. # ! ttylinux specific !
tar jcvf ../links-0.99.tbz .
13) Remove unneeded files. (cleanup!) # ! ttylinux specific !
cd ..rm -fr linksTmp
rm -fr links-0.99rm -fr links-0.99.tar.gz
rm temp.filelist
14) Copy the package "links-0.99.tbz" on your ttylinux machine. # ! ttylinux specific !
15) Install the package with pacman # ! ttylinux specific !
pacman --install links-0.99.tbz
And we're done!

วันจันทร์ที่ 18 กุมภาพันธ์ พ.ศ. 2551

vb script del old file

' Objective: To delete old files from a given folder and all subfolders below
' Created by: MAK' Created Date: June 21, 2005
' Usage: cscript deloldfiles.vbs c:\dba\log 3
' : It deletes files older than 3 days

Set objArgs = WScript.Arguments
FolderName =objArgs(0)
Days=objArgs(1)

set fso = createobject("scripting.filesystemobject")
set folders = fso.getfolder(FolderName)
datetoday = now()
newdate = dateadd("d", Days*-1, datetoday)
wscript.echo "Today:" & now()
wscript.echo "Started deleting files older than :" & newdate
wscript.echo "________________________________________________"
wscript.echo ""
recurse folders
wscript.echo ""
wscript.echo "Completed deleting files older than :" & newdate
wscript.echo "________________________________________________"
sub recurse( byref folders)
set subfolders = folders.subfolders
set files = folders.files
wscript.echo ""
wscript.echo "Deleting Files under the Folder:" & folders.path
wscript.echo "__________________________________________________________________________" for each file in files
if file.date
lastmodified < newdate then
wscript.echo "Deleting " & folders.path & "\" & file.name & " last modified: " &file.datelastmodified
on error resume next
file.delete
end if

next
for each folder in subfolders recurse folder next
set subfolders = nothing set files = nothing
end sub

Show Hidden Devices in Device Manager

บางครั้งเราต้องการ uninstall driver ใน windows xp แต่เราไม่เห็น device เพราะมันซ่อนเอาไว้ เราสามารถให้มันแสดงได้โดยการ แก้ registry
----------------------------------------------------
Registry Key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\EnvironmentData
Value Name: DEVMGR_SHOW_NONPRESENT_DEVICES
Type: REG_SZ [String Value] //
Value Data: [1 = Show Devices / 0 = Hide Devices]

----------------------------------------------------
หรือที่
CMD
set devmgr_show_nonpresent_devices=1

แล้วต้อง reboot เครื่องด้วย

start devmgmt.msc

ต่ออายุ terminal client ใน windows 2003

ใช้ 3 คำสั่ง ต่อไปนี้แก้ปัญหา license expire 120 วัน
ไม่จำเป็นต้อง restart server
ไม่จำเป็นต้องลบ file ที่ client
------------------------------------------------------------------------
net stop "Terminal Server Licensing"
echo y del %windir%\system32\lserver\*.*
net start "Terminal Server Licensing"
------------------------------------------------------------------------

Tips : อาจจะใส่ไว้ใน task schedule ของ windows ให้ run ทุกๆ 120 หรือ 90 วัน

Linux Remount Read only root file system

ถ้าคุณใช้ linux แล้วเกิดปัญหา / เป็น read-ony
ดูได้จาก mtab ด้วย command
cat /etc/mtab แล้วเจอ root เป็น read only
สามารถแก้ปัญหาดังกล่าวได้ด้วย command

#mount -w -o remount /

วันเสาร์ที่ 16 กุมภาพันธ์ พ.ศ. 2551

Basic Linux 3.5

kernel 2.2
basic linux สามารถ download ได้ที่ http://distro.ibiblio.org/pub/linux/distributions/baslinux/

Kernel 2.4 (upgrade ยากนิดหน่อย)
http://keesan.freeshell.org/bl/blfiles.htm