Netbean Fonts & Colors Profile – Oblivion Revival

Posted: June 7th, 2010 | Author: | Filed under: Linux | 34 Comments »

*update 2011-02-10
A IntelliJ/PhpStorm port of this is released here

*update 2010-08-27
Updated the color per Conrad’s request

Made this based on the Oblivion color scheme on gEdit, it colors PHP/CSS/Javascript/HTML/etc in Netbeans, should work in all Netbean 6 versions.

PHP

HTML

JavaScript

CSS

Download: oblivion_revival
Use the Import function in options to import this color scheme.
Tested under Netbeans 6.9. Remember to choose font & color in your options to enable this.


Ubuntu Start

Posted: May 19th, 2010 | Author: | Filed under: Linux | Tags: | No Comments »

https://launchpad.net/ubuntustart


Advanced SVN – Give SVN a web interface

Posted: May 3rd, 2010 | Author: | Filed under: Linux | 1 Comment »

Install required applications

To do this we will need subversion, libapache2-svn, and of course LAMP stack lamp-server.

# Install lamp-server
sudo apt-get install lamp-server^

# Optional: phpmyadmin and mods for apache
sudo apt-get install libapache2-mod-auth-mysql phpmyadmin
sudo a2enmod vhost_alias rewrite

# Install subversion
sudo apt-get install subversion subversion-tools

# Install libapache2-svn
sudo apt-get install libapache2-svn

Now some more preparation to do.

# SSL
sudo a2enmod ssl

# Regenerate self-signed ssl key if you want
sudo make-ssl-cert generate-default-snakeoil --force-overwrite

Users, folders and groups

Next step we need to add svn usergroups, but not before we fix show all users.

Launch gconf-editor, check “showall” in /apps/gnome-system-tools/users.

Then run Users and Groups in System -> Administration. In Manage Groups, click Add. Name the new group subversion, add yourself and www-data to the member. Log out and log in to activate this.

*Note: all your team members need to be added into subversion group.

The repository

Now, time to create the repository.

sudo mkdir /home/svn
sudo mkdir /home/svn/NEWPROJECTNAME
sudo svnadmin create /home/svn/NEWPROJECTNAME
sudo chown -R www-data:subversion /home/svn/NEWPROJECTNAME
sudo chmod -R 765 /home/svn/NEWPROJECTNAME

# If files under NEWPROJECTNAME/ don't have all group access repeat the previous command again.

Now time to tell apache to set up the access to this repository:

# Add the following content to /etc/apache2/mods-available/dav_svn.conf to make all your repository available. Or add them to each website in /etc/apache2/sites-available

<Location /svn>
 DAV svn
 SVNParentPath /home/svn
 SVNListParentPath On
 AuthType Basic
 AuthName "Subversion Repository"
 AuthUserFile /etc/apache2/dav_svn.passwd
 <LimitExcept GET PROPFIND OPTIONS REPORT>
 Require valid-user
 </LimitExcept>
</Location>

# Restart apache2 after adding the content above
sudo /etc/init.d/apache2 restart

Password protection

# Now, creating the password file.
sudo htpasswd -c /etc/apache2/dav_svn.passwd SVNUSERNAME

# To add more users:
sudo htpasswd /etc/apache2/dav_svn.passwd ANOTHERUSERNAME

# Then you can access to your repository with:
svn co https://hostname/svn/PROJECTNAME PROJECTNAME --username SVNUSERNAME

How to edit grub2 boot order in Lucid Lynx

Posted: May 3rd, 2010 | Author: | Filed under: Linux | No Comments »

As everyone knows the new Ubuntu Lucid Lynx is using Grub2 instead Grub1, the setting up process has changed quite a bit.

Now if you have various boot entries and want to add, remove or re-order the boot list, you won’t find /etc/grub/menu.lst. Instead the info is stored in /boot/grub/grub.cfg. But wait, you are not supposed to edit this grub.cfg. Instead you need to go to /etc/grub.d/ folder…

In /etc/grub.d/ folder you will find a list of executables like:

  • 00_header
  • 05_debian_theme
  • 10_linux
  • 20_memory_test
  • 30_os-prober
  • 40_custom

And your boot list will be order by the numbers. In fact, 10_linux gives you the 2 lines of linux (normal and recovery mode), 20_memory_test gives you 2 lines of memory test, 30_os-probers will list whatever other systems you have on your harddisk, and 40_custom is the extra bits you can add/remove.

So, if you want to move your other OS (for example, Windows) to first, then Ubuntu, and remove memory test from the list, you delete file 20_memory_test, and rename the rest files to like this:

  • 00_header
  • 05_debian_theme
  • 10_os-prober
  • 20_linux
  • 30_custom

Now all you need to do is sudo update-grub which update your /boot/grub/grub.cfg and boot list accordingly.


xorg.conf for ATI

Posted: May 12th, 2009 | Author: | Filed under: Linux | No Comments »

This is for ATI Fire GL 5700, but most of them should be fine for any ATI card. In Ubuntu Jaunty this card scores 5000fps in glxgears -info.

Section "ServerLayout"
        Identifier     "aticonfig Layout"
        Screen      0  "aticonfig-Screen[0]-0" 0 0
        Option      "AIGLX" "on"
EndSection

Section "Files"
EndSection

Section "Module"
        Load  "glx"
EndSection

Section "Monitor"
        Identifier   "aticonfig-Monitor[0]-0"
        Option      "VendorName" "ATI Proprietary Driver"
        Option      "ModelName" "Generic Autodetecting Monitor"
        Option      "DPMS" "true"
EndSection

Section "Device"
        Identifier  "aticonfig-Device[0]-0"
        Driver      "fglrx"
        Option      "XAANoOffscreenPixmaps" "on"
        Option      "TexturedVideo" "on"
        Option      "VideoOverlay" "off"
        Option      "OpenGLOverlay" "off"
        Option      "Textured2D" "on"
        Option      "UseFastTLS" "1"
        Option      "BackingStore" "on"
        BusID       "PCI:1:0:0"
EndSection

Section "Screen"
        Identifier "aticonfig-Screen[0]-0"
        Device     "aticonfig-Device[0]-0"
        Monitor    "aticonfig-Monitor[0]-0"
        DefaultDepth     24
        SubSection "Display"
                Viewport   0 0
                Depth     24
        EndSubSection
EndSection

Section "DRI"
        Group        "Video"
        Mode         0666
EndSection

Section "Extensions"
        Option      "RENDER" "Enable"
        Option      "DAMAGE" "Enable"
        Option      "Composite" "Enable"
EndSection

Config Ubuntu/Linux

Posted: May 10th, 2009 | Author: | Filed under: Linux | No Comments »
# fix apache2 "Could not reliably determine the server's fully qualified domain name", add the following to /etc/apache2/httpd.conf
ServerName localhost

# open fonts folder
gksu nautilus /usr/share/fonts/truetype

# rebuild font cache
sudo fc-cache -f -v

# about swap

https://help.ubuntu.com/community/SwapFaq

sudo dd if=/dev/zero of=/mnt/swap bs=1M count=8000 (twice of memory)
sudo mkswap /mnt/swap
sudo swapon /mnt/swap
gksudo gedit /etc/fstab
/mnt/swap none swap sw 0 0
gksudo gedit /etc/sysctl.conf
vm.swappiness=10

# about mount

https://help.ubuntu.com/community/MountWindowsSharesPermanently

SVN For Dummies

Posted: April 24th, 2009 | Author: | Filed under: Linux | No Comments »

# First install SVN server (e.g. svnserve) and client (svn)

# Set up auto propset
vim /etc/subversion/config

# Set the following config
enable-auto-props = yes
*.png = svn:mime-type=image/png
*.gif = svn:mime-type=image/gif
*.jpg = svn:mime-type=image/jpeg
*.ini = svn:keywords=Date Revision Author HeadURL Id;svn:eol-style=native
*.html = svn:keywords=Date Revision Author HeadURL Id;svn:eol-style=native
*.phtml = svn:keywords=Date Revision Author HeadURL Id;svn:eol-style=native
*.php = svn:keywords=Date Revision Author HeadURL Id;svn:eol-style=native
*.js = svn:keywords=Date Revision Author HeadURL Id;svn:eol-style=native
*.css = svn:keywords=Date Revision Author HeadURL Id;svn:eol-style=native

# Create repository
svnadmin /var/svn/repos

# Build the project repository
svn import ~/project file:///var/svn/repos/project -m "Build"

# Start svnserve as daemon
svnserve -d

# Check out
svn checkout file:///var/svn/repos/project ~/working_copy

# Set ID keyword to files
svn propset svn:keywords "Id" *.php
svn propset svn:keywords "Id" *.js
svn propset svn:keywords "Id" *.gif
svn propset svn:keywords "Id" *.jpg
svn propset svn:keywords "Id" *.png
svn propset svn:keywords "Id" *.phtml
svn propset svn:keywords "Id" *.html
svn propset svn:keywords "Id" *.css
svn propset svn:keywords "Id" *.ini

# Or, recursively
find ./ -name '*.phtml' -print0 | xargs -0 svn propset svn:keywords Id

# Next time when you commit, $Id:$ will be updated
svn ci -m "commit"

# Update
svn up

# Check file state
svn st

# Add new files to svn
svn add ~/working_copy/new.php

# Delete file from svn
svn delete ~/working_copy/new.php

# Move/rename file in svn
svn mv ~/working_copy/from.php ~/working_copy/to.php

Bash: a few bash commands

Posted: April 21st, 2009 | Author: | Filed under: Linux | No Comments »
### Find all php files from the current folder down with 'LOOKINGFOR' content ###
find . -name '*.php' -print0 | xargs -0 grep 'LOOKINGFOR'

### Database backup and import ###
mysqldump -u ACCOUNT -pPASSWORD --databases DATABASE1 DATABASE2 DATABASE3 --complete-insert --extended-insert=false > FILE.sql
mysql -u ACCOUNT -pPASSWORD DATABASENAME < FILE.sql

### Checking a log file content live ##
tail -f /var/log/httpd/error_log

### Tar and untar ###
tar -cvzf FILENAME.tgz FOLDERNAME
tar -xvzf FILENAME.tgz

### Delete files that name matches 'MATCHPATTERN' ###
find . -name 'MATCHPATTERN' -exec rm -f '{}' ;

### SCP ###
scp LOCALFILENAME USERNAME@REMOTEHOST:/REMOTEFOLDER/FILENAME