How To Get the Structure of All Tables in a MySQL Database Using mysqldump

Author: , Posted on Sunday, December 2nd, 2018 at 3:16:22pm

mysqldump -u {yourUserNameHere} -p --no-data --compact {yourDatabaseHere}

How To Disable Adobe Daemons Using launchctl on MacOS

Author: , Posted on Sunday, November 18th, 2018 at 9:14:28am

I installed an old version of Adobe software on my new Mac and as usual, it installed some daemons that are undesirable.

Here is how I got rid of them via the Terminal.

Note: Adobe installs daemons in the user context, so do this as your regular user login, not as root.

shell> launchctl list | grep -v apple
PID Status Label
513 0 com.yujitach.MenuMetersApp.1140
- 0 com.logmein.GoToMeeting.G2MUpdate
- 0 com.rockysandstudio.Memory-Diag.LaunchHelper
19355 0 com.openssh.ssh-agent
509 0 com.fuekiin.NightOwl.1320
511 0 com.bartelsmedia.ShareMouse.4680
- 0 com.adobe.CS5ServiceManager
- 0 com.adobe.AAM.Scheduler-1.0
519 0 com.rockysandstudio.Memory-Diag.848
63060 0 com.adobe.PDApp.AAMUpdatesNotifier.8000.4C572D6C-E775-4656-B4CB-BD24142281FE

shell> launchctl dumpstate | grep adobe | grep plist
path = /Library/LaunchDaemons/com.adobe.SwitchBoard.plist
path = /Library/LaunchAgents/com.adobe.CS5ServiceManager.plist
path = /Users/erics/Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist

shell> launchctl unload -S Aqua /Library/LaunchDaemons/com.adobe.SwitchBoard.plist
/Library/LaunchDaemons/com.adobe.SwitchBoard.plist: Could not find specified service
shell> launchctl unload -S Aqua /Library/LaunchAgents/com.adobe.CS5ServiceManager.plist
shell> launchctl unload -S Aqua /Users/erics/Library/LaunchAgents/com.adobe.AAM.Updater-1.0.plist

shell> launchctl list | grep -v apple
PID Status Label
513 0 com.yujitach.MenuMetersApp.1140
- 0 com.logmein.GoToMeeting.G2MUpdate
- 0 com.rockysandstudio.Memory-Diag.LaunchHelper
19355 0 com.openssh.ssh-agent
509 0 com.fuekiin.NightOwl.1320
511 0 com.bartelsmedia.ShareMouse.4680
519 0 com.rockysandstudio.Memory-Diag.848
63060 0 com.adobe.PDApp.AAMUpdatesNotifier.8000.4C572D6C-E775-4656-B4CB-BD24142281FE

shell> launchctl stop com.adobe.PDApp.AAMUpdatesNotifier.8000.4C572D6C-E775-4656-B4CB-BD24142281FE

shell> launchctl list | grep -v apple
PID Status Label
513 0 com.yujitach.MenuMetersApp.1140
- 0 com.logmein.GoToMeeting.G2MUpdate
- 0 com.rockysandstudio.Memory-Diag.LaunchHelper
19355 0 com.openssh.ssh-agent
509 0 com.fuekiin.NightOwl.1320
511 0 com.bartelsmedia.ShareMouse.4680
519 0 com.rockysandstudio.Memory-Diag.848

How To Test Nagios Remote NRPE Commands

Author: , Posted on Thursday, September 27th, 2018 at 10:46:20am

There are many things to configure in Nagios, especially when using custom check commands. Recently I needed to configure all of the Continuent Clustering Nagios checks. Once setup on the database side, I wanted to confirm that everything was working.

Basics: Run a Remote NRPE Check

To test a remote NRPE client command from a nagios server via the command line, use the check_nrpe command:

1
shell> /opt/local/libexec/nagios/check_nrpe -H db1 -c check_tungsten_latency
shell> /opt/local/libexec/nagios/check_nrpe -H db1 -c check_tungsten_latency

The above command calls the NRPE daemon running on host db1 and executes the NRPE command “check_tungsten_latency” as defined in the db1:/etc/nagios/nrpe.cfg file.

Here is the line used in nrpe.cfg to define the check_tungsten_latency remote NRPE call:

1
command[check_tungsten_latency]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_latency -w 2.5 -c 4.0
command[check_tungsten_latency]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_latency -w 2.5 -c 4.0

Note that sudo is in use to give the nrpe user access as the tungsten user to the tungsten-owned check scripts using the sudo wildcard configuration.

Here is the service check definition in the /opt/local/etc/nagios/objects/services.cfg file:

1
2
3
4
5
6
7
8
9
# Service definition
define service{
    service_description         check_tungsten_latency - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_latency
    contact_groups              admin
    use                         generic-service
    }
# Service definition
define service{
    service_description         check_tungsten_latency - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_latency
    contact_groups              admin
    use                         generic-service
    }

Security: Sudo Configuration

To enable sudo for the nrpe user, create or edit the file /etc/sudoers.d/20_nagios like so:

sudo vim /etc/sudoers.d/20_nagios

1
2
3
Defaults:nrpe !requiretty
Defaults:nrpe !visiblepw
nrpe          ALL=(tungsten)  NOPASSWD: /opt/continuent/tungsten/cluster-home/bin/check*
Defaults:nrpe !requiretty
Defaults:nrpe !visiblepw
nrpe          ALL=(tungsten)  NOPASSWD: /opt/continuent/tungsten/cluster-home/bin/check*

Additional Command Examples

/etc/nagios/nrpe.cfg

1
2
command[check_tungsten_online]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_online
command[check_tungsten_progress]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_progress -t 5</code>
command[check_tungsten_online]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_online
command[check_tungsten_progress]=/usr/bin/sudo -u tungsten /opt/continuent/tungsten/cluster-home/bin/check_tungsten_progress -t 5</code>

/opt/local/etc/nagios/objects/services.cfg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Service definition
define service{
    service_description         check_tungsten_online - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_online
    contact_groups              admin
    use                         generic-service
    }
 
# Service definition
define service{
    service_description         check_tungsten_progress - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_progress
    contact_groups              admin
    use                         generic-service
    }    
# Service definition
define service{
    service_description         check_tungsten_online - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_online
    contact_groups              admin
    use                         generic-service
    }

# Service definition
define service{
    service_description         check_tungsten_progress - Continuent Clustering
    servicegroups               myclusters
    host_name                   db1,db2,db3,db4,db5,db6,db7,db8,db9
    check_command               check_nrpe!check_tungsten_progress
    contact_groups              admin
    use                         generic-service
    }    

For more information about monitoring Continuent clusters, please visit https://docs.continuent.com/tungsten-clustering-6.0/ecosystem-nagios.html.

To learn about Continuent solutions in general, check out https://www.continuent.com/solutions

How To Create a PayPal-styled Button Using CSS and HTML

Author: , Posted on Friday, August 31st, 2018 at 11:42:15am
1
<button class="paypal-btn large" onclick="window.location='https://www.yoursite.com/targetPage/';return false">What a Great Button</button>
<button class="paypal-btn large" onclick="window.location='https://www.yoursite.com/targetPage/';return false">What a Great Button</button>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
button.paypal-btn {
 white-space: nowrap;
}
button.paypal-btn {
 white-space: nowrap;
 overflow: hidden;
 border-radius: 13px;
 font-family: "Arial", bold, italic;
 font-weight: bold;
 font-style: italic;
 border: 1px solid #ffa823;
 color: #0E3168;
 background: #ffa823;
 position: relative;
 text-shadow: 0 1px 0 rgba(255,255,255,.5);
 cursor: pointer;
 z-index: 0;
}
button.paypal-btn:before {
 content: " ";
 position: absolute;
 width: 100%;
 height: 100%;
 border-radius: 11px;
 top: 0;
 left: 0;
 background: #ffa823;
 background: -webkit-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: -moz-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: -ms-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 z-index: -2;
}
button.paypal-btn:after {
 content: " ";
 position: absolute;
 width: 98%;
 height: 60%;
 border-radius: 40px 40px 38px 38px;
 top: 0;
 left: 0;
 background: -webkit-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: -moz-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: -ms-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: linear-gradient(top, #fefefe 0%, #fed994 100%);
 z-index: -1;
 -webkit-transform: translateX(1%);
 -moz-transform: translateX(1%);
 -ms-transform: translateX(1%);
 transform: translateX(1%);
}
button.paypal-btn.small {
 padding: 3px 15px;
 font-size: 12px;
}
button.paypal-btn.large {
 padding: 4px 19px;
 font-size: 14px;
}
button.paypal-btn {
 white-space: nowrap;
}
button.paypal-btn {
 white-space: nowrap;
 overflow: hidden;
 border-radius: 13px;
 font-family: "Arial", bold, italic;
 font-weight: bold;
 font-style: italic;
 border: 1px solid #ffa823;
 color: #0E3168;
 background: #ffa823;
 position: relative;
 text-shadow: 0 1px 0 rgba(255,255,255,.5);
 cursor: pointer;
 z-index: 0;
}
button.paypal-btn:before {
 content: " ";
 position: absolute;
 width: 100%;
 height: 100%;
 border-radius: 11px;
 top: 0;
 left: 0;
 background: #ffa823;
 background: -webkit-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: -moz-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: -ms-linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 background: linear-gradient(top, #FFAA00 0%,#FFAA00 80%,#FFF8FC 100%);
 z-index: -2;
}
button.paypal-btn:after {
 content: " ";
 position: absolute;
 width: 98%;
 height: 60%;
 border-radius: 40px 40px 38px 38px;
 top: 0;
 left: 0;
 background: -webkit-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: -moz-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: -ms-linear-gradient(top, #fefefe 0%, #fed994 100%);
 background: linear-gradient(top, #fefefe 0%, #fed994 100%);
 z-index: -1;
 -webkit-transform: translateX(1%);
 -moz-transform: translateX(1%);
 -ms-transform: translateX(1%);
 transform: translateX(1%);
}
button.paypal-btn.small {
 padding: 3px 15px;
 font-size: 12px;
}
button.paypal-btn.large {
 padding: 4px 19px;
 font-size: 14px;
}

R.I.P. William “Bill” Baldwin

Author: , Posted on Thursday, August 9th, 2018 at 12:48:45pm

Bill Baldwin passed away from a stroke in July 2018. He will be missed terribly by his many friends, family and co-workers. His exemplary craftsmanship and feisty attitude will be remembered with great fondness by all who knew him.
Bill-1
Bill-4
Bill-2
Bill-3

How To Display Blog Pages for a Single Category

Author: , Posted on Monday, August 6th, 2018 at 4:23:58pm

Create a new page and set the page template to Blog.

Add a new Custom Field to the page.

Set the Name to the string query_args and the value to cat=NNN, where NNN is the ID of the desired category.

Be sure to click Publish or Update when done.

You can locate the Category ID on the Categories management page:

/wp-admin/edit-tags.php?taxonomy=category

If you cannot find the Custom Fields box on the edit page screen, look at the very top for a drop-down menu called “Screen Options”. Make sure that “Custom Fields” is checked.

How To Revert All Changes in a git Branch

Author: , Posted on Thursday, August 2nd, 2018 at 12:55:42pm

git checkout -f

How To Disable WordPress wpautop for Shortcodes

Author: , Posted on Friday, June 15th, 2018 at 1:35:54pm

remove_filter( 'the_content', 'wpautop' );
add_filter( 'the_content', 'smart_autop' );
function smart_autop($content) {
$post = get_post();
if($post->post_type != 'post') return $content; // if not a post, leave $content untouched
return wpautop($content);
}

Trademark Symbol

Author: , Posted on Friday, June 15th, 2018 at 9:53:58am

&#x2122; ™

How To Select Rows in MySQL with No Matching Entry in Another Table

Author: , Posted on Wednesday, May 16th, 2018 at 6:08:36pm

SELECT t1.id
FROM tableOne t1
LEFT JOIN tableTwo t2 ON t1.id = t2.id
WHERE t2.id IS NULL

The “WHERE t2.id IS NULL clause” restricts the results to only those rows where the id returned from tableTwo is null.

tableTwo.id will be NULL for all records from tableOne where the id is not found in tableTwo.