Flush the DNS Cache on Yosemite (using a nice quick alias)

Problem: I’ve updated some Name Server records on a domain and I want to check they’ve propagated using Dig. When I dig mydomain.com ns I keep getting the old results.

Solution: The local DNS cache on the machine needs to be cleared. As far as the OS is concerned, it’s already looked up that domain name and doesn’t need to do a fresh lookup until the domain record’s TTL (time to live) has expired.

On OS X Yosemite there are two name resolution caches that need emptying, Multicast DNS and Unicast DNS. They can be cleared / emptied / flushed using two commands in Terminal:

sudo discoveryutil mdnsflushcache
sudo discoveryutil udnsflushcaches

Continue reading “Flush the DNS Cache on Yosemite (using a nice quick alias)”

Homemade 6v Conlog type alarm fob battery.

Problem: A few old 90’s alarm key fobs use 6 volt batteries made up of 4 separate 1.5v button cells. Last year I needed one quick-like – same day – for the Golf Mk3 I’d just bought. There are plenty online, eBay etc, for about £5 to £10 but I couldn’t wait 2 days for one.

Solution: Nipped down to the Pound Shop and bought an assorted selection of hearing-aid button cell batteries for a quid! Taping four AG3’s together with Sellotape or Electrical Tape didn’t make a good enough electrical connection between the cells. Turns out a piece of Heat Shrink tubing, placed over all 4, then gently shrank (shrunk?) with a lighter forces the cells together nicely! After this is done, trim the top and bottom of the tubing to make sure the battery contacts are able to make connection. Continue reading “Homemade 6v Conlog type alarm fob battery.”

Replacing Golf VR6 Mk3 rear light seals, fixing a leaking boot.

Problem: The boot of my 1996 Golk mk3 VR6 has been leaky since I got it last year, and this autumn and winter it’s beginning to get out of hand and make the car all stinky and damp!

Solution: After removing every piece of trim and carpet in the boot area, it was clear that water was getting in around the tail light cluster / unit seals. The part number for these seals or gaskets is 1H6 945 191, and they can be ordered from a VW dealer parts desk for about £20 a pair. I wanted mine a but quicker than the dealer could do it so went to a Trade Parts Specialist who ordered them in for me next morning by 8:30am.

Here’s how to fit them… Continue reading “Replacing Golf VR6 Mk3 rear light seals, fixing a leaking boot.”

Remove ‘ul’ and ‘li’ tags from WordPress menus while retaining all the classes

Problem:
I need to output a WordPress nav menu as a series of anchors surrounded by spans, within one nav element. Manipulating the args passed to wp_nav_menu() function will allow the <ul> element to be removed, and passing the output through ‘striptags’ can remove the <li> elements, but I end up losing all the link ancestry classes.

Solution:
If a ‘Walker’ class is used, the output from wp_nav_menu() can be controlled totally. Here’s an example that removes the list elements, adds a span around each item link, and adds the possibility of a separator string between each menu item.

Add to your theme / header / etc: Continue reading “Remove ‘ul’ and ‘li’ tags from WordPress menus while retaining all the classes”

Custom Ordering Shopp (wordpress plugin) products in just one category

Problem: I’ve developed a site using the Shopp ecommerce WordPress Plugin and product ordering is set to ‘Price – Low to High’ at the Client’s request. Splendid. But now – for one category only – he want’s the Products to be give a custom order. In the Shopp presentation settings, ‘Product Order’ is set site-wide.

Solution: I created a custom template for the category in question, then in that template loaded the specific category with the ‘order’ option set to ‘custom’. Here are some steps.

1) Create the category specific template in the ‘Shopp’ theme templates directory in your WordPress theme. In my case the file was called category-truss.php as ‘truss’ is the slug of the category, and it’s a copy of my main category.php template file.

2) At the top of category-truss.php add the API function shopp(‘storefront.category’) like so:

<?php shopp('storefront','category','slug=truss&load=true&order=custom'); ?>
// load=true is needed to stop the functioning spitting out the category directly.
// slug is whatever your category's slug is. See the docs for more 'order' options.

3) In the Shopp Admin area, edit the category you want to custom order, then use the ‘Arrange Products’ button/link. Then drag the products into the order you want and test.

It might be that there’s an easier or better way to do this, if so please let me know in the comments!

Please let me know if this tiny snippet was useful, just one click!
Nope, not helpful...Yep, more useful than not! - +1 thumb, 1 overall.
Loading...

Noisy gritty squeaky Golf Mk3 steering wheel

Problem: My steering wheel sounded like it had sand in it, scraping on every turn. Nasty business.

Solution: Behind the steering wheel there are one or two sprung metal contacts that ‘slide’ over a metal contact ring on the steering wheel itself, presumably to connect the horn and airbag electrics. After 17 years it seems that lots of dirt and crap have built up on the contacts. Continue reading “Noisy gritty squeaky Golf Mk3 steering wheel”

Using the Vgate VS450 with a Mk3 Golf VR6

Vehicle: 1996 Golf Mk3 VR6 Highline.

Problem-ish: 

I bought a Vgate VS450 to check out some error codes on my VR6. It’s an OBD2 interface scanner, but as there are several other interfaces/protocils it can read, and mine is a ooooold car, it took a few attempts to get it to read anything worthwhile. Here are some screenies to guide you thorough.

Solution-ish: 

Step 1: Plug the unit into your OBD port. On my Golf Mk3 (’96) the port is under a plastic cover to the left of the ash-tray. To remove the cover, first take out the ashtray (there’s a little sprung lever under the tray that allows it to be removed completely), then slide the plastic cover to the right. In my case the OBD port was crusted up with 18 years of dust so a quick wipe over with Switch Cleaner sorted that out. Continue reading “Using the Vgate VS450 with a Mk3 Golf VR6”

Exclude a WordPress Post Category across the whole site… but not custom queries.

Problem: On my latest project there’s a WordPress post category that only ever displays in a sidebar. I never want it to display in a ‘main’ loop posts on an archive page (whether it be the blog home, date archives, author archive etc etc. Until now I’ve been using ‘query_posts()’ and doing something like this in the main templates like home.php and index.php:

<?php $catObj = get_category_by_slug('my-cat-slug');
query_posts( 'cat=-'.$catObj->term_id );
if ( have_posts() ) :
	while ( have_posts() ) : the_post(); ?>
		<!-- Show stuff init! -->
	<?php endwhile;
endif;?>

This works… but I have to do it everywhere the loop is used, and when you dig into WordPress Templates that’s a lot of places.

Solution: There’s always a way to do something globaly in WordPress using Filters, Actions, or Classes in your theme’s functions.php file (or a plugin even). In this case we can use the ‘pre_get_posts’ action in functions.php to exclude the category for all main queries: Continue reading “Exclude a WordPress Post Category across the whole site… but not custom queries.”

Bower update failed with ‘ERR! error rolling back’

2018 update: Bower might not be the right thing to be using nowadays. Here’s a note from the Bower website: “…psst! While Bower is maintained, we recommend using Yarn and Webpack or Parcel for front-end projects read how to migrate!”


Problem: I just tried to update Bower with:

$ npm update -g bower

Which resulted in failure, and Bower wasn’t able to roll back so the install was fudged. Here’s some output of the errors:

$ npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/bower/.editorconfig'
$ npm ERR! error rolling back  bower@1.2.8 { [Error: EACCES, unlink '/usr/local/lib/node_modules/bower/.editorconfig']
$ npm ERR! error rolling back   errno: 3,

Solution: Firstly I stopped being a dork and remembered I’d need to add ‘sudo’ (the ‘Error: EACCES’ gives it away)… Continue reading “Bower update failed with ‘ERR! error rolling back’”

Golf MK3 Boot / Tailgate ‘grip molding’ fixing missing

Vehicle: 1996 Golf Mk3 VR6 Highline.

Problem: One of the 4 machine screws attaching the trim surrounding the hatchback / tailgate / boot lid lock mechanism was missing. This resulted in rattling, which is an irritation, but more seriously the trim bent every time the boot was opened. The original fixings are Torx headed with an integral washer.

Solution: The original fixing’s part number is N90626201 but it’s no longer available. Taking measurements from an existing fixing shows that the size is M5 x 14mm (standard 0.8 mm pitch), and fixings of this size are available all over the place. Be careful with the length, this fixing screws into a closed-head Rivet Nut welded into the panel. Continue reading “Golf MK3 Boot / Tailgate ‘grip molding’ fixing missing”