CAT | development

Our team has recently updated to TortoiseHg 2.0 and everybody were frustrated with the update that came with it regarding shelving. Sometimes you simply can’t unshelve your files, while keep receiving the following message “1 out of 1 hunks FAILED”:

image

Solution

If you are aware of what I am talking about here is the quick fix for you:

Add following lines

[patch]

eol = auto

into the next file

%userprofile%\mercurial.ini

Enjoy!

Why it happens?

It’s because of EOL handling problems when running mecutial under Windows, this line enables patch to fix it.

, , , ,

The answer is simple:

Our mind always wants complex tasks.

That’s why we subconsciously always looking for this complexity. And this is where things become interesting. Its often a challenge for programmer to prevent himself from overarchitecting and overcomplicating solutions. It can become a real problem for smart guys. As far as I am smart =) this is a real challenge for me too.

What should we do?

I propose a simple solution – convince yourself  that keeping thing as simple as possible is a bigger challenge than making them complex. Following the KISS (“Keep it simple, Stupid!“) principle is a very difficult task itself.

It is very easy to make things complex when you are smart, but it is unbelievable hard to keep them simple.

, ,

ninja-with-nunchaku There are two bracing techniques/styles in      c-like languages:

Foo()
{


Foo() {

}

I’ve seen both used in C# and in JavaScript, but it was always interesting why last one is much more popular in JavaScript and first one in C# and C++. Now I have the answer:

Putting braces on the same line after statement prevents from doing silly JavaScript mistakes, possible thanks to ECMASrcipt standard.

It states the following:

Certain ECMAScript statements (empty statement, variable statement, expression statement, do-while statement, continue statement, break statement, return statement, and throw statement) must be terminated with semicolons. Such semicolons may always appear explicitly in the source text. For convenience, however, such semicolons may be omitted from the source text in certain situations. These situations are described by saying that semicolons are automatically inserted into the source code token stream in those situations.

And a little demo of what they mean:

function FooA() {
	return
	{
		x: 8
	};
};

function FooB() {
	return{
		x: 8
	};
};

function Bar() {
	alert(FooA().x);
	alert(FooB().x);
}

When calling Bar() function you will see “undefined” and then “8” . This happens because JavaScript is too smart and put semicolon after first return statement (predicting your intent, that is actually should be a marketing slogan), so your anonymous object declaration will never be executed. Why? Here is a little intriguing pause and some dummy text that takes a little more time to read… And finally the answer is: “For convenience”, as told us by ECMA. Enjoy and don’t forget to feel convenient =)

,

Не секрет, что читабельность кода играет очень большую роль. Речь пойдёт об оптимальной длине строки. На данный момент самым распространённым стандартом являюется длина в 80-100-120 символов. Jeff Atwood уже писал об этом и его слова подтверждены исследованиями. Если в кратце, вывод таков:

Более длинные линии облегчают быстрое чтение.

Более короткие линии – облегчают понимание.

Но всё это спорно, и как правильно здесь замечено, следует руководствоваться здравым смыслом и общей читабельностью той или иной строки, а не сухим правилом ограничения длины. Я советую выбрать приемлимую длину для выработки стиля и комфортной работы и разумно её придерживаться. Вот элегантное решение, которое позволяет сделать это. Оказывается можно добавить тонкую линию (или несколько), которая ограничит нужное количество символов от правой части экрана. Выглядеть это будет так:

 right guideline

Для этого нужно найти в реестре соответствующий вашей версии студии ключ:

2003: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\Text Editor

2005: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor

2008: HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0\Text Editor

2008 Express: HKEY_CURRENT_USER\Software\Microsoft\VCExpress\9.0\Text Editor

И добавить новый строковый параметр Guides со значением RGB(230,230,230), 120

image 120 означает расстояние в символах от левой части экрана.

Если этого недостаточно – загляните на обсуждение на stackowerflow.com.


	

, , ,

Find it!

Theme Design by devolux.org