tag:blogger.com,1999:blog-72155092816093747502024-03-14T03:22:43.303+00:00Simon Coopey's Techy BitsTechy tidbits from a veteran of a ten-year war against CentOS and a twenty-eight-year war against Apple. Oh, and in a long entente cordiale with WordPress.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.comBlogger24125tag:blogger.com,1999:blog-7215509281609374750.post-6212065145664213302018-06-03T21:54:00.001+01:002018-06-03T21:54:15.041+01:00Links not working after cloning WordPress site, .htaccess ok, wtf?Ok so I:<br />
<br />
<b>Migrated a Wordpress site from one host to another</b><br />
<br />
Pretty simple, moved all the files to the new host, kept the same directory structure, kept the same database user names and passwords and copied the MySQL database over. Site loads, everything is great.<br />
<br />
<b>Every link is getting a error 404 page</b><br />
<br />
Oh, did I copy across the .htaccess file? Yes. Cue 30 minutes of head scratching checking the new server is Apache on not nginx, stripping the .htaccess to the most basic version allowing a WordPress multisite.<br />
<br />
I remembered! httpd.conf Sure enough, I looked under up the server's httpd.conf and in the section pertaining to /var/www/ there was 'AllowOverride none', meaning it ignored all those rules in .htaccess - I change this line to:<br />
<br />
<b>AllowOveride All</b><br />
<br />
And it works! Simple, simple.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-44441819947441562352015-02-17T12:11:00.000+00:002015-02-17T12:11:57.406+00:00O2 MMS Settings on Jolla PhoneI have an O2 pay monthly SIM and a <a href="http://jolla.com/">Jolla</a> phone (JP-1301) running <a href="http://sailfishos.org/">Sailfish OS</a>. I needed to reinstall MMS settings so sent 'ACTIVE' to 2020 as they advise and was greeted with a return text message stating: "<i>Unfortunately we had problems dealing with your requset for settings. Please contact Customer Service</i>". Now, I've dealt with customer service enough times to know how this would pan out: "Yeah, it says here your device doesn't have MMS capabilities so there's no settings for it" being a likely outcome. So I poked through some other devices and tried a few variations of the settings I found. The following worked for me:<br />
<br />
Go to: <b>Settings > System > Mobile network > MMS access point</b><br />
<br />
And enter the following settings:<br />
<span style="background-color: #fff2cc;"><br /></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">Connection Name: O2 MMS postpay</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">Access point name: mobile.o2.co.uk</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">Security</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">Username: o2web</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">Password: password</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">Proxy</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">Proxy address: 82.132.254.1</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">Proxy port: 8080</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;"><br /></span></span>
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">MMS message centre</span></span><br />
<span style="font-family: "Courier New",Courier,monospace;"><span style="background-color: #fff2cc;">MMS message centre address: http://mmsc.mms.o2.co.uk:8002</span></span>Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-22199128027932860172014-03-11T20:28:00.002+00:002015-02-17T11:55:36.404+00:00Fixing XMPP problem after updating Flamingo IMI've just updated the <a href="http://flamingo.im/">Flamingo</a> app and found it couldn't connect to my custom XMPP server, despite having the details correct.
Turns out, it failed to connect because I have a 'self signed' SSL certificate. Would have been nice to have an error message!
Anyway, getting around this is trivial. Open a new <a href="https://www.blogger.com/Fixing%20XMPP%20problem%20after%20updating%20Flamingo%20IM">Terminal</a> window and enter:<br />
<span style="background-color: black;"><span style="color: lime;"><code>defaults write com.nonatomic.Flamingo AllowSelfSignedCertificates -bool true</code></span></span><br />
I restarted Flamingo and was able to connect straight away. Obviously, you have now an issue where Flamingo will connect to any server with a self-signed certificate, so only do this if you're aware of the risk.
<a href="http://simoncoopey.net/2014/xmpp-wont-connect-after-flamingo-update">This post originally appeared on SimonCoopey.net: http://coopey.me/p-AUy</a>Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-27000277891303221422013-12-03T17:54:00.000+00:002013-12-03T17:54:06.137+00:00Debian / Ubuntu Postfix Error: Diagnostic-Code: X-Postfix; unknown user:I've just set up a new Debian/Ubuntu server, and had a problem with Postfix rejecting mail. Mails were getting returned to sender with the error:<br />
<span style="font-family: Helvetica; font-size: 12px;"><br /></span>
<span style="font-size: 12px;"><span style="font-family: Courier New, Courier, monospace;">Diagnostic-Code: X-Postfix; unknown user: "admin"</span></span><br />
<br />
From the command line, I opened the Postfix config file:<br />
<br />
<b><span style="background-color: black; color: lime; font-family: Courier New, Courier, monospace;">vi /etc/postfix/main.cf
</span></b><br />
<b><span style="background-color: black; color: lime; font-family: Courier New, Courier, monospace;"><br /></span></b>
Then I found the line:<br />
<br />
<span style="background-color: yellow; font-family: Courier New, Courier, monospace; font-size: 13px;">mydestination = example.com, localhost, localhost.localdomain</span><br />
<br />
(where example.com was the server address) and changed it to:<br />
<br />
<span style="background-color: yellow; font-family: Courier New, Courier, monospace; font-size: 13px;">mydestination = localhost, localhost.localdomain</span><br />
<br />
I saved the file (:wq) and restarted Postfix:<br />
<br />
<b style="background-color: black;"><span style="color: lime; font-family: Courier New, Courier, monospace;">service postfix retstart</span></b><br />
<br />
Emails started arriving! I believe that the original format confuses Postfix- instead of trying to find and deliver to the local mailboxes, it tries to forward them on to example.com perhaps?Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-70422852919758520962013-06-24T11:25:00.004+01:002013-06-24T11:25:24.952+01:00Uninstall Copy (copy.com) in Mac OS X (10.8)I tried '<a href="http://copy.com/">Copy</a>' (or <a href="https://copy.com/?r=qNQ17O">click this link for </a><a href="https://copy.com/?r=qNQ17O">+5GB free</a>), and while the generous storage quota was appealing and the service worked fine generally, I didn't like the Mac OS X client.<br />
It prompted me to log in on every start up, a big hassle when you use super-long <a href="http://passwordsite.co.uk/">randomly generated passwords</a>. On the other hand, Box and Dropbox both work away in the background without needing any assistance.<br />
Also, it put an unexpected and unwanted extra menu option on the right-click menu which I was not too happy about.<br />
<br />
First, exit Copy from the menubar; Then delete the application from the Applications folder.<br />
<br />
Then, to get rid of the extras Copy installs, run these commands in Terminal:<br />
<br />
<span style="background-color: black; font-family: courier; font-size: 12px; line-height: 17px; text-align: left;"><span style="color: lime;">sudo rm -rf "/Library/Application Support/Copy Agent"</span></span><br />
<br />
and:<br />
<br />
<span style="background-color: black; font-family: courier; font-size: 12px; line-height: 17px; text-align: left;"><span style="color: lime;">rm -rf "~/Library/Application Support/Copy Agent"</span></span><br />
<br />
Sorted.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-38774596626992222942013-05-07T21:50:00.003+01:002024-02-04T13:59:47.033+00:00Removing hard-coded social share buttons on Adelle themeAn acquaintance of mine, <a href="http://rachphillips.com/">Rachael Phillips</a>, has a blog and uses the nice <a href="http://www.bluchic.com/shop/adelle-theme">Adelle theme from Bluchic</a>. Bluchic don't offer support for the theme (fair enough, as it's given away for free), and the WordPress forums were little help with a small problem Rachael had with the theme.<br />
She has added a social sharing plugin, but the Adelle theme has its own social sharing buttons hard-coded in to the theme. So there is some duplicity in post footers:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSe7tjA7T4JO3FEDIooZLGS8y7yGWGMwjLbsBBNmoxgLJLI5JyS-L4qIUWLVPv08V3V0b25NI2qezY_2cmdhiUUAIgUgdU_0Ek8gQYRypE_pbd3eWZ574VtC6uv9dkI1kl-TYz_8c6JDc/s1600/Screen+Shot+2013-05-07+at+21.18.35.png" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="65" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSe7tjA7T4JO3FEDIooZLGS8y7yGWGMwjLbsBBNmoxgLJLI5JyS-L4qIUWLVPv08V3V0b25NI2qezY_2cmdhiUUAIgUgdU_0Ek8gQYRypE_pbd3eWZ574VtC6uv9dkI1kl-TYz_8c6JDc/s320/Screen+Shot+2013-05-07+at+21.18.35.png" width="320" /></a></div>
<br />
I thought that the 'Tweet' and 'Like' buttons would be quite easy to get rid of, by adding "display: none;" to relevant classes in the style.css file. This worked for the Tweet button, but the 'Like' button stubbornly remained. In the end, I opted to edit the relevant files directly as this seemed like the quickest option.<br />
<br />
To remove the hard-coded social buttons you need to edit the following files:
<br />
content.php<br />
content-list.php<br />
single.php<br />
<br />
In each of these files, look for the footer:<br />
<br />
<pre> <footer class="post-footer">
<ul class="post-info-meta">
<li>
<a href="<?php echo esc_url('https://twitter.com/share'); ?>" class="twitter-share-button" data-url="<?php the_permalink() ?>" data-count="horizontal">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
</li>
<li>
<div class="fb-like" data-href="<?php the_permalink() ?>" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>
</li>
<li class="post-info-comment"><div class="post-comment"><?php comments_popup_link( __('0 comment','adelle-theme'), __('1 Comment','adelle-theme'), __('% Comments','adelle-theme') ); ?></div></li>
</ul>
</footer><!-- .post-footer --></pre>
<br />
You want to find the following lines...<br />
<br />
<pre> <li>
<a href="<?php echo esc_url('https://twitter.com/share'); ?>" class="twitter-share-button" data-url="<?php the_permalink() ?>" data-count="horizontal">Tweet</a><script type="text/javascript" src="//platform.twitter.com/widgets.js"></script>
</li>
<li>
<div class="fb-like" data-href="<?php the_permalink() ?>" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>
</li>
</pre>
<br />
...and simply remove them.<br />
<br />
Save each file, and upload into the /adelle/ folder, replacing the existing files.<br />
<br />If you don't want to edit files, or are worried about editing the files yourself, you can download them here:[removed! so old now]<br />Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-69317288519769690022013-04-29T14:31:00.001+01:002013-04-29T22:34:27.171+01:00Diverting visitors from a specific IP address to another websiteI don't like certain companies or people looking me up. UK company A4e is one I most definitely don't want to be associated with, and I do not fancy them looking up my CV website- but I found visitor records suggesting that someone at the company has. Obviously, this is a public page and doesn't contain much in the way of personal information- its purpose is to help people who have worked with me track me down, or people who get an email from me on a professional level look up more about me. What it is not for is the likes of A4e to data-mine and use my information for any of their purposes. So I set out to block any repeat visits, with a redirect to a page that says why.<br />
<br />
This seems to be quite easy to accomplish with .htaccess. To block someone from a specific IP address add the following to a .htaccess file: (or append it to an existing one, taking care not to delete important existing rules)<br />
<br />
<pre>RewriteEngine On
RewriteCond %{REMOTE_ADDR} ^195\.171\.111\.196
RewriteRule .* http://goaway.coopey.me [R,L]
</pre>
<br />
If you wanted to block a whole range of IP addresses use '.$' e.g. to block the range 195.171.111.* use the following for line two:<br />
<br />
<pre>RewriteCond %{REMOTE_ADDR} ^195\.171\.111\.$
</pre>
<br />
If you wanted to block a subsection, use the following format: (this will block 195.171.111.16 to 195.171.111.32)<br />
<br />
<pre>RewriteCond %{REMOTE_ADDR} ^195\.171\.111\.(1[6-9]|2[0-9]|3[0-2])$
</pre>
<br />
The IP address 195.171.111.196 in this example seems to be A4e's fixed IP from their head office in Sheffield. The page goaway.coopey.me is hosted at Tumblr, and says 'Access Denied' with a short explanation why.<br />
<br />
Remember, this will only work on visitors from a specific IP (or range of IPs). If you block a range, you may be blocking more people than you attended, and if you block someone who uses a dynamic IP address (their ISP changes this each time they connect to the internet) then they will not be permanently redirected- and the people who are subsequently assigned the IP will have to access!Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-82014620233692787222012-09-19T15:24:00.001+01:002012-12-16T20:44:57.446+00:00Check CentOS Version<div xmlns="http://www.w3.org/1999/xhtml">
Ever go to install a package, but can’t remember which specific version of CentOS you’re running? This often happens to me, and helpfully I can never remember the command. So for as much my benefit as yours, this is what you do:<span id="more-346"> </span> <br />
<br />
Run:<br />
<br />
<blockquote>
<br />
<pre>cat /etc/redhat-release</pre>
</blockquote>
<br />
which will return your version number, eg:<br />
<br />
<blockquote>
<br />
<pre>CentOS release 5.8 (Final)</pre>
</blockquote>
<br />
Edit:<br />
<br />
The command:<br />
<br />
<blockquote>
<br />
<pre>cat /etc/centos-release</pre>
</blockquote>
<br />
works in CentOS 6.<br />
<br /></div>
Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-75530617967686712142012-09-19T14:39:00.001+01:002012-11-18T15:43:07.915+00:00Changing root password in CentOS<div xmlns="http://www.w3.org/1999/xhtml">
If you want to change the default root password in CentOS, it’s one simple command: (assuming you’re logged in as root)<span id="more-341"> </span> <br />
<br />
<blockquote>
<br />
<pre>
passwd</pre>
</blockquote>
<br />
You’ll have to enter your new password twice:<br />
<br />
<blockquote>
<br />
<pre>
Changing password for user root.
New UNIX password:
Retype new UNIX password:</pre>
</blockquote>
<br />
If they match, you’ll get the message:<br />
<br />
<blockquote>
<br />
<pre>
passwd: all authentication tokens updated successfully.</pre>
</blockquote>
<br />
All done!<br />
<br />
If you need help <a href="http://passwordsite.co.uk/">generating a random and secure password</a>, try passwordsite.co.uk<br />
<br />
<br />
<br />
<br />
<br />
via Simon Coopey » Development http://simoncoopey.com/2012/changing-root-password-in-centos/#utm_source=feed&utm_medium=feed&utm_campaign=feed</div>
Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-66816170442387912332012-04-28T14:58:00.004+01:002024-02-04T13:58:55.697+00:00Moving home...<strike>Well not home, but this blog.</strike><br />
<strike><br /></strike>
<strike>The content has been merged in with my main blog at coopey.si</strike><br />
<br />
Some of the content seemed better suited kept separate. So I kept the short 'tidbits' here, and moved the longer posts there.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-8250388201027890082012-04-16T16:37:00.003+01:002013-04-29T15:40:35.279+01:00Edit BuddyPress Admin Bar - Log InA site I've been working on is using a <a href="http://wordpress.org/">WordPress</a> multisite install, with <a href="http://buddypress.org/">BuddyPress</a>. As a multisite install, the idea is users will be able to create their own blog, which works fine. However, say a user who is not logged in, visits one of the sub-blogs and clicks the 'Log In' button on the BuddyPress admin bar, they're redirected to the main blog home page. Not optimal behaviour for me.<br />
<div>
There was no option to edit this in the BuddyPress admin menu, no plugin to alter this, and trying to search for a solution turned up results that either asked how to fix it, or were about a slightly different problem (e.g. disabling the BuddyPress admin bar and creating one's own).</div>
<div>
<br /></div>
<div>
I have created a plugin to fix this- '<a href="https://github.com/SimonCoopey/BP-adminbar-c"><b>BuddyPress Adminbar Log In Fix</b></a>' or 'BP-adminbar-c' for short.<br />
<br />
To fix the log in behaviour of the button is not too difficult, we create a function for the button, active only when the user is not logged in:<br />
<br />
<br />
<pre style="white-space: pre-wrap; word-wrap: break-word;"><span class="Apple-style-span" style="background-color: #fff2cc;">function custom_adminbar_li_button() {
if (!is_user_logged_in()) {
echo '<li><a href="/wp-login.php/">Log In</a></li>';
}
}</span></pre>
<br />
<br />
Then, we create a function to remove the original log in button, and replace it with our new button, appending it to the WordPress footer which calls the BuddyPress admin bar:<br />
<span class="Apple-style-span" style="background-color: #fff2cc; font-family: monospace; white-space: pre-wrap;"><br /></span>
<span class="Apple-style-span" style="background-color: #fff2cc; font-family: monospace; white-space: pre-wrap;">function remv_bp_adminbar_li(){</span><br />
<br />
<pre style="white-space: pre-wrap; word-wrap: break-word;"><span class="Apple-style-span" style="background-color: #fff2cc;">remove_action('bp_adminbar_menus', 'bp_adminbar_login_menu', 2);
add_action('bp_adminbar_menus', 'custom_adminbar_li_button', 2);
}
add_action('wp_footer','remv_bp_adminbar_li',1);</span></pre>
<br />
<br />
This plug in is available on GitHub: <a href="http://coopey.me/3xci7">http://coopey.me/3xci7</a></div>
Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-22796260177573761692012-02-21T16:26:00.002+00:002013-08-06T10:24:32.978+01:00WordPress and InstapaperI noticed that when I clipped my blog posts, some useless extra info got clipped too.<br />
This was easy to fix with a few lines of code and the <a href="http://www.instapaper.com/publishers">Instapaper publisher guidelines</a>.<br />
<br />
I have created a plug-in containing this code, available here: <a href="http://coopey.ml/m44u">http://coopey.ml/m44u</a><br />
<br />
If you want the code yourself it's:<br />
<br />
<pre><blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;"><?php</span></div>
</blockquote>
<blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;">function instapaper_ce($content = ''){</span></div>
</blockquote>
<blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;"> if(is_single()){</span></div>
</blockquote>
<blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;"> $content = '<div class="instapaper_body">' . "\n" . $content;</span></div>
</blockquote>
<blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;"> $content .= "</div><!-- instapaper_body -->\n";</span></div>
</blockquote>
<blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;"> }</span></div>
</blockquote>
<blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;"> return $content;</span></div>
</blockquote>
<blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;">}</span></div>
</blockquote>
<blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;">add_filter('the_content', 'instapaper_ce');</span></div>
</blockquote>
<blockquote class="tr_bq">
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="Apple-style-span" style="background-color: yellow;">?></span></div>
</blockquote>
</pre>
Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-12158211655149920002012-01-16T14:52:00.000+00:002012-01-16T14:52:08.406+00:00Blank Wordpress homepage and blank admin page / dashboardActivated a new Wordpress theme, but the home page is blank? Worse still the admin page is blank? Uh-oh. I did this today on a live site- <a href="http://2sc.eu/wX0qz6">a stupid mistake</a>.<br />
<br />
Luckily, I figured out how to fix it quite quickly, so all is well.<br />
<br />
You've uploaded your new/test theme to your Wordpress install and activated it. You visit the homepage and it's blank, so you visit /wp-admin/ but that's blank too.<br />
Simply go back to your FTP client and delete or rename the folder with your new theme in.<br />
Give it a few seconds and try and visit /wp-admin/ again and you'll see the dashboard again. If you go to the theme selector you'll see a message saying 'theme not found, reverting to default' or something similar.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-43617987830462112432012-01-16T14:44:00.002+00:002012-01-16T15:01:00.888+00:00Rules of Web DevelopmentI'm a fool.<br />
Rules of web development:<br />
1. Always back up.<br />
2. Do not test on a live site.<br />
<br />
Today I forgot rule 2.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com1tag:blogger.com,1999:blog-7215509281609374750.post-77971357201457595522011-12-11T10:00:00.000+00:002011-12-11T10:00:03.338+00:00not an rpm package (or package manifest):<br />
Got this?<br />
<br />
<blockquote class="tr_bq">
<span class="Apple-style-span" style="background-color: black; color: lime;">not an rpm package (or package manifest):</span></blockquote>
<br />
You’ve probably downloaded a .html file and not the actual package. Don’t waste 20 minutes wondering why the RPM didn’t work. Like I just did.<br />Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com1tag:blogger.com,1999:blog-7215509281609374750.post-82673243675526918072011-12-10T22:42:00.001+00:002011-12-10T22:50:47.141+00:00How do I get the copyright notice to update year automatically?<br />
I have a few little websites scattered around, and I noticed one of them had an outdated copyright notice. “Why doesn’t this update automatically?” I thought, then realised it’s easy with PHP- simply pop this in to your footer (or wherever you want it to appear):<br />
<br />
<blockquote class="tr_bq">
<span class="Apple-style-span" style="background-color: #ffd966;">&copy; Copyright My Website 2010 - <?php echo date("Y") ?></span></blockquote>
<br />
Easy, huh?<br />Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-16839160848139292622011-11-26T22:46:00.001+00:002014-02-10T20:24:40.026+00:00WordPress Multisite Domain Mapping - ISPConfig 3I'm going to assume you're familiar with setting up and installing WordPress and installing plugins and have an intermediate knowledge of hosting and domains.<br />
This isn't a tutorial, more of a checklist, but if you have any questions then please ask in the comments below.<br />
<br />
If you're setting up a WordPress multisite network on your server with ISPConfig 3 control panel, the workflow is mostly the same as the tutorials you can find by searching with your favourite search engine. There are, however, two important things to get right (highlighted <span class="Apple-style-span" style="color: red;"><b>red</b></span>) that if not correct will result in endless redirect loops. The 'Aliasdomain' section isn't covered in any tutorials I could find, but this slots in where the official tutorial talks about 'parking' names in cPanel (a more popular control panel solution).<br />
<br />
Example Site: example.com, blog2.example.com, example.org<br />
Example IP: 217.145.318.277<br />
(Replace with your own details- IP address is impossible anyway!)<br />
<br />
<b>Set up domain in ISPConfig:</b><br />
Set up DNS details making sure you have A records for 'www', '*' and ' ' (i.e. blank) all pointing to the server's primary IP address<br />
-- So www.example.com, example.com and everythingelse.example.com at the moment all point to your index.html page on example.com<br />
Set up a site for your primary domain (where you'll install WordPress).<br />
<br />
<b>Installing WordPress & Plugins:</b><br />
Install <a href="http://wordpress.org/">WordPress</a> (I'm using 3.2.1). Set up your primary blog on example.com<br />
Follow <a href="http://codex.wordpress.org/Create_A_Network">instructions for setting up a multisite network</a>.<br />
Install and activate the plugin <a href="http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/">Wordpress MU Domain Mapping</a>.<br />
Install and activate the plugin <a href="http://hakre.wordpress.com/plugins/better-http-redirects/">Better HTTP redirects</a>.<br />
<br />
<b>Mapping Domains:</b><br />
Create your secondary blog e.g. 'Blog2' which is now at the address blog2.example.com.<br />
From the Settings menu, choose 'Domain Mapping'. If you were hosting your WordPress install on your server's default domain, you could put the IP in and omit CNAME, but as we're installing on a server that we're sharing with many domains, ignore IP and in CNAME enter the main blog domain i.e. example.com<br />
In 'Domain Options' on the mapping page, select options 1, 2, and 4.<br />
Next choose the option 'Domains' from the Settings menu. In 'Site ID' enter '2' (assuming this is a fresh install and the first sub-blog you've set up, else find your ID from the 'Sites' menu) and in domain enter example.org. <span class="Apple-style-span" style="color: red;"><b>IT IS VERY IMPORTANT THAT DOMAIN IS ALL IN LOWERCASE!</b> </span>Tick/check the 'Primary Domain' option and click save.<br />
<br />
<b>Setting Up Secondary Domain:</b><br />
At your registrar, find where you can edit your DNS settings.<br />
Remove any A records for ' ' (i.e. blank) - sometimes represented as '@', '*' and 'www'.<br />
In their place create CNAME records for each of the above, pointing at 'example.com'.<br />
<br />
<i>Alternatively, if your name servers already point at your ISPConfig server, you can create the domain name under 'DNS' and change the settings on the ISPConfig server as outlined above.</i><br />
<br />
<b>Alias To Main Site</b><br />
In your ISPConfig control panel, select the 'Sites' menu option, and then the 'Aliasdomain for website' from the left-hand menu.<br />
Choose to 'Add new alias domain'.<br />
In 'Domain' enter example.org<br />
For 'Parent Website' select example.com from the drop-down menu.<br />
<b><span class="Apple-style-span" style="color: red;">For 'Redirect Type' select 'No Flag' from the drop-down menu.</span></b><br />
Leave 'Redirect Path' blank, and for 'Auto Subdomain' select '*.' from the drop-down menu and make sure 'Active' is ticked/checked.<br />
<br />
Sometimes, DNS settings take a while to work, so I would suggest taking this opportunity to make some tea/coffee.<br />
<br />
Now, visiting example.com should take you to your primary blog, example.org should take you to Blog2 and if anyone entered blog2.example.com, they should get redirected to example.org (which should display in the address bar). All sites can be managed from the 'Network Admin' page which you can reach from the WordPress dashboard (at 3.2.1 this is where it says 'Howdy, Yourname", but this will be slightly different in 3.3).<br />
<br />
<b>Update</b> [Feb 2014]: <a class="g-profile" href="https://plus.google.com/117667414309209066991" target="_blank">+Gwyneth Llewelyn</a> has posted a helpful comment containing a method for nginx users to utilise the benefits of W3 Total Cache: <a href="https://plus.google.com/117667414309209066991/posts/SsWV8EXds5c">https://plus.google.com/117667414309209066991/posts/SsWV8EXds5c</a><br />
She also points out that the 'Better HTTP redirects' plugin is no longer maintained (I've just realised this post is over two years old!) and may not be required. I deactivated on one of the few WP Multisite installs I have remaining and there seems to be no adverse effects. (YMMV).Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com3tag:blogger.com,1999:blog-7215509281609374750.post-80526381696323748242011-11-23T14:52:00.001+00:002011-11-23T14:56:02.119+00:00Change hostname on CentOS serverIf your hosting provider has given you a rubbish or branded hostname for your server, you'll be pleased to know there is a simple way to see and change the hostname on a CentOS server.<br />
Use:
<br />
<blockquote>
<span class="Apple-style-span" style="background-color: #ffd966;">sysctl kernel.hostname</span></blockquote>
to read the current hostname, and:<br />
<blockquote class="tr_bq">
<span class="Apple-style-span" style="background-color: #ffd966;">sysctl kernel.hostname=YOUR_SERVER_NAME</span></blockquote>
to change it.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-39557154643957898402011-11-13T19:20:00.001+00:002011-11-27T19:04:06.158+00:00coopey@gmail.comSome spam bot (80.86.81.22) is signing up to lots of blogs and attempting to post spammy comments and is using *my* GMail address. Posting it here is probably going to make it worse (luckily it is a secondary account and not my main account).<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">I'd like to assure anyone who has decided to search for this address that it is not me.</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">And, because the address is being posted everywhere, it is now getting scraped by other spam bots and I'm getting hundred of spam mails every day. Credit to Google, only 3 have got through the filter so far.</div></div>Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-69512539665133926802011-11-10T23:26:00.001+00:002011-11-11T01:27:14.791+00:00Hide WordPress Admin LinkIf you're editing or building a WordPress theme, and want to hide the 'Admin' link, the solution is very simple:<br />
<br />
<blockquote class="tr_bq"><span class="Apple-style-span" style="background-color: #ffe599;"><?php if (current_user_can("manage_options")) : ?></span><br />
<span class="Apple-style-span" style="background-color: #ffe599;"> <a href="<?php echo bloginfo("siteurl") ?>/wp-admin/">Admin</a></span><br />
<span class="Apple-style-span" style="background-color: #ffe599;"><?php endif; ?></span></blockquote>This will show a link saying 'Admin' if an admin is logged in, for all other users and logged-out users nothing is displayed.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com1tag:blogger.com,1999:blog-7215509281609374750.post-46221142027113439912011-10-25T23:02:00.000+01:002011-10-25T23:29:25.268+01:00Where is .htaccess? How to show hidden files on Mac OS X Lion.I hate .htaccess files for many reasons.<br />
One is their annoying vanishing act on some systems- OS X in particular. (It's because of the [noname].[extension] format marking it as a 'system' file, I assume).<br />
<br />
Anyway, to show hidden files on Mac OS X Lion 10.7:<br />
<br />
Open Terminal (Open Finder, then look in the 'Utilities' folder)<br />
In Terminal, enter this command and press return to run it:<br />
<b style="background-color: #fff2cc;">defaults write com.apple.Finder AppleShowAllFiles YES</b><br />
<br />
Relaunch Finder (Alt+Right Click on icon and choose 'relaunch'.).<br />
<br />
Hidden files should now appear (as greyed-out icons to show they're hidden). Make sure you don't delete anything important!<br />
<br />
To undo this:<br />
<b style="background-color: #fff2cc;">defaults write com.apple.Finder AppleShowAllFiles NO</b><br />
<div>
<br /></div>Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com2tag:blogger.com,1999:blog-7215509281609374750.post-72311285521875162682011-10-18T22:25:00.000+01:002011-10-30T19:10:25.316+00:00Where is .ssh/known_hosts?I keep forgetting where this is, and Mac OS X's Spotlight is no help, so I'm writing this for me and anyone else who might search for "where is .ssh/known_hosts".<br />
<br />
Open a new Finder window. Either open the 'Go' menu and select "Go to Folder...", or press ⇧+⌘+G (Shift+Cmd+G). In the dialog that pops up enter<br />
<b>~/.ssh</b><br />
and press enter. Note the ~ (tilde) at the start.<br />
<br />
This should open the folder, and often known_hosts will be the only file in this folder.<br />
<br />
A little extra on the known_hosts file- If you're opening this to look for a line, be aware that TextEdit wraps the text- so visible lines are often not the same as actual lines. I am blessed with a big screen, so I stretch the window as far as I can to get the content to 'unwrap'.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-67481155290660869142011-10-18T20:00:00.002+01:002011-10-18T22:27:29.273+01:00I was wrong!Contrary to my earlier post, it seems Blogger is here to stay (probably going to be renamed 'Google Blogs' at some point) and looks a bit sexier too! So I'm going to use the account again.Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com0tag:blogger.com,1999:blog-7215509281609374750.post-83473379613320266222011-08-20T22:19:00.001+01:002024-02-04T14:01:39.002+00:00I hear Blogger is being phased out...?This clearly never happened, this content is out-of-date and I moved my main URL again since writing this!<br />Simon Coopeyhttp://www.blogger.com/profile/11002632310320053744noreply@blogger.com1