Category Archives: Web Development

Entrecard – Introducing Stores

Entrecard has announced it’s addition of the ‘Store’ module which uses EC credits as currency. Currently, Entrecard is the only seller, offering a few things to promote your blog faster but they are planning on giving users seller status in the future. If I were to have a store it would benefit both Entrecard any myself as I would offer not only adspace on my blog but quality reviews and business card redesigns.

A rough idea of what I would sell:

- 20 Card Redesigns at 400 Credits a pop
- Quality reviews at 500 credits a pop (a note about this, by quality, I mean in my writing. If your site sucks, I’ll say so. I’m not going to help promote internet garbage.)
- Ad space on my blog, 2 weeks for 2500 credits / 1 month for 4000
- T-shirts with on line creative says fresh out a book of ideas I’ve been compiling for a few months… the price of these is undetermined at this moment.

If you aren’t familiar with entrecard, check it out below.

Entrecard

Daily database backups on dreamhost

To do daily database backups, I use cron jobs. If you aren’t familiar with cron jobs, think of the as scripts that run on a timer. Much like ‘scheduled tasks’ on windows. To edit your cron jobs on dreamhost, locate the ‘cron jobs‘ menu item located under ‘goodies‘ on the main menu:

Location of cron jobs on dreamhost

Before we add a cron job though, I want to familiarize you with the script and have you run a test to save you a headache later.

#! /bin/sh

# Daily backups on your database with email notification
# Tyler Mulligan

# file
dateVar=$(date +%m-%d)          # Date variable to append to filename (default: month-day | 11-24)
savePath="/home/tyler/backups/" # Backups are stored here
fileName="my_db_backup"         # File name minus the date

# email
subject="My Database Backup ${dateVar}"
email="[email protected]"

# database
username="root"      # username
password=""          # password
hostname="localhost" # hostname
database="database"  # database

mysqldump -u $username -p$password -h $hostname $database | gzip  > $savePath$fileName-$dateVar.sql.gz

uuencode $savePath$fileName-$dateVar.sql.gz $fileName-$dateVar.sql.gz | mail -s "$subject" $email

I’ve set it up so you fill out your information like any other config file, the last two lines do all the work.

I suggest you create a new text file called ‘dbbackup.txt’, and paste the above code in and saving it for future reference. It’s always good to have a clean slate to start from. Once you have that done, fill in your file, email and database variables and give it a test run.

Create a shell script through ssh and run that.

Copy your personalized database dump code, log into your server and type:

vi my_db_test.sh
[press i]
right click (to paste the copied code)
[press esc][type ":wq"]
[press enter]

Your script is now written to a file called ‘my_db_test.sh’.

chmod +x the file and run it:

chmod +x my_db_test.sh
./my_db_test.sh

Once you receive the email, check your backup directory and verify that the database was properly dumped. If you don’t receive and email, you did something wrong.

If everything worked fine, return to the dreamhost cron job page, add a cron job and paste your working code into your newly created cron job.

A new cron job on dreamhost

Save, wait a day and you should receive your email. It’s a wise idea to grab a copy of your backup every week or so to store locally.

Dreamhost is actually offering a special for their 10th anniversary right now, 500gb disk space, 5TB transfer for only $5.95 a month. I’ve been with them 2 years and I’ve been pleased.

Getting Entrecard to Work with Blogger

Just the other day, I was trying to integrate Entrecard into one of my Blogger accounts and it didn’t work. The reason for this, is google’s very strict about their document validity, while Entrecard has seemingly over-looked a common HTML markup mistake. The use of an ampersand, rather than html entity:

& causes blogger to fail markup validation when saving.

Theirs:

Valid:

Note: don’t just copy that code and use it in your blog… unless you want to display my card!

Doctypes and why I never really gave a crap

To me, doctypes have always been somewhat of a hassle. I know when I write good code and I know how to fix errors the validator spits out at me. Other than that, my knowledge is limited. I usually just copy the header from my older documents and hope for the best. However, yesterday I had a change of heart and thanks to a simple google search, that led me to a great article, that brought me to a not so easily found page on w3. I was able to sigh in relief. I really don’t understand why the chart below isn’t easily accessible.

Valid Doctypes
This chart is located about half way down the page.

According to my purple to blue link ratio, there are no links off the front page of w3 to this article. I find this rather inconvenient. Thankfully, the good folks at ALA know what’s up.

Zuckerberg's Trout Was the Poke

With the evolution of communication via the internet, it’s interesting to see how websites of today are really client-side applications of yesterday. In some cases, we see applications mirroring existing applications (meebo). Advances in CSS and Javascript with the push of ‘web 2.0 technologies’ such as application frameworks and AJAX have shown programmers of other backgrounds that we web folk really aren’t that different. This in combination with the release of various APIs and the opening of platforms ensures these companies existence in this new module war. Thus initiating the next step in this game of chess, which one company has already taken a shot at.

Behold the future of web applications:

The Future of Web Applications

Businesses will ensure their place in the industry by becoming the host of niche web applications, utilizing their services as modules.

Christmas Savings

I can’t recall a time where I was working on just one project. Sometimes bigger projects eclipse my little adventures and so I’m left with half completed mini scripts. Today my memory was jogged by a friend who asked about some Christmas deals. I like a bargain as much as the next guy but I don’t really feel compelled to waste a boat load of time to save a few bucks. My solution to this, was to create a website that does the work for me.

Coupon Crawl - Search coupon codes

Utilizing google’s CSE, I created Coupon Crawl. I’m still playing with page weights to yield the best results but it works fantastic for certain items. Before checkout at any online store, it’s a good idea to do a quick search here for a promo code. I’ve probably saved over $100 total from this thing already!

Creating MySQL Queries Visually

Over the past few days, I’ve been creating some rather large and confusing SQL queries, so I went on a hunt to see if maybe there was a visual aid that would make the selects, joins and sub queries easier. I was a bit disappointed to find that MySQL offered a Query Browser that wasn’t available for download… or was it?

After a little more research I came about a link to a slightly thinner client in the developer zone under the Generally Available (GA) license. I’ve played around with it a bit and while it wasn’t exactly what I was looking for, it’s helped me during those times I don’t feel like waiting on phpMyAdmin.

Check out this screencast to get a better idea of how this tool works. I’m sure I’ll grow to like this tool a lot more in the future, I just need to learn more about it’s functionality. I thought I’d pass this tip onto you.

mysql-browser.png

PHP Functions: Strip Chars From A Filename and Cloud

Someone overheard a friend and I chatting about a website and it’s tag cloud script. I mentioned that it’s pretty easy to create and that I had already created a php function. He asked me to dig it up, so I present to you a cloud script in it’s simplest form.

Cloud

=11 && $times <=40)
			$size = 2;
		else if ($times>=21 && $times <=60)
			$size = 3;
		else if ($times>=31 && $times <=80)
			$size = 4;
		else
			$size = 5;
		// You should really replace this with a return $size, this is just for demonstration purposes
		echo "$name ";
	}
}
?>

It’s pretty straight forward and easily modified. You setTop based on the number of entries in your database, then pass $name and the number of times it appears to the sizeMe function. If you have any questions or suggestions please let me know. I tried to keep this simple.

In this example I created classes, a1, a2, a3, a4 and a5 that I defined font-size for in a css file.

Strip Characters From A Filename


I wrote this function because I had a boatload of images with ridiculous characters in them and I wanted them out before I uploaded them somewhere. Most frameworks have a similar function built in but if you’re looking for a quick fix, this is perfect for you.