Making folder backups using Cron

Cron JobsAs I mentioned in yesterdays post on ,a href=’https://www.azurecurve.co.uk/2019/12/making-mysql-backups-using-cron/’>making backups of mySQL databases, earlier this year I migrated from a Microsoft Windows based web hosting package to a Linux based one. This meant I had to learn a few new ways of doing things, such as backing up databases or files, on a regular repeating basis.

This is accomplished on Linux web hosts using the Cron time-based scheduler. I needed to create two types of cron jobs; one to backup databases and one to backup files. Yesterdays post was on the databases and todays is on backing up files.

The syntax for backing up a files using Cron jobs will largely be the same on all web hosts.

The below example shows the syntax to backup a files, with the sections to change highlighted:

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
/bin/tar -czvf /home/{username}/backups/backup_{sitename}_$(date +\%Y\%m\%d\%H\%M\%S).tar.gz /home/{username}/{foldername}

Making mySQL backups using Cron

Cron JobsEarlier this year I migrated from a Microsoft Windows based web hosting package to a Linux based one. This meant I had to learn a few new ways of doing things, such as backing up databases or files, on a regular repeating basis.

This is accomplished on Linux web hosts using the Cron time-based scheduler. I needed to create two types of cron jobs; one to backup databases and one to backup files.

The syntax for backing up a MySQL database using Cron jobs will largely be the same on all web hosts.

The below example shows the syntax to backup a mySQL database, with the sections to change highlighted:

/*
Created by Ian Grieve of azurecurve|Ramblings of a Dynamics GP Consultant (http://www.azurecurve.co.uk) This code is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0 Int). */
/usr/bin/mysqldump -u {username}-p'{password}' {databasename} > /home/{username}/backups/backup_{databasename}_$(date +\%Y\%m\%d\%H\%M\%S).sql

WordPress/ClassicPress Plugin Development: Checking If Function Exists In Namespace

WordPress PluginI’ve been developing my own plugins for WordPress and, more reently, ClassicPress. At times it’s been necessary to check if a function exists.

It’s fairly straightforward to do this check:

if (!function_exists('azrcrv_get_breadrumbs')){
	// code here
}

I also use a few plugins developed by other people. One of the ones I’ve been reviewing recently is Estimated Read Time by CodePotent.

John uses namespaces in his plugins which means the check also needs to include the namespace. You can check for this using the following syntax (the highlighted section is the namespace defined in the plugin):

if (function_exists('CodePotent\EstimatedReadTime\process_shortcode')){
	// code here
}

I’m posting this as a reminder to myself as it took me a few minutes of searching before I found the right answer.

GitHub Announces New Unlimited Repos & Unitifed Enterprise Offering

GitHubI’ve recently been taking a look at ClassicPress and one of the subjects that came up was that it might, for the plugin directory, use GutHub instead of SVN like WordPress.

I create an account and started looking into creating repositories for my plugins. Hot all of my plugins are on that site however, as not all have been released to the public. Some of them are only going to be usable to me (for example plugins drive both the GP Table Reference and my distilleries website) and you were limited on GitHub to a certain number of private repositories.

However, GitHub yesterday announced the following:

  • GitHub Free now includes unlimited private repositories. For the first time, developers can use GitHub for their private projects with up to three collaborators per repository for free. Many developers want to use private repos to apply for a job, work on a side project, or try something out in private before releasing it publicly. Starting today, those scenarios, and many more, are possible on GitHub at no cost. Public repositories are still free (of course—no changes there) and include unlimited collaborators.
  • GitHub Enterprise is the new unified product for Enterprise Cloud (formerly GitHub Business Cloud) and Enterprise Server (formerly GitHub Enterprise). Organizations that want the flexibility to use GitHub in a cloud or self-hosted configuration can now access both at one per-seat price. And with GitHub Connect, these products can be securely linked, providing a hybrid option so developers can work seamlessly across both environments.

The second point isn’t relevant to me, but the first might be useful as it will allow me to store both my public and private plugins in the same place.

More details are available from the GitHub blog.

Remove Yellow Background from Google Adsense Adverts

Microsoft Dynamics GPI’ve been hosting adverts from Google Adsense for a while and, after my last site redesign, I started using responsive adverts which scale according to the size of the browser window (or device size).

Since then, I’ve had yellow background showing either side of the adverts:

Adverts with yellow bars

The other day, I finally had time to track down and fix the issue. The html code for the adverts, which is supplied by Google, places the adverts within an ins tag and a class of adsbygoogle (see two highlighted sections):

...<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
				<!-- azurecurve Responsive Leaderboard -->>
				<ins class="adsbygoogle"
					 style="display:block"
					 data-ad-client="{adsense publisher id}"
					 data-ad-slot="5299901990"
					 data-ad-format="auto"></ins>
				<script>
				(adsbygoogle = window.adsbygoogle || []).push({});
				</script>...

The yellow background is the default colour used by WordPress for ins tags; so to remove it, all you need is a snippet of css in your stylesheet:

ins.adsbygoogle {
	background: transparent;
}

With the css saved, the yellow background disappears:

Registering dotNET DLLs

Microsoft Dynamics GPIn the past when I have needed to manually register DLLs they have been C++ or VB ones which are registered using the regsrver command.

A recent project for a client was done using C# which requires the assembly to be registered using a different command. I am posting this here as a reminder to myself next time I need to do this.

When you register the assembly, you may receive a warning message about registering unsigned assemblies using the /codebase switch which is intended only with signed assemblies. If you trust the origin of the assembly then you can safely register the assembly and ignore the warning.

To register the .NET DLL, open a command prompt and type the following (the highlighted section is the name of the assembly being registered):

%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe reportprinter.dll /codebase

To unregister a .NET DLL type the following:

%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\regasm.exe reportprinter.dll /unregister

The highlighted section is the dll being registered or unregistered.

azurecurve Posts Archive WordPress Plugin – Beta Testers Wanted

WordPress PluginI recently created a WordPress archive of my Twitter posts using the plugin and theme from Ozh.

Part of the theme was a sidebar posts archive which I quite liked the look of and have now extracted and turned into a WordPress plugin so I can use it on any site (including this one):

azurecurve Posts Archive

Check out the archive in action in the sidebar to the right below the Calendar and above the Tag Cloud.

I am thinking about releasing it via the WordPress Plugins Directory, but before doing so, wondered if anyone might be interested in doing some beta testing? It is a very easy install (upload to plugins folder, activate and then place widget in widget area) and currently has no options although I am willing to create some if necessary (such as the ability to change the display name).

The plugin only reads the number of posts and does not write back to the database so there is no risk.

If you’re interested in beta testing get in touch with me (by email if you have it or use the Contact page) and I’ll send you a download link (I’m not posting publicly as I want to keep numbers under control while it gets tested).

SASS CSS How-to: A (Short) Review

Microsoft Dynamics GPAs well as a strong interest in Dynamics GP, I tend to have an interest in most things computer related. As such I have a few years experience with HTML+CSS and have created a few sites in the past, in addition to this blog on which I have done some customisations and enhancements of the code and theme.

I do find some of CSS a bit of a hassle when it comes to changing common elements such as colour so I was interested when I heard about the concept of SASS or Syntactically Awesome Style Sheets (I’ll admit to being happier with the acronym than the full name).

Packt Publishing, who are publishing my Microsoft Dynamics GP 2013 Cookbook, have published a SASS CSS How-to book by Alex Libby. This book takes a look at how to write more efficient CSS using the SASS CSS library through practical hands-on recipes;

SASS CSS How-to

Continue reading “SASS CSS How-to: A (Short) Review”

Review of Developing Microsoft Dynamics GP Business Applications – Part 4

Microsoft Dynamics GPI started reviewing Leslie Vail’s book, Developing Microsoft Dynamics GP Business Applications,which was published at the end of December by Packt Publishing, a few weeks ago. To do this review I decided to take a read through and complete all the examples she gives on developing an application as I’ve only had very limited experience with Dexterity;

Developing Microsoft Dynamics GP Business Applications by Leslie Vail

Today I’m taking a look at Chapter 5 which covers sanScript and how to add it to windows to enable the required functionality. The key topics to be covered are:

  • Introduction to sanScript
  • Scrolling Windows
  • Triggers

Continue reading “Review of Developing Microsoft Dynamics GP Business Applications – Part 4”

Review of Developing Microsoft Dynamics GP Business Applications – Part 3

Microsoft Dynamics GPAfter slacking off a lot in terms of reviewing Leslie Vail’s book Developing Microsoft Dynamics GP Business Applications, which was published at the end of December by Packt Publishing, I’m going to try to get a regular tempo of review posts going. Today I’m here with the review for chapter 4;

Developing Microsoft Dynamics GP Business Applications by Leslie Vail

This chapter is all about Building the User Interface which Leslie does by getting the reader to build an interface for customer contacts integration and covers:

  • Creating base resources
  • Creating tables and keys
  • Creating forms and windows
  • Creating scrolling windows
  • Working with window fields
  • Completing your windows

So from this chapter I expect to get a good grounding in creating an entirely new window which should look like this:

Customer Contact Maintenance

Continue reading “Review of Developing Microsoft Dynamics GP Business Applications – Part 3”