Optimizing Website Peformance with a CDN (jQuery)

0

If you want to increase load times for your site a good way is to serve your resources (js/images/css) from different hosts. Even better is to use a CDN (Content Delivery Network) that has edge locations, see Amazon’s CloudFront,  that will serve those resources from hosts that are nearest to your viewers.  If it is logistcally possibly for your needs and its free is there any reason not to? Yes.

Specifically if you use jQuery on any of your sites more than likely you serve it with every page on your site, so if you want to have one less request for every page just use a free CDN to host it:  GoogleMicrosoft

A recent blog post @ elijahmanor.com explains more why you would want to do such a thing. However, a commenter on that blog post has a good point… If I point my jquery resource at one of these cdn’s how do I know that the files are being served since it is all client side? What’s worse is how much functionality is broken if jquery is 404′d from that CDN?

Well here’s a little trick that you can use verify that jQuery is loaded and how to handle it if not:

Read more

Testing Plugin Syntax Highlter Evolved

1

Just a quick post to test the Syntax Highlighter Evolved plugin.

<?php
$this = 'only a test'; //ignore me
$shout = new shoutOut();
try {
    $shout->out();
} catch (Noise $n) {
    $shout->whisper();
}

Make any webpage printer friendly and create pdf’s on the fly

0

I just noticed this was added to my sociable plugin, but I have to say it is definitely a great concept and it is one of those things that makes you wonder why it took so long to come about. I would use this any day over some browser plugin, the less crap to fill up my browser that it wasn’t intended for the better. The coolest part is being able to remove any content in the url and print your modified version of the page.

http://www.printfriendly.com/

Recent Computer Build

0

Just built a computer for a client and wanted to share my experience.  Its been a while since I’ve built a complete system from scratch, but it is always enjoyable.

Specs:

XP SP3 OEM
(2) Western Digital Caviar SE 320GB 7200 RPM SATA 3.0Gb/s
	(RAID 1 Array) - WD3200AAJS
Western Digital Caviar Black 1TB 7200 RPM SATA 3.0Gb/s - WD1001FALS
AMD Phenom 8450 Toliman 2.1GHz Socket AM2+ 95W Triple-Core - HD8450WCGHBOX
CORSAIR 4GB (2 x 2GB) DDR2 800 Dual Channel Kit - TWIN2X4096-6400C5
ASUS M4N78 Pro (On board Gefore 8300 Video [DVI / HDMI / D-SUB])
LIAN LI PC-A05B (Includes a 550W PS)
Price Tag: Roughly $775

Read more

Quick Tip: Managing Linux Processes

0

Quick tip on managing linux processes, I always end up asking myself this and having to research how to do such things. So here are some quick tips to help you manage your linux processes. This is all done in bash, I’m not sure what is different with the other shells so ymmv.

Here is my sample script, just something that doesn’t end right away so I can use it for proof of concept:

#!/bin/bash
while [ 1 ]
do
        date
        echo "Sleeping 5 seconds"
        sleep 5
done

Sending a process to the background

Read more

Zero user interaction CAPTCHA – (lamecaptcha)

1

This is not a new concept by far, however I want to share my fix for auto filling of forms on some of my sites.  The issue arises from people creating bots/scripts that are intended to auto populate forms on site and submit them with the assumption that data does go somewhere and hopefully someone will click a bad link or buy some viagra or what not. This is most common when you have common web applications that have indentical registration forms or comment forms (like wordpress sites or forum software like phpbb). To solve this problem I’m sure you’ve see the wavy, crooked, colorful and always hard a hell to read text garbled that you have to enter before signing up to certain sites or buying tickets from ticket master. This form of “humanness test” if you will is refferred to as CAPTCHA (Completely Automated Public Turing test to tell Computers and Humans Apart). The nice thing about implementing some form of captcha is that it will usually prevent most random attacks because most people don’t spend time directly targeting a single site, what they do is try to make it work with the most sites as possible to spread the spam as much as possible.

The issue I have with most captcha systems is that they are a) annoying and b) they make me work harder than I need to be c) I end up having to squint my eyes and think hard to figure out what the f*ed up image is really saying. My ideal captcha would require 0 user interaction and somehow figureout that you are real.

So I decided to create my ‘lamecaptcha’.

On most of my forms I have basic javascript validation that says If field a is empty than alert saying field a is empty please fill it in and return false so the form doesn’t submit. However, all the bot has to do is fill in those required fields with garbage and then they put their html links/spam in my textbox or other field and submit away.  But, I use this to my advantage. The bot says let me fill in all the text boxes available and hit submit.

So I decided to create a hidden textbox that a normal user can’t see but a bot doesn’t know is hidden.

(hidden: <input type="text" value="" name="lamecaptcha" style="display:none;" /> ) <br />
(visible: <input type="text" value="" name="text" /> )

(hidden:

)

(visible:

)

Now when the form is submit all I have to do is make sure that the text box is empty and then I allow it to pass through:

<?php
if(!empty($_POST['lamecaptcha'])){
       //Do something because no human should fill a hidden text box
       //If the box was visible for some reason, they still shouldn't fill
       //any text box with out a label saying what should be in it
}

My “attacks” were few and far between but I have noticed that my database is no longer filled with garbage submissions and my clients are not complaining about getting spam from my server.
I haven’t taken the time to figure it out but I would assume a lot of bots are also not running javascript, so another check might be to not allow form submission unless javascript is enabled (this can easily be defeated by a browser bot or there may be some way to fake out the check I don’t know) but it may be worth while to enhance the effectiveness of this.

Again there are simple things like asking for 1+1 or type “here” in the box but I don’t want to make my users do more work because of the a-holes out there, what we need to do is make it more difficult for them. People spend so much time sifting through the spam and garbage it is discusting. Please share with me any ways you have created zero interaction captcha, I think as a service provider bogging down the user is the wrong way to go, and I’m suprised to see CAPTCHA systems become more difficult for the user than the bot.

-Ak

New Host

0

Everything has been successfully migrated to my new server @ slicehost. I can already see the speed improvements on the backend. Hopefully they show up on the front end as well!

-Ak