Monday, August 30, 2010

Iesi.Collections




I haven't used this library for a long time. It's been so long, that I forgotten it's name:) I hate it when I want to use something, I know that I used it before and that this is a place to use it, but I don't remember what was it called. So I post about it to know where to find it next time, when I need it:)

Iesi.Collections fills a gap in the Sytems Collection by providing a set collection. This collection comes in handy when an array or list are insufficient either because you need to add and remove elements often (tedious in an array) and duplicates are undesirable.

Tuesday, August 17, 2010

My .emacs base




Each time when I move to next machine I install GNU Emacs on it. For the last 8 years it's been the best development tool (and much more), that I've seen. The problem is that each time when I set up a new machine I have to start writing .emacs file from scraches. Ofcourse I download from my gmail account some examples that I've used in my previous machines, but I fought that it would be nicer to get it from a blog, then search throu entire mail. Here is my .emacs base:


(global-font-lock-mode 1)
(show-paren-mode 1)
(setq dired-recursive-deletes 'always)

(global-set-key [f8] '(lambda () (interactive) (find-file "c:/.emacs")))

(add-to-list 'load-path "c:/worek/emacsPlugins/color-theme-6.6.0")
(add-to-list 'load-path "c:/worek/emacsPlugins/pink-bliss")

;color-theme
(require 'color-theme)
(color-theme-initialize)

;pink-bliss
(require 'pink-bliss)
(pink-bliss)

(defun load-dot-emacs ()
"load dot emacs"
(interactive)
(load-file "c:/.emacs"))

(defun dot-emacs ()
"find file .emacs"
(interactive)
(find-file "c:/.emacs"))

Monday, August 16, 2010

The Validation Application Block




Recently I've been refactoring some monolithic project. I'm trying to make it more modular, easier to manage. I'm dividing code into smaller projects base on business logic (parts of code that can be made module base on some autonomous functionality, and are not really strongly connected to the application base) and based on architectural modules - like separate project for a database layer, separate for managers... one of those smaller projects are validators. There are so many different ways of validating input in the application. It's shocking, each time somebody inputs a date into the system, it is validated in a different way, not to mention that there is no such a thing like a common date format, or error message format. This is where 'Validators' module kicks in, it is supposed to be the only place that is responsible for keeping some regular expressions, configurations, validation methods that are related with validation and are not included in a base (in my case that do not exist in a System.ComponentModel.DataAnnotations). I really enjoy the idea of validating input by using annotations. My research on different annotation based validation frameworks lead me to Validation Application Block.

As for me it gives more possibilities available out of the box to validate input then DataAnnotations, but it doesn't integrate MVC validation framework. I had to write adapters in order to connect both frameworks.

If you haven't seen it, give it a shot.

Sunday, August 15, 2010

Favorite Firefox Addons




It changes every year:) Currently I ejnoy:


1. Firebug
2. YSlow
3. Greasmonkey - just for Youtube HD Ultimate



I don't use any more:

1. Adblock plus
2. NoScript
3. ChromaTabs
4. ColorfulTabs
5. TabKit
6. IE Tab Plus
7. Greasmonkey scripts to manage gmail account
8. FireGestures


I wander how it will change next year:)

Ajax helper in .NET MVC 2 and form problem




Recently I've been working with some legacy code with a weird design. Currently we are migrating some parts of a solution from ASP.NET to MVC 2. The problem is that entire content of the page is inside one giant 'form' tag that is in a master page, and there is no 'form' nesting in html standard. I was hoping to use Ajax.Form helper from MVC 2 to solve this issue - I mean, I hoped that it will behave as a some other kind of container then 'form' and submit information via AJAX requests. For example in a 'div' tag. Unfortunately for me Ajax.BeginForm generates a 'form' container, like:


<form onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace });" onclick="Sys.Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));" method="post" action="/Ajax/Foo">

</form>


Jet again I have to write my own JavaScript code to handle some action inside 'div' contaier.

I hope that soon I will receive a green light to refactor the master page and remove the 'form' tag from it. It is a bad place to place it.

Tuesday, August 10, 2010

Slashdot audio reader sucks




It is a good idea, but the voice is terrible, it is so much beter to read it on your own:

slashodt audio

And it also reminds me about Apple/Amazon ebook problem. Why is that Apple does not have any technical book (to read, or listen, on iPhone/iPad). And there are many that are avaiable on Amazon, but 'only' for kindle, and kindle is in my opinion not as good as iPad.

Monday, August 9, 2010

Amazon book price




How come kindle books are more expensive then a hardcover? This is so weird. There was a time when I loved to buy a pdf books, because the shipment prize was killing me. Now days you can't even buy a pdf book, and a version for kindle is more expensive then the hardcover book, have a look here:

Refactoring book at Amazon

Hardcover: $52.96
Kindle edition: $57.11

Why is that?

Like a month ago I bought an eBook from ebooks.com. I decided to buy an eBook because the shipment price was a joke. They allowed me to download it or to view it online. But I couldn't download it because it requires Adobe Reader with some kind of anti piracy protection (DRM support perhaps). Unfortunately Adobe Reader didn't want to register on my machine, because Ebooks.com Adobe Reader license key was not valid. I spend 3 hours talking back and forward with Ebooks.com people and Adobe people and no one could help me. And they didn't even allow me to download it in a different format or in a different way. I was so pissed off! I sticked with a ‘view online’ option, which really sucks. And you can't even print a book.

What is going on with an eBook word?

Sunday, August 8, 2010

VS2010 shortcuts that I use




Because I use my Emacs keybinding plugin. I had to rearrange some of the ReSharper shortcuts. This is what I use the most:


ReSharper.ReSharper_GotoFile: Ctrl+,,Ctrl+.
ReSharper.ReSharper_GotoType: Ctrl+,,Ctrl+,
ReSharper.ReSharper_GotoFileMember: Ctrl+,,Ctrl+m
ReSharper.ReSharper_GotoRlatedFiles: Ctrl+,,Ctrl+l
ReSharper.ReSharper_LocateInSolutionExplorerAction: Ctrl+,,Ctrl+/
EditorsContextMenus.CodeWindow.GoToView: Ctrl+m,Ctrl+g
EditorsContextMenus.CodeWidnow.NavigateTo.ReSharper_GoToTestFile: Ctrl+,,Ctrl+k


You can import and export them easly by going to:


Tools->Import and Export Settings...->

then choose only:

Options->Environment->Keyboard