Category: Tech

Tech related posts.

Firefox download warning when closing browser

More than once I’ve closed Firefox whilst in the midst of a download that cannot be resumed.  When I do it, it makes me crazy.  But the fix is easy.

  1. Get to the Firefox config info by typing about:config in the URL line of the browser.
  2. Seek out the line browser.download.manager.quitBehavior
  3. Set its pref from 0 to 2.

 

On Privacy

Online privacy’s been a thing for me for years now.  Not because I’m doing anything “wrong,” but simply because I feel it’s my right – and your right – not to be snooped on.

I don’t pretend to be an expert at this (or at anything, for that matter), but here are a few things I use and recommend to try to keep prying eyes away:

Use Firefox.  I used to be a Chrome fan, but Google’s a big part of the problem.  No organization is perfect, but Mozilla – thus far – seems much more interested in our individual well being than that of any other browser offering.  And the very first step in locking down Firefox is to navigate to Tools > Options > Privacy and choose “Tell sites that I do not want to be tracked.”  

Next, a slew of Firefox add-ons:

  1. HTTPS Everywhere – An EFF offering (and are you a member of EFF? You should be.) that forces a secure connection to your surfing destination whenever possible.
  2. DoNotTrackMe – a tracking blocker.
  3. disconnect – another tracking blocker, this one specifically tailored towards social media.
  4. Ghostery – a configurable tracker/cookie blocker.
  5. AdBlock Plus – perhaps not so much so for privacy, but for sanity.  Surfing the web without ABP freaks me out.
  6. DuckDuckGo – Make DuckDuckGo your search engine of choice.  Simply go to the site, and then click the icon next to the search field (to the right of the URL field in Firefox) and add it.

Other security/privacy conscious items I use include:

  • TrueCrypt – I use TC for create encrypted containers to store all my sensitive data, personal and client related.  It adds a much needed layer of comfort to using sync services such as Dropbox or Windows Live.  Granted, it makes it a pain in the ass to sync (the whole container must be resynced rather than just the changed files within it), but with a decent connection and some common sense container sizing it’s worth it.  I also use TC whole disk encryption on all my family’s laptops.  If someone swipes your ‘top, at least they’re not getting your data!
  • VPN – Securitykiss is but one of many VPN services.  I can’t speak to their effectiveness specifically – I include them only as an example.  A Google search will pull up a wealth of free and paid VPN options, along with plenty of reviews.  VPN is essentially a tunnel between your computer and a remote gateway, through which your online requests are routed.  The theory is that your traffic is effectively anonymized by way of emanating from a shared point of entry to the ‘net (the gateway), meaning it’s undifferentiated from the traffic of everyone else utilizing the gateway.  The tunnel between you and the gateway is also secured via encryption.  Ultimately the effectiveness of VPN relies on the provider, as they have the ability to log your activity in their tunnel.  In other words, do your research and choose wisely.

There are lots of other privacy options out there, like TOR, but the few things I’ve listed above are the simplest ways to start securing your privacy.

Sending an email with Task Scheduler using Powershell

Today at work I had a need to query a bunch of databases for a particular, er, thing, and then send that thing, if found, to myself via email.  I needed this to happen every morning. I decided, since we’re talking about a MS SQL and Windows 2003/2008 environment, that Powershell was the way to go.  And it was – until I popped it into scheduler.

When executed as a scheduled task, the email didn’t send.  Things before and after the email routine worked – the arrays populated, the log file filled – but the email didn’t go.  Firing it from a Powershell manually, everything went fine.

Being the stubborn arse I am, rather than get to Googling I started ripping things apart.  I had the query dump its results into a temp file that a separately scheduled script would open, parse, email and then clear.  Same result: run manually everything worked peachy. Scheduled, no email.

In the end the problem was irritatingly simple.  For some reason, when run as a scheduled task the script didn’t keep the socket open to the SMTP server long enough for a successful transmission.  I added a Start-Sleep -s 5 right after the SMTP command to give it a 5 second breather before continuing on.  Voila – email success.  How silly.

I think I’m going to like Powershell just fine.  Other than quirks like this, and getting used to the syntax, it’s easy enough – and it seems a lot of Windows specific stuff is streamlined, at least in comparison to my old go-to admin scripting languages.

Modified page of categories in WordPress using “Page of Posts”

I hate it when I fail to document.  About a year ago I solved a problem I was having on a client site involving customized pages of categories.  I didn’t document my solution, and not unexpectedly as the months ticked by it slipped out of my brain.  Fast forward to now and I need the solution again.  After too much time spent poking at my own mess, I have the solution again.

My problem was this: I want a page that shows all posts of a particular category, and I want the ability to format those posts into a custom view.  No links in titles, no thumbnails, etc.

Find the Slug of the particular category you want to display.  This is in the Category edit page.  Then create a .PHP file named SLUG_page_template.php.  Populate the file thusly:

{code type=php}
<?php
/*
Template Name: PageOfPosts
*/
get_header(); ?>
<div id=”content” class=”narrowcolumn”>
<?php
if (is_page() ) {
$category = get_post_meta($posts[0]->ID, ‘SLUG’, true);
}
if ($category) {
$cat = get_cat_ID($category);
$paged = (get_query_var(‘paged’)) ? get_query_var(‘paged’) : 1;
$post_per_page = 4; // -1 shows all posts
$do_not_show_stickies = 1; // 0 to show stickies
$args=array(
‘category__in’ => array($cat),
‘orderby’ => ‘date’,
‘order’ => ‘DESC’,
‘paged’ => $paged,
‘posts_per_page’ => $post_per_page,
‘caller_get_posts’ => $do_not_show_stickies
);
$temp = $wp_query; // assign orginal query to temp variable for later use
$wp_query = null;
$wp_query = new WP_Query($args);
if( have_posts() ) :
while ($wp_query->have_posts()) : $wp_query->the_post(); ?>
<div <?php post_class() ?> id=”post-<?php the_ID(); ?>”>
<h2><a href=”<?php the_permalink() ?>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></a></h2>
<small><?php the_time(‘F jS, Y’) ?> <!– by <?php the_author() ?> –></small>
<div class=”entry”>
<?php the_content(‘Read the rest of this entry »’); ?>
</div>
<p class=”postmetadata”><?php the_tags(‘Tags: ‘, ‘, ‘, ‘<br />’); ?> Posted in <?php the_category(‘, ‘) ?> | <?php edit_post_link(‘Edit’, ”, ‘ | ‘); ?> <?php comments_popup_link(‘No Comments »’, ‘1 Comment »’, ‘% Comments »’); ?></p>
</div>
<?php endwhile; ?>
<div class=”navigation”>
<div class=”alignleft”><?php next_posts_link(‘« Older Entries’) ?></div>
<div class=”alignright”><?php previous_posts_link(‘Newer Entries »’) ?></div>
</div>
<?php else : ?>
<h2 class=”center”>Not Found</h2>
<p class=”center”>Sorry, but you are looking for something that isn’t here.</p>
<?php get_search_form(); ?>
<?php endif;
$wp_query = $temp; //reset back to original query
} // if ($category)
?>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>
{/code}

On line 9 change SLUG to the appropriate slug of your category.  Update this file to represent the changes you want reflected on the category page.

Determine the cat number of your category.  This is easily done by going into Categories and hovering over View.  Then you can test by going to http://www.yoursite.com/?cat=#  where # represents the category.  Category pages can also be added to menus easily.

0 Day Java Exploit. How to disable Java in your browser.

A JRE exploit has reportedly hit the wild. Context here.  Some kind Redditor has posted instructions on disabling the JRE in various browsers:

  • In Firefox : Press Firefox button -> Add-ons, go to Plugins and click the “Disable” button next to anything named “Java”.
  • In Chrome : Type in: “chrome://plugins/” into the address bar (no quotes). Scroll down to Java and click disable.
  • In Opera: Type in “opera:plugins” into the address bar (no quotes). Scroll down to:
    • Java(TM) Platform <click on> Disable.
    • Java Deployment Toolkit <click on> Disable.
  • In Internet Explorer:
    • Disable UAC (if enabled) and restart.
    • Open the Java app in Control Panel.
    • Go to advanced tab.
    • Expand Default Java for browsers.
    • The checkbox next to IE is grayed out.  Select Microsoft Internet Explorer and press spacebar. Click OK.
    • You can re-enable UAC and restart now.

 

“Expanding” a vmdk in VirtualBox

When I created my vmdk for my work virt in VirtualBox I made the mistaken assumption that by “dynamic” they meant the drive size would expand as necessary.  What they really meant was that the drive would expand as necessary within the limits of the initial drive size setting – which I stupidly set to 20 gig.

Expanding your vmdk for VirtualBox is really a misnomer.  You have to create a new one of the size you want and then clone your old one over to it.  It’s a little time consuming, but not hard.  Disclosure:  My host is running Windows 7 64 and my VM is running Windows 7 32.  Why bother?  It’s a security thing.

  1. Shut down your VM (obivously)
  2. Within the VirtualBox Manager, open the Settings for your existing VM, then choose Storage.
  3. Add a hard disk to the controller.  Make it the same type as your current disk, and make it the size you need.
  4. Once it’s created open a command prompt and head to the directory containing vboxmanage.exe – typically in C:\Program Files\Oracle\VirtualBox\
  5. Run the following, altering the paths to match your current and new vmdk files: 
  6. Twiddle thumbs.
  7. Once that’s complete, reopen the VirtualBox Manager and head back to Settings > Storage.  Add an existing hard disk to your controller, choosing your new drive.  Disconnect your original drive.
  8. Fire up your VM, from within it navigate to disk management, and expand away.