iframe for ad loading good or bad?

According to Yahoo’s “Best Practices for Speeding Up your Site”, the pros for using iframes:

  • Helps with slow third-party content like badges and ads
  • Download scripts in parallel

but the cons are:

  • Costly even if blank
  • Blocks page onload

I want to use an iframe to load ads using the technique mentioned on this site:

Does using this technique mean that as soon as the html contents requested by the iframe are returned to the client, it will load the ad script, potentially blocking the rest of the page’s rendering and downloading? Or will the iframe request get processed concurrently while rest of the document is downloaded and rendered?

I’m, however, not looking for a discussion on the philosophy of whether ads are good or bad.


Rendering of the interior iframe is processed concurrently with the exterior page. Any javascript inside the iframe will only prevent loading of the contents inside the iframe.

Edit: also, I just noticed I answered your previous question on this subject, and as explained there it’s possible to trigger iframe loading in javascript whenever you wish (e.g. after the rest of the page is loaded).


Check if directory exist on android’s sdcard

How do I check if a directory exist on the sdcard in android?


Regular Java file IO:

File f = new File(Environment.getExternalStorageDirectory() + "/somedir");
if(f.isDirectory()) {

Might also want to check f.exists(), because if it exists, and isDirectory() returns false, you’ll have a problem. There’s also isReadable()

Check here for more methods you might find useful.


Dynamic Midi generation and playback on Android: Possible?

Strangely I find no support for Midi in Android.
The only thing that comes close is the Jetplayer, but this only takes a existing .jet file.

I want to dynamically generate a midi file with some intervals and play it.
I even thought about just manually creating a .jet file with a tone and then transposing it with the jet player, but it limits the transposing to -12, +12. Which is not so good for me.

There also is a ToneGenerator on Android, but it’s limited to predefined tones with no way to transpose.

Does someone know how to achieve midi generation and playback on Android?


Perhaps this Pragmatic Programmer thread might be of interest.


autoLink for map not working

I have the following TextView in my XML layout file:-


The string autolink_test contains a phone number, an email address, a website address and a physical geographical address.

While the first three are showing up correctly as clickable autolinks, the address does not. Only the zipcode part shows up as an autolink… and that too as a phone number! (When I click it, the phone dialer starts up with that number).

Any help would be appreciated.


OK, I figured out what was causing the problem. Just thought I will leave the answer here in case someone else runs into the same problem.

If the street address is not properly capitalized, it is not read properly as the address!

Here is my XML autolink_test string:

<string name="autolink_test">Name: New York Times n
   Email: n
   Phone: 212-556-7652 n
   Address: 620 Eighth Avenue New York, NY 10018  n
   Address: 620 Eighth avenue New York, NY 10018  n

The first address shows up correctly as an autolink. The second one (with a small ‘a’ in ‘avenue’) does not show up correctly.

This seems a little strange to me as the google maps website certainly doesn’t care about such niceties.

Anyways, so here it is 🙂


Preferred method to reload page with JavaScript? [closed]

which way to reload a current page (using a button) would you prefer?

1 <input type="button" value="Reload" onClick="history.go(0)">
2 <input type="button" value="Reload" onClick="location.reload(true)">
3 <input type="button" value="Reload" onClick="window.location.reload(true)">
4 <input type="button" value="Reload" onClick="window.location.href=window.location.href">
5 <input type="button" value="Reload" onClick="document.location.reload(true)">
6 <input type="button" value="Reload" onClick="document.location.href=document.location.href">

As the URL of the page changes frequently AFAIK a ‘fallback function’ like

<a href="urlOfCurrentPage.html" onclick="window.location.reload(true);return false;">Reload</a>

won’t work for me, right?


Depends on what you want to do. The fourth and sixth methods there won’t reload any form data, they essentially make a separate visit to the page. Some versions of Firefox also have issues with the third method. Other than that, I’d go with the fifth as a personal preference. It seems the clearest.

Source: stackoverflow
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Privacy Policy, and Copyright Policy. Content is available under CC BY-SA 3.0 unless otherwise noted. The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 © No Copyrights, All Questions are retrived from public domain..