WordPress Http Error on Media Uploader

Out of the blue, I was receiving a red “HTTP Error” while attempting to upload images with WordPress’ core image uploader (WordPress version 3.6.x). This was occurring while using the mult-file uploader (ajax) and the legacy browser uploader. It even reported a HTTP Error while setting a featured image. There was a lot of users reporting this on WordPress.org, but I couldn’t find any solid answers. Here’s mine:

Make sure you’re running PHP 5.3 – as soon as I made this change, all 3 sites (including this one) started behaving normally again. You can make this change by adding the following code to you .htaccess file for each of your wordpress applications:

AddHandler application/x-httpd-php53 .php

Sidenote: I use bluehost as my hosting provider and the default configuration is PHP 5.2 with a single php.ini file. I did not change this setting in the PHP Config section of cPanel. I simply updated each .htaccess file in the root of each website. I hope someone finds this useful out there.

Make a DIV stick when you scroll

I’ve seen this method used a lot around the web and I’ve recently been working on a website where I wanted to incorporate it.  After finding zero results in about a minute of research, I thought this would be a neat topic to write a post about.

So my main concept here is to have a sidebar that would stick to the top of the page once the window was about to pass it by while scrolling. This could be used for dozens of reasons. Perhaps you want to ensure your advertisements are being shown the maximum amount of time possible; or maybe you want to offer your visitors an area of quick-links so they wouldn’t have to scroll to the top of the page to navigate somewhere else.  The site I’m working on is e commerce, so it will be an area to up-sell other products relative to the page the user is viewing.

stick a div when it scrolls

In the code below, I have two DIVs floating that represent the main content area and the sidebar.  Sidebars are usually shorter than the main content area, so this is where my sticky DIV will be.  I give it an id of “sticker” (original, huh?).  With some jQuery, I’m able to fire off a function every time I scroll on the page.  This function calculates my current position, or viewport, or distance from the top.  It also calculates how far from the top my “sticker” div is.  Then, there’s an IF statement that’s fired off…

IF my current position is greater or equal to the “sticker” position, give the sticker div a class of “stick”.  This changes the CSS of the div to have a FIXED position as long as the viewport is lower than the position of the sticker.

HTML – Nothing crazy going on here – a mere 2-column setup

<div id="wrapper">
  <div id="mainContent">
    <!--Content for your main div - like a blog post-->
  <div id="sideBar">
    <!--Some content in your right column/sidebar-->
    <div id="sticker">...start scrolling to watch me stick</div>
  <div class="clear"></div>

CSS –  Again, nothing super high-tech – just not the styles applied to div#sticker and the class “.stick”

div#wrapper {
	margin:0 auto;
div#mainContent {
div#sideBar {
.clear { 
div#sticker {
	margin:20px 0;
.stick {

jQuery – Calculates the position of the sticker div and makes its position fixed if the page has scrolled that far

$(document).ready(function() {
	var s = $("#sticker");
	var pos = s.position();					   
	$(window).scroll(function() {
		var windowpos = $(window).scrollTop();
		s.html("Distance from top:" + pos.top + "<br />Scroll position: " + windowpos);
		if (windowpos >= pos.top) {
		} else {

Conclusion – I used to think these sticker DIVs were annoying, but I’m coming across more and more ideas to implement them to help the visitor. I have also thrown a demo page together if you want to see it in action. Download zipped source code

* UPDATE – per David’s request, the sticker stops at the large footer – demo page 2Download zipped source code (2.0)

Sorting Indicators on ASP.NET GridView

I was recently trying to sort an ASP.NET gridview and realized it was no easy task to show the column that the grid was sorted by.  I don’t know if 4.0 or 4.5 .NET has this capability, but it seems like the GridView control should have parameters that you could assign an ascending/descending icons to.  Unfortunately, it doesn’t.

ASP.NET GridView Sort Indicators

In a few lines of code I was able to add an image next to the column header like the example above (see that little triangle?).  I was amazed on what I found online when researching this.  Many developers have a tendency of over-complicating things, so my code below is as bare-bones as possible.

VB.NET (Code-Behind on GridView RowCreated Event):

If e.Row.RowType = DataControlRowType.Header Then
  For Each field As DataControlField In gv1.Columns
    If field.SortExpression = gv1.SortExpression Then
      Dim sortImage As New Image()
      If gv1.SortDirection.ToString = "Ascending" Then
        sortImage.ImageUrl = "images/asc.png"
        sortImage.ImageUrl = "images/desc.png"
      End If
      sortImage.AlternateText = "Sorted " & gv1.SortDirection.ToString
    End If
End If


It’s assumed you already have a GridView databound to an object datasource and you have sorting enabled. This code-behind should be under the gridview (gv1) RowCreated event.

  • 1 – Checks if the row being generated is a header row (otherwise, the row is ignored)
  • 2 – Sets up a loop to go through each cell, or field, in the row
  • 3 – Checks if the sort expression of the GridView matches the current field/column
  • If the sort expression matched – enter lines 4 – 11
  • 4 – Creates a new image object called ‘sortImage’
  • 5 – 9 – Tests the GridView’s current sort direction.  If it’s ‘Ascending’, assign an ImageUrl (you need ascending/descending icons – mine are in my ‘/images’ folder).  Otherwise, assign the descending image to the ImageUrl
  • 10 – Sets ALT text to the image so we keep W3C compliance – Mine is a concatenated string that would be something like ‘Sorted Descending’
  • 11 – Adds the image to the header cell

I hope this helps someone out there.  I know there are many ways to do this, but this seemed to be the most light-weight scenario I could come up with without using a third-party solution.

Not Receiving Apple ID Verification Email

My mother recently bought an iPhone (Go Mom!). I think the main reason was to FaceTime with my siblings and myself. I was showing her a few little tricks on the phone when I realized she hasn’t downloaded any apps from the app store. I told her how she needed an Apple ID, and once she signed up for one, she could download some neat stuff for the phone. Easy enough, right?

I continued to sign up for an Apple account on her phone. After filling in the long form, I finally got a message telling me to verify the account through the email that was sent to her. I signed in to her email… nothing. I tried multiple times to resend the email from her phone… still nothing hours later. I even tried signing her into iTunes thinking I’d be able to manage her account in there, but iTunes wouldn’t even let me sign in without verifying the account.

I finally went searching online a way to manage my apple account without it being verified and I found a little hidden nugget. Go to https://appleid.apple.com and click on “Manage your account”. From there you can sign in and have the system resend the verification email. This was the only time the email functionality worked. It finally came through and I was able to click on the encrypted link to verify my account.

Apple ID Verification Email Instructions

I hope this helps someone out there. I was about ready to pull my hair out on this. No wonder why technology annoys so many people. Apple, if you’re reading this, you may need to investigate your email function coding. I read a ton of forums of people barking about this same issue with no resolutions.

Creating a Caption Slider with jQuery

I know I’ve been on a jQuery kick.  I guess I’ve been doing a lot of user-interface coding lately.  I really enjoy using jQuery.  It really makes a developer’s life easier as it handles most cross-browser problems.  Also, the way you write it just seems to make logical sense to me.

Anyway, here’s what I’ll be creating today… (go ahead and mouse over Jack).

Jack, the springer spaniel
Hello, my name is Jack


No need for an independent sample page.  This script is pretty easy.  It’s really just a few lines of JavaScript/jQuery.


<div class="theBox">
  <img src="jack.jpg" alt="Jack, the springer" />
  <div class="theBoxCaption">Hello, my name is Jack</div>

The CSS…

div.theBox { width:325px; height:200px; position:relative; overflow:hidden; }
div.theBox img { width:325px; height:200px; position:absolute; }
div.theBoxCaption { background:#000000; color:#FFFFFF; padding:10px; top:200px; width:305px; position:relative;
	opacity:0.75; filter:alpha(opacity=75);}

The JavaScript/jQuery…

<script type="text/javascript">
$(".theBox").hover(function() {
	var mainHeight = $(this).height(); //height of the main container
	var captionHeight = $(this).find("div.theBoxCaption").innerHeight(); //height of caption box
	var finalPosition = mainHeight - captionHeight; //calculates where the caption box needs to end up at end of animation
	$(this).find("div.theBoxCaption").animate({top:finalPosition + 'px'},{queue:false, duration:500}, 'swing'); //mouseEnter animation
}, function() {
	var mainHeight = $(this).height();
	$(this).find("div.theBoxCaption").animate({top:mainHeight + 'px'},{queue:false, duration:750}, 'swing'); //mouseOut animation

English Translation:

Starting with the HTML, I use a DIV with a class of “theBox” as my main container. I used a class and not an ID intentionally, so it gives me the option to add another image with a caption on the same page (thinking ahead is always good programming practice). The CSS is pretty standard. The important part is to have a position of relative and overflow:hidden on “theBox”. Then, when you set a position:relative for “theBoxCaption”, you need to set the “top” property to match the height of “theBox”. The rest is really powered by jQuery. I’ve seen a lot of plugins out there and always wanted to come up with a way to do this on my own.

The only property I’m animating here is the “top” property on “theBoxCaption”. Initially, this gets set by the CSS of the page (it’s set to 200px). Then, I do some calculating to find out what the top value needs to be at the end of the animation. I subtract the height of the “captionBox” from the height of “theBox”. Then, it’s just a matter of sending that value in an animate function. The second argument of my .hover() function is actually the mouseOut event. A lot of people don’t realize that you don’t need a separate MouseOut event and that you simply just write that in the 2nd argument for the .hover() function. For this example, I’m just reversing what I did and animating the “top” value of “theCaptionBox” back to the height of the main parent container (“theBox”).

This has sort of encouraged me to write my own plugin – maybe I’ll repost this topic at that time. I hope you find this useful.