Search Results

Search found 155 results on 7 pages for 'liam westley'.

Page 4/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • Paying it Forward

    - by Liam McLennan
    You’re a talented guy (or girl). You’ve done alright. Years of hard work and stick-to-it-ive-ness have paid off and left you with plenty and an opportunity to make a positive difference to someone else. And then there are people with less than they need. Sometimes all they need to help themselves is a start. Opportunity International provide micro financing to help people grow their small businesses so that they can afford food, shelter, water and education. microfinance to solve poverty   MonsoonerOrLater This June, Chris, Angus (my brother) and I are travelling to India, entering into a rickshaw race and raising money for charity (Opportunity International and Round Table India). The Deccan Odyssey is a nine day rally, racing up the coast of India from Goa to Mumbai in a three wheeled motorbike. If you would like to support us, please make a tax deductable donation via our secure site at GoFundraise. For more information take a look at the MonsoonerOrLater site. If you live in Brisbane come along to An Evening With MonsoonerOrLater. The entry fee includes a three-course Indian meal, live music, henna tattooist, chilli eating competition, best bollywood dance off, Dhalsim Vs Dhalsim Street fighter, Delhi Belly Bet, Auctions and Prizes. All profits go to our charities: Round Table India and Opportunity International.

    Read the article

  • Ad-hoc String Manipulation With Visual Studio

    - by Liam McLennan
    Visual studio supports relatively advanced string manipulation via the ‘Quick Replace’ dialog. Today I had a requirement to modify some html, replacing line breaks with unordered list items. For example, I need to convert: Infrastructure<br/> Energy<br/> Industrial development<br/> Urban growth<br/> Water<br/> Food security<br/> to: <li>Infrastructure</li> <li>Energy</li> <li>Industrial development</li> <li>Urban growth</li> <li>Water</li> <li>Food security</li> This cannot be done with a simple search-and-replace but it can be done using the Quick Replace regular expression support. To use regular expressions expand ‘Find Options’, check ‘Use:’ and select ‘Regular Expressions’ Typically, Visual Studio regular expressions use a different syntax to every other regular expression engine. We need to use a capturing group to grab the text of each line so that it can be included in the replacement. The syntax for a capturing group is to replace the part of the expression to be captured with { and }. So my regular expression: {.*}\<br/\> means capture all the characters before <br/>. Note that < and > have to be escaped with \. In the replacement expression we can use \1 to insert the previously captured text. If the search expression had a second capturing group then its text would be available in \2 and so on. Visual Studio’s quick replace feature can be scoped to a selection, the current document, all open documents or every document in the current solution.

    Read the article

  • A Reusable Builder Class for .NET testing

    - by Liam McLennan
    When writing tests, other than end-to-end integration tests, we often need to construct test data objects. Of course this can be done using the class’s constructor and manually configuring the object, but to get many objects into a valid state soon becomes a large percentage of the testing effort. After many years of painstakingly creating builders for each of my domain objects I have finally become lazy enough to bother to write a generic, reusable builder class for .NET. To use it you instantiate a instance of the builder and configuring it with a builder method for each class you wish it to be able to build. The builder method should require no parameters and should return a new instance of the type in a default, valid state. In other words the builder method should be a Func<TypeToBeBuilt>. The best way to make this clear is with an example. In my application I have the following domain classes that I want to be able to use in my tests: public class Person { public string Name { get; set; } public int Age { get; set; } public bool IsAndroid { get; set; } } public class Building { public string Street { get; set; } public Person Manager { get; set; } } The builder for this domain is created like so: build = new Builder(); build.Configure(new Dictionary<Type, Func<object>> { {typeof(Building), () => new Building {Street = "Queen St", Manager = build.A<Person>()}}, {typeof(Person), () => new Person {Name = "Eugene", Age = 21}} }); Note how Building depends on Person, even though the person builder method is not defined yet. Now in a test I can retrieve a valid object from the builder: var person = build.A<Person>(); If I need a class in a customised state I can supply an Action<TypeToBeBuilt> to mutate the object post construction: var person = build.A<Person>(p => p.Age = 99); The power and efficiency of this approach becomes apparent when your tests require larger and more complex objects than Person and Building. When I get some time I intend to implement the same functionality in Javascript and Ruby. Here is the full source of the Builder class: public class Builder { private Dictionary<Type, Func<object>> defaults; public void Configure(Dictionary<Type, Func<object>> defaults) { this.defaults = defaults; } public T A<T>() { if (!defaults.ContainsKey(typeof(T))) throw new ArgumentException("No object of type " + typeof(T).Name + " has been configured with the builder."); T o = (T)defaults[typeof(T)](); return o; } public T A<T>(Action<T> customisation) { T o = A<T>(); customisation(o); return o; } }

    Read the article

  • Random MongoDb Syntax: Updates

    - by Liam McLennan
    I have a MongoDb collection called tweets. Each document has a property system_classification. If the value of system_classification is ‘+’ I want to change it to ‘positive’. For a regular relational database the query would be: update tweets set system_classification = 'positive' where system_classification = '+' the MongoDb equivalent is: db.tweets.update({system_classification: '+'}, {$set: {system_classification:'positive'}}, false, true) Parameter Description { system_classification: '+' } the first parameter identifies the documents to select { $set: { system_classification: 'positive' } } the second parameter is an operation ($set) and the parameter to that operation {system_classification: ‘positive’} false the third parameter indicates if this is a regular update or an upsert (true for upsert) true the final parameter indicates if the operation should be applied to all selected documents (or just the first)

    Read the article

  • Using Query Classes With NHibernate

    - by Liam McLennan
    Even when using an ORM, such as NHibernate, the developer still has to decide how to perform queries. The simplest strategy is to get access to an ISession and directly perform a query whenever you need data. The problem is that doing so spreads query logic throughout the entire application – a clear violation of the Single Responsibility Principle. A more advanced strategy is to use Eric Evan’s Repository pattern, thus isolating all query logic within the repository classes. I prefer to use Query Classes. Every query needed by the application is represented by a query class, aka a specification. To perform a query I: Instantiate a new instance of the required query class, providing any data that it needs Pass the instantiated query class to an extension method on NHibernate’s ISession type. To query my database for all people over the age of sixteen looks like this: [Test] public void QueryBySpecification() { var canDriveSpecification = new PeopleOverAgeSpecification(16); var allPeopleOfDrivingAge = session.QueryBySpecification(canDriveSpecification); } To be able to query for people over a certain age I had to create a suitable query class: public class PeopleOverAgeSpecification : Specification<Person> { private readonly int age; public PeopleOverAgeSpecification(int age) { this.age = age; } public override IQueryable<Person> Reduce(IQueryable<Person> collection) { return collection.Where(person => person.Age > age); } public override IQueryable<Person> Sort(IQueryable<Person> collection) { return collection.OrderBy(person => person.Name); } } Finally, the extension method to add QueryBySpecification to ISession: public static class SessionExtensions { public static IEnumerable<T> QueryBySpecification<T>(this ISession session, Specification<T> specification) { return specification.Fetch( specification.Sort( specification.Reduce(session.Query<T>()) ) ); } } The inspiration for this style of data access came from Ayende’s post Do You Need a Framework?. I am sick of working through multiple layers of abstraction that don’t do anything. Have you ever seen code that required a service layer to call a method on a repository, that delegated to a common repository base class that wrapped and ORMs unit of work? I can achieve the same thing with NHibernate’s ISession and a single extension method. If you’re interested you can get the full Query Classes example source from Github.

    Read the article

  • Handy Javascript array Extensions &ndash; contains(&hellip;)

    - by Liam McLennan
    This javascript adds a method to javascript arrays that returns a boolean indicating if the supplied object is an element of the array Array.prototype.contains = function(item) { for (var i = 0; i < this.length; i += 1) { if (this[i] === item) { return true; } } return false; }; To test alert([1,1,1,2,2,22,3,4,5,6,7,5,4].contains(2)); // true alert([1,1,1,2,2,22,3,4,5,6,7,5,4].contains(99)); // false

    Read the article

  • Investigating Strategies For Functional Decomposition

    - by Liam McLennan
    Introducing Functional Decomposition Before I begin I must apologise. I think I am using the term ‘functional decomposition’ loosely, and probably incorrectly. For the purpose of this article I use functional decomposition to mean the recursive splitting of a large problem into increasingly smaller ones, so that the one large problem may be solved by solving a set of smaller problems. The justification for functional decomposition is that the decomposed problem is more easily solved. As software developers we recognise that the smaller pieces are more easily tested, since they do less and are more cohesive. Functional decomposition is important to all scientific pursuits. Once we understand natural selection we can start to look for humanities ancestral species, once we understand the big bang we can trace our expanding universe back to its origin. Isaac Newton acknowledged the compositional nature of his scientific achievements: If I have seen further than others, it is by standing upon the shoulders of giants   The Two Strategies For Functional Decomposition of Computer Programs Private Methods When I was working on my undergraduate degree I was taught to functionally decompose problems by using private methods. Consider the problem of painting a house. The obvious solution is to solve the problem as a single unit: public void PaintAHouse() { // all the things required to paint a house ... } We decompose the problem by breaking it into parts: public void PaintAHouse() { PaintUndercoat(); PaintTopcoat(); } private void PaintUndercoat() { // everything required to paint the undercoat } private void PaintTopcoat() { // everything required to paint the topcoat } The problem can be recursively decomposed until a sufficiently granular level of detail is reached: public void PaintAHouse() { PaintUndercoat(); PaintTopcoat(); } private void PaintUndercoat() { prepareSurface(); fetchUndercoat(); paintUndercoat(); } private void PaintTopcoat() { fetchPaint(); paintTopcoat(); } According to Wikipedia, at least one computer programmer has referred to this process as “the art of subroutining”. The practical issues that I have encountered when using private methods for decomposition are: To preserve the top level API all of the steps must be private. This means that they can’t easily be tested. The private methods often have little cohesion except that they form part of the same solution. Decomposing to Classes The alternative is to decompose large problems into multiple classes, effectively using a class instead of each private method. The API delegates to related classes, so the API is not polluted by the sub-steps of the problem, and the steps can be easily tested because they are each in their own highly cohesive class. Additionally, I think that this technique facilitates better adherence to the Single Responsibility Principle, since each class can be decomposed until it has precisely one responsibility. Revisiting my previous example using class composition: public class HousePainter { private undercoatPainter = new UndercoatPainter(); private topcoatPainter = new TopcoatPainter(); public void PaintAHouse() { undercoatPainter.Paint(); topcoatPainter.Paint(); } } Summary When decomposing a problem there is more than one way to represent the sub-problems. Using private methods keeps the logic in one place and prevents a proliferation of classes (thereby following the four rules of simple design) but the class decomposition is more easily testable and more compatible with the Single Responsibility Principle.

    Read the article

  • How can I exclude content in my notifications bar from being indexed?

    - by Liam E-p
    Of course I want my content to be indexed pretty fast by search engines, however not my notifications bar. My notifications bar contains the last 30 changes to content on the site, and I don't want this to show in my SEO meta. As all the notifications are generic, it often doesn't provide any relevant information. As I said the notifications are generic. If an article named "123" was created, it would create a notification that says "Article "123" was created by xxx at 12:00AM". I'm now wondering if this is a content design problem. As only 1/3 of this information is actually relevant to users (the title, what happened). By SEO meta, and irrelevant notification data being shown, I mean this - Basically what I was wondering, is how I could optimise this, so search engines wouldn't show this generic nonsense.

    Read the article

  • Unnamed Refactoring

    - by Liam McLennan
    This post is a message in a bottle. It cast it into the sea in the hope that it will one day return to me, stuffed to the cork with enlightenment. Yesterday I  tweeted, what is the name of the pattern where you replace a multi-way conditional with an associative array? I said ‘pattern’ but I meant ‘refactoring’. Anyway, no one replied so I will describe the refactoring here. Programmers tend to think imperatively, which leads to code such as: public int GetPopulation(string country) { if (country == "Australia") { return 22360793; } else if (country == "China") { return 1324655000; } else if (country == "Switzerland") { return 7782900; } else { throw new Exception("What ain't no country I ever heard of. They speak English in what?"); } } which is horrid. We can write a cleaner version, replacing the multi-way conditional with an associative array, treating the conditional as data: public int GetPopulation(string country) { if (!Populations.ContainsKey(country)) throw new Exception("The population of " + country + " could not be found."); return Populations[country]; } private Dictionary<string, int> Populations { get { return new Dictionary<string, int> { {"Australia", 22360793}, {"China", 1324655000}, {"Switzerland", 7782900} }; } } Does this refactoring already have a name? Otherwise, I propose Replace multi-way conditional with associative array

    Read the article

  • Twitter Customer Sentiment Analysis

    - by Liam McLennan
    The breakable toy that I am currently working on is a twitter customer sentiment analyser. It scrapes twitter for tweets relating to a particular organisation, applies a machine learning algorithm to determine if the content of tweet is positive or negative, and generates reports of the sentiment data over time, correlated to dates, events and news feeds. I’m having lots of fun building this, but I would also like to learn if there is a market for quantified sentiment data. So that I can start to show people what I have in mind I have created a mockup of the simplest and most important report. It shows customer sentiment over time, with important events highlighted. As the user moves their mouse to the right (forward in time) the source data area scrolls up to display the tweets from that time. The tweets are colour coded based on sentiment rating. After I started working on this project I discovered that a team of students have already built something similar. It is a lot of fun to enter your employers name and see what it says.

    Read the article

  • Optimising website IP for location

    - by Liam Sorsby
    From my understanding of SEO, websites are optimised for the current location of their IP address. For example if xxx.xxx.xxx.xx resolves to the UK then you are more likely to get higher rankings in the UK then you are in the USA. However, my query is when you use a CDN you are storing a cached version of your website across multiple servers at strategic locations across the globe to reduce load time in locations that your trying to target. Now if you use a CDN and geo-locate the website URL then it only resolves back to the USA (where our IP address resolves too) but it doesn't say it resolves to any other countries. As far as I know you can have multiple IP address resolving to one domain (from different countries). Do CDN's really help to optimise the location of your website or are they soley meant to optimise load time? Is there a better way to optimise for multiple countries with regards to the resolution of the IP address? Are VPN's as per this post here relevant to this? Any advice would be helpful.

    Read the article

  • How should I store a Game Database on Android?

    - by Liam
    I'm looking at creating a game for Android and while I have most of the ins and outs worked out, the one thing I'm struggling with is how to store data for the game. Ultimately, the game will be based off of a lot of pre-defined data and statistics so the obvious choice to me would be something like SQLite, but as I'm pretty new to the realm of Android and Game Development, I'm not 100% certain if this is the right route to follow. The data will be general pre-defined data as well as player data (along the lines of careers stats - what place finished, etc). I was wondering if there was a better/best practice solution that wasn't SQLite and that would provide said functionality and if so, could you point me in the right direction?

    Read the article

  • Command Query Separation

    - by Liam McLennan
    Command query separation is a strategy, proposed by Bertrand Meyer, that each of an object’s methods should be either a command or a query. A command is an operation that changes the state of a system, and a query is an operation that returns a value. This is not the same thing as CQRS, hence why I think that CQRS is poorly named. An Example of Command Query Separation Consider a system that models books and shelves. There is a rule that a shelf may not be removed if it holds any books. One way to implement the removal is to write a method Shelf.Remove() that internally checks to make sure that the shelf is empty before removing it. If the shelf is not empty then it is not removed and an error is returned. To implement this feature following the principle of command query separation would require two methods, one to query the shelf and determine if it is empty and a second method to remove the shelf. Separating the query from the command makes the shelf class simpler to use because the state change is clear and explicit.

    Read the article

  • Simple moving object jitters every couple of seconds [on hold]

    - by Liam
    I'm trying to get smooth movement in my game, right now every couple of seconds the moving square jitters. I'm using C++ with SDL2. I made a very simple project to test different methods so all that's happening is a box moves across the screen. Here's a pastebin of the code http://pastebin.com/7YxxSw0D Here's a link to a dropbox folder containing the 'game' https://www.dropbox.com/sh/0ygntl140qv8iv0/AABVuuk6khArOJmdBi1OaFlua?dl=0 Any input would be greatly appreciated, and let me know if you need any more info. Thanks!

    Read the article

  • Learning PHP from beginner to advanced

    - by Liam
    I've dabbled with PHP for a few years now and I'm capable of most of the basic things, building login forms etc but from my time on here I've noticed there's so much more I need to learn, like best practices, security issues etc and so I want to learn everything from the very basics. In the past I've used forums and browsed the web for snippets of code only I think this has led to my bad practices, can anybody recommend books or Valid, recommended learning sources? Thanks in advance!

    Read the article

  • What &lsquo;enterprise&rsquo; doesn&rsquo;t understand about risk

    - by Liam McLennan
    Enterprises (large bureaucracies) obsess about risk. I think it is because of the inertia generated by the process and politics that they have to deal with. The trouble is that they respond to risk in precisely the wrong way: by adding complexity. Need to call a method? Better wrap it in WCF service. Need to talk to another application? Better hook a message queue to a service bus connected to a biztalk sharepoint – on Oracle. Here is a simple guide: Complexity increases risk. Simplicity reduces risk.

    Read the article

  • Learning PHP from beginner to advanced [closed]

    - by Liam
    I've dabbled with PHP for a few years now and I'm capable of most of the basic things, building login forms etc but from my time on here I've noticed there's so much more I need to learn, like best practices, security issues etc and so I want to learn everything from the very basics. In the past I've used forums and browsed the web for snippets of code only I think this has led to my bad practices, can anybody recommend books or Valid, recommended learning sources? Thanks in advance!

    Read the article

  • SQL Server architecture guidance

    - by Liam
    Hi, We are designing a new version of our existing product on a new schema. Its an internal web application with possibly 100 concurrent users (max)This will run on a SQL Server 2008 database. On of the discussion items recently is whether we should have a single database of split the database for performance reasons across 2 separate databases. The database could grow anywhere from 50-100GB over 5 years. We are Developers and not DBAs so it would be nice to get some general guidance. [I know the answer is not simple as it depends on the schema, archiving policy, amount of data etc. ] Option 1 Single Main Database [This is my preferred option]. The plan would be to have all the tables in a single database and possibly to use file groups and partitioning to separate the data if required across multiple disks. [Use schema if appropriate]. This should deal with the performance concerns One of the comments wrt this was that the a single server instance would still be processing this data so there would still be a processing bottle neck. For reporting we could have a separate reporting DB but this is still being discussed. Option 2 Split the database into 2 separate databases DB1 - Customers, Accounts, Customer resources etc DB2 - This would contain the bulk of the data [i.e. Vehicle tracking data, financial transaction tables etc]. These tables would typically contain a lot of data. [It could reside on a separate server if required] This plan would involve keeping the main data in a smaller database [DB1] and retaining the [mainly] read only transaction type data in a separate DB [DB2]. The UI would mainly read from DB1 and thus be more responsive. [I'm aware that this option makes it harder for Referential Integrity to be enforced.] Points for consideration As we are at the design stage we can at least make proper use of indexes to deal performance issues so thats why option 1 to me is attractive and its more of a standard approach. For both options we are considering implementing an archiving database. Apologies for the long Question. In summary the question is 1 DB or 2? Thanks in advance, Liam

    Read the article

  • how do I make my Dualshock 3 gamepad work in Ubuntu 14.04?

    - by user290527
    When my desktop computer was running Ubuntu 12.04, my PS3 controllers would work with USB. I didn't need to do any special setup. I could just plug it in before I start SuperTuxKart and it would recognize it. I can also do this on my laptop (still running 12.04). Since I gave my desktop a fresh install of Ubuntu 14.04, the controller would never work. I have played with some installed software that I found when looking for information. Here is what I get with xboxdrv: liam@Liam-CustomDesktop:~$ sudo xboxdrv --detach-kernel-driver xboxdrv 0.8.5 - http://pingus.seul.org/~grumbel/xboxdrv/ Copyright © 2008-2011 Ingo Ruhnke <[email protected]> Licensed under GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This program comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see the file COPYING for details. Controller: PLAYSTATION(R)3 Controller Vendor/Product: 054c:0268 USB Path: 003:012 Controller Type: Playstation 3 USB Your Xbox/Xbox360 controller should now be available as: /dev/input/js0 /dev/input/event16 Press Ctrl-c to quit, use '--silent' to suppress the event output So the existence of this controller is acknowledged at on my computer. But it never works for input. In my old installation, I didn't even need to get software like xboxdrv for it to work. I have never tried bluetooth on either computer, but I don't think I even have that on my desktop. So now, how do I make my gamepad work in Ubuntu 14.04?

    Read the article

  • AMD Phenom 2 is idling at 50°C, can I get it cooler?

    - by liam
    Is it possible to damage a CPU so that it works, but only at high temperatures? My Phenom 2 1090T is idling at 50°C and I have tried everything to get it down. I can play Deus Ex HR, Arkham City, or Dirt 3 and it hovers around 60. I have cleaned out all my fans: 2 intake (front and side), 1 exhaust (Arctic Freezer). My machine is a brand new Antec 520 high current gamer. Also: Extreme3 770 8 GB Kingston DDR3 (2x4 GB) 750 GB Seagate Barracuda ASUS Xonar DG Radeon HD 5670 New Arctic Freezer Pro Rev 2 (days old and mounted properly with Arctic Silver 5). I also dropped an Athlon 250 dual core into my rig and that ran at under 30. Is the CPU dying? I know that 50°C idle for an AMD is not normal.

    Read the article

  • Unable to configure Ruby with readline

    - by Liam Berg
    1) ./configure --prefix=$HOME/.packages --with-readline-dir=$HOME/.packages 2) configure: WARNING: unrecognized options: --with-readline-dir I am trying to setup the most up-to-date version of Ruby on my webhost (I do not have sudo access). Line 1 is the configure command I used for Ruby and Line 2 is the first printed line after executing 'configure'. I've googled this issue and found other people with the same problem but there aren't any real solutions. There are no warnings or errors when configuring/compiling readline-6.1. I am pretty stumped, any help/insight would be greatly appreciated. Thanks ahead of time.

    Read the article

  • Expanding Files 0%, error 0x80070017 Windows 7 x64 RTM

    - by Liam
    I have downloaded Windows 7 x64 from MSDN. I have checked the hash of the file and it is correct. I have them made a bootble USB stick (http://kmwoley.com/blog/?p=345 (had to use my vista bootsect.exe as running 32bit at the moment). When I boot from the USB it fails when expanding the file. It stays on 0% and fails after around 90 seconds. The error is 0x80070017. As the hash is correct and I am using USB I guess it could be a hardware problems. Any advice how to get Windows 7 installed? The machine is a Dell Studio Slim.

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >