Wednesday, December 28, 2011

Postgresql query in transaction

The following is short example of query in transaction. We will delete all records and will insert new one in single transaction those actions both fails or both succeeds:
BEGIN;
DELETE FROM hi_value;
INSERT INTO hi_value(next_value) VALUES(5308);
COMMIT;

Developing software is like building something fairly simple out of bricks (link)

Although very few managers ever express it directly this way, many behave as if developing a piece of software is like building something fairly simple out of bricks. It might be something large. But it’s still fairly simple. This is tempting. The inexperienced person thinks that bricks are easy to understand: they’re all the same: if you know how to work with one, you know how to work with them all. You can measure the progress of building something out of bricks by counting the bricks in place. And anyone can contribute, even if only by moving bricks from one place to another using brute force. Read here more...

Tuesday, December 27, 2011

Code evolution vs. Intelligent design (link)

You are feeling proud of yourself. You sit back after having just polished off another piece of masterful code and look down at the next item on your to-do list. You start to think through how you are going to tackle the next problem and then it dawns on you. To implement the next step you are going to have to go back and dig up all that perfect code you have just finished writing, hack it apart and bolt-on a whole new bunch of functionality. The perfect structure you have been building might not make it through through the carnage. Read here more...

Friday, December 23, 2011

HipHop for PHP at Hyves (link)

At Hyves, we use HipHop to run our web servers and our daemons, which are also written in in PHP. In this blog, I will detail some of our experiences and results. Read more...

Thursday, December 22, 2011

All Programmers Are Self-Taught (link)

A pitching coach teaches you how to pitch, but a CS professor doesn’t teach you how to code. Read more...

Tuesday, December 20, 2011

The Switch: Python to Node.js (link)

Cloudkick was primarily written in Python. Most backend services were written in Twisted Python. The API endpoints and web server were written in Django, and used mod_wsgi. We felt that while we greatly value the asynchronous abilities of Twisted Python, and they matched many of our needs well, we were unhappy with our ability to maintain Twisted Python based services. Specifically, the deferred programming model is difficult for developers to quickly grasp and debug. It tended to be ‘fail’ deadly, in that if a developer didn’t fully understand Twisted Python, they would make many innocent mistakes. Django was mostly successful for our needs as an API endpoint, however we were unhappy with our use of the Django ORM. It created many dependencies between components that were difficult to unwind later. Cloud Monitoring is primarily written in Node.js. Our team still loves Python, and much of our secondary tooling in Cloud Monitoring uses Python. Read here more...

Monday, December 19, 2011

Ideas and execution (link)

Some people regret the fact that they can come up with lots of great ideas, but cannot execute them. Others are frustrated that they can execute well, but cannot come up with an idea that is original or noteworthy... Read more here...

How big are PHP arrays (and values) really? (link)

Very interesting observations about PHP implementation

Tuesday, December 13, 2011

More shell, less egg (link)

Jon Bentley had a regular column called “Programming Pearls” in the Communications of the ACM (you may have come across this collection of some of his columns). In 1986 he got interested in literate programming, so he asked Donald Knuth to write a program in that style as a guest column and Doug McIlroy to write a literary-style critique of it. Read more here...

Tuesday, December 6, 2011

Example of Regex: validating GUID

Here is a simple example of Regex used to validate GUID.
using System;
using System.Text.RegularExpressions;

namespace Program
{
    class MainClass
    {
        public static void Main(string[] args)
        {
            string[] uuids = new string[]
            {
                Guid.NewGuid().ToString("D"), 
                Guid.NewGuid().ToString("D"),
                "some random string"
            };
   
            foreach(string uuid in uuids)
            {
                Console.WriteLine("uuid: '{0}' macth '{1}'", 
                    uuid, Regex.IsMatch(uuid, @"^[a-z0-9]{8}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{4}-[a-z0-9]{12}$"));
            }
        }
    }
}

Friday, December 2, 2011

Tyranny of the tools (link)

"When we create Agile teams, we create teams of real, live people. That means our control and communication systems must be built around the qualities and capabilities of people, not robots. We are doing much more in a team room than simply transferring abstract pieces of metadata around about a project. We are gaining a common emotional understanding of the problems and the players, getting a deep feeling for what might go wrong and what we need to worry about, adjusting our work patterns, our communication techniques, and our problem solving skills to this particular team, this particular problem, in this particular situation." ... "An Agile team isn't a team that moves stories across a wall. It's a team that looks each other in the eye and talks about things the Product Owner wants and how they're going to give it to them." Read more...