Friday, October 3, 2008

How to map s3fs drive on an EC2 ubuntu server

Install the appropriate libraries

apt-get update 
apt-get -y install libfuse-dev libfuse2 libc6-dev make pkg-config gcc build-essential libcurl3-dev libxml2-dev libfuse-dev

Download the packages

mkdir –p /mnt/work/downloads  
cd /mnt/work/downloads  

Install fuse

cd /mnt/work  
tar xfz downloads/fuse-2.8.0-pre1.tar.gz   
cd /mnt/work/fuse-2.8.0-pre1/  
make install

Install s3fs

cd /mnt/work   
tar xfz downloads/s3fs-r177-source.tar.gz
cd /mnt/work/s3fs/   
make install

Link the fusermount to /usr/sbin (for rc.local purposes)

ln –s /usr/local/bin/fusermount /usr/bin/fusermount

Mounting your s3 folder

This assume that you have the folder /myfolder in your s3 account.

mkdir -p /mnt/s3buckets/myfolder 
s3fs -o allow_other myfolder /mnt/s3buckets/myfolder/ -o use_cache=/tmp/s3fs_cache -o accessKeyId=YOURACCESSKEYID -o secretAccessKey=YOURSECRETACCESSKEY
Note: If you trust your server and the users that has access to your /etc, you can create a file /etc/passwd-s3fs which contains just your Amazon ID and secret key separated by ":", e.g: YOURACCESSKEYID:YOURSECRETACCESSKEY). Next you can add the mount cmd into your rc.local file... everytime you boot you will see the mount s3 folder...

Tuesday, March 18, 2008

How to create a Linked Server to hitseft (Microsfoft Server 2005)

You can find good information here (

Under, Object Explorer of (Microsfoft SQL Server Management Studio) go to:
Server Objects - Linked Servers
Right click on Linked Servers and select - New Linked Server...

My situation is very simple, I have multiple server with 2 databases, some of the database are replicated to the other server. I have a store proc that need to be call the same way on both server, but one of my server host the replicated copy (read only) of my db so the sp need to write to the other one. That need to work the same way on both server

MYLINKSERVERNAME.myDBName.dbo.my_store_prod_name NULL, 'Tester', ' HELLO WORLD '

Server_A and Server_B both contain the link server name: MYLINKSERVERNAME, and both links, point to Server_A.

Tuesday, February 5, 2008

Join SQL Update


Don't know about you but I've wondered on occasion whether or not it's possible to do a join update in Oracle and SQL Server as I've seen done in mySQL. For those who've never seen an update join, here's one to illustrate:

Old school:
update invc_item
set feed_id =
(select max(feed_id)
from calls
where invc_item_id = invc_item.invc_item_id)
where feed_id = 0
and exists
(select *
from calls
where invc_item_id = invc_item.invc_item_id
and feed_id > 0)

As you can see in the example, this SQL re-queries calls twice - once for the update and once for the where.

Update join:
update i
set i.feed_id = c.feed_id
from invc_item i, calls c
where i.feed_id = 0
and c.invc_item_id = i.invc_item_id
and c.feed_id > 0

Much simpler, far more efficient, and once you get the hang of it - less prone to error when doing these sorts of updates.

I'm not sure whether or not you have to use the table aliases as I did. Haven't tested without. This is how it was illustrated in the documentation I found.

Now for the bad news... SQL Server (the toy wannabe database) supports it, Oracle does not.

Thanks for the help Scott...

Thursday, January 24, 2008

How to protect my PC, Free virus scan

Desktop support is not what I like to do, too many of my friend would like me to go clean up thier PC. No way I'm not going to be spending hours cleaning somebody else's PC. I usually answer to my friends; sorry I'm a mac/linux guy. We don't really get virus...

Anyway I saw an article today: How to take better care of your PC in '08

Here what you need to know:

Free options exist, such as AVG Anti-Virus Free Edition ( and Ad-Aware 2007 (, but many users choose more robust pay-for-use programs, like Sympatico Security Services ($6/month), Norton Anti-Virus 2008 (; $39.99), Windows Live OneCare (; $39.99) or McAfee VirusScan Plus(; $39.99).

and keep your windows up-to-date with all Microsoft patches.

I hope this help, and please don't ask me to fix your PC :-) Imagine if I was asking you to come pick up to 4 weeks of 2 dogs pup in my back yard when it's 8 F outside. (I'm having one of those day today, and it's only 7:30 AM :-(...)