Here's a C# program to mirror all changes in one directory with another.
I build it to let me edit a PHP web project on my development PC and have it mirrored to my development server, without any action on my part.
Its all being hosted at Google Code, go on give it a try :)
This is a guide for setting up a mail server with a mysql backend for users and domains using Dovecot for the IMAP Server, Postfix for the MTA and SpamAssassin for preventing spam and all with SSL client-server encryption.
I'll also assume you have a MySQL server ready for use.
Here is one of the best paradoxes I've seen in a long time:
"At a desert oasis, A and B decide independently to murder C. A poisons C's canteen, and later B punches a hole in it. C dies of thirst. Who killed him?
A argues that C never drank the poison. B claims that he only deprived C of poisoned water. They're both right, but still C is dead. Who's guilty?"
[Via Futility Closet]
Hmm.. Which is better?
I would say software raid is better*, my reasons:
[*] Under most conditions, ie. without big budgets, mission critical servers etc...
See Also:
Stackoverflow Blog: Tuesday Outage: It's RAID-tastic!
Linux: Why software RAID?
I have a Creative Zen, its a very nice little mp3/video player, and while it plays xVid/DivX/WMV its a bit picky about what it will play.
So ive created this script to convert videos to a format it will play (320x240, xVid, with auto black bars to maintiain aspect ratio & 128KB ABR MP3 audio).
Its a Bash script using Mplayer / Mencoder.
Files
Here's a lambda function in use with the new extensions for a List object.
personnel.foreach(x => x.DoSomeCoolStuff());
Here is a nifty class to handle an angle. it will wrap around increments and decrements that exceed 360 or 0, e.g. adding 20 to 350 will give 10 not 370 and subtracting 10 from 5 will give 355 not -5.
Code sample:
Angle angle = 0;
double angle2 = angle + 5;
Console.WriteLine("a1:{0) a2:{1}",angle,angle2);
//Output: a1:0 a2:5
Output compression using Gzip and Deflate is a common feature of modern webservers. Webpages can be compressed by the server and then decompressed by the client seamlessly.
By default (at least on debian/ubuntu) Apache has a module installed and enabled called mod_deflate. While great, here is the default configuration:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml
</IfModule>
Now at a glance this is fine, But modern webpages consist of more than just html, we have CSS, Javascript, RSS and even JSON, all of which can benefit from compression but aren't enabled by default.
Here's a modified config file that will compress these files:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml application/javascript text/css application/rss+xml application/json
</IfModule>
This config is usually located at /etc/apache2/mods-enabled/deflate.conf.
With this done jQuery (minified) goes down from 54KB to just 16KB of data send to the client :D
Here's a quick way not so good way (see update) of getting multiple javascript functions to be called when the page has finished loading.
Add this to the pages Head section:
<script type="text/javascript" charset="utf-8">
var onload_functions = new Array();
window.onload = function() {
for (i in onload_functions) {
var onload_function = onload_functions[i];
onload_function();
}
}
</script>
And then where you need an onload event callback do this:
onload_functions.push(function() {alert('The page loaded...'););
Update:
As pointed out by phihag, this solution isn't great, instead try using phihag's code or use jquery and just $(document).ready(function{} {alert('The page loaded...');});.
One of the greatest frustrations for me when designing a website has been using css to layout a multi-column format (like this one).
I've found that it is important to understand the box model. more importantly knowing that when you set the width of a block element (ie div) it sets the width of the content. The padding, border and margin is wrapped arond it.
