Testing WordPress for Blackberry

0

Downloaded WordPress for Blackberry, seems awesome and runs well. It’s almost easier to use than the web interface. There is support for tags, categories, custom fields, excerpts, spell check, photos and more… Check it out (search google for WordPress Blackberry as I don’t have a link)

Apache: How to redirect all root domain traffic to www subdomain

0

Problem: Traffic comes to http://aknosis.com/something/ but they really need to go to http://www.aknosis.com/something/.

Solution: 301 Redirect via Apache with mod_rewrite.

Simple easy addition to your httpd.conf or .htaccess, I placed mine right above my wordpress mod_rewrite rules. If you are using .htaccess just dump it in that file above the wordpress redirect, if you having your rewrite rules in your httpd.conf then it needs to go inside the container:

<Directory /www/mydir/>
        RewriteEngine On
        RewriteCond %{HTTP_HOST} !^www\.aknosis\.com$ [NC]
        RewriteRule ^(.*)$ http://www.aknosis.com/$1 [R=301,L]
#Wordpress Here
        RewriteBase /
        RewriteCond %{REQUEST_FILENAME} !-f
        RewriteCond %{REQUEST_FILENAME} !-d
        RewriteRule . /index.php [L]
</Directory>

Breakdown:

RewriteCond %{HTTP_HOST} !^www\.aknosis\.com$ [NC]
If the HTTP_HOST header doesn't equal www.aknosis.com then :
RewriteRule ^(.*)$ http://www.aknosis.com/$1 [R=301,L]
Use the rewrite rule to push the request to http://www.aknosis.com/
^ - Beginning of request uri
() - Means group this into $1
$ - End of request uri
http://www.aknosis.com/$1 - Rewrite to this ($1 = the request uri)
[R=301 - Use a 301 Redirect
,L] - Make this the final rewrite rule and go

Try it out, go here (http://aknosis.com/) and you end up here (http://www.aknosis.com/). You can see the actual redirect in firebug’s net tab:

firebug-redirect

A ton of Web Developer Cheat Sheets

0

Stop digging in your notebook for all your hand written notes, or jumping around your My Computer, because anything you ever wanted it probably listed here: http://www.tripwiremagazine.com/tools/tools/55-seriously-useful-front-end-web-developer-cheat-sheets.html

Fun with jQuery – Checkboxes!!!

0

Another day with jQuery, this time we are talking about checkboxes.

Just like I stated in my previous post about select boxes, jQuery and checkbox integration, if you will, isn’t cut and dry but damn near close. So how can jQuery assist with checkboxes? Lots of ways, here are a few examples to keep you entertained.

Try and manually select a checkbox and it will still toggle them correctly (turn them off it they are on and vice versa).

[inline]
[script type="text/javascript"]
function toggleChecks(){ $(‘input[type=checkbox]‘).each( function(){ if($(this).is(‘:checked’)){ $(this).removeAttr(‘checked’); }else{ $(this).attr(‘checked’,true); } }); }
[/script]
[/inline]

jQuery selector for checkboxes

Just like any input you can choose your checkbox(es) with any standard selector.

  • By Class
    //Selector
    $('.cb_class')
    
    <!-- Input Html -->
    <input type="checkbox" class="cb_class" />
    
  • By Id
    //Selector
    $('#cb')
    
    <!-- Input Html -->
    <input type="checkbox" id="cb" />
    
  • By tag and attribute
    //Selector
     $('input[type=checkbox]')
    //Note: This would select all checkboxes
    //(same code in the Toggle Checks button above)
    
    <!-- Input Html -->
    <input type="checkbox" />
    
  • By tag and attribute
    //Selector
    $('input[name=checkBoxname]')
    
    <!-- Input Html -->
    <input type="checkbox" name="checkBoxname" />
    

Read more

More jQuery Fun – Auto Populating a Select Box

3

Note: This post was updated 8/2/2011 to include jsfiddle code snippets and better/smarter code overall. Enjoy!

Problem: You want to dynamically populate a select box and you don’t know how.

Solution: Easy, I will show you.

First off, I lied there is no built in way in jQuery (why?, I don’t know) to automatically populate a select box. But it actually is very easy. There are plenty of methods to accomplish this but I like to do it this was because utilizes the Option object and it doesn’t require html string concatenation.

The basics

Example 1:

Here is the code for the onclick event of that button:

Read more

Fun with jQuery – toggle() – Easy tips to visually enhance your website

0

Here’s a quick tip to add some cool effects with jQuery that require very little code to implement. In this example I’m going to so how use of the toggle function can make the simplest functionality and jazz it up.

.toggle()

In a nutshell, the toggle function will call the show() function if your element isn’t visible and the hide() function if it is.

  • Hamburger
  • Philly Cheese Steak
  • Taco
  • Pizza
  • Something else greasy and unhealthy
<input onclick="$('#preview1').toggle();" type="button" value="Toggle My Menu" />

So as expected, clicking the button will toggle the menu. Now lets get a little more flashy:

Read more

Hiding Unnecessary Response Headers Apache/PHP

1

One way to help protect your website/server is to not tell everyone what platform and app versions everything is running on. If you were to request a php file from my site you see some response headers that could be useful to people looking to break in, cause havoc etc…

Here is my request to aknosis.com (I’m viewing all of this in Firebug, if you don’t have it get it, best web development tool in my arsenal)

Date Wed, 14 Oct 2009 05:59:59 GMT
Server Apache/2.2.3 (CentOS) PHP/5.2.9 mod_ssl/2.2.3 OpenSSL/0.9.8b
X-Powered-By PHP/5.2.9
X-Pingback http://www.aknosis.com/akwp/xmlrpc.php
Expires Wed, 11 Jan 1984 05:00:00 GMT
Last-Modified Wed, 14 Oct 2009 06:00:00 GMT
Cache-Control no-cache, must-revalidate, max-age=0
Pragma no-cache
Vary Accept-Encoding,User-Agent
Content-Encoding gzip
Content-Length 10636
Keep-Alive timeout=2, max=100
Connection Keep-Alive
Content-Type text/html; charset=UTF-8

So if I was running a known insecure version of php, apache, or any other out of date software exposed in the response headers, an attacker has to look no further to determine what you are using and how best to attack you.

Apache

Read more