Monthly Archives: September 2005

Import Script, Import CSS, Import PHP

Just because sometimes I forget, here are some code fragments to import JavaScript, CSS, and PHP files.
JavaScript:

<script
type=’text/javascript’
src=’directory/file.js’>
</script>

CSS:

<style type=’text/css’ media=’all’>
@import ‘directory/file.css’;
</style>

Icon:

<link
rel=’Shortcut Icon’
href=’directory/file.ico’
type=’image/x-icon’>

PHP:

<?php @ require_once (’directory/file.html’); ?>

For the PHP import, by placing the @ symbol before require_once suppresses [...]

Posted in CSS, HTML/XML, JavaScript, PHP, TechKnow | Leave a comment

Hide Your HTML Source

Sometimes you might not want to allow guests to your website to view the HTML source code. You can disable the right click context menu by using the following bit of code in your page:

<body oncontextmenu=’return false;’>

You can use this feature to prevent users from right clicking and saving an image from your site. [...]

Posted in HTML/XML, JavaScript, TechKnow | Leave a comment

Delete Temporary Files on Exit

Sometimes your application requires holding data in a temporary file. I’ve had to do this when printing a PDF file. The following bit of code demonstrates how to create a temporary file and delete said file when the program terminates.

File temp = File.createTempFile("SomePrefix", ".pdf");
temp.deleteOnExit();

The file is created in the system’s temp directory, see [...]

Posted in Java, TechKnow | Leave a comment

Escape From XML

If you want to use a greater than sign (>) in an XML document you need to escape it. I once had to meticulously look over a 120 MB xml file that was generating a parsing exception, the cause of the exception, a greater than sign. Escape the following characters they are intended [...]

Posted in HTML/XML, TechKnow | Leave a comment

Default Printer

This pieced of code, simple as it is, took me a long while to develop. I am not well versed in …

Posted in TechKnow, Visual Basic | Leave a comment

Eclipse Tool Tip #1: Getters and Setters

Currently my favorite IDE is Eclipse 3.1.0. For this inaugural Eclipse Tool Tip, I will just mention a time saver of a feature. When creating a new JavaBean, start by defining the attributes. Once this is done, go to Source > Generate setters and getters. This will open a wizard to [...]

Posted in IDE, TechKnow | Leave a comment