Sunday, December 26, 2010

ycombinator and things I read




Recently a friend of mine send me a link to ycombinator - great resource for someone like me. So, if you like to read things that are more pragmatic then going deep but stay focused on one technology, methodology or technic, then this is something like /. but more techie. Simply I love it, usually, really short articles behind, on various subjects. Some time ago I spend tremendous amount of time looking for some good resources of techie knowledge, and so far /. is the only thing I am using on daily basis, but ycombinator seems to be great as well.

In terms of books, recently I read:
Knuth's The Art Of Programming (first 3 tomes)
Avodey's Category Theory (Oxford Logic Guides)

I enjoy reading few books at this same time (well, almost this same). When a part of book, or some topic is not really interesting, I switch to second book, and give my brain a fresh topic.

In terms of Knuth's books, I enjoy the way how they are written, easy to read, with sense of humor. Excellent exercises at the end of each topic. I don't like the MIX language. It is too old fashion to me. Sometimes, dealing with the language is harder then the algorithm itself, and a problem is more about how to write the code well (or even, how to write it), and not how to deeply understand, why some operations take place, and why they are done now, and that way. But still I recommend this book.

I spend some time deciding between Category Theory (Oxford) and Basic Category Theory for Computer Scientists (MIT). The O book is newer and bigger than M book, but also more expensive. I made a decision, base on fact that I am more Oxford then MIT boy (sorry chaps:)). So far I love it, easy to understand, lot's of new stuff to learn. I don't see to many exercises that are good for me, and It makes it hard to test new knowledge.

Sunday, December 19, 2010

Enabling grep in windows emacs installation




New windows, means new emacs and firefox configuration.

First step is to install dired plus, so it would be easy to search using grep directly from dired.

To enable grep in windows installation of emacs one needs to install grep, it is a good idea to install also find utilities. I tend to change the find.exe file name to efind, because windows already defines find utility. Then add bin directory to windows path. And copy following libraries:

libiconv2.dll
libintl3.dll
pcre3.dll
regex2.dll


to emacs installation bin directory:

%EMACS_HOME%\emacs\bin


In addition in my last post I forgot to add following line in .emacs

(setq make-backup-files nil)


In terms of Firefox some additional plugins, that I tend to use recently:

Tamper data
Statusbar
Visual Event

Haskell Platform





Long, long time ago, when I started to learn haskell I spend many days trying to choose between ghc and hugs. Some people used ghc and other hugs, and there was no right choice. The problem for me was pretty big, because I come to haskell from the world of scheme, and in scheme sooner or later one finds out that there are 'some' differences between implementations, and later on when you want to use some public library you need to switch to other implementation, and code that you already have is not 100% compatible with it. And some migration errors are really hard to find. For example if an element of a code is not used usually, but will fire up when some weird criteria are met. Sad thing, isnt it?

Today, I created a new Windows box, and I needed an haskell environment. I tend to write my haskell code in Emacs (OurComments.org edition), and I love it, but today I went to haskell.org, and I was surprised to see that there are dramatical changes in the contend of this site (I don't use this site at all). And finally somebody have written some cool looking haskell tutorial. I love the look and feel of it (guys, great job there). Also I was surprised to see that they are promoting a Haskell Platform. Witch is an environment and set of tools on top of ghc. I gave it a shot, and so far so good. Good to see that the haskell is still improving. Let's keep it that way:)

Sunday, October 10, 2010

Types in c#

I hate to forget about links that I love to read. From time to time I forget about how it goes. Here are two great articles and links to nice blogs to read.

Types in C#.

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

Sunday, June 20, 2010

SQL tests and various DBMS





Long, long time ago, I was writing a maven plug-in to manage different DBMS systems from an application. As you probably know there are some differences between various DBMS systems, and it is good for your application to take an advantage of a DBMS specific behaviors. In my maven plug-in it was due to performance reasons, but one should be aware that sometimes our approach that perfectly works in SQL Server, will not work on Oracle database. Some mistakes are easy to catch - for example application refuse to work:) Other are really difficult to catch. I remember that one of my colleagues, was not aware about different transaction approaches between Oracle and SQL Server (optimistic vs. pessimistic), and it caused some problems to catch it, cause everything seemed to work fine, and from time to time, everything crashed - because submit was refused to run. Anyway, I always wanted to have some easy database available out of the box that can be installed on most popular DBMS systems, so I can run my tests and check if everything works fine. ChinookDatabase is a tool that I use recently. Enjoy.

Monday, June 14, 2010

Anonymous class in C#




I find it very annoying that I can't create an anonymous class that implements an interface, or includes a method. Actually the only things that anonymous class can have are properties.

Many of people use 'using' statement as a fast way to deal with IDisposable objects, but they forget that it is also useful to quickly create a block of code that is, in some way, isolated from the rest. Some people use it instead of begin/end block, and in some way I agree with those people. If I know that I am doing some operations that won't be useful later on in my function I can put them into a block and release them at the end. I know that I can create a separate method for it, but sometimes putting something in one method is more readable and understandable then decomposition. From the other point of view, when majority of people see using statement they think about IDisposable interface, and they correlate IDisposable interface with unmanaged code. Unfortunately unmanaged code is not the only case to use IDisposable interface and to manually manage the memory management, but I will live this subject for a separate discussion, and return to the main subject. Abstract classes would be an excellent choice for some ideas that I run into during my work. Sometimes I just want to create a temporary container for a short period of time and later on get rid of it, and free some memory that was used during that object modification. Unfortunately because I cannot implement an interface in an abstract class I cannot use it in a usage statement.

Sunday, June 13, 2010

Iron stuff




.NET people tend to tell all those stories about languages that are ported to the .NET framework. Like Iron Python, Iron Ruby... Last week I examined how it looks like for Haskell and Scheme. In the Channel9 movies I heard few times that there is something like Iron Scheme and Iron Haskell, I wanted to compare VS against Emacs editor in terms of fast coding. I found out that there is no such thing as Iron Haskell, but there is a visual Haskell, and it only works for VS2003 and VS2005. It is just an interface via COM, between VS and GHC. This is also the reason why it won't work in VS2008 and VS2010. I've been thinking, what's the point of mentioning that there is a Haskell version for VS if not many people use VS2005 or VS2003 anymore. It is like saying that POSIX compatible application, written on Linux system will compile under MS Windows. Sure it will compile, but only on a Windows platform that was POSIX compliant (has a POSIX personality), and the last version that did that was Windows NT:) In other words telling me that there is an Implementation of Haskell running under VS and on top of .NET is like telling me to get a version of a Windows NT, and still not telling the truth, cause as far as I can see this Haskell does not behave as C# or VB.NET in terms of compilation to IL and running in a .NET framework.

Iron Scheme is a different story. It can be executed in VS2008, too bad that I want to use VS2010. It doesn't give me a power of a .NET framework and ability to use a scheme language. For me writing an application in this hybrid is like a functional-imperative disco polo kind of programming. A good subject for a separate post.

Wednesday, June 2, 2010

What do I read?



I was searching in the market for some good .NET books. I mean books that target not only one programming language, but give you also knowledge about application frameworks available currently on the market that support .NET, or might be easily used by these technologies. So far I was able to find following positions.

For C#:
C# in a Nutshell
C# in Depth
CLR via C#

I hate when the author starts to explain how to do for loop on page 200. It’s such a waste of time. I mean I read a book and I see that probably I know everything that is on this page, so I skip it, and then I realize that I know everything that is in this chapter, so I skip it. And finally I am frustrated, because I don’t buy/read a book to skip something, but to understand something more deeply.
About mentioned positions. C# in a Nutshell is really on the topic;) Not many words but they move attention to specific problems, or features in a way that makes you want to investigate it. Sometimes it motivates you to search more deeply for the solution. CLR via C# is my favorite, on each page I am motivated to search for something; on each page I learn something new. I truly love this book. I believe that it is the best book for an intermediate person. C# in Depth is somewhere between. Good positions to find information that are not mentioned in previous positions.

For SQL:
Inside Microsoft SQL Server 2008: T-SQL Programming
Inside Microsoft SQL Server 2008: T-SQL Querying

Ben-Gan is the man. Haven’t seen a book that starts to explain SQL Server environment, from math, for a long time. I love math, and even if the math in this book is not really complex – you probably seen it all, If you like to study math on your on. But! It turned my attention to connection between some math problems and design of the SQL Server, or T-SQL itself. I enjoy those books so much that I want to get more books written by Ben-Gan, and there are a few to read.

So far I was unable to find anything interesting about ASP.NET, Silverlight, DDD, WF, WPF, and so on. There are so many books made by O’Railly, Manning, P2P, but none of those that I’ve seen is something that I am looking for. The best way for me, so far is to read training kits from Microsoft, like this one. I hope that I will find something sooner or later.

Also I would like to recommend a link to some interesting features of C#. And entire MSDN, I see that this web site changed so dramatically in a previous year, two or so. Now I can really easily find useful information.

Monday, May 24, 2010

.NET Reflector




I've been trying to figure out how some stuff work in .NET. And I found out that the tool I need is a reflector. Basically it allows you to disassembly a dll and see what's inside it. Don't expect too much, but it's great to know what is going on. Here is a tool that I decided to use Red gate reflector. Enjoy, it's free to use it!

Wednesday, May 5, 2010

How-to register an addin in VS2010




Somehow I was unable to find this information on the web. Here is how to do it for those of you who don't like to use wizards.

You need following files:

Foo.addin

Foo.dll

Foo.pdb

Foo.xml


Keep dll, pdb, and xml file in a one folder. Place Foo.addin file into "Visual Studio 2010\Addins" folder. Edit Foo.addin file to show a path to Foo.dll. Run Visual Studio. Plug-in should appear in an Add-in Manager. If you delete a Foo.dll file Visual Studio will rename a Foo.addin file to something different, so be prepared to rename is manually. And of course if a plug-in appears in an Add-in Manager, you can use it by selecting it.

Visual Studio 2010 second look




List of features that I do not enjoy.



I can not see a way to write a visual studio plugin in F#


Even if you set a binding for a key binding command it want reset all the bey bindings that are associated with the shorcut. For some shorcuts it seems to work, for others it does not. For example if I set a shorcut for a Edit.CharRight to Ctr+F it works, but if I set a shorcut for Edit.CharLeft it doesn't (after hitting Ctr+B visual studio waits for a second character, because there are some keybindings that use Ctr+B in a combination). Microsoft if I want to set Ctr+B to Edit.CharLeft it means that I know what I want, and I want to get rid of all the key bindings associated with Ctr+B + something.


I created some plugin for emacs key binding. Unfortunatelly The API for assigning multi key strokes, like Ctr+Shift+F is not working!


And, here is a good place to find a list of snippets for vs2010

http://www.developer.com/net/net/article.php/3557701/Introducing-Visual-Studio-2005-IntelliSense-Code-Snippets.htm


Why there isn't anything for methods? Anybody?

Visual Studio 2010 and things around.




Finally got some power to have a look at a new visual studio. First thing that shot me was a lack of a support for Emacs key bindings. Crap, I had to map all major things by myself, but w/o mapping this tool wouldn't be useful for me. It was pretty sad for me, cause I had a great hope that Microsoft is going to fix some issues with key bindings with a new release of VS. Namely all key bindings seem to work only in a code window. If you go to a Command Window or to a Solution Explorer or F# Interactive, nothing seems to work correctly. And what's even more annoying is a fact that there are key binding commands inside VS2010 (like Edit.EmacsLineUp, Edit.EmacsCharRight), but if you use them, they don't work. None of the Edit.Emacs... command seems to work. And yes I am aware that Microsoft said that they didn't have a time to implement key bindings for Emacs and Brief in VS2010, but they are working on it, but why show commands that do not work if you use them? Some of the Emacs commands seem to have an implementation in a non Emacs scheme like:

Edit.EmacsLineUp => Edit.LineUp

Edit.EmacsLineStart => Edit.LineStart

Edit.EmacsCharLeft => Edit.CharLeft


. I hope that I will have strength to write a plug-in for Emacs key bindings, so I won't have to change it manually each time I see VS2010.

I was also unable to change the look and feel of this tool to only show a code window. Yes I am aware of a full screen option, but it is not enough. I removed from the view 'Standard' and 'Text Editor' and all the views that hide on the left right and bottom sides of the screen. Still it is not enough. Am I missing something or there is no way to hide tabs (or better remove them), and hide a menu on a top. I really like a crude look and feel, less things, less things to distract, and also it force you to remember shortcuts, how-to go to a class w/o clicking, how-to manage a database view w/o clicking, and so on. So Microsoft, please make it useful, one day;)

Why there is no intellisense for an F# Interactive? Are you expecting me to know all the methods for all libraries? I can do it if I code only in a one programming language, but if you write on you daily bases in more than 20 you really don't remember if it was writeln() or WriteLine() or writeline() or wl() or println(). Anyway, I am glad to see an interactive shell, it helps me a lot to test some things, even if they are written in a different language then the project that I write.