Chelsea : There’s Only One Drog At The Bridge

Didier Drogba
Didier Drogba

There’s only one Drog at the Bridge, the whole of England actually. No other team has a striker so reliant that you can just will him to score and he will. And you don’t have to go through all the foreplay of passing the ball around in the midfield. Everything works for him – loft it to him directly from the goal kick, cross the ball for him, play a cutting pass through the defenders – he’s always there to collect the ball. His strength and precision makes him a defender’s nightmare. The man is Didier Drogba!

He’s been the man of big moments for Chelsea these last couple of months. He’s started every decisive match. He’s always been there for Chelsea – playing the hit man looking for goals or being the actor to break the oppositions flow and get a much deserved rest for his teammates. And he’s scored in both the finals this year.

And this is exactly why I feel a tinge of guilt about being so happy on signing Torres. I was one of the joyful people who thought we had replaced Drogba. I had even wanted Drogba out last summer so that Torres can finally take the center stage. But it is at times like these that prove we had the best striker of the English Premier League all the time. Torres’ goals and pretty play at Liverpool count for nothing against what the legendary Drogba has done at Chelsea. I am not maligning Torres – I love him and know he’ll come good for us, it’s just that I feel guilty of thinking he was eons ahead of Drogba. Well, one thing is for sure – no one can replace Drogba from the legends of Chelsea. You just cannot find another man in his mold with the same passion and dedication for the club.

With Drogba’s contract over, the million dollar question is – Will Drogba sign a new contract at Chelsea? Will Drogba leave? Should Drogba leave? Should Drogba be given the 2 year contract he so desires?

Alas all good things must come to an end. As Harvey Dent said

You either die a hero or you live long enough to see yourself become the villain.

Drogba has conquered all at Stamford Bridge – the premier league titles, the Carling cup, the FA cup and now the Champions League. He has nothing to prove to anyone anymore. He’ll forever be loved by all the Chelsea fans and respected by the neutrals. And he literally won the Champions League for Chelsea. But his league form had been terrible. He’s gotten older and has slowed down. He cannot help us in the league anymore. He’s become a man for the big occasions now. He gets all charged up and energized for one game. You cannot expect him to play this way a whole year. And I do not think being a bit-part bench player would be acceptable for him. He is a legend, he deserves respect. And this is why I feel this is the right time to call it quits on his Chelsea adventure. He can walk out with his head held high on his own terms.

I realize that letting Drogba leave could backfire disastrously. Andrea Pirlo is the best example – left by Milan he won the scudetto for Juventus. But I think that letting go of Drogba now would be the best thing to do. Roman wants a change in style of play to one that does not suit Drogba. It’s better for him to leave now as the European Champion than endear a possibly frustrating campaign trying to adapt to a completely new system.

The Chelsea management have got some pretty tough decisions to make this summer. It makes me anxious. I want the suspense of summer to be over. I want to know how this story ends and I want to dream of the beginning of a new season at the Bridge. If only I could close my eyes and drift off into a month long hibernation.

Popularity: 1% [?]

Perforce: Can’t Clobber Writable File Error

When getting the latest version of a package from a perforce repository I was getting the following error:

Can’t clobber writable file

And of course the file was not being updated. Remember that all the files in perforce are marked as read-only unless opened by the ‘p4 edit’ command. I did a ‘p4 opened’ to check if the file had been opened for edit. It was not. Then I checked the permissions and found that the file was marked as writable.

Simply removing the writable field from the permissions of the file did the trick.

chmod -w <filename>

Now when I did a ‘p4 sync’ the file got updated. Happy.

Popularity: 1% [?]

Java: Fix Unchecked Warnings In Java Collections

If you use Collections.EMPTY_LIST, eclipse shows up an unchecked conversion warning. This can be easily avoided by using Collections.<FooBar> emptyList() instead.

Popularity: 1% [?]

The Linux OOM Killer

Most Linux distributions allow processes to request more memory that what is available in the system. The logic behind the approval is that generally the allocated memory is not used up immediately. Also it has been observed that processes over their lifetime do not utilize all of the memory they had initially requested. Thus over-committing allows the system to fully utilize it’s memory at the risk of out-of-memory (OOM) situations.

The purpose of OOM Killer is to find the best process to kill in case of severe memory shortage. The process is selected on the basis of badness score. The value of badness score is determined by the following properties:

  • original memory size of the process – more memory a process uses higher is its score
  • it’s CPU time
  • the run time – the longer a process is alive lower is its score
  • oom_adj value – The /proc/<pid>/oom_adj can be set to a value between -17 and +15. Higher the value, more likely is it to be selected as the sacrificial lamb. Setting this value to -17 instructs the OOM Killer to never kill the process.
  • Half of each child’s memory size is added to parent’s score.
  • If the task has a nice value above zero, the score doubles
  • Superuser or direct hardware access tasks have their values divided by 4
  • Depending on oom_adj the value is adjusted as:
    • if oom_adj > 0, score <<= oom_adj
    • if oom_adj < 0, score >>= -(oom_adj)

The principle on which the OOM Killer operates is :

System should lose the minimum amount of work done, recovers a large amount of memory, doesn’t kill innocent processes eating tons of memory and kills the minimum number of processes (limit to 1 if possible).

The task with the highest badness score is selected and all it’s children are killed. If the process does not have any child then the process itself will be killed.

Adding more info from OOM_KILLER.

The function which does the above mentioned badness score computation is called badness(). It gets called by the following chain:

_alloc_pages -> out_of_memory() -> select_bad_process() -> badness()

The badness() accumulates points for each process and returns them to select_bad_process(). The scoring of a process starts with the size of it’s resident memory:

        /*
* The memory size of the process is the basis for the badness.
*/
        points = p->mm->total_vm;
view raw badness_1.c This Gist brought to you by GitHub.

The memory size of any child is added to the process:

        /*
* Processes which fork a lot of child processes are likely
* a good choice. We add the vmsize of the childs if they
* have an own mm. This prevents forking servers to flood the
* machine with an endless amount of childs
*/
          ...
                  if (chld->mm != p->mm && chld->mm)
                        points += chld->mm->total_vm;
view raw badness_2.c This Gist brought to you by GitHub.

Process with nice value above zero have their score increased and long running processes have theirs decreased:

        s = int_sqrt(cpu_time);
        if (s)
                points /= s;
        s = int_sqrt(int_sqrt(run_time));
        if (s)
                points /= s;

        /*
* Niced processes are most likely less important, so double
* their badness points.
*/
        if (task_nice(p) > 0)
                points *= 2;
view raw badness_3.c This Gist brought to you by GitHub.

Superuser processes and direct hardware access tasks have their scores reduced:

        /*
* Superuser processes are usually more important, so we make it
* less likely that we kill those.
*/
        if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_ADMIN) ||
                                p->uid == 0 || p->euid == 0)
                points /= 4;

        /*
* We don't want to kill a process with direct hardware access.
* Not only could that mess up the hardware, but usually users
* tend to only have this flag set on applications they think
* of as important.
*/
        if (cap_t(p->cap_effective) & CAP_TO_MASK(CAP_SYS_RAWIO))
                points /= 4;

view raw badness_4.c This Gist brought to you by GitHub.

Finally, honour the oom_adj setting:

        /*
* Adjust the score by oomkilladj.
*/
        if (p->oomkilladj) {
                if (p->oomkilladj > 0)
                        points <<= p->oomkilladj;
                else
                        points >>= -(p->oomkilladj);
        }
view raw badness_5.c This Gist brought to you by GitHub.

Thus the ideal candidate will be:

One that was recently started, is a non-privileged process which together with its children uses a lot of memory, has been nice’d and does no I/O. Something like a nohup’d parallel kernel build (which is not a bad choice since all results are saved to disk and very little work is lost when a make is terminated).

From the SDE Tip – Amazon

Popularity: 2% [?]

Knuth-Morris-Pratt String Search Algorithm

The KMP algorithm searches for the occurrence of a word W in a sentence S while employing the observation that when a mismatch occurs W contains sufficient information to determine the start position of the next search in S.

Say W = abcd and S = abcbabcd. Now we compare W[0] with S[0], W[1] with S[1], W[2] with S[2] and they all match. But W[3] does not match S[3]. The brute force algorithm would have started the next search by comparing W[0] with S[1]. But a simple observation tells us that it would be fruitless as there is no W[0] till S[3]. We would have done better by starting the next search from S[4]. And this is exactly what the KMP tries to achieve.

KMP requires a pre-processing of the word W. We create a Partial Match Table by iterating over all the letters of W in such a way that in case of a mismatch we can quickly figure out the next start position by looking at the table. The wiki article on KMP describes with an example how to create the table:

KMP – Partial Match Table

The partial match table can be created in O(n) time using O(n) space, where n is the length of the word W. Once we have the table we can iterate over each element of S consulting the table every time a mismatch occurs. You may want to read up the algorithm with examples from

KMP – Algorithm With Examples – Wikipedia

The search happens in O(k) where k is the length of the sentence S. Thus the algorithm runs in O(n + k).

Below is my java implementation of the same:

/**
* Perform the Knuth-Morris-Pratt string search. The algorithm first pre-processes the word to create a Partial Match
* Table. The table is creatd in O(n) where n is the length of the word. After the pre-processing, the actual search can
* be performed in O(k) where k is the size of the sentence.
*/
public class KMPStringSearch {
/**
* Searches for all occurances of the word in the sentence. Runs in O(n+k) where n is the word length and k is the
* sentence length.
*
* @param word The word that is being searched
* @param sentence The collections of word over which the search happens.
* @return The list of starting indices of the matched word in the sentence. Empty list in case of no match.
*/
public List<Integer> searchString(final String word, final String sentence) {
final List<Integer> matchedIndices = new ArrayList<>();

final int sentenceLength = sentence.length();
final int wordLength = word.length();
int beginMatch = 0; // the starting position in sentence from which the match started
int idxWord = 0; // the index of the character of the word that is being compared to a character in string
final List<Integer> partialTable = createPartialMatchTable(word);
while (beginMatch + idxWord < sentenceLength)
if (word.charAt(idxWord) == sentence.charAt(beginMatch + idxWord)) {
// the characters have matched
if (idxWord == wordLength - 1) {
// the word is complete. we have a match.
matchedIndices.add(beginMatch);
// restart the search
beginMatch = beginMatch + idxWord - partialTable.get(idxWord);
if (partialTable.get(idxWord) > -1) idxWord = partialTable.get(idxWord);
else idxWord = 0;
} else idxWord++;
} else {
// mismatch. restart the search.
beginMatch = beginMatch + idxWord - partialTable.get(idxWord);
if (partialTable.get(idxWord) > -1) idxWord = partialTable.get(idxWord);
else idxWord = 0;
}

return Collections.unmodifiableList(matchedIndices);
}

/**
* Creates the Partial Match Table for the word. Runs in O(n) where n is the length of the word.
*
* @param word The word whose Partial Match Table is required.
* @return The table as a list of integers.
*/
public List<Integer> createPartialMatchTable(final String word) {
if (StringUtils.isBlank(word)) return Collections.EMPTY_LIST;

final int length = word.length();
final List<Integer> partialTable = new ArrayList<>(length + 1);
partialTable.add(-1);
partialTable.add(0);

final char firstChar = word.charAt(0);
for (int idx = 1; idx < word.length(); idx++) {
final int prevVal = partialTable.get(idx);
if (prevVal == 0) {
if (word.charAt(idx) == firstChar) partialTable.add(1);
else partialTable.add(0);
} else if (word.charAt(idx) == word.charAt(prevVal)) partialTable.add(prevVal + 1);
else partialTable.add(0);
}

return Collections.unmodifiableList(partialTable);
}
}

Popularity: 2% [?]

Chelsea: Do I Want Di Matteo To Stay?

Honest to god answer – No. But do I believe Chelsea can find a better manager with no Champions League – Probably not.

Don’t get me wrong. Di Matteo has done a fantastic job since taking over from Villas Boas. This Chelsea team had been written off by one and all. Napoli players knew that they were into the next round even before visiting the Stamford Bridge. It’s a testament to the our interim Italian manager that he brought together a divided dressing room to produce a brilliant display in front of the home crowd. Chelsea fans will be hard pressed to find a more emotional and charged atmosphere than the second leg victory against Napoli.

Chelsea flag

Amazing as the start has been to Matteo’s managerial stint at Chelsea, the spark is still missing. One notable difference between Villas Boas and Matteo’s side is the change in formation from 4-3-3 to 4-5-1. The biggest loser from this change is Sturridge and the biggest gainer being Kalou. Let’s not get into that though.

Villas Boas tried to create a Chelsea team that attacks with flair. This required a high line of defense and lot of pressing. Chelsea got off to a great start in the Premier League. It was not soon enough when the opposition team started to realize that the Chelsea players were not suited to the high line tactics. Villas Boas reluctance to change his style eventually cost him his job.

Di Matteo has decided to pack his mid field and play with a lone striker. Luckily for him Torres has begun finding his feet and Matteo can make the simple decision of playing Torres ahead of Drogba – which must be pleasing Roman as well. But when you play with 5 in the middle you are expected to retain possession for majority of the game. Stats paint a completely different picture. Only against Stoke at home did Chelsea have like 70% possession. Other games we have been chasing mostly with around 47% possession. Villas Boas side almost always managed a 60% possession even with just 3 midfielders! This could mean only one thing – Di Matteo has set up his side to play defensively. Chelsea don’t care about possession play any more, they just want to sit tight and attack on the break. This also explains why Matteo prefers Meirless and Kalou over the tired, slow legs of Lampard and Malouda.

Now I don’t have much problem with a counter attacking setup. The German national team played the whole World Cup 2010 with that philosophy and no one can complain that the German games were boring. They were high energy exciting games! Napoli, that caught the eye of Europe this season, have been setup to play counter attacking game and even they are an exciting sight to watch. Chelsea on the other hand fail to convince. They are too slow – even when counter attacking. Most of the times the Chelsea midfielders run out of ideas after reaching the final third and instead of playing a defense-splitting pass to release the striker they just play the ball back to their safest player.

Di Matteo has been effective but not interesting or exciting. Chelsea have gone back to being boring and this is not what Roman desires – nor do I. One could argue that Matteo is doing the best with what he has and if given a chance to create a new team during the summers then he could turn around Chelsea fortunes. But the argument isn’t as convincing as one might want to believe.

The biggest problem that Chelsea will have to deal with this summer is attracting exciting players. They either need the Champions League or a charismatic manager. Champions league qualification looks more and more unlikely as the days pass by. So to finally bring about the transition that we’ve been talking about for a year not we would need a coach with lots of klout – someone players will want to play for – a man with reputation.But then without the lure of Champions League would a manager be willing to take up the high-profile high-risk job of Roman’s empire?

It’ll be unfair to Di Matteo after his inspiring work in these few weeks. But being realistic and without meaning any disrespect to him, I do not believe that he’ll remain as our manager the next season. The only reason I could perhaps want him to stay will be his love for the club. In fact, getting Zola as the manager could perhaps be the best solution. He’s a legend at Stamford Bridge. He could be to Chelsea what Pep has been to Barcelona. But after the spectacular failure of the young Villas Boas do I really believe Roman will go for another not-so-experienced coach again – naah.There are quite a few big names being talked about.

Patience is the key. I’m already looking forwards to the next season with a hope that nothing can be worse than the year that has just passed. Just when you think Chelsea can get out of the miserable form they pull you back in!

Popularity: 2% [?]

Your ClassNotFound Error Is Probably Not Telling You Everything

Quicktip
If a class fails to load due to an exception during class initialization, the actual problem is only logged the first time you attempt to load the class.  After the first time, the classloader recognizes that it’s already tried to load the class and just throws a ClassNotFoundException or NoClassDefFoundError.

Symptom
You will see logs for the ClassNotFoundException or NoClassDefFoundError (usually many such logs), but you see that the class is in the classpath.  You won’t see any root cause on any stack trace but the first (and that one is typically not a CNFE or NCDFE).

Finding the root cause
If you get a CNFE or NCDFE and you see the class in the classpath, search back your logs for ${missing classname}.<clinit> in a stack trace to figure out what prevented the class from being loaded.  Remember that the log may have rolled off.

Possible root causes for CNFE/NCDFE

  • Desired class is not in classpath (this is the boring case)
  • Initialization of desired class throws a RuntimeException or an Error
    • Static variable is initialized via a function which threw an uncaught Throwable
      • E.g. public static final String SOME_CONST = SomeClass.getString(“SOME_KEY”); where SomeClass.getString(String key) can throw an Exception.
    • Static block (loose code in {} in the class definition) threw an uncaught Throwable
      • E.g. public class Foo { { doSomeStaticInitialization(); } …
    • variable or method signature includes type which could not be initialized (see this same list of root causes)
      • E.g. public class Foo { SomeClassWithErrorInInitializer attr1; …

From The SDE Tip – Amazon

Popularity: 1% [?]

Chelsea: Torres and Sturridge Neighbors In Dressing Room!

Chelsea Dressing Room

Chelsea Dressing Room

In the Chelsea dressing room, players are allowed to choose their neighbors. Earlier they were seated by their jersey numbers. Now I don’t recall when this change happened but I remember it was because Terry wanted to sit beside someone else. But that is a completely different matter.

Well, now the above arrangement in the Chelsea dressing room surprises me. It’s kind of ironic that Torres and Sturridge sit beside each other, what with Sturridge completely blanking out Torres in the games. Neighborly love hasn’t yet rubbed on eh?

Source of pic: @chelseafc

Popularity: 4% [?]

EPL: Chelsea vs Tottenham Hotspur – March 2012

No one needs to be reminded about how massive a game this is for both the clubs. A month ago Spurs were flying high in their third place, comfortably ahead of Arsenal. But all that England manager talk seems to have gotten to them and now they are fourth with just 5 more better than Chelsea. If Chelsea were to win today this fight for the final Champions League birth will go right to the end!

Last weeks defeat at the hands of Manchester City coupled with Spurs somehow drawing their match leaves Chelsea with a must-win scenario. 5 points towards the end of the season is too much to make up and a win is absolutely must if we want to qualify for the Champions League. The FA Cup and the Champions League games coming up don’t make life any easier as Di Matteo must take care of player energy levels and rotate the squad. Arsenal and Tottenham do not have this problem – and I don’t envy them for this luxury.

I will be watching the game nervously, hoping for a Chelsea victory. Let’s pile more pressure on Spurs. We know they can crack under pressure and yield us that qualifying spot.

Popularity: 1% [?]

EPL: Manchester City vs Chelsea – March 2012

We have yet another blockbuster coming our way. We travel to the Etihad stadium to face the wounded Manchester City who we defeated 2-1 at home earlier in December. Remember that game when the high flying blue side of Manchester visited a frail Chelsea? That was a sweet victory. We were the first team in this season to defeat Manchester City! Now it’s time to inflict their first home defeat in the premier league. Are we ready? Hell yea – more than we have ever been this whole season.

We have strung together a streak of 4 wins scoring 12 and allowing only 3 in the process. Torres is finding his feet once again and the Old Guard are back to their dominating best. Manchester City on the other hand have just crashed out of the European competition – that’s twice in two months actually – and were also defeated by Swansea City. They are also under tremendous pressure with Manchester United having taken a 4 point lead yesterday. After having spent so much in the summer – a British record – a trophy-less season will be a disaster for Mancini.

Quick Fact: Last time a club smashed the British summer spending record they went on to win the Premier League two consecutive seasons. That was Chelsea of course.

The biggest headache for RDM will be his team selection. Chelsea has mostly played in the 4-3-3 formation. But with Torres and Drogba both showing good form there is a possibility to pair them up at the front. RDM has tried that in the Napoli game towards the end and one wouldn’t call that a disaster.  Also Mata has been playing centrally just behind the strikers the last two games. Has RDM been preparing his team for the coming fixture? Below is the team I would like to see walk out on Wednesday.

football formations

C’mon. Admit it. Every Chelsea fan wants to see the pairing of Drogba and Torres flourish. Add the cunning Mata behind them and you’ve got yourself an entertainment. The only problem with having Mata in the center is that when Chelsea attack through the flanks he becomes useless. Ivanovich has been something like a revelation. The way he’s attacking the right flank and sending across those crosses is amazing. We do need the hard working Ramires in the team. His energy keeps our otherwise static midfield on their toes. Lampard over Meirless is a no brainer. And the tidy Essien should sit in front of the defense. When Essien’s in the mood, and given the Bison that he is nicknamed, he keeps the ball well and helps breakdown opposition attacks.

For me Mata behind the strikers is the key. But he’ll have to deal with the physical presence of Yaya Toure. I’m hoping for another great game of football and keeping my fingers crossed for a Chelsea victory.

Popularity: 2% [?]