DevSnips.com Code Snippet Repository
search:    


Navigation
  Home
About
Library
Contact
 
Snippet Library
  ColdFusion   338  
  ASP   201  
  PHP   101  
  HTML   11  
  JavaScript   77  
  XML   2  
  CSS   5  
  SQL   13  
  JSP   2  
  C#   1  
  ASP.NET   0  
  Submit a Code Snippet
 
Blog Archive
  September 2007
August 2007
July 2007
June 2007
May 2007
November 2006
October 2006
Search Archives
 
Random Affiliates
  BioMetric Base
Uno-Code
Tom Morris
PHP Arch

Want to become an affiliate?
Read more...


Privacy Policy
© 2008

Blog Archive

 
"Do you want to close this window?" IE 7 Fix

So I'm sure some of you out there have run into a problem where you want to close a Internet Explorer window (that wasn't created via script) and get the following IE warning "Do you want to close this window?".

I've run into this problem a few times in the past, specifically trying to close a browser window that was opened with target="_blank", etc. Today's problem was related to a client side Google Earth application where placemarks were going to open a window and play a movie. The problem is that Google Earth (not to be confused with Google Maps) does not support javascript within the placemark at this time. So to open a browser, size it and remove features (ie: toolbars, etc), I had to get crafty.

What I ended up doing in the end was create a relay script. Google Earth opens a new page (using target="_blank" in the HTML) which opens my relay script. That page, in turn, opens a 'sized' popup and closes the parent (relay script). Here is where the IE warning occurs. I first tested with IE6 and easily worked my way around it by using the following browser hack:

Read the full article >>


Submitted on 05/31/07 at 11:05AM
Post Comment | Comments: 0
Bookmark to:
Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add ' Add '


What books do I read?

The library is back in action! If anyone has any recommendations, please let me know and I'll get them in there. Most of the books in the library now are books that I have on my shelves now, or books that have helped in the past, that are worth recommending.

On those lines, I often get asked what books I have on my desk now, and 'why' do I still buy books since alot of the information is on the web any way (and books are commonly out of date with the speed of technology and methologies growing on a daily basis).

First question: "What books do I have on my desk now".
Well, I'm way into AJaX (Asynchronus Javascript and XML) lately, and with the movement of Web2.0, interactive web applications acting like software apps is the hot style right now. So I have two books with coffee ring stains..

Professional Ajax (Wrox) - Zakas, McPeak, Fawcett
Bruce Perry's Ajax Hacks (O'Reilly)

Read the full article >>


Submitted on 05/25/07 at 10:31AM
Post Comment | Comments: 0
Bookmark to:
Add 'What books do I read?' to Del.icio.us Add 'What books do I read?' to digg Add 'What books do I read?' to FURL Add 'What books do I read?' to blinklist Add 'What books do I read?' to reddit Add 'What books do I read?' to Feed Me Links Add 'What books do I read?' to Technorati Add 'What books do I read?' to Yahoo My Web Add 'What books do I read?' to Newsvine Add 'What books do I read?' to Socializer Add 'What books do I read?' to Ma.gnolia Add 'What books do I read?' to Stumble Upon Add 'What books do I read?' to Google Bookmarks Add 'What books do I read?' to RawSugar Add 'What books do I read?' to Squidoo Add 'What books do I read?' to Spurl Add 'What books do I read?' to BlinkBits Add 'What books do I read?' to Netvouz Add 'What books do I read?' to Rojo Add 'What books do I read?' to Blogmarks Add 'What books do I read?' to Shadows Add 'What books do I read?' to Simpy Add 'What books do I read?' to Co.mments Add 'What books do I read?' to Scuttle


SoloSEO - Search Engine Optimization Tools!

With this sponsored post I would like to talk about SoloSEO seo software which gives you a suite of web based tools to manage and optimize your SEO (Search Engine Optimization).

Over the years I've seen various tools to generate keywords, etc. and I never really see anything that pushes it up a notch. Generating good PR (page rank), you need a few things in place. Keywords, backlinks, rich content are just a few ingredients in the pie to make a site successful.

Read the full article >>


Submitted on 05/24/07 at 11:47AM
Post Comment | Read | Comments: 1
Bookmark to:
Add 'SoloSEO - Search Engine Optimization Tools!' to Del.icio.us Add 'SoloSEO - Search Engine Optimization Tools!' to digg Add 'SoloSEO - Search Engine Optimization Tools!' to FURL Add 'SoloSEO - Search Engine Optimization Tools!' to blinklist Add 'SoloSEO - Search Engine Optimization Tools!' to reddit Add 'SoloSEO - Search Engine Optimization Tools!' to Feed Me Links Add 'SoloSEO - Search Engine Optimization Tools!' to Technorati Add 'SoloSEO - Search Engine Optimization Tools!' to Yahoo My Web Add 'SoloSEO - Search Engine Optimization Tools!' to Newsvine Add 'SoloSEO - Search Engine Optimization Tools!' to Socializer Add 'SoloSEO - Search Engine Optimization Tools!' to Ma.gnolia Add 'SoloSEO - Search Engine Optimization Tools!' to Stumble Upon Add 'SoloSEO - Search Engine Optimization Tools!' to Google Bookmarks Add 'SoloSEO - Search Engine Optimization Tools!' to RawSugar Add 'SoloSEO - Search Engine Optimization Tools!' to Squidoo Add 'SoloSEO - Search Engine Optimization Tools!' to Spurl Add 'SoloSEO - Search Engine Optimization Tools!' to BlinkBits Add 'SoloSEO - Search Engine Optimization Tools!' to Netvouz Add 'SoloSEO - Search Engine Optimization Tools!' to Rojo Add 'SoloSEO - Search Engine Optimization Tools!' to Blogmarks Add 'SoloSEO - Search Engine Optimization Tools!' to Shadows Add 'SoloSEO - Search Engine Optimization Tools!' to Simpy Add 'SoloSEO - Search Engine Optimization Tools!' to Co.mments Add 'SoloSEO - Search Engine Optimization Tools!' to Scuttle


Understand your server environment to maximize your programming skills and security

Throughout my years of programming, I've often seen two camps, the programmer and the server administrator. Often these two camps don't see eye to eye and difficulties can arise. This is mainly due to a lack of understanding between the two departments. The server administrator does not see the scope of completing the job for a demanding client, and the programmer does not see potential issues with misconfigured and poorly programmed applications being introduced to a server, where other services could be heavily impacted. I almost believe they focus on the opposite, and in reality, we as programmers, should be really viewing their priorities, since we all want to have secure applications in the end.

As a programmer, I see great benefit learning the environment where your application will reside. Over the last few years I've been heavily involved Linux server administration. My application have been mainly written to use the LAMP environment (Linux Apache Mysql Php). Because of this, I thought becoming fluent in Linux administration could help bridge the gap between myself and server administrators, since a majority of my clients use Linux servers.

Read the full article >>


Submitted on 05/22/07 at 11:31PM
Post Comment | Comments: 0
Bookmark to:
Add 'Understand your server environment to maximize your programming skills and security' to Del.icio.us Add 'Understand your server environment to maximize your programming skills and security' to digg Add 'Understand your server environment to maximize your programming skills and security' to FURL Add 'Understand your server environment to maximize your programming skills and security' to blinklist Add 'Understand your server environment to maximize your programming skills and security' to reddit Add 'Understand your server environment to maximize your programming skills and security' to Feed Me Links Add 'Understand your server environment to maximize your programming skills and security' to Technorati Add 'Understand your server environment to maximize your programming skills and security' to Yahoo My Web Add 'Understand your server environment to maximize your programming skills and security' to Newsvine Add 'Understand your server environment to maximize your programming skills and security' to Socializer Add 'Understand your server environment to maximize your programming skills and security' to Ma.gnolia Add 'Understand your server environment to maximize your programming skills and security' to Stumble Upon Add 'Understand your server environment to maximize your programming skills and security' to Google Bookmarks Add 'Understand your server environment to maximize your programming skills and security' to RawSugar Add 'Understand your server environment to maximize your programming skills and security' to Squidoo Add 'Understand your server environment to maximize your programming skills and security' to Spurl Add 'Understand your server environment to maximize your programming skills and security' to BlinkBits Add 'Understand your server environment to maximize your programming skills and security' to Netvouz Add 'Understand your server environment to maximize your programming skills and security' to Rojo Add 'Understand your server environment to maximize your programming skills and security' to Blogmarks Add 'Understand your server environment to maximize your programming skills and security' to Shadows Add 'Understand your server environment to maximize your programming skills and security' to Simpy Add 'Understand your server environment to maximize your programming skills and security' to Co.mments Add 'Understand your server environment to maximize your programming skills and security' to Scuttle


PHP and GD for generating and cropping avatars

Since I'm still on a major GD kick, I wanted to talk about a new trick that I'm using to generate avatars on the fly. This technique uses a single file, crops that image to be centered (left/right) and outputs a square avatar at set dimensions. Since this is using GD, we're actually creating the image and not simply resizing it via the img tag.

I'm using two custom user defined functions (resizeToMin() and getImageType()) to help with the calculations on the dimension and the file types. getImageType uses the exif extension of PHP, so you'll need to be sure that you have exif support built in. This may require a re-compile of PHP. If you do not wish to use exif (shame on you), you can handle type based off of the file extension, but there might be security issues related to that... or at the very least, possible error issues.

The reason I want to determine file type is to know which functions to call, since functions are specific to jpg or gif, etc (for example: imagejpeg() vs imagegif()) .

Read the full article >>


Submitted on 05/18/07 at 3:54PM
Post Comment | Comments: 0
Bookmark to:
Add 'PHP and GD for generating and cropping avatars' to Del.icio.us Add 'PHP and GD for generating and cropping avatars' to digg Add 'PHP and GD for generating and cropping avatars' to FURL Add 'PHP and GD for generating and cropping avatars' to blinklist Add 'PHP and GD for generating and cropping avatars' to reddit Add 'PHP and GD for generating and cropping avatars' to Feed Me Links Add 'PHP and GD for generating and cropping avatars' to Technorati Add 'PHP and GD for generating and cropping avatars' to Yahoo My Web Add 'PHP and GD for generating and cropping avatars' to Newsvine Add 'PHP and GD for generating and cropping avatars' to Socializer Add 'PHP and GD for generating and cropping avatars' to Ma.gnolia Add 'PHP and GD for generating and cropping avatars' to Stumble Upon Add 'PHP and GD for generating and cropping avatars' to Google Bookmarks Add 'PHP and GD for generating and cropping avatars' to RawSugar Add 'PHP and GD for generating and cropping avatars' to Squidoo Add 'PHP and GD for generating and cropping avatars' to Spurl Add 'PHP and GD for generating and cropping avatars' to BlinkBits Add 'PHP and GD for generating and cropping avatars' to Netvouz Add 'PHP and GD for generating and cropping avatars' to Rojo Add 'PHP and GD for generating and cropping avatars' to Blogmarks Add 'PHP and GD for generating and cropping avatars' to Shadows Add 'PHP and GD for generating and cropping avatars' to Simpy Add 'PHP and GD for generating and cropping avatars' to Co.mments Add 'PHP and GD for generating and cropping avatars' to Scuttle


Platinax Business Form -- Resource for Webmasters

With this sponsored post, I would like to talk about Platinax and their Business Forum . Now, what does a business forum have to do with the programming and code repository / how-to site? Simple, this business forum covers various aspects of internet business ranging from start-ups to web hosting and design/coding and could be extremely beneficial to the coders out there.

I like to think of coders in two different camps. The first camps are programmers that work for various corporations and business doing web development and such. The other set of coders are individuals with their own start-ups that are trying to make it on their own on the internet arena. Regardless of what camp you are in you could benefit from learning new techniques to promote yourself or your clients.

Read the full article >>


Submitted on 05/17/07 at 12:46AM
Post Comment | Comments: 0
Bookmark to:
Add 'Platinax Business Form -- Resource for Webmasters' to Del.icio.us Add 'Platinax Business Form -- Resource for Webmasters' to digg Add 'Platinax Business Form -- Resource for Webmasters' to FURL Add 'Platinax Business Form -- Resource for Webmasters' to blinklist Add 'Platinax Business Form -- Resource for Webmasters' to reddit Add 'Platinax Business Form -- Resource for Webmasters' to Feed Me Links Add 'Platinax Business Form -- Resource for Webmasters' to Technorati Add 'Platinax Business Form -- Resource for Webmasters' to Yahoo My Web Add 'Platinax Business Form -- Resource for Webmasters' to Newsvine Add 'Platinax Business Form -- Resource for Webmasters' to Socializer Add 'Platinax Business Form -- Resource for Webmasters' to Ma.gnolia Add 'Platinax Business Form -- Resource for Webmasters' to Stumble Upon Add 'Platinax Business Form -- Resource for Webmasters' to Google Bookmarks Add 'Platinax Business Form -- Resource for Webmasters' to RawSugar Add 'Platinax Business Form -- Resource for Webmasters' to Squidoo Add 'Platinax Business Form -- Resource for Webmasters' to Spurl Add 'Platinax Business Form -- Resource for Webmasters' to BlinkBits Add 'Platinax Business Form -- Resource for Webmasters' to Netvouz Add 'Platinax Business Form -- Resource for Webmasters' to Rojo Add 'Platinax Business Form -- Resource for Webmasters' to Blogmarks Add 'Platinax Business Form -- Resource for Webmasters' to Shadows Add 'Platinax Business Form -- Resource for Webmasters' to Simpy Add 'Platinax Business Form -- Resource for Webmasters' to Co.mments Add 'Platinax Business Form -- Resource for Webmasters' to Scuttle


Overlay text using PHP and GD

Today I would like to discuss using the GD library to render text on top of existing images. This could be nicely applied for customized error messages or watermarking your existing image 'on-the-fly'.

The GD Library is a open source library for the dynamic creation of images by programmers. You must first ensure that your PHP has support for the GD library. Depending on your situation or environment, you may need to rebuild/recompile PHP with --with-gd in your configuration flags. It might also be useful to compile with --with-exif as well. Exif extension you will be able to read stored header information in the graphic file. Since this example is using text overlay, you'll need to ensure that your PHP also has freetype support built in (--with-freetype-dir=/usr).

For more information on GD and PHP with GD please check out the links below: http://libgd.org/Main_Page
http://us.php.net/manual/en/ref.image.php

Read the full article >>


Submitted on 05/14/07 at 12:31AM
Post Comment | Comments: 0
Bookmark to:
Add 'Overlay text using PHP and GD' to Del.icio.us Add 'Overlay text using PHP and GD' to digg Add 'Overlay text using PHP and GD' to FURL Add 'Overlay text using PHP and GD' to blinklist Add 'Overlay text using PHP and GD' to reddit Add 'Overlay text using PHP and GD' to Feed Me Links Add 'Overlay text using PHP and GD' to Technorati Add 'Overlay text using PHP and GD' to Yahoo My Web Add 'Overlay text using PHP and GD' to Newsvine Add 'Overlay text using PHP and GD' to Socializer Add 'Overlay text using PHP and GD' to Ma.gnolia Add 'Overlay text using PHP and GD' to Stumble Upon Add 'Overlay text using PHP and GD' to Google Bookmarks Add 'Overlay text using PHP and GD' to RawSugar Add 'Overlay text using PHP and GD' to Squidoo Add 'Overlay text using PHP and GD' to Spurl Add 'Overlay text using PHP and GD' to BlinkBits Add 'Overlay text using PHP and GD' to Netvouz Add 'Overlay text using PHP and GD' to Rojo Add 'Overlay text using PHP and GD' to Blogmarks Add 'Overlay text using PHP and GD' to Shadows Add 'Overlay text using PHP and GD' to Simpy Add 'Overlay text using PHP and GD' to Co.mments Add 'Overlay text using PHP and GD' to Scuttle