If you have a PHP script that may take a long time to process (more than a couple minutes), make sure you’re printing output as it gets generated. If the page takes too long to load then some browsers will close the connection if nothing is being sent to it. All you have to do is print out a character to keep the connection open, so if you’re in a loop, trying printing “.” every iteration.

Hope that helps!

 

I was trying to make a shortcut to hibernate Windows since one of my computers didn’t have that option. Using this was giving me permission denied errors:

powercfg /h on

I even tried to do it from within a ‘Run as Administrator’ console window, no luck. Found the easy solution, just use this instead:

shutdown /h

Hope that helps  you!

 

I used the Codiqa Screen Designer on the JQuery Mobile homepage and while at first I was impressed, I noticed quite a bit of extra padding and spacing. I tried to override the CSS, but the best way to get rid of it was to remove all of the fieldcontain and controlgroup divs that it adds in:

 <div data-role=”fieldcontain”>
                    <fieldset data-role=”controlgroup”>
Now it looks like a normal form!
 

If you ever come across a website that renders as though it’s in IE7, even though it’s IE9 or later, try checking the meta tags. It probably has this set:

<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″>

This tells the browser to render as though it’s Internet Explorer 7 no matter what the version.

If you need to detect whether this is happening programmatically, you can do so with the following attribute:

if(document.documentMode==7) ….

Hope that helps!

 

We recently tried Google’s Pagespeed Service to see if it was quicker and easier than using a CDN. Quick answer – it didn’t help us too much. But I did encounter a number of weird 404′s when testing it out that I thought I might document.

Before we made any permanent changes we of course wanted to test it out locally. We did so by modifying our proxy settings for the site we were testing. We have several resources on amazon cloudfront, and some of them just weren’t getting loaded properly!

It had to do with using “Proxy Switchy!” to run our test. I had set up a different proxy that I could switch to when I wanted to test so that I could try side-by-side tests easily. But for some reason that wasn’t working. If you follow the recommended settings Google suggests you won’t have this issue. Just modify your main proxy connection instead of creating a separate one to test with.

Hope that helps!

 

When developing a mobile app, I noticed that one person’s profile picture was showing up rotated sideways. When I visited this on my computer browser, it appeared fine, but when trying with an iPhone it was always to the side!

At first I thought this was a coding problem, but I realized that if I access the image directly through the url it does the same thing! Turns out that some cameras store orientation data with the image. Most desktop browsers don’t care about this, but for some reason mobile browsers do so they read that information and rotate the image the way it was taken.

An easy solution is to remove the EXIF data associated with that image. I did a quick google search and found sites that would strip exif data of any image and allow you to resave it. Doing that fixed it!

Hope that helps!

 

I recently completed an intro package to flying and I learned a lot about what it takes to become a pilot. I’m documenting the steps along with the money and time needed because I couldn’t find a realistic viewpoint anywhere else.

Steps

  1. Complete Ground School Training (classroom instruction)
  2. Pass written FAA exam
  3. Complete Stage 1 Flight Instruction: basic maneuvers, take offs, landings
  4. Complete Stage 2 Flight Instruction: cross country flying, solo flights
  5. Complete Stage 3 Flight Instruction: high performance maneuvers, non-standard take offs and landings
  6. Medical exam
  7. FAA oral exam
  8. FAA flight exam

None of this has to be done within a certain amount of time, although the written FAA exam results are only good for 2 years, so if you take longer than 2 years going through steps 3-8 you’ll have to take it again.

Initial Cost

  • Ground School Training – $225
  • Books, flight calculators and accessories – $500.
  • Aircraft rental – average of 60 hours at $125/hr – $7500
  • Flight instruction (gotta pay for instructors time too) – 40 hours at $50/hr – $2000
  • Tests – $500

Overall it should take about $10,000 to receive your pilot certificate. I’m told that there are several ways to bring the cost down, such as if you need to travel for work you can write that off, or if you take a group of friends somewhere you can split the cost with them (although you cannot charge people for flights, as you need a commercial license to do that).

Initial Time

  • Ground school training – 3 months of 2 nights/week
  • Flight time – about 60 hours. Most schools say you can get it done in 35 hours, but no one has ever known anyone to do it that quickly. Average is 50-70 hours. Although this does not expire, the quicker you do this the better, otherwise more of your subsequent lessons will be focused on review. Recommendation is to do 1-2 hour flights per week. Flight time includes taxiing.
  • Studying for tests – not sure, every student is different, but plan on time for this too.
Overall it will take just over a year to get all this done if you follow the recommendations, but can be several months before or after depending on how often you choose to fly.

Maintaining Your Pilots License

  • FAA requires 3 landings every 90 days. Some flight clubs will require more (usually 5 landings every 90 days).
  • FAA Flight Review every 2 years. This includes 4 hours of classroom instruction, 1 flight, and a medical exam.
So once you have it, you have to do these things to keep it valid. Will be a minimum of about $2000 and 20 hours per year.
It’s a lot to overcome, but it’s not unmanageable! Hope this helps and good luck if you do decide to become a pilot!

 

 

For Christmas my girlfriend had given me a certificate good for the intro package at Golden State Flying Club. They’re a small aviation school based out of Gillespie field in El Cajon (San Diego), CA. She got it for under $150 and it included 2 sessions of their classroom training, a manual and a flight log book, and two 1- hour flight lessons. It was an exhilarating experience and I highly recommend it. Here’s my review of how everything went:

Classroom Instruction

Every 3 months they start a “Ground School Training” program. It’s one of the requirements you need to complete as part of becoming a pilot, and they let you sit in on two of these sessions. It’s basically a small classroom at their facility at  Gillespie Field, holding probably about 20 people. The instructors are great, very knowledgeable, very passionate about the subject. I’d recommend going towards the start of the series, as if you’re doing an intro package you probably only need to know the basics (basic aerodynamics such as lift, stalls, flaps, turns). They have videos to most of their sessions available for anyone to view online. They book they provide was nothing special. You’ll be alongside other students who are there to get their license, so they have other books and a bit more training than you. They have homework and quizzes, but since you’re just sitting in you don’t have to worry about it.

Flight #1

I was extremely nervous, not knowing what to expect, and realizing how light those tiny Piper Warrior planes are. My instructor (Dave Kraft – great guy) was fun but very professional, made me feel safe the entire time. Here’s a summary of what we did:

  • Explanation of cockpit instruments and controls. There’s a lot but only a few to worry about
  • I got to steer the plane while taxiing on the runway with the rudder
  • Instructor did the take off, but within about 30 seconds of take off, he passed the controls over to me and I was flying!
  • Practiced ascending and descending to certain altitudes, then trimming the elevator so that you didn’t have to constantly hold the stick in position and could relax (basically like setting cruise control for the steering wheel of a car).
  • Practiced turns – it’s very different from driving a car. In a car you just turn left/right. In a plane every time you turn you must move 3 different controls at once: ailerons to bank (lower one wing relative to another), rudder to prevent slipping (turns like a steering wheel does to a car), and elevator up (otherwise you’ll lose altitude). It’s a choreographed set of movements for these 3 controls every time you turn, and it takes some getting used to.
  • Practiced straight and level flying while extending flaps to various degrees (flaps provide lift and allow you to descend without gaining too much speed).
  • Instructor showed the types of stalls (when you lose aerodynamics of the wings due to speed or angle and you start falling out of the sky) and how to recover from them. A little scary but very cool!
  • Our route: west to the coast, then north along the coast up to Del Mar, then east to get back to land.
  • My girlfriend came expecting to just watch us take off, but my instructor let her come with! She sat in the back seat and got to take pictures and videos the whole time. She got a little motion sick at the end, but she hung in there!
  • About a minute before landing the instructor took back the controls and did a trick landing (side-slip). Was one of the smoothest landings I’ve ever felt.

Flight #2

This flight was much more enjoyable because I was better prepared for it. If the first flight didn’t make me want to be a pilot, the second one definitely did:

  • Did inspection of airplane, fuel, engine.
  • I taxied until take off, which my instructor did again.
  • Our route: East to an open training area, then south down to Brown Field. Then back to Gillespie.
  • We did the same sort of exercises as before – turns, ascents, descents, flaps – although it was much easier this time. I was starting to get the feel of the plane.
  • We landed at Brown Field (small airport just near the Mexico border) for a touch and go. My instructor said if I feel comfortable he’d be happy to walk me through the take off! I gladly accepted and took off – was a little scary, but he led me through it and had no problem at all!
  • Once back near Gillespie he did a short field landing – was very impressive.

I’m pretty sure they’re losing money by offering all of this for under $150, as individually it’s about $400. My guess is they hope you become hooked and commit to becoming a pilot through them, as that’s where they make their money. I’m not sure I have the time and money to commit to becoming licensed, but this package was WELL worth it and I really hope I inspire you to try it!!!

 

I was setting up a Facebook Page for a client and noticed that it was taking forever to load the IFrame I had pointing it to. When I visited the IFrame contents without going through Facebook it was really fast, but when through Facebook it took up to 5 seconds before it even started loading the IFrame contents.

I was going to try different apps other than the “Static HTML: IFrame Tabs” but everyone claims that this is the best app for loading an iframe into your facebook page. I accepted this, and decided that perhaps if I couldn’t improvement the performance of it, I could at least let our visitors know that something was loading and to please be patient. I feared that the blank page while it was loading would make users think it was broken.

Here’s the code I came up with:

<img src="https://www.yourserver.com/loading.gif"
 width=508 height=381 id='loadingimg'>

<iframe src="https://www.yourserver.com/iframe.php"
 frameborder="0" width="520" height="2500" scrolling="no"
id="theiframe" style="visibility:hidden"
 onload="document.getElementById('loadingimg').style.display='none';
document.getElementById('theiframe').style.visibility='visible';"></iframe>

Just place this in the setup of your Static HTML contents and it will show a loading image (you’ll have to change the path to an image of your own) while it’s loading the IFrame (also don’t forget to put in the path of your iframe  instead).

Hope that helps!

 

I recently had a project where I had to require that a user scroll down the terms and conditions and privacy policy before they could check that they agree to them. I read everywhere that in order to get the position of how far down the scroll bar is you have to use $(element).scrollTop(). But this kept returning 0 no matter where the scroll handle currently was!

The solution is to use $(element).contents().scrollTop()

var position = $('#myIframe').contents().scrollTop();

That position is actually the number of pixels that are hidden above the top edge in the iframe. To figure out if the scroll bar is all the way at the bottom, you have to use a calculation including the height of the iframe and the height of the iframe contents.

If this equals true, then they have scrolled to the bottom:

$('#myIframe').contents().height()-$('#myIframe').contents().scrollTop()-$('#myIframe').height()==0

Considering I wanted to warn them when they haven’t seen all the contents, this became my final piece of code to prevent them from checking a checkbox until they had scrolled all the way down:

//must scroll to bottom of terms to agree
$('#checkAgree').click( function() {
    if($('#terms_iframe').contents().height()-$('#terms_iframe').contents().scrollTop()-$('#terms_iframe').height()>0)
    {
        alert("Please scroll through the terms and conditions before clicking agree");
        return false;
    }
});

I’m aware that there are ways to get this without jQuery, feel free to leave it in the comments. Hope that helps!

© 2012 ShaneLabs Suffusion theme by Sayontan Sinha