Archive

Archive for the ‘Time Savers’ Category

Windows XP Update Popup

January 5th, 2009

The windows update popup has lost me hours of work for the last time!

Please Restart... Please Restart... Please...

Please Restart... Please Restart... Please...

Ok.. so that may be a little over the top, maybe minutes of work but it’s still irritating losing all of the windows I have spend days opening and lovingly arranging. After the umpteenth popup of the day I thought I would Google the answer to turn off this unwanted menace.

I found a site that told me exactly the answer I was hoping for and I was popup free in under 5 minutes. The depressing thing is that it was written in 2006 and it took me nearly three years to build up the inclination to do something about it.

So here’s how to do it:

  • Click on the Start button and choose ‘Run.’
  • Type: gpedit.msc.
  • Expand Local Computer Policy, Computer Configuration, Administrative Templates, Windows Components, Windows Update.
  • Select “Re-prompt for restart with scheduled installations.”
  • Choose “Enable” and then type in how many minutes you want to wait.

I do feel it necessary to put a little disclaimer in here, gpedit is not something that you should really go playing with and I imagine you need to be an administrator on the machine (most home computers are set up so you are the admin) to make the change

I got this handy hint from Tech Target however you are bombarded with advertising as you enter the site. you have been warned.

Time Savers, Windows , , , ,

bbPress Email notification on post

September 9th, 2008

At Newmedias, we use bbPress and have been using the email notification plugin written by thomasklaiber. It sends an email to those registered for forum notifications every time a post is left on a thread that they had registered for.

http://bbpress.org/plugins/topic/post-notification/

I often look at my emails when im away from home on my pda/phone and find it a real pain to have to open the web link in each email to read it. This also means that I can’t download them in my email client for reading later.

My solution to this was blindingly simple,

Put the body of the most recent post into the email itself!

This feature was not available at the time of writing and works very well. The mod is very simple, here’s how i did it.

note: Before doing this to your version of the plugin, make sure that the original author hasn’t added his own version of the same thing!

1) Open notification.php and find the notification_new_post function
2) Paste the following code after the get_topic() call but before the $message=… call

$posts = get_thread($topic_id);
$last = array_pop($posts);
$last_text = strip_tags($last->post_text);

3) Overwrite the $message variable to include the new string at the end as follows:

$message = __("There is a new post on: %1\$s \nReply by: %2\$s \n\n%3\$s \n\n%4\$s");

4) Overwrite the sprintf call to the following:

sprintf($message, $topic->topic_title, get_user_name($bb_current_user->ID), get_topic_link($topic_id), $last_text)

(if you are more familiar with php and sprintf then just add the $last_text variable to the end of the list of variables within the existing call)

5) Save, Backup, Upload and test! It should now send the post body with the email

Optionally you can improve the code within this function somewhat…

1) The get_topic call doesn’t need to be in the foreach loop because the topic_id doesn’t change anywhere in the function. Although bbPress uses cacheing, it would still be best practise to move that line and the lines from my step 2 to the line before the foreach loop.

2) Convert the email to HTML by adding the content-type header and setting it to text/html. If you do this then the \n’s will also need to be changed to <br /> and you can optionally remove the strip_tags() from the last line in my step 2

Good luck and let me know about any problems you may have.

Time Savers, bbPress ,

Google Charts overview

August 18th, 2008

I came across Google Charts the other day and wanted to let people know what it’s all about. I found it incredibly easy to use to make a simple chart but a little more complicated to make something more complex.

The hello world example is given as follows:


http://chart.apis.google.com/chart?cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World

(should be used within an <img src=”" /> tag)

To be clear, Google Charts does not use an API key system like Google Maps which takes a layer of complication away.

Let me break up the key parts of the url used to generate the above example…
The first part http://chart.apis.google.com/chart? should always be the same followed by a combination of the following:

  • cht = Type of chart you want to make (Common types are p3, lc, bhs, bvs)
  • chd = Chart data stream(s), usually in the form of t:item1,item2,item3
  • chs = Chart size (widthxheight)
  • chl = Chart Label separated by a | per dataset

The next logical step is to look at bar charts because you can do all sorts with datasets/axis/labelling and colouring. See the following example (it’s not as complicated as it looks as I will show):

http://chart.apis.google.com/chart?chs=300x
120&cht=bvg&chg=0,10,1,5&chds=0,25&chxt=y&chxl=0:||5|10|15|20|25&chbh=60&chd=t:10,24,
6&chm=t10,000000,0,0,11|t24,000000,0,1,11|
t6,000000,0,2,11&chl=14/08/08|15/08/08
|18/08/08

This one is different in more ways that the obvious fact that it’s not a pie chart any more; it has labels on the axis, background lines, it’s scaled and there are labels per bar. The additional parts of the url are structured in the following manner:

  • cht=bvg (it was p3 before meaning 3D pie chart, this one is a vertical bar instead)
  • chg = Chart grid accepts 4 arguments: x step, y step, line length, blank length
  • chds = Data scale, arguments are minimum and maximum (this example 0-25)
  • chxt = Defines which axis have labels on (x, y, r)
  • chxl = Defines the labels for above in the form id:label1|label,id:label1|label2
  • chbh = Bar height (or width in this case as we are using a vertical chart)
  • chm  = Labels for each bar, arguments are id, colour, dataset id, dataset index

This has been a very simple guide to understanding how to use Google Charts. There are Infinitely more resources available at: http://code.google.com/apis/chart/

Google Charts, Statistics, Time Savers

Zen Cart Welcome Email Editor

July 31st, 2008

I’ve just dug up a script that I wrote a while back for someone. It’s not the most advanced thing in the world and it does what it says on the tin.

Within Zen Cart there is a menu on the admin pages called ‘Tools’ which has an option called ‘Email Welcome’. This script is a default Zen Cart page to simply show you what the welcome email looks like.

Screenshot 1

hint: be sure to turn on html emails and it will show you both the html and text versions (default text only is set)

I have modified this script to allow the editing of these pages if you have little or no knowledge of writing PHP although some HTML skill is required.

Zen Cart puts together a number of PHP Defines to build the welcome email and normally when you want to modify it then you have to trawl through three of four files of these defines to get to the one you want.

This script basically does that for you and parses/updates the files necessary with your new information. The following image shows the new page and i’m sure no explanation is needed to show you how to use it.

Screenshot Thumbnail 2

Known Bugs: the only thing I know to be wrong with it is that some defnes reference other defines and this script doesn’t respect that. There are only one or two defines like this so nothing to worry about unless you intend to change the name of the shop owner frequently. If you do change it, however, then just make sure you use this system to update the welcome email at the same time. Nice and easy!

UPDATE: Please make sure to chmod your languages/[language]/email_extras.php, languages/[language]/create_account.php and /languages/[language].php files (in both catalogue and admin) to be writable by apache if not this may not work.

Time Savers, Zen Cart ,