Archive for the ‘1’ Category

It’s a common problem with no single right answer: extract the top domain (e.g. example.com) from a given string, which may or may not be a valid URL. I had need of such functionality recently and found answers around the web lacking. So if you ever “just wanted the domain name” out of a string, give this a shot…

<?php
function get_top_domain($url, $remove_subdomains = 'all') {
  $host = strtolower(parse_url($url, PHP_URL_HOST));
  if ($host == '') $host = $url;
  switch ($remove_subdomains) {
    case 'www':
      if (strpos($host, 'www.') === 0) {
        $host = substr($host, 4);
      }
      return $host;
    case 'all':
    default:
      if (substr_count($host, '.') > 1) {
        preg_match("/^.+\.([a-z0-9\.\-]+\.[a-z]{2,4})$/", $host, $host);
        if (isset($host[1])) {
          return $host[1];
        } else {
          // not a valid domain
          return false;
        }
      } else {
        return $host;
      }
    break;
  }
}// some examples
var_dump(get_top_domain('http://www.validurl.example.com/directory', 'all'));
var_dump(get_top_domain('http://www.validurl.example.com/directory', 'www'));
var_dump(get_top_domain('domain-string.example.com', 'all'));
var_dump(get_top_domain('domain-string.example.com/nowfails', 'all'));
var_dump(get_top_domain('finds the domain url.example.com', 'all'));
var_dump(get_top_domain('12.34.56.78', 'all'));
?>

Most of the examples are simply proofs, but I want to draw attention to the string in example #4, 'domain-string.example.com/nowfails'. This is not a valid URL, so the call to parse_url() fails, forcing the script to use the entire original string. In turn, the path part of the string causes the regex to break, causing a complete failout (return false;).

Is there a way to account for this? Surely, however I’m not about to tap that massive keg of exceptions (i.e. just a slash, slash plus path, slash plus another domain in a human-readable string, etc).

No regex for validating URL’s or email addresses is ever perfect; the “strict” RFC requirements are too damn broad. So I did what I always do: chose “what works” over “what’s technically right.” This one requires any 2-4 characters for a the top level domain (TLD), so it doesn’t allow for the .museum TLD, and doesn’t check to see if the provided TLD is actually valid. If you need to do further verification, that’s on you. Here’s the current full list of valid TLD’s provided by the IANA.

If you need to modify the regex at all, I highly recommend you read this article about email address regex first for two reasons:

  1. There’s a ton of overlap between email and URL regex matching
  2. It will point out all the gotcha’s in your “better” regex theory that you didn’t think about

http://www.eapmovies.com, while browsing I found this website,seems E.A.P Films and Theaters private limited has launched an online ticket booking site http://www.eapmovies.com.

null
(more…)

Firefox mobile hits the Nokia N810

Posted: April 30, 2009 in 1

Firefox mobile hits the Nokia N810

The much anticipated Firefox Mobile, AKA Fennec, has had its first beta release on the Nokia N810. And boy is it something. Packing plenty of familiar Firefox functionality, Fennec is already impressive, even though it’s only at beta 1. This release is designed for testing purposes only, according to the Mozilla site, and aims to get wider feedback on the user experience, get developer feedback and encourage existing add-on developers to port existing Firefox add-ons to Fennec – yep, Fennec supports add-ons.

Any regular Firefox user is well aware of the benefits of Firefox, but for those who aren’t, add-ons extend the functionality of Firefox and is particularly useful for web development (Nokia test the mobile version of Conversations using the Firefox user-agent add on).

(more…)

online file converter

Posted: April 15, 2009 in 1

Online File Converter


null

This site allows users to convert their files.

converts,
1. Documents, text
2. Archives
3. Movie
4. Image
5. Sound

converts files from,
1. Local File Conversion
2. Conversion From Url
3. File Hosting
4. Website Screenshot

also you can Send File to Mobile

media-convert.com/
zamzar.com/

NASAWorld Wind 1.4.0

Posted: April 12, 2009 in 1

NASAWorld Wind 1.4.0

World Wind is developed at NASA Ames Research Center by Chris Maxwell, Randy Kim, Tom Gaskins, Frank Kuehnel and project manager Patrick Hogan.

World Wind allows any user to zoom from satellite altitude into any place on Earth, leveraging high resolution LandSat imagery and SRTM elevation data to experience Earth in visually rich 3D, just as if they were really there.

Particular focus was put into the ease of usability so people of all ages can enjoy World Wind. All one needs to control World Wind is a two button mouse. Additional guides and features can be accessed though a simplified menu. Navigation is automated with single clicks of a mouse as well as the ability to type in any location and automatically zoom into it.

Using World Wind, you can continue to zoom past Blue Marble and reveal the extremely detailed seamless mosaic of LandSat 7 data.

LandSat 7 is a collection of images from 1999-2003 at an impressive 15 m per pixel resolution. It includes other color bands such as the infrared spectrum. Users will be able browse these different sets as they become available. Any changes and updates are automatically inherited by World Wind.

LandSat 7’s resolution makes it possible to see your own city, neighborhood, or landmarks in your vicinity. Seeing the whole globe like this puts the world in context with scientifically accurate data


DOWNLOAD

Apple i bangle

Posted: April 1, 2009 in 1

Apple i bangle


ibanfle

Apple Design new concept design for an Apple mp3 player. It is called the iBangle and it is unique as well as ground breaking. It’s no screen and it has some other really cool features.

You see that blue inner band? Push a tiny button on the side and it fills with air, expanding to fit snugly around your wrist.

Apple iBangle’s a multi-touch track pad for easy navigation, and the audio finds its way to your ears via a couple of wireless earbuds. Alas, there’s no screen, but designer Gopinath Prasana figures you can navigate just fine with an audio-oriented navigation system.

Ear buds with the annoying cords won’t be found here, as the audio is transmitted via wireless ear buds. There’s a multi-touch track pad for easy navigation. It also has a few additional buttons for music control. Although the iBangle doesn’t have a screen, designer Gopinath Prasana figures you can navigate just fine with it’s audio-oriented navigation system.

I-Bangle

I-Bangle

i bangle

i bangle

i bangle

i bangle

i bangle

i bangle

How to Create a CON folder in Windows?

Posted: March 27, 2009 in 1

How to Create a CON folder in Windows?

Can you create a folder named “con”, “prn”, “nul” “com1″ “com2″ “lpt1″ etc. in windows ?

The answer is NO and YES!

NO because create a new folder and try to rename it to any one of the above specified names, you know what happens! In Windows XP the folder name automatically changes back to “New Folder” no matter you try any number of times.Where as in Windows Vista when you try to rename the file you get an error message “The specified device name is invalid”.

What is the reason for this? Simple, these names represent the internal devices and hence we cannot create folders with the above names.

YES because it is still possible to create these folders using the command prompt.Heres the instructions to create it.

(more…)