My slice of insanity

Running a WordPress site locally using WAMP

The WAMP server menu visible from the task bar

WAMP server

When working with any site it is important to have a development environment. With WordPress there can be conflicts with WordPress versions and plugins. It is also vital to be able to test code before making it live. I am documenting here how I run a local development environment and populate it with a live site.
These instructions work and have been tested on Windows 8 and 10.
First step is to install WAMP. You will need to allow it to pass through your firewall. When it is installed and you run it there will be an icon in the taskbar that will turn green if successful.

Note:  If the icon won’t turn green then there could e another process running on port 80. Skype will interfere so you may want to close it down. Alternatively you can set up WAMP to listen on a different port. To do this you will need to:

  1. Edit C:\wamp\bin\apache\apacheX.X.X\conf\httpd.conf
  2. Change the two Listen lines to use port 8080 instead of 80
  3. Change localhost:80 to localhost:8080
  4. Use :8080 after URLs

Now you need to get a copy of your WordPress site:

  1. Export and download your database
  2. On your live Wordress site, zip wp­admin, wp­content and wp­includes as well as any files beginning with wp­ in root and index.php
  3. Download the zip file from the above step and be sure to remove it from the server
  4. Create a folder in c:\wamp\www called yourwebsite
  5. Unzip the live WordPress files to the folder you just created
  6. Create a database using http://localhost/phpmyadmin/ the database name will be the same as the database listed in your wp-config.php file
  7. Import the database file exported from the live site in step 1
  8. Update C:\wamp\www\yourwebsite\wp_config.php, change user to “root” and empty password
  9. Edit C:\wamp\bin\apache\apacheX.X.X\conf\httpd.conf change DocumentRoot “c:/wamp/www/” to DocumentRoot “c:/wamp/www/yourwebsite/”
  10. In the apache modules (from clicking on WAMP in the taskbar and choosing apache > modules ensure rewrite_module is enabled
  11. Using http://localhost/phpmyadmin/ run the SQL script at the end of this list. This is important as all the links in the database will be pointing at your live server.
  12. See if the site works: http://localhost (ot http://localhost:8080 if you canged port numbers)
  13. In admin panel go to settings / permalinks and save. This will overcome page not found on child links

These steps should work to get a local development environment working. It will not send emails, so if that is required you may want to try using Test Mail Server Tool

SQL Script to fix links

You need to ensure you replace yourwebsite.com with your website name

UPDATE wp_options SET option_value = replace(option_value, ‘https://www.yourwebsite.com’, ‘http://localhost’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
UPDATE wp_posts SET post_content = replace(post_content, ‘https://www.yourwebsite.com’, ‘http://localhost’);
UPDATE wp_postmeta SET meta_value = replace(meta_value,’https://www.yourwebsite.com’,’http://localhost’);
update wp_posts set post_content = replace(post_content, ‘https://www.yourwebsite.com’, ‘http://localhost’) where instr(post_content, ‘https://www.yourwebsite.com’) > 0;
update wp_posts set post_content = replace(post_content, ‘http://www.yourwebsite.com/’, ‘http://localhost/’) where instr(post_content, ‘http://www.yourwebsite.com’) > 0;
update wp_links set link_url = replace(link_url, ‘http://www.yourwebsite.com/’, ‘http://localhost/’) where instr(link_url, ‘http://www.yourwebsite.com/’) > 0;
update wp_links set link_url = replace(link_url, ‘https://www.yourwebsite.com/’, ‘http://localhost/’) where instr(link_url, ‘https://www.yourwebsite.com/’) > 0;
update wp_links set link_url = replace(link_url, ‘https://yourwebsite.com/’, ‘http://localhost/’) where instr(link_url, ‘https://yourwebsite.com/’) > 0;

Alternatively you can use a text editor to do a find and replace on the SQL file before you import it. If using Notepad++ the following will work well, assuming your site is example.com.au:

Find (using Regulat expression): http?://(www\.)?example.com.au([^\s”]*)

Replace: http://localhost/example\2

And that’s it!

Good luck. The main issues I have come across are that:

WAMP won’t start – you will need to check what else is running on the same port

Internal links are broken – Make sure to go to settings > permalinks and press save, and that you updated the SQL script before running it.

Wikipediaize

A few years ago I created a Visual Studio Tools for Office (VSTO) application called Wikipediaize which will take a user defined dictionary of acronyms and create a table of acronyms/abbreviations as well as an option to hyperlink them.  When I migrated my blog I didn’t migrate all the old posts, so a lot of the programming code didn’t come across.

The technology may be a little old now, but I notice people are still trying to access it and I have had a request for the code, I have included it here as a download. Please feel free to use it and adapt it and credit me. There is no support as I am no longer actively programming. When I get some time I will hunt down the original article about how it is set up, but it should be reasonably clear from the code. Here it is: Focas.NET.Wikipediaise

Waze – my experiences

The waze car logo showing a happy driving car

Waze

So I have been using Waze for a while now and wanted to document my experiences with it, and what I like about it, and where it is lacking. In Waze’s own words…

Waze is a free social mobile app that enables drivers to build and use live maps, real-time traffic updates and turn-by-turn navigation for an optimal commute.
100% powered by users the more you drive the better it gets.

Currently the community in Australia is small so it will take a while before Waze is very useful here. I believe that Waze are shooting themselvews in the foot by not encouraging more participation. I will try to summarize what I feel Waze are doing well and where they could do better.

Please note that Waze is a beta product so some of these observations should be considered in the light of this.

What Waze does right

Waze provides a free turn-by-turn GPS application for smart phones. These are not overly expensive, and my Android phone actually came with a free turn-by-turn GPS app so I don’t really need one. But for some this would be a bonus.

By gathering real time data Waze can in theory change the route it offers based upon traffic jams or other traffic issues encountered by other users. This is a difficult feature to test as there are so few routes I could actually get Waze to find instructions for. I do like the feature, so I have stuck with Waze to help build up a community of Australian users.

There is a nice feature for recording roads that Waze is unaware of so far. Once activated, the car icon that represents my car is replaced by a road grazer, and a new road is carved into the map. I don’t know why but I fiound this particularly satisfying. It would have been nice to see some little summary of how many metres I had graded so far as I carved new roads out.

There is the ability to report map issues and update house numbers from the GPS application.

A user can update the maps by using the Waze website. New roads can be added, they can be given names and some other map editing features, so the community can contribute to the whole system.

It is a satisfying feeling to feel you are contributing to a community, and a combinatin of these features helps to bring that feeling out.

Sometimes there are special icons you can drive by and get bonus points. A lot of these appeared at Easter, eggs, bunnies etc. These seem to have disappeared now and it has become just another GPS application.

Overall, that was about all I really found Waze did well.

Where Waze needs to improve

Waze starts out with some gamification elements, being an active user you get points and unlock a few achievements early on such as driving your first 5 kilometres, but then it all just stops. There is a dashboard that shows how many kilometres I have driven, how many new roads I have carved, how many map updates I have made etc. This information needs to be presented in a more friendly and attractive manner. I would like some more features local to the country I am in. For example, it would be great to see how may new roads I have carved out this week compared to other Australian drivers, or how many kilometres I drive compared to other local drivers.

I really do not get the feeling of being rewarded for contributing. I have carved a lot of new roads, and added a lot of roads on the map using the map editor, and named those roads. Most systems would reward you with unlocking some achievement levels, like “Congratulations, you have unlocked the ‘Master road builder level'”. There could be sneak previews of upcoming releases offered to the active users, or a notification ‘You are the second most active map editor in your area. If you had performed 10 more edits last week you would have been the number 1 map editor for the week’. Something to give me more enthusiasm. Without the feeling of some sort of community participation, it just feels like my time is being used to create maps for someone else to get rich from. Something desperately needs to be put back into the Waze users to encourage future participation.

The map editor is difficult to use. There are various editing panels that always appear on top of the map and dont remember their positions between sessions, so each time I try to edit I have to move them all afresh. When adding new roads the drop down for type of road displays ‘one way’ by default, require extra effort for almost every new road. It is very confusing working out how to make a ‘no right turn’ intersection. There seems to be no way to add street numbers using the map editor. This can be done via the app, but is unintuitive. The dashboard does not reflect any street number updates.

The smartphone app seems to be designed for the iPhone. Using it on an LG P500 Android device, the lists come out all screwy. The main app is OK. Some of the options are ignored when set. Overall it is not too bad, but not really designed with usability in mind. I would like to be able to edit street names from the app but this is not available.

There is a ping feature allowing drivers to ping each other and send messages. This to me seems ill thought out. For a start it is just outright dangerous. It is probably OK if a  never passenger does the pinging, but I couldn’t really see the point of this.

When driving, there should be an easy way to report a ‘No right turn’ street, but unfortunately there isn’t.

The website is not updated regularly enough.  The updates feel more like semi-advertisements than true updates.  Waze claim to be using game mechanics, but they seem to be failing. They really need to acknowledge their community a lot more if they want to get more back in return.

The website should include a ‘remember me’ feature. It is frustrating to have to log back in all the time.

The website needs to be less United States-centric. For example when going to the ‘Community’ section, the users country preference is ignored and only US map fixing options are presented. This is very frustrating as it ensures Australian road fixes will progress a lot slower than they could be. This page is just plain unusable for Australian users as it probably is for any non-US drivers.

Other features that could be implemented

I have always been fascinated by what roads I have never driven on before, it would be great to get an overlay in a different colour of roads I have visited, so occaisionally I could go experimenting with raods I have never visited before.

A much improved dashboard that allows map editors to compete to improve the whole map structure.

A regularly updated website.

Improved Android support

More communication with the More reaching out, greater incorporation of gaming mechanics in tasks. Waze needs to see the community more as a community of people contributing their time and effort to Waze, rather than just a free labour force.

Empire Avenue – social networking in a share trading context

A screenshot of social network activity in Empire Avenue

Social network activity in Empire Avenue

Empire Avenue is a social game which aims to connect people together via their social networks. It works like a stock market where you buy and sell shares in other Empire Avenue members. The best people to invest in are the producers and influencers, people who make a lot of Facebook and LinkedIn updates, who use Twitter regularly, upload videos or comment on YouTube and share pictures on Flickr. The more a member interacts with social media and the more they inteeract in Empire Avenue, the higher their share price goes. By investing in people who are active you can build up a portfolo and earn Eaves, the currency in Empire Avenue.

This is a free website, but you can buy additional Eaves for real money.  Quite why you would want to do this I am not sure, it strikes me a little like those services that offer Twitter followers or Facebook friends for a fee.

Empire Avenue is a strangely compelling website. It makes great use of gamification elements and allows a member to easily post all their actions and updates and unlocks to their social network accounts. The list of social networks is limited to those listed above. This is a little frustrating as for instance I use Picasa for my photos and won’t be changing to Flickr just for Empire Avenue. Each time an account is linked, an achievement is unlocked. Achievements can be unlocked by writing blog entries, performing a certain number of share transactions, joining communities etc.

There is also an element of business social media similar to the way companies have a presence on Facebook. So far I haven’t really worked out what the companies are doing here but as Empire Avenue seems to be thriving I guess they are scared of missing out on something that could be potentially huge.

A screenshot showing the share prices for a member on Empire Avenue
Empire Avenue share prices

There is a lot of potential here, Empire Avenue is another way of finding people, working, working out who are the thinkers and influencers in areas of interest and has potential for linking people by interest, geography, profession etc. I am undecided on members being able to buy extra Eaves sa it seems to be a little too much like buying influence. However I can see that Empire Avenue have to make some money somehow. I will keep having fun using this site for at least a few weeks before I can really be certain whether I want to continue. I think this might just fill a gap for me. I don’t really like Facebook, it just doesn’t do it for me. I like Twitter but there is a very low signal-to-noise ration. Yammer is fantastic but is locked to my professional life. This seems to be a nice umbrella for all these services and networks, and creates a fun environment to aggregate them all together.

You can view my Empire Avenue profile if you would like. Invest in me if you wish, I may just make you some Eaves!

 

Google docs – My experiences so far

I have been using Google Docs for quite a while now and thought I might write about my experiences. I love Google Docs, but there is a long way to go before they can replace Microsoft Office. The advantage of Google Docs being in the cloud is great. This can be achieved using Microsoft Office and Google Cloud Connect for Microsoft Office, however this is not a very polished product. The toolbar also take up a lot of valuable space on the screen and cannot be minimized.

There are a lot of features in Microsoft Word that I never use. These are great features, I just have no use for them and so won’t miss them. When I used to be a programmer I used a lot of the features such as macros and Visual Studio Tools for Office to make add-ins. Google Spreadsheets. Google docs doesn’t have any sort of scripting in the documents. although the spreadsheets can.

Microsoft Office is absolutely fantastic for keyboard shortcuts, and what can’t be done with shortcuts can easily be done with macros.

These are the features I found difficult with Google Documents:

  • When inserting a new row in a table the the mouse has to be clicked in the cell to start editing. This should happen by default.
  • If text is copied from one cell in a table and pasted it to another, the content isn’t copied but a whole table structure is inserted in the cell.
  • When clicking ‘update’ on a Table of Contents, the table scrolls down and the button has to be clicked again to actually update. This doesn’t always happen, but seems to be when the table of contents gets longer.
  • When copying a table where the first row has a background colour, the first cell loses its background colour which then has to be reset.
  • There are no table styles
  • There are no table captions or figure captions

The list could be a lot longer, but for the vast majority of the document work I do this works well for me. The collaboration aspect is great, I like being able to edit the document at the same time as others and having  discussions during it. Never having to save the document is fantastic, and what I believe should be the future of all computer documents.

To overcome the final few weaknesses with Google docs what I have been doing is to do all the collaboration in Google Docs and then to export the document as a Microsoft Word document. The resulting document is excellent quality and then I place it in Microsoft SharePoint to enable versioning. I would like to be able to do this in Google docs, but it is not as strong as Microsoft SharePoint for document management.

The one other issue with Google docs is document corruption. I have had two documents become corrupt. I suspect this was due to the recent pagination update. Google don’t seem too concerned with customer support and leave it up to the community to support themselves. I reported this issue on the forum but have not seen a solution to it yet.

In conclusion, I am sold on Google docs for its collaborative features,  its cloud storage/access anywhere paradigm and ease of use. If I need more complex documents such as extensive cross-referencing then I still use Microsoft Word.

Chore wars – making housework fun

For the last two weeks I have been experimenting with Chore Wars as a way of getting my children to be more involved with housework. The premise is fairly simple but really appeals to the kids. It reminds me a little of Super Nanny, where a formalised way of recording the kids activities helps them on the path to a reward.

By performing tasks that can be configured easily they can be given XP points (eXperience points). The longer they play and the more XP they gain, the more levels can be unlocked. This really appeals to their love of gaming.

Initially my 8 year old was the most excited, running around making his bed, doing dishes, wiping benches, all with a big smile on, I couldn’t believe my eyes! My 12 year old who was in a bad mood with me at the time was doing his most to try to discourage the younger son, but I knew that given time he would come over. A few times I caught him on the site, but without any real movement. Due to some issues today, I blocked runescape for him, and he came up and asked me if I would unblock it if he gained 100 XP. After asking him what would be involved in gaining 100 XP, he had clearly checked the site out well as he listed the tasks he would do, among them was cleaning the bathroom and cleaning up the dog poo. As he was explaining it to me he had a huge smile on his face and couldn’t wait to get on the job. Never have I seen a child smiling explaining that they want to clean up dog poo! My hat is tipped to Chore Wars.

The game was created by Kevan Davis in 2007. It is free to join up, and there is also a gold option which for a one off fee of $USD 10 will unlock extra statistics.

Android App for Roselands Football Club

This is my first Android app which I created for the Roselands Football Club. Its purpose is to enable easy discovery of where a match is being played for a given grade and on a given date. It’s fairly simple. Just install using the QR code at the top of the post. You can download it from the Android marketplace. Currently only the first three weeks of the draw have been published by the Canterbury District Soccer Football Association. As soon as the draw is updated I will update the app.

The app includes the ability to display the park where the match is being played on a Google Map, and also to get driving instructions there using Google maps again. Some screenshots show the functionality.

The source code can easily be modified for any sport for any club, so leave a note in the comments if you would like a copy of the code.

Screen allowing selection of the grade of the team

Grade selection screen

Date selection screen

Date selection screen

Details screen

Details screen

Map of park

Map of park

Navigation screen

Navigation screen

Driving instructions

Driving instructions

Upgraded to WordPress 3.0

I have upgraded to WordPress 3.0. It’s very impressive the amount of work that so many people have put into this platform. It still amazes me how good this platform is and it keep getting better. Now I need to really check out WordPress.tv and get to playing around with creating some plug-ins.

There is a good overview of what’s new in WordPress 3.0 available on the WordPress blog.   It has been embedded below. The features I want to play with most are the custom posts and the multi-user blogs.

https://videopress.com/v/wp-content/plugins/video/flvplayer.swf?ver=1.21

Using Google Font directory and its API

I have been playing around with the Google Font Directory and the Google Font API. This is a new offering from Google which allows for the use of their open source fonts on any website. It is extremely easy to use, all that needs to be done is to add a link to the font, and then specify it in the stylesheet. In the case of this blog, I am using Droid Sans font. To use this font I added this to my WordPress theme’s header.php file:

<link href=’http://fonts.googleapis.com/css?family=Droid+Sans’ rel=’stylesheet’ type=’text/css’ />

And this to the style.css file:

body{ font-size:14px; font-family: ‘Droid Sans’, arial, serif;;line-height:14px;}

and Voila!

There is a Getting started guide that details what fonts are currently available and how to use them.

Blog migration

I have moved my blog to a new server and have not migrated any of the content yet. Lately I have moved away from development so will not be posting any of the previous code that was here. You can contact me thru this site if you are after any of the code that was previously available.