Reading about how to create a RAM disk on Linux:
# mount -o size=200M -t tmpfs none /mnt/tmpfs
Reading about how to create a RAM disk on Linux:
# mount -o size=200M -t tmpfs none /mnt/tmpfs
Wow, this was complicated!
Make sure PHP, Xdebug, etc. are installed:
# apt-get install php php5-xdebug php5-curl php5-mysql php5-gd
Install Eclipse:
# apt-get install eclipse
To install PHP Developer Tools in Eclipse: Open Eclipse, click Help -> Install New Software…
Work with: http://download.eclipse.org/tools/pdt/updates/release
Select PHP Development Tools / PHP Development Tools (PDT) and install.
Create a new PHP project in Eclipse.
Download PHPUnit into your project folder, e.g.:
$ cd ~/workspace/new-project $ wget https://phar.phpunit.de/phpunit.phar $ chmod +x phpunit.phar $ cp phpunit.phar /usr/local/bin/phpunit
In your Eclipse PHP project right-click on your project and select “Include Path” -> “Configure Include Path”.
Click “Libraries” -> “Add External PHARs” then add “phpunit.phar” (in your project’s workspace).
In Eclipse click “Run” -> “Debug Configurations”. Click “PHP CLI Application” and then “New”. Enter the PHP Script name as “PHPUnit” with Project default PHP: PHP CLI (Xdebug 5.4.4 CLI). Set the PHP file as “/project-name/phpunit.phar”.
Edit your php.ini file, e.g.:
# vim /etc/php5/cli/php.ini
And make sure to specify an xdebug configuration (append to end of file is OK):
[xdebug] zend_extension=/usr/lib/php5/20100525/xdebug.so xdebug.remote_enable=On ;xdebug.remote_host="localhost" xdebug.remote_host=localhost ;xdebug.remote_port=9999 ;xdebug.remote_port=9000 xdebug.remote_port=9999 xdebug.remote_handler="dbgp" xdebug.profiler_enable=1 xdebug.profiler_output_dir="/var/tmp" xdebug.default_enable = on xdebug.remote_autostart=on xdebug.remote_mode = "req" xdebug.remote_connect_back = on xdebug.remove_log = /tmp/xdebug.log
Make sure you have a phpunit.xml file next to phpunit.phar in your workspace, e.g.:
<?xml version="1.0" encoding="UTF-8"?> <phpunit backupGlobals="false" backupStaticAttributes="false" syntaxCheck="false"> <testsuites> <testsuite name="Tests"> <directory suffix="Test.php">test</directory> </testsuite> </testsuites> </phpunit>
Make sure there is one test in your test directory, e.g. /project-name/test/MyTest.php
<?php class MyTest extends PHPUnit_Framework_TestCase { public function setUp() { //require_once( __DIR__ . '/../src/example.php' ); } public function testExample() { $this->assertSame( '1', '1' ); } }
Double-click in the sidebar next to $this->assertSame to put a breakpoint there.
Then in Eclipse on the toolbar at the top is a little ‘bug’ icon, click ‘down’ next to that and debug ‘PHPUnit’.
Your unit tests should run in PHPUnit and break into the PHP debugger in Eclipse.
Did that work for you? Let me know!
I’m having a problem whereby my KDE session is “locking up” periodically for 5 or 10 minutes at a time. I checked /var/log/syslog and dmesg and it *seems* as though the high-priority audio threads are staving other threads, so I figure I’ll try to disable sound and see if my system continues to lock up. To disable sound I used:
root@mercy:/home/jj5# alsa force-unload Unloading ALSA sound driver modules: snd-ens1371 snd-ac97-codec snd-seq-midi snd-seq-midi-event snd-rawmidi snd-pcm snd-page-alloc snd-seq snd-seq-device snd-timer (failed: modules still loaded: snd-ens1371 snd-ac97-codec snd-rawmidi snd-pcm snd-page-alloc snd-seq-device snd-timer).
Today I needed to convert a UTF-16 file to UTF-8 and I did it with iconv:
iconv -f UTF-16 -t UTF-8 /path/to/input > /path/to/output
Learned about the chage command today. Can be used to set the expiry of a Linux account. There’s some more information about disabling user accounts.
Reading about Access Keys. Also a good article on Wikipedia.
For Firefox on Linux use: Alt + Shift.
I’ve been getting this error from time to time on my Ubuntu server:
INFO: task dpkg:27497 blocked for more than 120 seconds.
I did some research and it turns out this is related to a bug in the dpkg system, and apparently it’s been fixed already (but not rolled out as part of Ubuntu yet).
Look forward to the fixed being rolled out, because the implication of the bug at the moment is that my system can hang for long periods of time while I’m installing software with apt-get.
Read about the security considerations for find. Find is a *nix tool for searching though directories for files and filtering them to build lists or run commands.
While I’m here I might as well show you my latest find command, I think it’s a beauty. :)
sudo find . \ \( \( \( \! -user jj5 \) -or \( \! -group jj5 \) \) \ -execdir chown jj5:jj5 '{}' \+ \) , \ \( \( -type d \( \! -perm -u+rwx \) \) \ -execdir chmod u+rwx '{}' \+ \) , \ \( \( -type f \( \! -perm -u+rw \) \) \ -execdir chmod u+rw '{}' \+ \)
I was wondering how I could disable the console screen saver on my server (so I can watch progress of stuff in the background) and I found this article, How do I permanently disable Linux’s console screen saver, system-wide?
One of the solutions suggests installing the console-tools package, but there is another solution that looks like it doesn’t need any package installed, so I’m gonna give that a try first. The solution is to edit /etc/kbd/config and specify:
BLANK_TIME=0 POWERDOWN_TIME=0
I’ve configured that now but won’t be able to test for a while as I can’t reboot my server just at the moment.
While I was at it I figured I’d have num lock enabled by default too:
LEDS=+num
Update: I was finally able to reboot my system and test that config, and: it didn’t work.
I tried to apt-get install console-tools, but that make things even worse! I recommend that you don’t try and install console-tools on Ubuntu Lucid, if my experience is anything to go by. Lucky I could still SSH to my server, because there was no console!
In the end I settled on a solution I found over here, being to add the following to /etc/rc.local:
setterm -blank 0 -powersave off -powerdown 0
To disable a user login:
$ sudo passwd -l username
To unlock a disabled user login:
$ sudo passwd -u username
To specify all the secondary groups a user should be in (if they’re already in a group not in this list they will be removed from it) you use:
$ sudo usermod -G grp_a,grp_b username
To append to the list of secondary groups:
$ sudo usermod -a -G grp_c username
To show what users are in a group:
$ grep ^group: /etc/group
E.g. to show which users are in the sudo group:
$ grep ^sudo: /etc/group
You also need to check primary groups by grepping for the gid in the passwd file. For instance the gid for the sudo group is 27, so to see who’s in sudo you also have to:
$ grep 27 /etc/passwd
Of course you should take all of the above with a grain of salt because there are a thousand caveats.