Monthly Archives: December 2012

Finding large files or folders on a drive

My Toshiba Ultrabook has a 128G SSD drive and it is kinda small. I’ve just gone through the process of some clean up to remove unused apps and archive data files.

In the process I tried a number of free “Large File Finder” type applications and there are two that I really like.

The first is WinDirStat which provides a neat graphical view as well as a file list.

The other is from Extensoft called Free Disk Analyzer.

I’ve prepared two simple screenshots showing each one after I used them on my drive when it was over-crowded. Since then I’ve done a clean up.

I think the visual aid of WinDirStat is helpful, but I am a simple lists type user (changing the default Windows view to Details list is normal, and using Linux ls -la, is my default setting) and I think Free Disk Analyzer is my first go-to tool.

 

Nextgen Gallery WordPress nggtags template caption option

I have a slightly older version of NGG because I have modded it and have yet to transfer those mods to the latest version. But I just made another minor change that I wanted to document before I forget what I did.

Using the

no images were found

  works well for showing the images from the gallery that are tagged as an automated gallery creation.

But I wanted to get the captions displayed as well like the syntax for the standard gallery by id display

no images were found

.  So I needed to add the ” template=caption” as an option for the nggtags shortcode.

Edit /wp-content/plugins/nextgen-gallery/nggfunctions.php

Around line 867 should start the function into which I inserted the $template value (with relevant comma’s etc.) at 3 places as highlighted with the new text.

[php highlight=”1,13,23″]
function nggShowGalleryTags($taglist, $template = ”) {

// $_GET from wp_query
$pid    = get_query_var(‘pid’);
$pageid = get_query_var(‘pageid’);

// get now the related images
$picturelist = nggTags::find_images_for_tags($taglist , ‘ASC’);

// look for ImageBrowser if we have a $_GET(‘pid’)
if ( $pageid == get_the_ID() || !is_home() )
if (!empty( $pid ))  {
$out = nggCreateImageBrowser( $picturelist, $template);
return $out;
}

// go on if not empty
if ( empty($picturelist) )
return;

// show gallery
if ( is_array($picturelist) )
$out = nggCreateGallery($picturelist, false, $template);

$out = apply_filters(‘ngg_show_gallery_tags_content’, $out, $taglist);
return $out;
}

[/php]

That sorts out the function that is called from the  /wp-content/plugins/nextgen-gallery/lib/shortcodes.php

Around line 114 there is a string evaluation test process that we change to look for a second option referenced as template= etc..  shown in the highlighted line.

[php highlight=”6″]

if ( stristr( $content, ‘[tags’ )) {
$search = "@(?:<p>)*s*[tagss*=s*(.*?)s*]s*(?:</p>)*@i";
if (preg_match_all($search, $content, $matches, PREG_SET_ORDER)) {

foreach ($matches as $match) {
$replace = "

no images were found

}" template="{$match[2]}"]";
$content = str_replace ($match[0], $replace, $content);
}
}
}

[/php]

Finally around line 273 there is the call to the nggShowGalleryTags in the show_tags function. Insert a new line for $template as a parameter and to the output option.

[php highlight=”5,12″]

function show_tags( $atts ) {

extract(shortcode_atts(array(
‘gallery’       => ”,
‘template’  => ”,
‘album’         => ”
), $atts ));

if ( !empty($album) )
$out = nggShowAlbumTags($album);
else
$out = nggShowGalleryTags($gallery, $template);

return $out;
}

[/php]

Now the nggtags option that will create a custom gallery from Tagged images can optionally include the image caption as well.

 

 

Awstats Configuration Files awstats.conf, awstats.model.conf

The default setup for awstats is really aimed at a minimal number of web site or other logs and the ability to setup specific config files for each site is good but seems a little top heavy.

The awstats.conf and awstats.conf.local files provide for the single site type setup. Configure the main .conf settings or alternatively add the specific overrides of the defaults into the awstats.conf.local file and all is good.

Using the awstats.model.conf for multiple web sites and copying it to a site specific file also is a good plan for a nominal number of sites.

But once we get to having 37 sites it is getting a bit out of hand.

So how to improve the process and automate it?

Roughly:

  • Have a standard config file for all the standard settings
  • Have a standard log file format for the specific type of log being stat’d
  • Have a header type config file that is specific to the site or URL being stat’d
  • Combine them all on-the-fly by using the Includes option in the awstats config files

I think the order should be:

awstats looks in /etc/awstats when the updateall process is executed

in the /etc/awstats directory are the header files which look like:

#include main config file from somewhere else (it cannot be in this directory as it would be read as a conf file directly)
#include the required log file format – parsing both apache and windows logs
#have only the site specific instructions in the file so that the file size and chance of overriding config standards is reduced

I’ll experiment with the above and update this with the result.