Amadiere.com

Fourteen and a half crazy frog burpers

25th April 2009

Configuring Subversion Clients

Filed under: Subversion — Tags: , , — Alex Holt @ 3:16 pm

After my new found love of all things Subversion, I’ve been trying to faff about obtaining that perfect config (instead of doing any actual coding!). There are a number of things in the TortoiseSVN settings that I’ve needed to change so far which have caused me a bit of bother maybe. That and I’d like to just point out a few cool things that you can find when digging around TortoiseSVN too.

Firstly, there is the two important settings you should heavily consider before you even start using SVN:

Some important settings for TortoiseSVN

Some important settings for TortoiseSVN

The first thing of note is the big “Global Ignore Pattern” box. This is a space delimited list of files (with wildcards included) that can be used for excluding when you commit to your repository. The original set I left as it was, but added a few key additional files to that list:

*.o *.lo *.la *.al .libs *.so *.so.[0-9]* *.a *.pyc *.pyo *.rej *~ #*# .#* .*.swp .DS_Store *_ReSharper* *.suo Thumbs.db

The key ones you’ll spot I’ve added are *_ReSharper*, *.suo and Thumbs.db. I was keen to avoid putting all the ReSharper files in there by default, and this seemed like a good way of doing this. The *.suo was added when I realised that all I had to do was open the project and this file would change, a little look around shed the light that this file isn’t needed and can be dropped from SVN altogether. Thumbs.db (case sensitivity is important btw), was because I develop on a windows box and it seems intent on creating that damn file everytime I put an image in the directory – so I’ve excluded that too.

The tickbox at the bottom was a little bit more recommended, than something I’ve learnt from. When you have a nosey at the official documentation for TortoiseSVN, they do say that Visual Studio.NET has issues with the dot format SVN directory (Edit: This was only relevant for VS 2003 it seems (see Bert Huijben’s comment below) – so not much of a worry if you are on exclusively newer versions.):

VS.NET when used with web projects can’t handle the .svn folders that Subversion uses to store its internal information. This is not a bug in Subversion. The bug is in VS.NET and the frontpage extensions it uses. Read the section called “Subversion Working Folders” to find out more about this issue.

If you want to change the behaviour of Subversion and TortoiseSVN, you can use this checkbox to set the environment variable which controls this.

You should note that changing this option will not automatically convert existing working copies to use the new admin directory. You will have to do that yourself using a script (See our FAQ) or simply check out a fresh working copy.

While this issue might have gone away (I never experienced it). It seems quite foolish to simply ignore this setting when it does explicitly say against it!

I’ll reserve this post for any future amendments to my standard settings – as much a reference for myself as anyone else.

Wooooo! Time to do some coding!

20th April 2009

MySQL Two-Way, Master-Master Replication

Filed under: MySQL — Tags: , , — Alex Holt @ 1:32 pm

A bit back, I was looking into database replication and specifically, two-way replication. Meaning that either server could be updated and it would replicate any changes to it’s nice neighbour. Microsoft SQL offer a solution – but it was way out of our price-range. So, we looked into the world of MySQL and at the time, the sparkly and new MySQL 5.0.

MySQL offer quite a bit of useful documentation on replication in general, but for our requirement of Master to Master connections, it offered the wonderful barley’s of:

MySQL replication currently does not support any locking protocol between master and slave to guarantee the atomicity of a distributed (cross-server) update. In other words, it is possible for client A to make an update to co-master 1, and in the meantime, before it propagates to co-master 2, client B could make an update to co-master 2 that makes the update of client A work differently than it did on co-master 1. Thus, when the update of client A makes it to co-master 2, it produces tables that are different from what you have on co-master 1, even after all the updates from co-master 2 have also propagated. This means that you should not chain two servers together in a two-way replication relationship unless you are sure that your updates can safely happen in any order, or unless you take care of miss-ordered updates somehow in the client code.

You should also realize that two-way replication actually does not improve performance very much (if at all) as far as updates are concerned. Each server must do the same number of updates, just as you would have a single server do. The only difference is that there is a little less lock contention, because the updates originating on another server are serialized in one slave thread. Even this benefit might be offset by network delays.

This offers some good advice and you really do need to understand exactly what you are doing before you can continue down this path. But suppose that it doesn’t really matter what order things happen, as long as they happen consistently across all servers, what are we to do then to get it all working? Well, enhancing and copying from my response to a question on the awesome Stack Overflow, here is what I’d do.

The first major problem that you must overcome, is that when a new incremental seed is created, it’s normally created 1, 2, 3, 4, 5 (the glorious one times table). However, this will be no good if the theoretical two-inserts-at-once-on-different-boxes happens. It would great two number 4′s. A BIG data-integrity issue. This is solved simply however, by simply providing a seed which equals the total number of masters you would have. So, in my case (and maybe most), there would be two Masters, one would be counting evens, and the other ones odd. 2,4,6,8 and 1,3,5,7. Following this logic there can be no duplicates. It does create the OCD-Offensive side-effect that there are numbers that are never used – but that doesn’t really matter a great deal as far as things go. In addition, you should ensure both your server_id’s are different (two MySQL servers with the same name in replication has distinct disadvantage to the other setups (it doesn’t work) – but that’s standard replication setup anyway. ;0

Master MySQL 1:

auto_increment_increment = 2
auto_increment_offset = 1

Master MySQL 2:

auto_increment_increment = 2
auto_increment_offset = 2

Using all the functionality and commands of the standard MySQL replication, you should then be able to start both servers up as slaves of the other one. Then to check both are working OK, connect to both machines and perform the command SHOW SLAVE STATUS and you should note that bothSlave_IO_Running and Slave_SQL_Running should both say “YES” on each box.

When creating your code to connect to the database servers, you want to send to both boxes equally? Or maybe favour one because it’s a bit beefier? You could add in death-checks to make sure a server is still serving queries and allowing connections – and if its not, use the other one.

All being told, I really like this solution for replication. For the fuller picture, you’d obviously add a slave somewhere that is remotely connected periodically (or all the time) and allowed to update. It acts as an off-site backup should your building be compromised (burns to the ground in a huge inferno-type-mess scenario. For example ;) ).

15th April 2009

What’s all this Twitter lark?

Filed under: Social Networking — Tags: , — Alex Holt @ 3:21 pm

One of the things I’m working on at the moment is the embracing of Twitter where I work. Social Networks are something that Local Authorities don’t really do a great deal to embrace historically – though this isn’t across the board and there are some great users of it.

When originally we were talking about pushing out our press releases, news and events via sites – Twitter wasn’t something that many people had a great deal of knowledge about. I found myself in the envious task of explaining Twitter and its pro’s and con’s to a number of colleagues. One question in particular made me smile and stutter as I hadn’t really thought about it prior to the meeting:

Why would people want to use Twitter?

I’m not sure those were the same words, but the sentiment was that. It’s not that they were sceptical about change, nor that they wanted to try and trick me into a corner – it’s just that it’s a very logical question. Why would anyone want to use Twitter? It’s not a technology that isn’t already out there, but its certainly not got a single rival in existing technology.

  • SMS / Text Messages – These exist in similar format to the limited characters, although almost all modern phones make it easy to send longer messages, it’s not their purpose and people generally keep it short. However, these cost money and sending them to all your friends is even more expensive.
  • Email – People tend to ramble-on in emails. Instead of keeping to the point, they elaborate and expand upon points and (much like a blog) they aren’t used to convey the same type of information as Twitter.
  • Facebook (etc) – Arguably, it’s similar to the Facebook Status, but without the 3rd person tense and indeed, the requirement to talk about how you are feeling.

A few very key points that Twitter does that other software doesn’t – decisions made that stand it aside from others.

  • Friendship isn’t always mutual. This is a big difference. If JoeBloggs23 starts to follow me, I’ve no requirement to follow them back – I don’t even know them! It doesn’t stop them from following me though. This means that I (or the Council) need not accept friendship to all these people. It’s not something I want to get into a great deal of effort debating, but there are people that the Council would not want to be seen as ‘following’, but there is no harm in them following us. Touchy subject :)
  • It keeps things short. People can’t write essays (they can link to them on their blogs – though people don’t need to follow those links and read the blog post). It forces them to chose their words a little more carefully than maybe they would.
  • It’s not personal – it’s micro news. This is only slightly different from my first point about friendship, but worth its own point. While the system is built for individuals, it allows organisations to simply tag along and become pushers of news. The sigma of being ‘friends’ or ‘a fan’ of a Council might be hard work – but just following for updates isn’t that bad really. It’s not something that people would be that worried about.

At the moment, Twitter is still in the world of the tech-savvy and has yet to branch into the general population (if it ever does). But make no mistakes, it’s here and it’s popular alright. It’s a valid and worthwhile means of communication, financially too when you consider how little time and effort it takes to promote things that you are already promoting anyway!

But the true test is still not complete. When my mum starts to follow me, I know then that Twitter is indeed truely mainstream…

Older Posts »

Theme designed & built for Amadiere.com by Alex Holt. Powered by WordPress