So, I am in no way a cryptographer... I read Neal Stephenson's The Cryptonomicon, but that's about it. Plus, I don't really have to do much with password security in web apps... usually securing a directory with .htaccess is as much as I have to do. Sometimes I need to write my own session-based password system, due to some hosts not running Apache. Anyway, for these simple systems, the password is usually stored in plaintext... the system is in place really only to deter, not to prevent attacks. I may change my mind on this if I get screwed by it in the future, but for the present, it's good enough. However, when creating a system that allows users to make their own accounts, more care needs to be taken. Since people often use the same password in many different areas, obtaining a password in one place can lead to identity theft. So I whipped up this cute little salt generator. Remember, if you are using a salt, you should probably store it so you can validate passwords later. There may be better encryption methods in PHP, but I'm really just scratching the surface right now.
// Encrypt the password with Blowfish and a salt - 16 chars starting with $2$
$salt='$2$';
$salt_length=16;
// Chars to choose from to generate the salt
$chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890!@#$%^&*";
//Generate the salt string
while(strlen($salt)< $salt_length)
$salt.=$chars{mt_rand(0,strlen($chars)-1)};
$hashed_password=crypt($password, $salt);
So I just realized that Safari 2 doesn't allow text input tags to be styled. What the heck, eh? I was confused for a while, since I had been using the Safari 3 beta on Windows, and it worked there. Then I get the Mac and nothing works to style those stupid tags. With Apple's "oh yeah, standards, we got 'em haha suck it IE" attitude, I can't believe they would leave this in. Standardization of user interface elements aside, all the other browsers do this, so it's about darn time. My recourse is to say "Sorry!" to the Safari 2 folks. I simply can't do anything about how crappy forms will look to you.
So, I've had my Mac Pro for a while, and am finally starting to get used to it. For a while, though, it was super frustrating to work on; one of the hardest things about switching computing platforms is the minor inconsistencies. For example, in Windows Explorer, hitting 'return' will open a selected folder, and 'F2' will rename it. In the OS X Finder, 'Command-O' opens a folder, and 'return' will rename it. Mouse behavior is quite different as well, with OS X using a very non-intuitive mouse acceleration algorithm. I had just gotten used to 'Home' and 'End' moving my text-editor's cursor to the beginning and end of a line, but OS X's default behavior moves the cursor to the beginning/end of the document.
Fortunately for me, it's relatively easy to edit key mappings in OS X, which means that the functionality I'm used to has mostly returned. For the mouse issue, I had to install a Microsoft mouse driver, which conflicted with the mouse control panel option for a while.
On a somewhat related note, have I mentioned that the Mighty Mouse is horrible? It doesn't fit my hand at all, has a worthless "scroll wheel" nubbin, and flaky left/right-click support. Sadly, back when I was working at my old job, I had thought about buying one, even going so far as to make some low bids on eBay. I think this piece o' junk is going up there for some other sod. I do like the Mac keyboard, though (not the new, shallow version). The keys, while not clicky, have an appropriate amount of tactile feedback. The keyboard itself is much narrower than my Model M IBM keyboard, though, which took a bit of time to get used to as well.
All in all, I'm pretty happy about my purchase... a little bit bitter about getting the shaft in terms of RAM and HD space (1 GB/250 GB in a machine of this class? Ridiculous! Plus no Bluetooth or WiFi=superlame), but prices for that stuff will keep going down. I'm glad to be using a more versatile machine, albeit one that's a massive investment.
So, this probably doesn't apply to a lot of folks, but if you're trying to use tables for page layout (i.e. for HTML emails), you may notice that Firefox inserts blank space at the bottom of each image that you just can't get rid of. The cause is that the <img> tag has the "display: inline" property, which means that Firefox allows space for "descenders" (i.e. the parts of letters that go below the baseline; examples: jgpq). The solution in table layouts is to assign each image the "display: block" property. Alternately, you can use adjust the "vertical-align" property on the image. Here's a page with a more detailed look at the problem/solution.
Another thing I just wanted to mention for my own reference was short conditionals in PHP. Example: