Archive Page 2
Google has a currency conversion feature built in to its search, all you have to do is search for 100 GBP in USD, for example, to convert £100 (UK Pounds Sterling) to US Dollars. If you don’t know the acronym for the currency you’re converting to then don’t worry as you can also do conversions with a search like 100 USD in Czech money, if you were planning a trip to the Czech Republic.
If you have a low-traffic website, consider joining the Money4Banners advertising network. They will pay you £10 + £5 each month for displaying a small advert on three of your pages, regardless of traffic. American webmasters are welcome, and since £10 == $20, you make more!
Save Embedded Media and Other Files in Firefox
0 Comments Published 2 years, 6 months ago in FirefoxThere’s a Firefox extension that allows you to easily save files which are embedded in a webpage, such as windows media files.
Download Embedded does exactly what it sounds like it does. It adds a right-click context menu entry to download all embedded files on a webpage. Its great for grabbing embedded flash animations, movies, music, etc., and a lot easier than digging through the page source or through Firefox’s Page Info.
Download Embedded makes the process simple. My previous technique was to find the URL for the embedded media in the Adblock extension’s ‘Blockable Items’ list.
I’m not sure how long this has been there (a while now; I’m imporing this from an old blog of mine), but Google has added a filter on its Advanced Search page which allows you to filter search results by the license that content on a website is released under, which would be useful, for example, if you are looking for content which you can republish on your page.

What I’ve always found useful since I started using Windows is to add notepad to the “Send To” menu, which is available when you right click on any file in Windows. This means that if you come across a text file with an extension which is not associated with Notepad then you can open it in Notepad quickly and easily.

To do this on your computer:
- Browse to your "SendTo" folder - this is a folder which contains shortcuts which appear in the Send To Menu.
Your user folder is located at:
C:\Documents and Settings\<username>\SendTo
eg, mine is: C:\Documents and Settings\Steven\SendTo - Right click somewhere in this folder, then from the right click menu, select New -> Shortcut.
- As the location of the item, enter "Notepad" (without the quotes) then Windows will figure out the correct path to it. Alternatively you can enter the full path to it; if your Windows directory is C:\Windows then the full path to notepad will be c:\windows\system32\notepad.exe
- As the name of the shortcut type whatever you want to see appearing in the "Send To" menu - I chose NotePad above.
- When you click ‘Finish’ then you should see the shortcut you’ve just created appearing in the" Send To" menu
How to stop .avi files from locking up in Windows Explorer
1 Comment Published 2 years, 6 months ago in Tips and WindowsIf you’ve downloaded a corrupt .avi file in Windows then you may have noticed that if you try to delete, rename or move it that explorer complains that the file is in use. This is because Windows is trying to load the whole file to generate a preview image for you. You can turn this preview off by doing the following:
- Open the ‘Run’ dialog box from the start menu (Start->Run or press the Windows and r keys together):
- To remove image preview, type and hit enter
regsvr32 /u shimgvw.dll - To readd image preview, type and hit enter
regsvr32 shimgvw.dll - To remove media preview, type and hit enter
regsvr32 /u shmedia.dll - To readd media preview, type and hit enter
regsvr32 shmedia.dll
Note: I found this information copy+pasted on a forum a while ago and I don’t know the original source.
Output redirection to a file from the Windows Command Line
2 Comments Published 2 years, 6 months ago in Tips and WindowsThis tip will show you how to write the output of a command at the Windows command line to a file. It’s not hard (infact it’s one of the very basics of command line programming).
Start Command Line within Windows by choosing Start->Run then entering ‘cmd’ and pressing enter.
Suppose you want to capture the output from a directory listing, say c:\blah. To get the directory listing to display on the screen you would type the command dir c:\blah which may generate the output:
C:\>dir c:\blah
Volume in drive C is Windows
Volume Serial Number is XXXX-YYYYDirectory of c:\blah
07/01/2006 21:08 <DIR> .
07/01/2006 21:08 <DIR> ..
07/01/2006 21:07 <DIR> folder1
07/01/2006 21:07 <DIR> folder2
06/03/2005 11:58 5,442,634 music.mp3
07/01/2006 21:07 17 text1.txt
2 File(s) 5,442,651 bytes
4 Dir(s) 12,453,460,480 bytes free
If you want to capture this listing to the file c:\folder.txt then you would append > c:\folder.txt to the original command, ie:
C:\>dir c:\blah > c:\folder.txt
Notice now that nothing appears on the command line window after this and it simply moves on to the next prompt. If we now check the file c:\folder.txt then we see that it has the contents of the directory.
A slight variant of this is to use the greater than symbol, >, twice, ie:
C:\>dir c:\blah >> c:\folder.txt
This will append the output of the dir command to what is already contained in the file c:\folder.txt.
How to use PHP in pages with a .html extension (or any other)
5 Comments Published 2 years, 6 months ago in Basics and PHPTo be able to use php code on a page with an extension other than .php, you need a server which supports .htaccess files.
To add an extension to be parsed for php, create or edit a file called .htaccess (with the dot first) containing the following line:
AddType application/x-httpd-php .html .moo .htm
This tells the server to check for php code and execute it in files with extensions .html, .moo or .htm. So upload that .htaccess file in the same folder as your .html files with PHP code inside them (using PHP tags: <?php ... ?>) then when you view them in the browser, the PHP should be dealt with as you’d expect from a PHP page.
The Difference Between require() and include()
6 Comments Published 2 years, 6 months ago in Basics and PHPThe key difference between require() and include() is that if you require() a file that can't be loaded (eg if it isn't there) then it generates a fatal error which will halt the execution of the page completely, and no more output will be generated. On the other hand, if you include() a file that can't be loaded, then this will merely generate a warning and continue building the page.
What one you should use depends on the situation; require() is best suited for loading files that are essential to the rest of the page - for example if you have a database driven website then using require() to include a file containing the database login and password is clearly preferred over using include(). If you used include() in this situation, then you may end up generating more warnings and errors than you had intended.
include() should be used when it isn't essential for that file to be loaded to execute the page. This is best used in situations where the file isn't essential to the processing of the page (for example a footer file), so if the file isn't present then the user can still view the site. You should, of course, make sure that all files you include() and require() are going to be available.
In PHP versions prior to 4.0.2. there was slightly different behaviour of require(). If you used a require() statement in an if block then the require() statement will always make sure that the file you're require()ing is readable, regardless of whether the condition was true for that if block to be processed. This is best illustrated with the following code example:
-
<?PHP
-
$a = 1;
-
if($a == 2) {
-
require("header.php");
-
}
-
?>
In this example, PHP versions before 4.0.2. will always make sure that header.php is available, but it will only actually execute the contents of it if $a is equal to 2.
From php.net:
Note: Prior to PHP 4.0.2, the following applies: require() will always attempt to read the target file, even if the line it's on never executes. The conditional statement won't affect require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed. Similarly, looping structures do not affect the behaviour of require(). Although the code contained in the target file is still subject to the loop, the require() itself happens only once.
Search
About
You are currently browsing the DiscoMoose weblog archives.
Categories
- ASP (3)
- ASP Basics (3)
- Blogs (2)
- C# (1)
- Firefox (1)
- Flash (1)
- Google (6)
- Hacks (3)
- Java (1)
- PHP (12)
- Basics (8)
- Files (1)
- Image Handling (3)
- Puzzles (1)
- Ruby (1)
- Tips (10)
- Web Hosting (3)
- Web Hosting Articles (1)
- Web Hosting News (2)
- Windows (6)
- Wordpress (2)
Latest
- Brainteaser: Which letter comes next?
- Hacking the translation plugin for nicer URLs
- How to Access a Page in Google’s Cache
- How to Control the Mouse Pointer Without a Mouse in Windows XP
- Use Google to define words
- List all processes with the Windows Command Line
- Kill a Process from the Windows Command Line
- Google: Search within a site
- Google Currency Conversion
- Save Embedded Media and Other Files in Firefox
Archives
Categories
- ASP (3)
- ASP Basics (3)
- Basics (8)
- Blogs (2)
- C# (1)
- Files (1)
- Firefox (1)
- Flash (1)
- Google (6)
- Hacks (3)
- Image Handling (3)
- Java (1)
- PHP (12)
- Puzzles (1)
- Ruby (1)
- Tips (10)
- Web Hosting (3)
- Web Hosting Articles (1)
- Web Hosting News (2)
- Windows (6)
- Wordpress (2)
