If you have for example a development box eg: http://mysite.com/dev/
and you are storing all your code in svn via http://mysite.com/svn/
then you can create an svn post commit script to update /dev/ every time someone makes a change to the svn repo.
From a linux command prompt, do the following:
MyWmaFile.wma is the file you want to convert into an MP3 called MyMP3File.mp3
first rip the wma into a wav file like so:
$ mplayer -vo null -vc dummy -af resample=44100 -ao pcm:waveheader MyWmaFile.wma && lame -m s -V 3 audiodump.wav -o MyMP3File.mp3
doneskies.
Here's the process for when I forget next time:
Create new linux partitions to be used in the software raid array, use mdadm to set them up, wait for them to sync, then create the filesystem on the new md0
# fdisk /dev/hdX
# mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/hdX1 /dev/hdY1
# watch cat /proc/mdstat (takes 30 mins for 80GB)
# add ARRAY /dev/md0 devices=/dev/hdc1,/dev/hdd1 to /etc/mdadm/mdadm.conf
# reboot
# mkfs.ext3 /dev/md0
/dev/md0 is now ready to be used :)
Hello search engines.
Any Java Programmers on the Gold Coast please go and sign up to the Gold Coast Java group here:
http://groups.google.com/group/gcjug
from the group: "A community of Java developers based in and around The Gold Coast, Queensland. This is a very informal group at present, we may do some casual meetups - but the purpose of the groups is really for Collaboration, Networking and possible recruitment."
Found myself in a situation where I was editing and uploading some files through Dreamweaver on a windows box. The files were accessed via a mounted samba share on a debian server.
Didn't want dreamweaver to see all the .svn directories and files under them (so uploading a folder from dreamweaver would skip uploading the .svn stuff).
Thanks to Gabriel for the easy solution:
------------
complex solution:
On the samba server I set these options under the [file share] section:
hide unreadable = yes
hide unwriteable files = yes
and restarted samba.
Then make all the .svn folders unreadable by my samba user like this:
# cd /path/to/samba/share
# chown myusername: . -R
# for i in `find . -name .svn `; do echo "setting $i"; chown -R othername: $i; chmod o-rwx $i; done;
that way all the .svn folders will be owned by othername and not accessible by the samba user myusername, samba will hide this folder from the windows box...
now I can edit and upload files from dreamweaver whilst commiting svn changes through a terminal at the same time.
Forcing a redirect to "www." on a website using .htaccess and mod_rewrite is easy.
Create a .htaccess file with this in it:
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www.yourdomain.com$
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301]
If you need to combine this redirect with some other mod_rewrite rules, then try putting the redirect at the very end like so:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,QSA]
RewriteCond %{HTTP_HOST} !^www.yourdomain.com$
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301]
Going one step further you can redirect all requests except those for certain files like so:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,QSA]
RewriteCond %{HTTP_HOST} !^www.yourdomain.com$
RewriteCond %{REQUEST_FILENAME} !some_script.php
RewriteRule ^(.*)$ http://www.yourdomain.com/$1 [R=301]
That way requests to http://yourdomain.com/some_script.php will not be redirected to http://www.yourdomain.com/some_script.php but all other requests will.
Setup a new svn repo, and got the following error:
# svn checkout http://xx.xx.xx.xx/svn /var/www/myproject --non-interactive
# svn: PROPFIND request failed on '/svn'
# svn: PROPFIND of '/svn': 301 Moved Permanently (http://xx.xx.xx.xx/)
Make sure apache has read/write access to the repo, if that doesn't fix it, then move your svn repo out of the DocumentRoot and you should be set.
I installed suPHP on a plesk box, works great for all the client vhost websites, all their PHP scripts run with their respective user account privellages.
However, suPHP was enabled for every PHP script which ran under apache. This caused a few issues ...
Continue Reading »Here's a simple script that helps package up RPM's - designed for packaging up php code from a /var/www/html/your_project directory - can be easily modified to suite other needs.
(hmm - I hope stripslashes() hasn't played around with anything too much)
Continue Reading »I couldn't get the export working through Oracle enterprise manager ... so I did it through a shell.
oraclebox is a solaris box with oracle 10g installed
oraclebox# export ORACLE_HOME=/u01/app/oracle/oracle/product/10.2.0/db_1
(set this to ur own oracle home dir)
oraclebox# cd $ORACLE_HOME/bin
oraclebox# ./exp 'username/password@orcl
(follow the prompts - this will create a file called expdat.dmp - copy this
to the Oracle XE server)
xebox is a debian box with oracle xe edition installed
xebox# export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/
xebox# cd $ORACLE_HOME/bin
xebox# ./imp 'username/password@xe'
(follow prompts - enter full path to the expdat.dmp file you copied to this server)
The error on tty1:
[ 80.143123 ] device-mapper: table: 254:5: linear: dm-linear: Device lookup failed
[ 81.289517 ] device-mapper: table: 254:5: linear: dm-linear: Device lookup failed
etc...
Continue Reading »
Setting up syntax highlighting in Vim is pretty easy. For one off situations - type the following while in vim:
:syntax on
If you would like syntax highlighting to be on all the time put the following in your ~/.vimrc file:
syntax on
Some other useful .vimrc settings:
set background=dark
syntax on
set ai
"set ai" does auto-indentation in vim
Sometimes it is useful to give out htpassword protected access to certain areas of your web server (say if you are developing an app for someone and want to give them a preview). Here is a simple way to do it:
Continue Reading »Well after upgrading Ubuntu I started seeing
eth1:avah inet addr:169.254.6.235
when doing an `iwconfig`
It looks like Ubuntu is setting up a dummy IP as an alias to my wireless adapter so that boot times are improved.
Ever need to send a log file or something to an email address:
for text attachments:
mail -s subject email@address.com < /path/to/my/text.file
for binary attachments (images etc..)
mutt -s subject -a /path/to/image.jpg email@address.com < /dev/null
You can create a link as:
CREATE PUBLIC DATABASE LINK "OtherDB" CONNECT TO "UserName" IDENTIFIED by "Password" USING 'SID'
SELECT * FROM "OtherSchema"."TableName"@"OtherDB";
or
CREATE SYNONYM "otherTableName" FOR "OtherSchema"."TableName"@"OtherDB"
SELECT * FROM "otherTableName"
( it's easier to do this via the oracle enterprise manager http://192.168.X.X:1158/em Administration > Schema )
You need to establish the link as a user on the other instance that has read access to the tables you need to join. Then:
SELECT a.columns, ..., b.columns
FROM yourTable a INNER JOIN otherdb.otherTable ON a.column = b.column
WHERE ...
ORDER BY ...;
After
the link is establiched, you can treat it as one of your tables in the
selects, just append the link name to the front of the table name.
Apache2 needs to be running in pre-fork mode for certain things like persistant database connections to work correctly
# /usr/local/apache2/bin/httpd -V|grep MPM
Server MPM: Prefork
Distributing PHP code with RPM's
Continue Reading »One day I needed to create thumbnails of about 300 websites, this would usually take a very long time, so I wacked together a simple shell script which makes use of Firefox, Xvfb, and Imagemagick
The script creates a virtual X desktop, starts a Firefox instance, and then, using the openUrl command, proceeds to load each website and capture a screenshot one at a time.
If you cannot get Xvfb working, you should be able to run this with little modification on a spare linux desktop. I suggest you play with image magicks cropping tools to remove the firefox decal.
here is the original bash script: Continue Reading »Try:
dpkg --clear-avail
apt-get update
Otherwise try a reboot - this happened to me after a virtual server ran out of ram. Reboot fixed it.
Ran into a problem trying to use mod_rewrite in .htaccess on a Melbourne IT hosting account.
They seem to run PHP as CGI instead of an Apache module. Read the differences here: http://blog.dreamhosters.com/kbase/index.cgi?area=2933
Here's the rewrite script that worked in the end:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php [L,QSA]
The problem was a missing / before the index.php
# ssh -p 220 -L 8080:192.168.0.254:80 user@remote.host
woo!
Here's some simple bash shortcuts that make using a Linux shell so much easier...
Ctrl + R etc..
Here's a simple way to view and even interact with a linux user who logs into your machine
Using the `screen` tool we automatically connect the user upon login to a `screen` instance, which we can then join and control.
I believe there is a bsd tool that provides this feature out of the box?
in /etc/passwd put...
Ever wanted to provide different dns responses depending on where the request came from?
For example, a query for mywebsite.com coming from the local network 192.168.0.0/24 will respond with 192.168.0.254, however a query for mywebsite.com coming from the internet address 1.2.3.4 will respond with 4.3.2.1
Here's a simple way to do it using a single bind instance.
config coming soon
Synergy
http://synergy2.sourceforge.net/
my config examples coming soon
|
Collector Comics is THE place to buy, sell, and research comics online. Launching soon.
Launch »
Screenshot »
|
|
Webitor is a kick-ass easy to use, easy to extend, non-database driven Content Management System. Version 2 with reseller plan coming soon.
Launch »
Version 1 »
|
|
GC Lounge is my own pet social network and test bed for social related code. Made by locals for locals.
Launch »
|
|
GG has indexed over half a million recent Trade Mark applications. This revolutionary tool is extremely valuable for industry experts.
Launch »
|
|
GCWiFi is the hub for techies interested in joining a ad-hoc wireless mesh spread across the Gold Coast
Launch »
|
|
Web based financial client management system
Launch »
|
|
OS Commerce modules and template modification
Launch »
|
| View More Projects » | |