PHP Excel/Reader and oleread.inc not reading negative numbers on 64-bit machines

I recently switched from a 32-bit machine to a 64-bit machine.  I noticed that negative numbers were coming in around 1073741814.  This has to do with how bits are shifted on the different machines.

I have read that not patching these files will cause memory exhaustion, which can be critically bad in a production environment. 

I found a fix for oleread.inc that replace the GetInt4d function with

function GetInt4d($data, $pos) {
$_or_24 = ord($data[$pos+3]);

if ($_or_24>=128)
$_ord_24 = -abs((256-$_or_24) << 24);
else
$_ord_24 = ($_or_24&127) << 24;

return ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | $_ord_24;
}

But what they failed to mention was that you also have to change the function _GetInt4d in the Excel/reader.php file as well.

I hope this helps someone (or myself) in the future.

 

Why Safari? Why? If innerHTML == ”

So I had an issue with the following very simple textarea onblur code.  Interestingly enough, it worked in IE and Firefox.  I just want the two textareas to be identical at the end of the day.

if (document.getElementById(’TopNotes’).innerHTML == ”) {
  document.getElementById(’TopNotes’).innerHTML = ‘Put notes here’;
}
else {
  document.getElementById(’BottomNotes’).innerHTML = document.getElementById(’TopNotes’).innerHTML;
}

Safari always ran the if, and never the else.  I changed to this and it worked like a charm.

var text = document.getElementById(’TopNotes’).innerHTML;
if (text == ”) {
  document.getElementById(’TopNotes’).innerHTML = ‘Put notes here’;
}
else {
  document.getElementById(’BottomNotes’).innerHTML = text;
}

 

Jquery Ajax Returning Null / Not Working

I was working with jquery.ajax yesterday and today and it just wasn’t working for me.  It was starting to get very frustrating because it was a very very very simple code snippet.  I have used this numerous times before with no problems.

So to debug it, I started watching all of my Apache Logs and saw that instead of a GET request, I was getting an OPTIONS request.  This was strange, so I thought that maybe I just have to set the ajax type property to GET.  Tried that to no avail, same request type.

Upon further research, I found that it was because I was trying to hit a different domain instead of the one I was on.  I setup a quick proxy through my domain and everything worked like a charm. 

After writing this post I read this NOTE on the jQuery site.

Note: All remote (not on the same domain) requests should be specified as GET when ’script’ or ‘jsonp’ is the dataType (because it loads script using a DOM script tag). Ajax options that require an XMLHttpRequest object are not available for these requests. The complete and success functions are called on completion, but do not receive an XHR object; the beforeSend and dataFilter functions are not called.

 

Internet Explorer (IE) javascript error using jquery

I was receiving an error in IE (”Object doesn’t support this property or method”) from javascript that was working flawlessly in Firefox and Chrome.  It drove me crazy, as I did web searches, and debugging to figure out the cause of this.

I probably spent a full hour tracking this down, asking for help on Twitter, etc…  Before anyone had the chance to respond, I figured it out.  IE Sucks….  had to be the answer.

Actually, I didn’t “Declare” a couple of my variables ahead of time.

handOrientation = $(’input[@name=handOrientation]:checked’).val();  //gives the above error

var handOrientation = $(’input[@name=handOrientation]:checked’).val();  // does not

var handOrientation = ”;
handOrientation = $(’input[@name=handOrientation]:checked’).val();  // This also works.

Sometimes loose standards are nice, other times they are a pain (cross browser support, being the biggest pain).

 

Mapped Network Drive: An unexpected network error has occurred.

Do you ever click on a mapped drive and receive the error “An unexpected network error has occurred?”  It’s an annoying little error and very vague.  It lead me to believe that there was an error between a PC and a server.  After some research and trying different things, I found the problem to be on the machine that was giving the error in the first place. 

To resolve the error, all I had to do was disconnect the mapped driver letter.  Wait a few seconds, and then remap it.  Everything worked like a charm.

System Administration can be annoying sometimes.

 

bowlingball.com Coupon

bowlingball.com is the #1 online retailer of bowling equipment in the United States.

Due to the low cost products and free shipping there is very little profit margin available, but there are coupons available.  Take a look at the Official bowlingball.com coupon page for details.

 

How to Install and Use ScribeFire in Firefox

Last time I told you how to install and use a new WordPress Theme.  Now I would like to explain ScribeFire.

THIS IS OPTIONAL, YOU DON’T HAVE TO DO THIS.

If you remember from our meeting, ScribeFire will allow you to write in split screen.  You will not have to log into WordPress everytime you want to write. 

Follow these steps

  1. The first step is to install the ScribeFire Plugin.  Just go to that page and click “Add to Firefox”.
  2. Once installed you will have to restart Firefox.
  3. Click the new yellow icon in the bottom right of the browser
  4. Ignore the ScribeFire Quick Ads
  5. Click on the same icon in the new popup window
  6. Now add your blog by clicking on the “Launch Account Wizard” on the right under Blogs
  7. Just enter your site name (example: http://www.airportlanesproshop.com)
  8. The next page should be left alone
  9. Enter your username and password
  10. You should be all set to use ScribeFire

Let me know if you have any questions.

John

 

Updating your WordPress Theme

Getting and choosing a new wordpress theme is very easy.

Search the web for WordPress Themes. You can also checkout the WordPress Theme Directory.

Once you find one you like, follow these directions.  This only works in FireFox.

  1. Right-Click on the Download Button
  2. Choose Copy Link Location
  3. Now log into your WordPress Admin Section
  4. Click Manage
  5. Click Upload Files
  6. Right-Click in the “From URL” box
  7. Choose Paste
  8. Choose the circle next to Theme
  9. Check the box next to “Remove archive after successful extraction”
  10. Click Upload
  11. Now let’s choose this theme.  Click Design.
  12. Choose the new theme you just uploaded under Available Themes.
  13. When the window appears, if you like it, click Activate “Theme Name” in the upper right hand corner.
  14. If you don’t like it, there is an “x” in the upper left hand corner.

I hope this was easy to follow.  Please ask me if you have any questions.

 

Ruby on Rails: First Time Out

I installed Ruby on Rails last week and just sat down to write my first code.  I am following a book that was written in Ruby 1.2, but I have Ruby 2 installed.

The first thing I found is that Ruby 2 uses SQLite by default instead of MySQL.  If you see errors saying: Missing Source sqlite3, then you can solve this easily.  Just remove your new application and then run “rails APP_NAME -d mysql”.

 

Download and Watch Slacker Uprising For FREE

Here is the trailer to, Michael Moore’s Slacker Uprising, a movie that is available online for free.  Let me know your thoughts after you watch it.  I will watch tonight and leave comments below.

 
 
This site hosted by bowlingball.com - Find the best deals on Bowling Balls, Bowling Bags, Bowling Shoes, and Bowling Accessories.