Add Site Meter

Wiki Page

add to  /usr/local/lib/python2.7/dist-packages/MoinMoin/config/multiconfig.py

 

('page_credits',
 [
 '<a href="http://moinmo.in/" title="This site uses the MoinMoin Wiki software.">MoinMoin Powered</a>',
 '<a href="http://moinmo.in/Python" title="MoinMoin is written in Python.">Python Powered</a>',
 '<a href="http://moinmo.in/GPL" title="MoinMoin is GPL licensed.">GPL licensed</a>',
 '<a href="http://validator.w3.org/check?uri=referer" title="Click here to validate this page.">Valid HTML 4.01</a>',
 '<script type="text/javascript" src="http://sm2.sitemeter.com/js/counter.js?site=sm2howtohomelinux"></script><noscript><a href="http://sm2.sitemeter.com/stats.asp?site=sm2howtohomelinux" target="_top"><img src="http://sm2.sitemeter.com/meter.asp?site=sm2howtohomelinux" alt="Site Meter" border="0"/></a></noscript> ',
 ],

 

Punbb

add to /var/www/punbb/include/template/main.tpl

<pun_announcement>
 <pun_main>
 <pun_footer>
 <div align="right">
 <script type="text/javascript" src="http://sm2.sitemeter.com/js/counter.js?site=sm2howtohomelinux"></script><noscript><a href="http://sm2.sitemeter.com/stats.asp?site=sm2howtohomelinux" target="_top"><img src="http://sm2.sitemeter.com/meter.asp?site=sm2howtohomelinux" alt="Site Meter" border="0"/></a></noscript>
 </div>

screen

터미널로 작업하다 터미널의 작업을 계속 요지 하면서 로그 아웃 하려면 screen를 사용한다.

screen을 실행한 후 쉘에서 작업을 하다가 ctrl-a-d를 누르면 detatch되고 이 상태에서 로그아웃해도 서버에서 작업이 계속 실행 된다.

원래 화면으로 돌아가려면 screen -r 실행한다.

ctrl-c handler

리눅스 콘솔 프로그램에서 ctrl-c 를 눌러 프로그램을 종료하기 전에 처리해야 할일이 있다면 signal함수를 사용하여 처리 함수를 등록하면 된다.

#include <stdio.h>
#include <signal.h>

bool forever = true;

void sighandler(int sig)
{
    forever = false;
}

int main(int argc, char *argv[])
{
        signal(SIGABRT, &sighandler);
	signal(SIGTERM, &sighandler);
	signal(SIGINT, &sighandler);

	while(forever)
	{
	}
} 


더 자세한 내용은 여기에
http://www.cplusplus.com/forum/beginner/1501/

Address Already in Use 에러

네트워크 프로그램에서 포트를 제대로 닫지 않은 경우, 다시 프로그램을 시작 하면 다음과 같은 에러가 발생하며 프로그램이 실행되지 않는다.

Error on binding: Address already in use

이런 경우  다음을 추가 하면 해결 된다.

int tr=1;

// kill "Address already in use" error message
if (setsockopt(listener,SOL_SOCKET,SO_REUSEADDR,&tr,sizeof(int)) == -1) {
    perror("setsockopt");
    exit(1);
}

Linux USB Gadget Driver

Embedded linux 보드에 USB는 있는데 이더넷이 없는 경우 USB gadget driver를 사용하면 usb를 이더넷으로 사용할 수 있다.

다음은 Linux USB gadget드라이버를 설치하여 USB를 통해 Window와 네트워크 연결하는 방법에 대한 글이다.

http://howto.homelinux.com/wiki/Linux4SAM#USBGadgetDriver.28forusbnetworkdriver.29

보드와 네트워크가 연결되면 ssh client 프로그램을 사용하여 보드에 접속 할 수 있고 파일 전송이 가능하다.

Hot to Install LAMP on Ubuntu GNOME Desktop to run Drupal (at Ubuntu)

1. Install Apache2

sudo apt-get install apache2
Install Apache Modules

sudo apt-get install libapache2-mod-auth-mysql
Apache 2 configuration of clean URLs on Debian
a2enmod rewrite

2. Install Php5
sudo apt-get install php5-common php5 libapache2-mod-php5
sudo apt-get install php5-cgi
sudo apt-get install php5-mysql
Install GD surport php5-gd

sudo apt-get install php5-gd

Restart Apache
sudo /etc/init.d/apache2 restart
3. Install MySQL
sudo apt-get install mysql-server mysql-client

Restart MySQL

sudo /etc/init.d/mysql restart
Configuration MySQL

You can edit the /etc/mysql/my.cnf file to configure the basic settings — log file, port number, etc. Refer to /etc/mysql/my.cnf file for more details.
To create a symbolic link

ln -s /path/to/real/file /path/to/non-existant/file
Install SSH Server

sudo apt-get install ssh

출처:http://www.thanhsiang.org/faqing/node/51

Folder의 크기를 알아내는 명령

[kscho@devel0 api]$ du –help
사용법: du [<옵션>]… [<파일>]…
Summarize disk usage of each FILE, recursively for directories.

긴 옵션에서 꼭 필요한 인수는 짧은 옵션에도 꼭 필요합니다.
  -a, –all             write counts for all files, not just directories
  -B, –block-size=SIZE use SIZE-byte blocks
  -b, –bytes           print size in bytes
  -c, –total           produce a grand total
  -D, –dereference-args  dereference FILEs that are symbolic links
  -h, –human-readable  print sizes in human readable format (e.g., 1K 234M 2G)
  -H, –si              likewise, but use powers of 1000 not 1024
  -k                    like –block-size=1K
  -l, –count-links     count sizes many times if hard linked
  -L, –dereference     dereference all symbolic links
  -S, –separate-dirs   do not include size of subdirectories
  -s, –summarize       display only a total for each argument
  -x, –one-file-system  skip directories on different filesystems
  -X FILE, –exclude-from=FILE  Exclude files that match any pattern in FILE.
      –exclude=PATTERN Exclude files that match PATTERN.
      –max-depth=N     print the total for a directory (or file, with –all)
                          only if it is N or fewer levels below the command
                          line argument;  –max-depth=0 is the same as
                          –summarize
      –help     이 도움말을 표시하고 끝냅니다
      –version  버전 정보를 출력하고 끝냅니다

SIZE may be (or may be an integer optionally followed by) one of following:
kB 1000, K 1024, MB 1,000,000, M 1,048,576, and so on for G, T, P, E, Z, Y.

[kscho@devel0 workspace]$ du -hs temp/
14M     temp
[kscho@devel0 workspace]$