None
FreeBSD mount iso
Mount FreeBSD iso image (or any other iso, on freebsd machine).
mdconfig -a -t vnode -f /patg/to/FreeBSD-9.0-RELEASE-i386-disc1.iso -u 1 #mkdir -p /mnt/cdrom mount -t cd9660 /dev/md1 /mnt/cdrom/
To unmount
umount /mnt/cdrom/ mdconfig -d -u 1
Array dereferencing support in PHP 5.4.0
A new nice improvement in PHP 5.4 As you can see in the news list they added array dereferencing support. What this actually means?
If a method of your class returns an array, then to use a specific element you will need another variable.
Example:
class MyClass { public function giveMeArray() { return array('test'=>'myvalue'); } }
If you want to display ‘myvalue’, you should do something like
$myClass = new MyClass(); $result = $myClass->giveMeArray(); echo $result['test'];
In the new PHP version you can do just:
$myClass = new MyClass(); echo $myClass->giveMeArray()['test'];
SVN how to merge branch into trunk
After I messed up a svn repo because of a wrong merge I started to read svn book and how to properly merge a branch into trunk.
Let’s assume you have a branch called my-branch.
1. Go into branch folder (/var/www/my-branch)
To be sure you are in the branch folder just type svn info. You should see: URL: svn://svn.example.com/project/branches/my-branch
2. Commit or revert everything to have a clean copy and update: svn up
3. Bring the last changes from trunk into your branch
svn merge http://svn.example.com/project/trunk
see changes and test
svn status
4. If everything is fine, commit those changes into your branch
svn ci -m ‘last changes from trunk into branch’
If something went wrong you can revert with svn revert . -R
5. Go into trunk folder (you should also have a trunk clone)
6. Update your trunk copy:
svn up
7. Most important. Bring changes from BRANCH to TRUNK.
svn merge --reintegrate svn://svn.example.com/project/branches/my-branch
8.
svn st
to see changes and test
9. Finally, commit your branch changes to trunk
svn ci -m “Merge my-branch into trunk”
Now, you can delete the old branch:
svn delete svn://svn.example.com/project/branches/my-branch -m “Remove my-branch”
Batch remove from Mercurial repo
If you did something wrong and created a lot of files in a mercurial repo, you can delete all very quickly with this
hg st | grep '^?' | cut -d ' ' -f 2 | xargs rm
Be carefully to execute “hg add” for files you intend to keep otherwise you will lose those files forever.