Here are the slides from my talk at the PHP meetup on 7.13.2010.
Category Archives: Programming
US Zip Codes and States
So I decided recently to work on getting a list of zip codes for the United States, in case I needed them in the future. I thought that it might be useful. I already had a list of US States, but I added a State FIPS code to correspond to the FIPS code in the Zip Code table.
I saved both files as ODF, CSV and SQL. You can download them here.
US Zip Codes (rar)
US States (rar)
The SQL files will let you import the information into your database, so you can build awesome web applications! I don’t think the zip code table is a complete list of zip codes, but it is the best I have for now. If you have anything that is more current, please let me know.
Reminder:
Only approved sites can link directly to the files. Please link to this page instead.
jQuery and CodeIgniter Chat
I adapted a Javascript & AJAX tutorial off of sitepoint to work with CodeIgniter. It uses jQuery to the handiwork. It is a simple AJAX chat script, not the most advanced thing in the world. Hopefully it will get better in the future.
Here is it in action:
Download jQuery Chat
REQUIREMENTS
- You have Downloaded and Installed codeigniter.
- You may want to check for a new version of jQuery.The version of jQuery that is included is 1.2.1. You can find the current version of jQuery here.
- The root folder is where codeigniter is installed.
- You are using MySQL.
INSTRUCTIONS
- Open /system/application/config/autoload.php
Verify that you are autoloading the database library. You should see ‘database’ listed in the $autoload['libraries'] array. - Open /system/application/config/database.php
Verify that you have the correct information for your database. - Upload /system/application/controllers/chat.php
to the corresponding folder on your server. - Upload /system/application/views/chatty.php
to the corresponding folder on your server. - Upload /public/js/jquery.js
to the corresponding folder on your server. - Upload /public/images/blueloading.gif
to the corresponding folder on your server. - Run the sql.sql file on your server using a tool like phpMyAdmin.
- Open a web browser and goto http://yourdomain.com/chat or http://yourdomain.com/index.php/chat if you have not configured your htaccess file.
Diggable WordPress Plugin
Diggable is a plugin for WordPress that adds Digg This buttons to websites. This will make it easier for your website visitors to submit content while it also allows them to see the Digg count for content that has already been submitted.
Features
General Features
- Admin Menu with options for button placement and customization
- No template modification, so you aren’t required to have any programming knowledge
- Buttons placed at the end of the content post and only visible if you load the page for a particular post
- There are options to display the buttons on pages and posts and on the front page of the website
- You can also select between the compact and normal version of the button. Currently the display options are basic but will be expanded soon.
Download
Support
The Sociable and Gregarious code helped a lot with development, so thanks goes out to Peter Harkins. Let me know what you think.
Setting Passwords that Expire in Linux
The /etc/login.defs file controls the parameters we are interested in changing inorder to enable or disable passwords that expire in Linux. It contains a number of other configuration setting for user accounts on your machine. The following are the ones that we are interested in.
- PASS_MAX_DAYS: Maximum number of days a password may be used. It controls how often users must change their passwords. Any passwords older than this will force the user to change their password the next time they login. To disable set to 99999.
- PASS_MIN_DAYS: Minimum number of days allowed between password changes.This prevents people from changing their password 5 times in one day. To disable set to 0.
- PASS_MIN_LEN: Minimum acceptable password length. No short passwords will be accepted. 8 characters is a recommended length.
- PASS_WARN_AGE: Number of days warning given before a password expires.
open the file /etc/login.defs using your favorite text editor.
# vi /etc/login.defs
edit the file (sample):
PASS_MAX_DAYS 90
PASS_MIN_DAYS 0
PASS_MIN_LEN 8
PASS_WARN_AGE 7
Save the file.
AACS encryption cracked, almost
A hacker posted the source code and a video of new software called BackupHDDVD that he developed that ‘supposedly’ allows people to backup HD-DVD.
Source: Electronista, Doom9
What really happened is that the method that Cyberlink uses to decrypt AACS was semi-compromised. Apparently this method won’t work for long because the key that is used to decrypt the content can be revoked with AACS. This was something that was not possible with CSS encryption.
Source: Chris Lanier, Arstechnica
Microsoft an Innovator, Yea Right
Slashdot | Is Microsoft An Innovator? – The Winer-Scoble Debate
Winer writes, ‘Microsoft isn’t an innovator, and never was. They are always playing catch-up, by design. That’s their M.O. They describe their development approach as “chasing tail lights.” They aren’t interested in markets until they’re worth billions, so they let others develop the markets, and have been content to catch-up.’
They are playing catchup to Google and Apple. Scoble lists 3 things that are not really innovative, like ClearType that was copied from Apple, Error messages in IE (Invent a better browser… wtf!) and Office 2007 (Open Office is free! I could care less about using the $600 Office).
If they are seriously to be considered as a truly innovative company they would have invented NEW things like Firefox or YouTube or Del.icio.us or Google Reader or Google Calendar. Either open source everything and charge companies for support or stick to video games!
CSS Based Forums
Smashing magazine gathered examples of styling forms using CSS. There are a couple of ones listed that actually look pretty nice. I wouldn’t mind using them on my projects in the future.
Amazon Affiliate Link Generator
I made my own Amazon Affiliate Link Generator using PHP. I think it is the best generator out there because it so simple.
You must know what the ASIN of the item is. You also need to have an Amazon Associate ID, which you can get from the Amazon Affiliate website. On their website they offer a more advanced Link builder, which is great, but you have sign in and fill out a more complicated form .
Here is an example link using my Associate ID. I have some ideas for possible future development on a similar tool.
