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 [...]
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. [...]
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 |
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 [...]
This pieced of code, simple as it is, took me a long while to develop. I am not well versed in …
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 |