Month: May 2013

[QA] How to start svn server (svnserve) on startup as daemon in MacOS

save org.apache.svnserve.plist to /System/Library/LaunchDaemons

<plist version="1.0">
   <dict>
      <key>Disabled</key>
      <true/>
      <key>Label</key>
      <string>org.apache.svnserve</string>
      <key>ProgramArguments</key>
      <array>
         <string>/usr/bin/svnserve</string>
         <string>--inetd</string>
         <string>--root=/path_to_your_repository</string>
      </array>
      <key>Sockets</key>
      <dict>
         <key>Listeners</key>
         <array>
            <dict>
               <key>SockServiceName</key>
               <string>svn</string>
               <key>Bonjour</key>
               <true/>
            </dict>
         </array>
      </dict>
      <key>UserName</key>
      <string>_www</string>
      <key>inetdCompatibility</key>
      <dict>
         <key>Wait</key>
         <false/>
      </dict>
   </dict>
</plist>
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.svnserve.plist
sudo launchctl start org.apache.svnserve
Tags : ,

[QA] How to backup svn server

svnadmin dump /path/repositoryfolder > 2013-05-14-SVNBackup.svn_dump
svnadmin create /path/repositoryname
svnadmin load /path/repositoryfolder < 2013-05-14-SVNBackup.svn_dump
Tags :

[QA] How to change fan speed in Mac programmatically

install smcFanControl

sudo ./smc -k F0Mx -w 2710
(0 = number zero, not o)
3e80 = 4000rpm
3680 = 3500rpm
2EE0 = 3000rpm
2710 = 2500rpm
1F40 = 2000rpm

Tags :

[QA] How to list all users and groups in macos

$ dscl . list /users
$ dscl . list /groups
$ dscl . readall /users
$ dscl . readall /groups
$ dscl -plist . readall /users
$ dscl -plist . readall /groups
Tags :

[QA] How to install svn in mac os 10.8.2

1. download from xCode

2. login to https://developer.apple.com/downloads/index.action and download Command Line Tools

Tags : ,

[WordPress] file and directory permission setting

never use 777  666, it can be hacked to alter or write files

  • Root directory                     0755
  • wp-admin                            0755
  • wp-content                          0755
  • wp-includes                        0755
  • .htaccess                            0640
  • readme.html                      0400
  • wp-config.php                   0644
  • wp-admin/index.php        0644
  • wp-admin/.htaccess         0640
find /path/to/wordpress/dir -type d -print0 | xargs -0 chmod 755
find /path/to/wordpress/dir -type f -print0 | xargs -0 chmod 644
find /path/to/wordpress/dir -name ".htaccess" -print0 | xargs -0 chmod 640
Tags :

[QA] How to check java class built version

$ file ~/bin/classes/MyClass.class
 /home/abc/bin/classes/MyClass.class: compiled Java class data, version 50.0
  • 46 = Java 1.2
  • 47 = Java 1.3
  • 48 = Java 1.4
  • 49 = Java 5
  • 50 = Java 6
  • 51 = Java 7
Tags :

[JAVA] Runtime.getRuntime().addShutdownHook

Before jvm finishs, it will run the thread added to Runtime.getRuntime().addShutdownHook

good for watch dog

public void attachWatchDog() {
   Runtime.getRuntime().addShutdownHook(new Thread() {
      public void run() {
         System.out.println("your last chance before program terminated");
      }
    });
}
Tags :