WordPress Massive Sitemap Generator

May 17, 2012 Author thepauleh@gmail.com

Create sitemaps for websites that have over 50,000 pages and posts to be indexed by Google Webmaster Tools

This Sitemap generator also works on WordPress Multisite and what’s more: It’s super, super fast at generating sitemaps. Commercial crawlers could spend days trying to check every post of your massive WordPress website. With Massive Sitemap Generator this can be done in seconds.

http://wordpress.org/extend/plugins/massive-sitemap-generator/

Collapsible Categories inside WordPress Admin

Feb 1, 2012 Author thepauleh@gmail.com

Recently had a project requiring over 1000 categories with WordPress, as you can imagine setting these categories is quite hard through the WordPress list. All this does is expand the categories list as you click on each one, and minimize when you remove that category. You may extend this how you like, and use this for whatever legal reasons you can fathom (apparently we live in a world where you need to state that..).

Place this inside your active theme’s function.php file

add_action(“admin_head”, “admin_category_change”);

function admin_category_change() {
echo “<style>.children{display: none;}</style>
<script>jQuery(document).ready(function($){
$(‘.selectit’).click(function(){
$(this).next().toggle();});});</script>”;
}

Quick Domain Migration using TTL

Nov 29, 2011 Author thepauleh@gmail.com

Here’s a pointer for website hosts transferring their domains over. About a day before your migration you want to drop your TTL values. This forces faster DNS lookups – the reason you have to wait this long is because DNS cache’s store the amount of time to check this again as a way of reducing the load on your DNS server (and nobody likes to see their DNS server fall over).

 

; zone 'zonename.com' 
$TTL 86400 @ IN SOA ns1.zonename.com. host.zonename.com. 
( 2006052101 ; Serial 
10800 ; Refresh 3 hours 
3600 ; Retry 1 hour 
604800 ; Expire 1 week 
86400 ); Minimum 24 hours 

 

If you knock that TTL value in bold down to 60 then you’ll be looking at 60 seconds before it goes live. But remember, you’ll need to wait the time you’ve already specified (86400 / 24 hours in this case) before you tell your registrar the new nameservers to avoid messing things up for your clients.

 

Hope you find this useful!

 

Concatentated Primary Key Searching with .NET

Nov 25, 2011 Author thepauleh@gmail.com

So here’s a little gem. Now, I’m in the CODD’s school of thought that composite keys are evil – but sometimes to quickly fit an existing system it is necessary. Just makes me shudder as I look at that one table I couldn’t normalise.

dim objFindValues(numOfKeys-1) as object ‘create an array with the elements
to match the number of columns in the primary key

objFindValues(0) = value1
objFindValues(1) = value

‘ Then we use the array as the search argument.
dataRow = dataSet.Tables(“TableName”).Rows.Find(objFindValues)

MySQL Batch Updates with VB.Net

Nov 21, 2011 Author thepauleh@gmail.com

Hi there,

In absense of great guides on the web on this subject I’ll be going through the process of a MySQL batch update using VB.Net. To get started, first you’ll need a MySQL server, MySQL/Net Driver and Visual Basic/Studio then up and running. First things first though, I don’t rate VB.Net compared to Java – but some situations dictate it.

 

So, we’ll be calling this inside a function:

Setup

Try
Using MySQLConn = New MySqlConnection(“Server=example.com;Database=dbname;user id=username;Pwd=password;”)
Dim adapter As New MySqlDataAdapter(“SELECT * FROM table_name”, MySQLConn)

Then we need to put this data into a dataSet, as follows:
Dim ds As DataSet = New DataSet
adapter.Fill(ds, “table_name”)
Dim dt As DataTable = ds.Tables(“table_name”)

This allows us to interact with the data from this source – it does seem somewhat wasteful but I think the benefits are reaped further on, with smarter write operations than your standard Java preparedStatement script.

Testing DataSet
If, like – you want to know this is working so far – throw this script in now to see the data presently inside your DataSet.
Dim maxrows = ds.Tables(“table_name”).Rows.Count
Dim inc = -1

If inc <> maxrows – 1 Then
inc = inc + 1
Debug.Print(ds.Tables(“table_name”).Rows(inc).Item(“column_name”).ToString)
End If

You might have to keep the console open to read your Debug Log, I use a cheeky:
Console.Write()

Appears I’m running out of time, so here’s the rest of the script for now to get inserts working:

Manipulate – To be completed soon, this assumes you have a DataTable of data to merge in called args

See: http://msdn.microsoft.com/en-us/library/5ycd1034(VS.80).aspx for a stronger typed version of this section, for users not trying to add an array into the dataset.

Dim sb As New MysqlCommandBuilder(adapter)
Dim drargs As DataRow
For Each drargs In args.Rows
Dim dr As DataRow
dr = dt.NewRow
dr(“col0″) = drargs(“newcol0″)
dr(“col1″) = drargs(“newcol1″)
dt.Rows.Add(dr)
Next

Update
adapter.UpdateBatchSize = 100
Try
adapter.Update(ds, “table_name”)
ds.AcceptChanges()
Catch a As Exception
Console.WriteLine(“fail ins”)
End Try

 

I’ll try to remember to post up an update, but at least this should be enough to get you started. Note that with this method you manipulate the DataSet directly.. but that would explain why massive sections of most guides are missing saying just ‘maniplate the dataset here

Here’s to hoping I can go back to my Linux Box soon ;(

If anyone has a leaner method, please comment on here – I’ll switch things around if I verify it as working, and hopefully we can help more people out there – there’s not enough resources out there on this.

True multi-paging posts on WordPress

Oct 14, 2011 Author thepauleh@gmail.com

It comes with great joy to me to announce that my latest project for HDTVTest.co.uk has finally made it’s way out of development. After previously modifying the CMS’ comments section to display based upon chosen category, one would think the step towards extending WordPress into a true multi-paged post CMS would be a little simple – especially considering that WordPress already has multi-paging page support.

 

I can tell you that that is sadly not the case.

The minimal support in this area involves the use of All in One SEO Pack, and modifying this to rip out the variables you need. However, this is not future proof, and I would advise everyone considering it against it. AIOSP needs to be updated regularly by it’s developers, as these popular plugins are often the focus of hackers. After all, it’s open source, and if you crack one – you’ve opened the door to everyone.

I walk away this week feeling like a true WordPress Ninja by writing this as a bespoke plugin. With this CMS, I’m starting to believe that pretty much anything is possible.

 

To preview this work, please visit:

http://www.hdtvtest.co.uk/news/toshiba-32sl753b-32sl753-20100908839.htm

And don’t forget to keep HDTVTest in mind when you’re looking for your next TV, they provide very, very detailed reviews!

Unbreaking the UberSVN Comments System

Oct 14, 2011 Author thepauleh@gmail.com

Hi, so this post is created due to Twitter’s 140 char limit.. which would be impossible to explain anything in.

Symptoms: Commit’s take forever; Message never goes to the dashboard.

So, I had the issue whereby I could not get messages from subversions submit statements to go up to the UberSVN dashboard. The weird thing being that messages such as ‘Ubersvn Restarted, Repository Created’ type messages working fine.

This pointed me to the post commit hook.

(Please note this is relevant to the Linux version, booting the server into Windows to find out how relevant that is just ain’t something I have time for).

A FQDN (svn.example.com) would not work on my system to connect to UberSVN, but the local network IP address does (you can check this by running the postcommit.jar file with the parameters you find in the post-commit inside opt/ubersvn/(lib?)/repositories/{name}/

Sorry if that’s wrong, but I left work a while back.

If you had the same issue as me it’ll say something along the lines that the UberSVN server cannot be reached, and to contact your system administrator.

You have to manually change the file in post-commit so it’s the IP as mentioned, instead of the FQDN. I also changed the URL to the IP inside UberSVN, but this does not automatically make the changes you need inside these repository files!

If anyone stumbles across this, and I’ve got the directories totally wrong and you’re well lost, just drop me an email at thepauleh@gmail.com!

 

**Edit** – A few days after making these changes I tried to make a new repository, couldn’t find it.. switched the binaries, apache svn refused to start.. I’m going to create a 10.04 LTS dedicated server for this, hopefully nothing will conflict with it!

Update 16/06/11

Jun 16, 2011 Author thepauleh@gmail.com

I’m currently unable to take on any further projects until 2nd July 2011. However, to make arrangement consultations for this weekend please book well in advance.

My only email address now is thepauleh@gmail.com. Any outstanding digital fruit clients in the Manchester area will be served by myself and Joseph in the Doncaster area respectively.

In addition, I’ve left the BCS and no-longer attach the MBCS post-nominals to reflect this on any documentation.