Calculating parallel resistances

Problem: Parallel resistances can be are hard to understand because your dealing with a ratio not a sum. If you had two 10 ohm resistors connected in parallel, the total resistance accross the two would be 5ohms – this much is fairly easy to grasp because both resistors would share the current equally. But as soon as the values are different, each resistor handles a different share of the current.

Solution: To work out the total resistance accross 2 or more resistors connected in parallel you need this formula:

Rtotal = 1 / ( (1/R1) + (1/R2) + (1/Rn) )

Note: (1/Rn) is repeated for each additional resistor in parallel, so for 4 resistors the formula would be:

Rtotal = 1 / ( (1/R1) + (1/R2) + (1/R3) + (1/R4) )

Example: The other day I was asked if an engine temperature sender could be wired in parallel to a resistor to make a miss-matched temperature gauge read properly (short answer: NO). So lets substitute some real world values from this example problem to see how the above formula works:
R1 is the resistance of the sender at a given temp, R2 is the resistor to be used in parallel. So substitute 400ohms for R1 and (for arguments sake) 39ohms for R2:

1) Rtotal = 1 / ( (1/400) + (1/39) )
2) Rtotal = 1 / ( (0.0025) + (0.0256) )
3) Rtotal = 1 / 0.0281
4) Rtotal = 35.6 ohms

If you play about with some values you’ll soon notice two things:
– Rtotal will never be higher than the smallest Resistor used. i.e with setup above, no matter what resistance the sender reads, Rtotal will never be over 39ohms.
– Rtotal will always be at most half of the value of the highest resistor used. With above info, whatever you choose for R2, Rtotal will always be 200ohms or less.

This could get complicated if we go into WHY the person wanted to change the working range of the sender. This post if just intended to give a real world example of parallel resistance. Please question, correct or comment below if you want 🙂

Was this useful? I’d like to know with a click/tap on a thumb: Nope, not helpful...Yep, more useful than not! (No Ratings Yet)

Moving VirtueMart: Link path problem in admin console

Problem: Just now, I needed to move a website running Joomla 1.5 and VirtueMart 1.1.2 from the development server, to the live web space. After I had moved the data, and the files, and updated the path in Joomla’s ‘configuration.php’ file, it seemed to work ok, but all the links in the VirtueMart Admin area still pointed to my development server.

Fix: After doing a ‘find in files’ for my development server’s name, I found two more paths that need changing in VirtueMart’s own configuration file. This is the file:


The following two paths need editing to point to the new server location (URL):

define( 'URL', '' );
define( 'SECUREURL', '' );

A simple fix, but probably worth posting.

Select template by Section in Joomla 1.5

Problem: In Joomla 1.5, at present, there is no way to set the template applied to an article or category  based on the section that article is in. Templates can be set by menu item, but not by the overall section they reside in. This means that if multiple templates are being used, each time a new article is added, changes have to be made to the template setup too – very tedious. All I wanted was to be able to create an article or category, add it to a certain section, and know that it would be rendered/displayed using a particular template:

Fix: This took some searching and tweaking. I found a post in the Joomla developers forum about someone trying to do something similar, but their example code was broken. It was enough to get me started though.

What you need to do is: find and open application.php in the includes directory on the root of your Joomla 1.5 installation. Then find line 309 or thereabouts and look for this code:

// Allows for overriding the active template from the request
$template = JRequest::getCmd('template', $template);
$template = JFilterInput::clean($template, 'cmd'); // need to filter the default value as well

Insert AFTER the comment on line 309, but BEFORE line 310, add this code:

// Templates by Section hack - Begin
$eItemView = JRequest::getVar('view');
$eItemId = JRequest::getVar('id');
$sectionId = NULL;
$eItemId = (strpos($eItemId,":"))? substr($eItemId,0,strpos($eItemId,":")) : $eItemId;
switch ($eItemView) {
case "article":
$edb =& JFactory::getDBO();
$eQuery = 'SELECT sectionid FROM #__content WHERE id LIKE '.$eItemId.'';
$edb->setQuery($eQuery, 0, 1);
$sectionId = $edb->loadResult();
case "category":
$edb =& JFactory::getDBO();
$eQuery = 'SELECT section FROM #__categories WHERE id LIKE '.$eItemId.'';
$edb->setQuery($eQuery, 0, 1);
$sectionId = $edb->loadResult();
case "section":
$sectionId = $eItemId;
// Edit the section id below, you can find it in the sections admin area.
if ($sectionId == "1") {
$template = "rhuk_milkyway_red"; // Use the full template name.
// Add more if clauses if there are other templates.
// Templates by Section hack - End

Hopefully you can see what this does. It looks for the section id to use in 3 ways, depending on whether joomla is currently displaying a section root page, a category root page, or an article. It then looks to see whether that section id has had a specific template specified for it by name.

This hack works well for me, I only need to add the different template data once in application.php for a given site. Ideally someone needs to make an admin mod for this, so that sections and categories can be assigned different templates in the backend. Maybe one day I’ll make one, but not unless there’s demand 🙂

Any questions, corrections or thoughts, please comment below (no need to create an account or anything!)

Launch Google Chrome in ‘Incognito’ mode from a shortcut

Niggle: I use Google Chrome’s Incognito window mode regularly to view multiple Google Analytics accounts at the same time on one PC. It’s very useful – it means I don’t have to keep signing in and out of my primary google account – but what annoyed me each time was having to open chrome, then open a new ‘incognito’ window from there, which leaves the old ‘normal’ window open in the background.

Solution: Since Chrome came out of beta, the ‘−−incognito’ command line switch has been available.

So, to get this switch working with a short cut, do the following:

  • Copy the existing Chrome shortcut in your quicklaunch bar, desktop, or start menu.
  • Rename the shortcut to something obvious, I called mine “Chrome Incognito”.
  • Right click on the shortcut, and select ‘properties’.
  • The Properties window opens, and you can select the ‘Shortcut’ tab as shown below:
Chrome Icon Shortcut properties
Chrome Icon Shortcut properties

Note the ‘Target’ path field

  • In the ‘Target:’ field, add the switch ‘ −−incognito’ to the end of the target path, as shown below:
Chrome incognito target path
Chrome incognito target path

incognito ‘Switch’ added to target path

  • Click ‘OK’ to save your changes.

There, all done, that shortcut will now open Chrome in incognito mode window. If you have other normal chrome windows open, they will not be effected by this window. For example, you can stay logged into a google account, a live account, or any other persistent cookie/session driven system. Incognito windows are also great for logging into online banking sites if you’re a bit paranoid.

Note: If you have a 0.* version you will need to upgrade to v1.* or higher.

Unable to Subscribe to Podcasts in iTunes store – Greyed Out Buttons?

Problem: You can’t subscribe to any Podcasts in iTunes music store because the the buttons are greyed out. An example is shown below:

Greyed subscribe button
Greyed subscribe button

Fix:This happens when the ‘Podcasts’ item is not enabled in the iTunes library. To enable it, follow these steps:

  1. Open the iTunes Preferences. To do this, either press ‘Ctrl+,’ (that’s the control key, and the comma key at the same time); or Go to ‘Edit’ in the top menu, and then ‘Preferences’.
  2. Select the ‘General’ tab, usually on the left most.
  3. Tick the ‘Podcasts’ item in the ‘Show:’ options list (highlighted below):
Select the Podcasts checkbox
Select the Podcasts checkbox

Once you say ‘Ok’ to the Preferences box, the ‘Podcasts’ item should appear in the top-left-hand side of the iTunes window. If you now view links to podcasts in the iTunes Store, they should be clickable.

If you have any corrections or alternative solutions to this problem, please leave a comment!

Please let me know if this post was useful with a click!
Nope, not helpful...Yep, more useful than not! (No Ratings Yet)

How to enable FLV file playback in IIS 6

Problem: This one crops up every-so-often, and a colleague just asked me again, so it’s probably worth posting. When an FLV is loaded into a Flash app, the FLV file is ‘played’ when the SWF or Projector is run. When this is done locally – i.e. you run an SWF from your hard drive, or file server – it’ll work fine. The problem comes when you upload it to your IIS web server. The server probably won’t recognise the ‘.flv’ filetype, so it’ll display nothing.

Solution: To make your IIS 6 web server aware of FLV files, do the following:

  • Open ‘IIS Manager’.
  • Right click on your site in ‘Web Sites’, and select ‘Properties’.
  • Choose the ‘HTTP Headers’ tab.
  • Click the ‘MIME Types…’  button on the bottom-right.
  • Click ‘New…’ and then add ‘.flv’ and ‘video/x-flv’ as shown below:
Setting FLV Mime type in IIS site properties
Setting FLV Mime type in IIS site properties
  • ‘Ok’ your way out, and ‘Apply’ when needed.
  • Your video should now play in a browser when embed in an SWF.
Note: You might have to stop and start ISS, but I didn’t when I added the Mime type a few hours ago.
Questions? Please leave a comment…

Please let me know if this post was useful with a click!
Nope, not helpful...Yep, more useful than not! (No Ratings Yet)

Textpad Regular Expressions

TextPad is a great editor, been using it for years, but never really used it to it’s full potential. Recently I needed to do some find/replace work in some huge SQL and CSV files – huge enough to make manual editing impossible – so I had to start using Textpad’s Regular Expression capabilities.

Here are a few expressions that came in handy. I intend to add to this list as time goes on.
Regexp shown in Green, my comments in Red:

CSV Editing:

Remove spaces and tab characters at the beginning of a line:
Find what: <span style="color: #008000;">^[ t]+</span>
Replace With: <span style="color: #ff0000;">don't enter anything in the field</span>

Remove spaces and tab characters at the end of a line:
Find what: <span style="color: #008000;">[ t]+$</span>
Replace With: <span style="color: #ff0000;">don't enter anything in the field</span>

Add “Hello” to the beginning of every line:
Find what: <span style="color: #008000;">(^.*)</span>
Replace With: <span style="color: #008000;">Hello 1</span>

Add “Hello ” to the beginning and ” World” to the end of every line:
Find what: <span style="color: #008000;">(^.*)</span>
Replace With: <span style="color: #008000;">Hello 1 World</span> <span style="color: #ff0000;">(watch the spaces)</span>

Find empty fields (i.e. “, ,”) with spaces or tabs in, and replace with empty field (“,,”):
Find what: <span style="color: #008000;">,[ t*],</span>
Replace With: <span style="color: #008000;">,,</span> <span style="color: #ff0000;">(just that, nothing else, just 2 commas)</span>

Remove blank lines in a text file, by searching for two linebreaks next to each other, and replacing with one:
Find what: <span style="color: #008000;">nn</span>
Replace With: <span style="color: #008000;">n</span>

Replacement Expressions:

Extract email addresses only from the following text: “Joe Blogs (”
This expression searches for 2 tagged expressions, firstly any printable characters including spaces up to the first open bracket symbol, secondly anything between the brackets. It then replaces the whole line with the second match.
Find what: <span style="color: #008000;">^([[:graph:] ]+)(([[:graph:] ]+))</span>
Replace With: <span style="color: #008000;">2</span>

Submitted by Paul: “Here’s how to convert csv to xml with a (quite large) regexp you can alter/extend for your needs.”
Find what: <span style="color: #008000;">^"([[:print:]]+)","([[:print:]]+)","([[:print:]]+)"</span>
Replace With: <span style="color: #008000;">123</span>


  • The expressions above need the ‘Regular Expression’ condition to be ticked in the Find or Replace dialogue boxes for them to work.
  • Text pad needs to be set to use UNIX not POSIX style expressions. To set this, open ‘Configure > Preferences’ (Ctrl+Q,P), find the ‘Editor’ settings, and untick the ‘Use POSIX regular expression syntax’ box.

Please let me know if this post was useful with a click!
Nope, not helpful...Yep, more useful than not! - +27 thumb, 29 overall.

Centre and float a div over page content with CSS – no hacks, cross browser


If you need to center a div (or any another block element) over the rest of the content in a page, and you need it to be cross-browser and valid (CSS and XHTML)…


Try the following CSS in your stylesheet or page head:

#cdiv {
  position:absolute; /* important. */
  left:50%; /*important if you want it absolutely centred in window. */ 
  margin-left:-50px; /* importnant. must be half the width. */
  width:100px; /* set to your requirements, but remember left margin setting. */
  height:100px; /* not neccessary if the element needs to grow with content. */
  border:1px solid #ABF; /* not important. */
  background-color:#DDF; /* not important. */
  text-align:center; /*not important. */

… and now set the ID of the element you want centered to ‘cdiv’. If the item you want to centre is an image, remember to add display:block; to the style (this makes it act like a block level element).

This style works perfectly (by my testing, but I’m not perfect) on:

  • Internet Explorer 6, 7 & 8+
  • Firefox 2.*+
  • Opera 8 & 9+
  • Google Chrome (all versions)
  • Safari (Mac and PC versions)
  • Netscape 9 (is anyone still using this?)
Any problems, please post a question or comment below.

Please let me know if this post was useful with a click!
Nope, not helpful...Yep, more useful than not! (No Ratings Yet)

Removing paper gasket residue from engine surfaces


I recently replaced the water pump on my car, and found the existing paper gasket clinging solidly to the pump face on the head. I needed a very quick removal method, as it was getting dark and the car had to be driven 30 minutes later, so I searched around for something hard, flat, but not likely to damage the surface. I found an old Stanley knife blade and tried it, but it wasn’t very easy to hold while scraping the papery crap off.


In the end I found a blunt hacksaw blade, snipped it in half with some tin-snips – making sure the cut was flat and neat – and ground off the teeth on the chopped-off end. This gave me a very hard, flat tool with which to scrape the paper off.  The ‘half-blade’ could be held in both hands at a good angle to avoid scoring the gasket face. Soaking the gasket paper residue in some detergent helped the process along also. 5 mins of careful scraping around the 3 studs saw the job done. New gasket and pump fitted in another 5 mins, jobs-a-good’un!

Please let me know if this post was useful with a click!
Nope, not helpful...Yep, more useful than not! (No Ratings Yet)

Vista Driver for HP Photosmart 1215…


Yesterday my father-in-law needed to hook his old HP Photosmart 1215 Inkjet to Windows Vista Home Edition. HP don’t provide a Vista driver for the 1215…


A quick search around the web found that the driver for the Photosmart 7200 works perfectly. He tried it and says it works exactly as it should.

To install the diver use the following steps:

  1. Click the ‘Start’ Icon, and select ‘Control Panel’ in the start menu.
  2. Once the Control Panel window opens, double-click the ‘Printers’ icon.
  3. In the ‘Printers’ window, click the ‘Add a printer’ icon/link in the top menu bar.
  4. In the ‘Add Printer’ dialog window, select ‘Local Printer’ and ‘Next’.
  5. When asked to ‘Choose a Printer Port’, select ‘Use an existing port’ and click on the ‘USB001 (virtual printer port for USB)’ item in the list. Then click Next.
  6. On the following page, select ‘HP’ or ‘Hewlett Packard’ in the left pane, and find ‘Photosmart 7200′ in the list on the right.
  7. IMPORTANT: Plug in the Printer now, if it’s not already plugged in, and switch it on.
  8. Click ‘next’ and then print a test page.

That should do it…

Please let me know if this post was useful with a click!
Nope, not helpful...Yep, more useful than not! (No Ratings Yet)