Wordpress HACK - How to widgetize your theme!
Well, I had to widgetize my old theme today but it was pretty simple:
Make a file called functions.php in your theme directory. (if you don’t have one yet)
Add the following code and save the file:
if ( function_exists(’register_sidebar’) )
register_sidebar(array(
‘before_widget’ => ”,
‘after_widget’ => ”,
‘before_title’ => ‘‘,
‘after_title’ => ‘‘,
));
?>
Then add the following anywhere you want to add dynamic widgets:
<?php if ( !function_exists(’dynamic_sidebar’)
|| !dynamic_sidebar() ) : ?><?php endif; ?>
You can actually put your existing code within the if loop OR you can also put it before or after.
Since I didn’t want to widgetize all existing stuff, I simply put it after all my existing code in my sidebar.
You can also create multiple dynamic widget locations simply by add numbers to the code like this:
<?php if ( !function_exists(’dynamic_sidebar’)
|| !dynamic_sidebar(1) ) : ?><?php endif; ?>
Other Online Resources:
Widgetizing Themes by Automattic
DIY Linux HACK - HOW TO optimize your Wordpress Blog, MediaWiki, or any other high load website with Compression!
Well, we did a lot of server hacking before with some MySQL, eAccelerator, and httpd.
There’s a lot of major blogs out there I have checked using Web Page Compression Tool that are not using compression. (For one, I checked John Chow’s blog)
Try to check one of your posts instead of checking your main URL as the tool is funky with root domains. (e.g. Check http://zedomax.com/blog/2008/02/23/never-give-up-especially-your-blog-dude/ instead of http://zedomax.com)
Here’s a screenshow of compression test I did for one of John Chow’s posts:

As you can see, John Chow’s blog does not use compression. As a result, he’s losing out on almost 5 times of bandwidth!!!
With level 9 compression, his site could be loaded on your web browser at 21K instead of the whopping 100K.
Now the compression might not be for all of you with slow CPUs. Our Zedomax.com runs on Quad-CPU server which has a lot of CPU processing power.
Here’s a screenshow of my server under normal load:

As you can see, most of the time, my CPU is idling at 80.8%! That means my CPU is pretty much sitting on its ass instead of doing work for me.
Now, if you have a similar situation, compression will help your site load faster and also bring your load down so you can handle more traffic.
Here’s how to enable compression if you have a dedicated or access to root on your server:
(Most servers have zlib installed, if you don’t have zlib installed, you will have to install that first, you can check it by making a test file and putting <?php phpinfo() ?> and search for zlib)
Add the following lines to your /etc/php.ini:
zlib.output_compression = on
zlib.output_compression_level = 5
and then restart apache! (of course):
httpd -k restart
Now, go check one of your posts on the Compression Test Tool here.

As you can see above, I just compressed one of my blog posts by a whopping 76.1%!
If you are using Super Cache plugin for Wordpress, make sure to go to options and do this too:

Now, your server will run faster since there’s less data being transmitted to your visitors, meaning you save bandwith, time, and most importantly, the ability to handle more traffic.
At 70% increase in bandwidth, that could translate to that many more visitors too as bandwidth is directly proportional to amount of time a visitor stays on your site. (Yes, I did take Calculus in college, I failed miserably before passing.) The less time a visitor takes to load a page on your blog or your site, the more time and bandwidth you have for other visitors.)
I was searching through the web for many ways to use compression for server optimization but I couldn’t find any so I sort put everything together here.
Hopefully, it helps you.
And one more thing, you can also check out this great tutorial on your httpd.conf setup.
You can always check out HOWTO decrease load on your server by 5 times also.
DIY Linux Web Server HACK - Automate your MySQL MySQL database backups
Okay, I’ve been running dedicated servers for couple years now and I used to mess around with Linux boxes back in college.
Here’s an essential automatic script and a cron job you will need in order to keep your backup automatic.
Yes, if you get a dedicated server, don’t get their stupid extra $15/month for backing up your database. (All they do is make scripts like this one and charge you for it)
You can follow this example and go spend that money on junk food.
So all you have to do is FTP your backup files.
This is way better than going into your phpMyAdmin and downloading from the web interface since the file is already ready for you to download.
Here’s how you do it:
1) Make a new file called backup.sh in your home directory. 2) Use the following syntax:
mysqldump -u[USERNAME] -p[PASSWORD] --opt [DATABASE NAME] > /root/backup/DATABASE1.sql
Here’s an example backup.sh file if you had 2 databases:
mysqldump -uUser1 -pPassword1 --opt Database1 > /root/backup/Database1.sql mysqldump -uUser2 -pPassword2 --opt Database2 > /root/backup/Database2.sql tar cvf /root/backup/sqlbackup.tar /root/backup/*
You can test your script by typing this:
sh backup.sh
(The mysqldump will overwrite the older file if you run this more than once)
3) If everything is working good, now you can put that script to be run once a day in your cron job.
For Fedora Core, you can edit this file /etc/cron.d/sa-update
Add the following line:
10 3 * * * root sh /root/backup/backup.sh
This will execute the script once a day at 3:10AM.
Now simply download one tar ball file whenever you feel like backing up your database.
You can probably change this a little bit and use it for many other things like backing up all your files too. (which I do)
If you have multiple servers like me, you can also automate your scripts to download backup databases to each server. That keeps things real redundant in case of server failure.
The biggest pyramid “splog” scam in this world today - StumbleUpon =Spambleupon
Okay, I will have to tell you the truth tonight about one of the biggest social networking sites, SpambleUpon, or most people call it, StumbleUpon.
They are making so much money off bloggers, basically StumbleUpon “scrapes” bloggers’ content and makes millions of dollars off you! Even though no one has really “sued” them, they are in big trouble if bloggers start sueing them one by one.
Google should really ban them for “splogging”, every one of SU users’ blogs are “splogs” made up of content written by bloggers like you and me. (My traffic actually boosted after SU banned me, I think I was getting penalized for duplicate content by using SU. Besides, don’t rely on backstabbing social networks who make millions dollars off your content and simply ban you later for “spamming”??? Are you kidding? Go look at my DIYs, they are all original. Lol…at least my blog isn’t full of splogs. Here’s a post you can read about how to protect yourself against splogs although it won’t work with SU.)
Why?
Well, every “blog”, they say, is a “splog”, every image consisting of an image scraped off a “copyright protected” blog (Mind you, every “blog” is actually naturally protected from scraping, this site has about 10 other sites’ images w/o their written permission) . So, we simply took at the most top-left blog on their “Top Stumbler” list.
Well here it is:

As you can see, the image is “scraped” off another “original” blog. If you go to any of their “splogs”, the results is the same. They almost store 0% of their “splogs” images on their servers and simply scrape and live off other blogs. SU is like a real big mosquito that lives off your blood, your blog post that “you” wrote and uploaded images. Their future will only rely on other bloggers’ content and NEVER their own.
So, what can you do?
You can always file a “copyright enfrigement” notice and lawsuit to SU, which their headquarters addresses I couldn’t even find, AND uninstall that hideous toolbar that takes too much of your life, time, and 50 pixels of height on your browser. (Most of their admins are “fake” people behind stupid 50×50 pixel images. They “pretend” they created a special technology when I could re-create a similar service within days.)
Then, simply head over to SiteHoppin, where every site is not “splogged” and is simply “bookmarked”.
Okay, here’s the 5 second wrap up:
1. Every blog on StumbleUpon is a “splog” made up of scraped images and text from other blogs
2. The only reason they don’t get sued is because they send websites traffic and a lot of website owners are happy about that.
3. Every blog in the world has now a “copyright enfringement” against SpambleUpon. If your content is on SU, you deserve the right to sue them for scraping your content.
Now, we don’t have to sue them. You do. So, in all, just stay away from these SpambleUpon guys and stick with the American Dream, SiteHoppin, where “real” developers develop w/o scraping bloggers’ content.
Now maybe we may be a little bitter but at least we fight for our right to be conscious about the “real truth” behind everything. Yeah, SU fucked up this time bad….real bad…let the truth be known even if you do continue to use SU, you will remember this when you get banned.
Here’s the address to send your copyright infringement letters about their “Splogs”: (This is the only real contact info you can find on their site baby)
StumbleUpon, Inc.
Attn: Copyright Agent
StumbleUpon, Inc.
140 Second Street, 3rd Floor
San Francisco, CA 94105
phone: 415-979-0640
fax: 415-896-2600
email: copyright AT stumbleupon.com
DIY Webmaster - Do not put all your web traffic in one basket!

In recent encounter with StumbleUpon, we have received about the same amount of traffic regardless. As you can see in the above graph, StumbleUpon only really helps those with small traffic. With out latest press release, we will be suing StumbleUpon for Copyright enfringement. That’s right. They don’t have the guts to take it outside and get their ass beat by me so I will have to take them to court. Thanks a lot SU, for leaving that copyright enfringement on forever, which I have already copied on to my harddrive, servers, my 4gb flash, ipod, you name it bitch.
On top of it, they used some “under-the-table” methods to take my rankings to zero on Alexa although my StatCounter.com says I have the same amount of traffic.
Why would a web giant bought by eBay go through this? I think they are dumb, that’s my honest opinion. No matter what, they will never stop Zedomax.com from saying what’s true and what’s not. The truth? I helped them gain more stumblers and visitors. That’s right. I controlled the black market of SU simply by providing them with more traffic. Yet, they have the balls to go against me for helping them and they listen to their stupid ass “spam” stumblers more than loyal customers like me.
Don’t worry, we are gonna sue them for copyright enfringement. That’s right. They took my whole post of writing and put it on their main SU discussion page. I already copied most it so, don’t even bother erasing. You guys are fucked as hell for disturbing a blog/wiki/social network business.
C you in court, happy site hoppin!
The lesson learn here?
Don’t put all your eggs in one basket. Go digg, stumble, reddit, and make it the same. Don’t depend on one big guy, because one day, he will fuck you over like SU did to me. At least, I got something to sue them big time.
What’s StumbleUpon afraid of?

In a recent encounter with StumbleUpon’s banning of 20 accounts in our network, we have conjured up a little bit of something we read in a book by Guy Kawasaki, “How to drive your competition crazy.” In the book, there’s an example of how Ben & Jerry’s turned a law-suit into an hilarious marketing victory.
Here’s our version on StumbleUpon’s latest diplomatic policies:
Do you think the Stumbleboy is afraid of two guys working in a rented apartment of 800 square feet?
Do you think the Stumbleboy is afraid he’s only going to make $61.3 million in profits instead of $61.8 million?
Do you think that maybe the Stumbleboy is afraid of the American Dream?
We only want to make the most fun site and let people of the internet make their choice on the internet, where guys like us can compete with guys like the Stumbleboy.
Next time you are surfing the web, uninstall that hideous looking 50 pixel StumbleUpon toolbar that takes up too much of your browser space and start using “extension-less” SiteHoppin. Because to tell you the truth, that’s what the Stumbleboy is really afraid of.
Hey, if you wanna help us and fight this bs, put this drunken button on your blog. We will add you to our blogroll so you go up with us when our press release go out tomorrow.
DaBomb.TV is on SALE at SitePoint!
Yeah, don’t ask me why, I have to start selling all of my websites one by one because I need to keep making a living.
With the recent sales of Wagg.It, I have gone slightly depressed, but here’s another great sale of a great video blog site, DaBomb.TV.
You can go bid at SitePoint here. The bid will end in 7 days so let the high bidder get the site!
FYI, you are not just buying a website, you are also buying our free blog promotion from 20+ blogs/social networks AND we make sure it gets installed correctly on your server, plus we will give you free consultation until you can get it everything running smoothly.
The new site owner will still be part of our Zedomax Network, and benefit from free SEO, backlinks, and free blog posts from many PR4-PR5 blogs.
Go bid now and let me stay in this risky business of internet entrepreneurship.
Is your blog hosted on a shared server? You are not serious then.
Is your blog hosted on a shared server such as BlueHost, Dreamhost, or whatever? Then you might be in for some surprises later down the road if you ever get more than 500 visitors per day. You can check how many websites are hosted on your shared server by entering your domain name at myIPneighbors.com.
I bet you though if you are on a hosted server, you will most likely find at least 10 other websites. Yes, this is bad.
When I first started blogging, I also started on a cheap $100/year hosting from bluehost.com. No shared hosting will ever be as good as a dedicated server so if you are serious about making money blogging or handling massive traffic, you should get a dedicated server.
I remember Zedomax got digged, bluehost went down like that! and never came back up until I transferred everything to a dedicated server.
But then, amazing thing happened after switching to a dedicated server. Since your website runs faster and doesn’t ever go down (unless you got digged AND stumbled again at the same time…), Google indexes your site faster and you get more search results on Google. It’s common sense that if your site has uptime of 99.9%, Google-bots and other search engine bots will crawl the site more faster.
Sometimes, I find that search engine robots are the ones gobbling up most of your bandwidth. You can always edit your robots.txt file and not let them crawl, but then you lose SEO (Search Engine Optimization) and eventually get no traffic from major search engines.
Here’s a summary of Zedomax traffic ever since its beginning in August 14th, 2006:

As you can see, well, as you can’t see also, I’ve upgraded my server numerous times due to diggs, stumbles, DOS (Denial of Service) hacker attacks, and whenever I made a new site.
You should really pay attention to how much traffic will be coming to your blog everyday to make sure your web hosting service can handle it.
Believe me, I tried these following shared hosts and they were all terrible when it came to traffic more than 500 per day:
BlueHost - The most reliable of the shared hosting I’ve tried.
DreamHost - They give you SSH2 access which is good but again, they host WAY too many websites on their servers. Result? I paid $100 for a year of hosting that I never used because my site kept going down. DreamHost is worst because they lock your site automatically when you exceed the maximum allowed bandwidth. Bluehost is much nicer in my opinion as they don’t have that system. Don’t fall into their “green” marketing scheme, when it comes to your website, you want it done right.
Lunarpages - Similar to BlueHost
I’ve tried many other ones for my previous job at Comfile, but I won’t list them all here, they all really suck in my opinion.
So, what is the best dedicated hosting?
Well, I’ve only tried 2 so far.
Aplus.net - These guys are pretty reliable until one day they had some type of packet-loss problem and ALL my 20 or so websites were down for more than 5 days!!! The funny thing was, Aplus.net itself was fine, it’s just all their customer’s servers were down. They put themselves in front of their customers. That was the end of doing business with them.
That’s when I moved everything to Cari.Net, which I already had couple sites running on. The most annoying thing is that Aplus.net seems to have customer service centers overseas. Not that I have anything against saving Aplus.net’s money, but when you are in America, you want to talk to someone in America, and want to get things done fast. Another thing about Aplus.net is that they are way too big a company now that they don’t care about little guys. All they are about is making money and who pays them more. This is an honest review of my experience with them and I am not being bitter about it, it’s the truth.
Cari.net - Right now, I am running all sites on Cari.net due to their reliability through my actual experience. I will probably try other hosting later down the road or even run my own servers but Cari.net is also priced much better than most hosting companies out there.
In my opinion, you should stick with a small to medium sized dedicated hosting company that cares about you. You want a simple host that you can call anytime anywhere without knowing your stupid registration number or get man-handled by stupid receptionists who redirect you 3 times before you get the dedicated support team.
Another thing you should think about is that the hosting company should only provide “dedicated hosting”. If they provide both, you are probably going to run into bunch of bs such as the company not providing enough support for dedicated server customers.
In all, I did learn a lot about Linux, servers, scripts, and everything you need to know about running a website through various server upgrades. If I didn’t do that, I’d probably have to pay a lot of money right now just to make new websites.
So, if you are going to make more than 1 website, get 1 dedicated server and bunch of dedicated IP addresses.
