Thursday, December 29, 2011

JavaScript as I know it

I really like a JavaScript language. But I am concerned about all the buzz around frameworks like node.js, knockoutjs or spinejs. My worries concentrate on a language and a knowledge of it. Who knows what does ++[[]][+[]]+[+[]] do? What about problem described in this article. There are so many pitfalls, and it's so hard to pass thru without stepping on a mine. There is not a single tool that I know that allowed writing a code in a JavaScript just like in a C# or Java - with a good warning, suggestion support, strong typing (I am willing to give up dynamic power in a JavaScript just to check for problems during compilation), or abbreviation support. I don't feel after reading books like JavaScript: The Good Parts, JavaScript Patterns, Pro JavaScript Techniques or JQuery Cookbook that I feel safer. I'm really curious what will happen in the future with the language, tools, and ideas of writing business logic or more control on a JavaScript side.

Wednesday, December 21, 2011

Temporary asp.net files

Visual studio, when it builds, runs, tends to create and use temporary asp.net files. Some compilation, and runetime errors, even when fixed are throwed/showed, because the cashed version of a logic is used, a code that does not exist any more in a project. Each time when I face this problem, I search a web, and it takes me some time to find this path:
C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files
Delete it all.

Tuesday, December 6, 2011

Excellent article abut BK-Trees

I love when ideas are presented in a simple way. BK-Trees are well known structures, but in a normal work as a typical programmer, when I need to implement a more advanced search that MS SQL or SOLR.NET (lucene) allows, I tend to do it in a simple way - by result combination of some sub queries. This approach makes me forget about some not often used data structures in a "day time" job. And when I find an article that is easy to follow, light in a form, and cool in a subjects that it touches, I simple love it.

Monday, October 31, 2011

On Decidability of Nominal Subtyping with Variance




Yes, I found this article about Gödel's incompleteness theorem problem in a programming languages design. I love it. I can see that one of the authors is an author of my favorite type topic books.

Friday, August 26, 2011

Typical windbg commands




Recently I debugged a lot .NET code in a native debugger. Some useful commands are listed below.


srv*c:\symbols\public*http://msdl.microsoft.com/download/symbols
.load sos
.loadby sos mscorwks


SOS commands

!eeheap -gc
!dumpstackobjects (!dso)
!clrstack
!dumpheap -stat - All classes in a memory
!dumpheap -mt message_table - First column
!dumpheap -stat - list of object for a given class
!do adress - Address of a command listed above
!gcroot adress - why it is not garbage collected
~* e clrstack - For all threats run command clrstack
!syncblk - Show all locks

Saturday, July 30, 2011

Gregs next video

I finally had a mud to watch a next video of great Greg Meredith. As many of his work, it opened my mind to different concepts of a perception of the universe. Great job Greg, I can't wait for a book of yours.

Sunday, June 26, 2011

Floating vs Double vs Decimal in C#

For a last few days I'm reading Java Puzzlers book (the older version). I am aware about using decimal formats for money, and data that needs to be calculated precisely. I am testing majority of puzzles against C# language, and I was surprised to figure out that in Java:


System.out.println(1.03 - .42);

The output is

0.6100000000000001


In C#

Console.WriteLine((1.03F - .42F));
Console.WriteLine((1.03D - .42D));

The output is

0.61
0.61


The surprising bit is that in both languages float and double are implemented based on IEEE-754 spec. So why the output differs? I was trying to figure out this by looking it up in a CSharp Spec, but no luck. IEEE specification does not give a strict guidelines of how to implement operations (like add, subtract, multiply), just to implementation of data itself - it should be kept as an exponent number. So I believe that operation implementations are different - maybe due to optimization - but it would be weird, because decimal type was 'invented' to tell explicitly, that a programmer is interested in a precise answer, not a relative accuracy.

Thursday, June 23, 2011

The world of floating points

From time to time in a word of computer scientist a question is raised, that for the first look is hard to figure. I remember few years ago there was a big deal about incorrect answer to a really simple algebra problem in MS Excell. Usually this class of problems deals with some math basics, that every computer scientist knows (at least I hope for that), but the knowledge is really rusty - not often used, so the answer doesn't come to a mind. A day ago a great question was raised dealing with a floating point arithmetic, for the first look at the question I wouldn't even guest that it is because we might deal with floating points. But ofcourse the answer is correct, and what's more it leads to a great article, a good read.

Monday, June 20, 2011

Java Pitfall

Recently, I've been interested in some differences between C# and Java. Mainly in how some behaviours are implemented. Consider flowing code:


Byte bigByte = 13;
test(bigByte);

byte smallByte = 14;
test(smallByte);


public void test(Byte b){
System.out.println("byte");
System.out.println(b);
}

public void test(int b){
System.out.println("int");
System.out.println(b);
}



The output is:

byte
13
int
14


I did not expect it. In Java there are mechanisms called widening and autoboxing. Starting from Java 5.0 framework first tries to wide the size of a type that is reserved for it in a memory - in this case Byte is equal to 4 bits, but int reserves 8 bits in a memory. And because before Java 5.0 there was no autoboxing, the framework is trying to find a method that somehow matches the call. Maybe it should throw an error, but designers decided differently. And starting from Java 5.0 the framework is trying to find a method that as an argument also takes a type of a primitive value in this case it is trying to find a type Byte for a byte call.

I understand designers that added autboxing feature, and were trying to keep compatibility with older versions - in a behaviour - this is why Java 5.0 first tries to use widening mechanism and then autoboxing. What concerns me is that the code behaves unnaturally for a person without a knowledge about Java history (when what mechanism was added). In other words, because this code compiles, my first impression is that the method that takes as an argument Byte should be called when I send a message with a byte parameter, but the framework behaves differently.

Friday, April 15, 2011

Blogs that are not updated

Yes, it is a problem. I am a huge fan of Brian Beckman and Bart de Smert. Unfortunately their blogs have not been updated for a long time. I read majority of their articles, and learned a lot, and I literally mean a lot, because each article requires some research to be done by myself in order to understand everything deeper and better. I ask myself a question, why do people like Hanselman or Haack blog a lot, and people that I prefer don't. Anyway, Brian, Bart I would exchange at least three months of blogging of Hanselman or Haack for a one of your posts. Power to visioners.

Tuesday, April 12, 2011

Test driven .NET

This is just a quick reminder about TestDriven.NET, a plug-in for visual studio that enables me to run my tests faster, and in an abstract way from a testing framework.

Saturday, April 9, 2011

Amb operator

It was three years ago when I first heard about amb operator. And it was schema language that implemented it. Somehow I haven't use it much, and I did not understand its power until I heard about Spec Sharp, PEX, and Z3. Since then I was looking for some tools, programming patterns, ideas to check for correctness of some code/theory, or mechanism to allowed me to check when or if the code will succeed. Today I read about amb implementation in JavaScript, a nice article, and a good reference.

Friday, April 1, 2011

P vs NP problem

There are some problems that are not easy to solve. One of them is CACM problem. Recently I read a great paper describing the history of the problem, its context, solve strategies, and what it means to solve it. A good read.

Thursday, March 24, 2011

Plugins for Eclipse that I use




Yet again, here comes a time when I need to configure my Eclipse environment, and yet again I need to search thru the web for all the pages to the tools that I need. And the winners are:
1. SpringIDE
a) Core / Spring IDE
b) Extensions (Incubation) / Spring IDE
c) Extensions / Spring IDE
2. Susbclipse
a) Core SVNKit Library
b) Optional JNA Library (recommended)
c) Subclipse
3. m2eclipse
a) Maven Integration for Eclipse

In order to configure maven plugin I had to add a following code in a eclipse.ini file (add it before -vmargs line)

-vm
C:\worek\java\jdk1.6.0_24\bin\javaw.exe


I love maven plugin - it allowed me to manipulate pom.xml file (dependencies, plugins,...) by just adding them knowing the name of the dependency (like springframework) and plug-in will search for it and suggest the newest version and create entire xml.


I also tend to use Flash Builder for my Flex development.
The biggest problem is that Flash Builder 4 requires a 32 bit JVM, it will rise an error when you try to run it against 64 bit ("An internal error occurred during: "Creating Adobe Flash Player trust file.."). This error is visible if you use a plug-in version of Flash Builder, the Stand Alone Version of Flash Builder has it's own JVM and it's 32 bit one, it means that stand alone version is not using your environmental settings if you didn't know :) Currently the Eclipse version (Helios) is 3.6.2 and Flash Builder is using 3.4.2. On some operating systems (like Solaris) one can use a flag -d32 in eclipse.ini file in order to tell JVM to run in a 32 bit mode, unfortunately under windows I had to install a 32 bit Java. Unfortunately installing Java in 32 bit version means also installing Eclipse in 32 bit version.

In an addition Tortoise can be downloaded from here and it doesn't require SVN server to be downloaded and installed separately (every two years when I rebuild my machine, or configure it at work I ask myself a question - do I need a server)

Friday, March 18, 2011

Recursive Functions by JMC

I've just read an excellent paper by John McCarthy. I believe I read it before, but it was so long ago, that I consider it to be read in a different life. When I look at the paper now I am amazed with the style of writing. John creates entire computational notation system, explaining it, giving examples and discussing why is it a good thing to do it his way. The topic/task is not trivial or simple, but John is able to do it in a way that not only allowed an average person to read it, but also paper is full of energy - it motivates for further thoughts and further readings. It is a truly a remarkable work.

Wednesday, March 9, 2011

Debuggable functions in Haskell

Long long time ago, when I was writing my first Haskell apps I had this huge problem - debugging. Because for majority of my life I was debugging more or less by writing printf(some variables) I was trying to apply this same pattern to Haskell. Unfortunately it didn't work. Didn't work because functions in Haskell do not allowed side effects, so if you don't want to (don't know how) use monads it isn't simple task to do, to write something to a screen, when you are in a function. In a last few years at least 10 people asked me how to write some debugging information on the screen, to try to figure out what is going on in your code, when it does not work, so far I was unable to point a good article how to do it, and I had to explain everything by myself. When you drink a beer with your mate and you try to explain how to use monads on a piece of tissue, it is not a good way, how to teach people anything. So I was so happy to find recently this article. It explains the problem (why it is not easy to write something on a screen when you are in a function) and how to deal with it so you don't need to refactor your code dramatically. Excellent work Darius, keep it up!

Monday, March 7, 2011

Types theory

As for me a theoretical part of Information Technology is a crucial part to understand what is going on in a dynamic environment. By a dynamic environment I mean plenty of frameworks that exists on a market, huge amount of different computer languages and different technologies, models that try to expose some ideas of its creators. But idea is a thing that can be described by a language, and probably if there are few ideas some of them share something in common, and some classes of abstraction can be named between them. This is why I was usually even more interested in a theory that stands behind some technology then the technology itself. Type theory is an example. About four years ago I was a hard core dynamic language purists that enjoyed everything that fully enabled me to express my mind - I loved writing Perl one liners, using sophisticated magic standing behind JavaScript prototyping. It was also a time when I first read a book Types and Programming Languages by C. Pierce. And it was a book that opened by mind to problems, benefits, ideas lying underneath typing, and also showed that static typing by sticking to its discipline allowed programmer to express himself by using a different approach (then dynamic language programmer) but it is hard to say that by sticking to static typing you miss something. As every human being I enjoy discussing my thoughts, ideas with other people, it allowed me to understand topics that I study deeper, more, and also allowed to look at it from a different perspective, a perspective of a person that I talk to (I assume that he spokes back:) ). Huge majority of people that I know do not study theory any more, they tend to read books about a specific technology - like MVC, SharePoint, instead of trying to understand a theory, philosophy standing behind a specific implementation. As a reader can imagine it is hard to find a person to talk to about types theory, but there are other methods/techniques that allowed me to rethink things that I now and get motivated to explore and learn more. This is why I am so happy to find a web page by brothers in arms from Oregon UV. A great place to explore and learn.

Saturday, March 5, 2011

My Land of Lisp just arrived

I used to program in a Scheme a lot, I preferred it over Lisp couse it was better documented, got good libraries to handle OpenGL, GLUT, and basic components for building a user interface. I am aware of a major concepts of both languages - similarities, and differences, but somehow I've always preferred Scheme. Even when I knew that there is a great macro library, or a object support library, for common lisp that I would like to use in my project I always sticked to a scheme. Few weeks ago I was surprised to fined out that there is not a single Lisp book on my bookshelf. So I made a small research about any book that would add something knew to my knowledge on a programming in a 'Lisp style'. Have a look at this web page. It is different, interesting, and you can't take it too serious but there are plenty of good parts underneath it. It makes you look at the ideas of the language from a different perspective, even when I am aware of all the concepts that are inside this book, after reading the few N*10 pages I was surprised to rediscover some features that I rearlly used (as every programmer I tend to stick to parts of a language that I enjoy). This book rocks, and have a look at this video:

Friday, January 21, 2011

Reactive Framework for .NET documentation

I do not enjoy one thing about RX.NET, the documentation. There is no such thing as a good documentation, or tutorial for this framework. There is a wiki, but It didn't save my day yet. As a result and easy task sometimes takes a while. Starting from looking at the methods, classes, types, extensions available, thru adding reference to something, and finally using it in a proper way. Today as an example I was playing with EnumerableEx, but first I had to ad a reference to it in my project. So I added a reference to System.Reactive, but it wasn't there, I checked if ReSharper will help me, but it was unable to figure out what was I up to also. I added a reference to Syste.CoreEx, but it wasn't there. Finally I added a reference to System.Linq.Async, System.Interactive, System.Reactive.ClientProfile, to figure out that EnumerableEx is a static class defined in System.Interactive. Usually, when I learn a new framework, or a set of libraries, I spend some time looking at public methods, data types, and basically a new arsenal that I can use. Just to have a high level view at what can I use. I strongly recommend looking at RX.NET classes before using it, it saves time later on, when one is trying to achieve something but is unsure if it is possible to do or one is using a wrong method for doing a wrong thing.

Curry’s anticipation of the types used in programming languages

I found a really interesting paper about types. Well written, easy read. It gave me a great background of history of combinatory logic, how it evolved and fought for it's place in a current math world. Enjoy the reading.

Functional Programming with Bananas, Lenses, Envelopes, and Barbed Wire

Today I finally found time (and will) to read a this classy paper. My first impression, well written, it is not boring, or too technical/mathematical. If a term might be unclear or unfamiliar to the read, then there is a reference to it, and there are plenty of resources on the web to get you going. Personally, it challenges me to start a small research on some subject while reading a paper, and it only makes a main paper more interesting. I hate when I need to read a paper that deals with a subject that I am familiar with, and when I have to go through all the basics and easy stuff (stuff that I already know) just to find an answer to the question that I am looking for.

Sunday, January 16, 2011

Ghostscript for GSView under windows 64 bit arch

I was trying to find forgotten by me information about type reduction for lambda calculus. I went to get Barendregt Lambda Calculi with Types, to find out that it's Postscript version. Because on my fresh box I didn't have GSView I had to download it from a web. By default it tries to find gsdll64.dll in it's path, but a compiled version of a new release of Ghostscript (9.0) is delivered in a plain file form - it does not install anywhere and does not register itself in any path. In order to make it available for GSView one needs to fire up GSView and select Options->Advanced Configure-> in 'Ghostscript DLL' insert a path to the library.

Saturday, January 15, 2011

Biosimilarity




We did it! Lucius Gregory Meredith was resin money for his book - Monadic Design Patterns. Greg is a full time (hard) worker and was having trouble to find time to finish writing his book. He wanted to make it good and helpful to other people, and making something good or even better requires time. I also find myself doing much better job when I do not have some other tasks on my mind, so truly understand his position. Greg was able to gather enough money by Kickstart web page to take a career break (or at least few days break) and spend his time on writing his book. Greg good luck, and hope to receive my copy as soon as it is going to be ready. Just want to add that Greg is one of the best Computer Scientists/Mathematicians that I met in my life, he is somehow my mentor and guru. Cheers.

Monday, January 10, 2011

OpenWrap vs NuGet




I've been using OpenWrap for some time now. So far I haven't found any problems with it. It just does the job. But the time goes by and there is still one more tool to try. Today on my fresh machine I installed NuGet, I hope that it is as good as OpenWrap.

I did a little research, trying to find developers suggestions why one tool is better then other. I was unable to find anything that convinced me. Here is some nice article summarizing why OpenWrap is good. But then again NuGet is deployed on Codeplex, and the platform introduces it to a wider range of developers. And also Scott Hanselman and Phil Haack blogged about it, so there is some chance that they stick to NuGet.

Sunday, January 9, 2011

Particle Video

I really enjoy, some projects that people have. By just looking at it I can see that the person who did it, spent plenty of time making it good, and he had a great time doing it. That's why I enjoy the final (or at least current) version so much.

Saturday, January 8, 2011

Common config for Sharepoint 2010




As always when the new SharePoint installation is deployed I tend to think about it's framework. As we know SharePoint is compiled to work with .NET framework 3.5, actually it works best with .NET 2.0 and I found myself doing hacks, from time to time, to make it work with 3.5 library. And I don't get it when people say that SharePoint 2010 works with .NET framework 3.5 Service Pack 1, it is so misleading. The truth is that SharePoint 2010 is compiled against .NET in version 3.5, and this version of ASP.NET framework is based on 2.0 runtime, it is because .NET version 3.0 and 3.5 did not change the runtime. Why can't I use framework 4.0, why people at Microsoft thought It would be great not to allowed SharePoint, to work with .NET 4.0 libraries? I can only guess that they wanted to realese new version as soon as possible, and didn't want to experiment with a new runtime, that probably did not exist when they started the project (or what is more probable it was unstable and no one knew if it is going to be stable on time). The result of those actions is my headacke, each time when I try to create architecture in order to overcome framework problem. In example I have to host WF4.0 workflows as WCF services in order to use it.

The next thing I do not like in SharePoint 2010 is it's configuration. Everything is done through XML, and there is no fluent, that I am aware of to make it simpler. In example, when I work in my development environment, and I have a fresh SharePoint installation I look at the web to find how to turn on error logging, that are developer friendly. As always it takes time to find in on the web and modify web.config.


<SharePoint>
<SafeMode CallStack="true" ...>
</SharePoint>
<system.web>
<customErrors mode="off">
</system.web>


Why can't you Microsoft make it more friendly?

Sharepoint 2010 on Windows 7




I finally did it! I was working on my mac dual boot (Leopard, Windows 7) box for a long time. Long time ago, I've chosen a Windows 7 32 bit operating system, instead of 64. I did it because when Microsoft released Windows 7 on 64 architecture I was struggling to do anything on 64 bit configuration (on my personal laptop), and I didn't want to face this same problems on my stationary computer at home. By problems (ehm... challenges, as my mentor once said) I mean majority of 3'party applications, or even applications written by Microsoft did not work on a 64 bit Windows 7. Those were a tools that everyone (developer) uses like SQL Server Management Studio Express, Remote Desktop, ... until updates were written and new version of products were released I spent many nights trying to find a tool that allowed me to do my job, that would be easily done by a tool that I knew, but was not willing to run on Windows 7 64.

Recently I find more (but still not many of them) applications that work only on 64 bit architecture. One of them in SharePoint server, and SharePoint foundation 2010. By not working on 32 bit architecture I mean that you can not even run the installer, It will simply not work. What you can do if you are desperate - you can virtualize the SharePoint image on your 32 bit computer. But it requires a different tool then Microsoft Virtual Server. You need a tool that can emulate the 64 bit architecture on top of 32 bit one (like VMWare Server, witch is also free). Some (I don't know any tool that does not) of emulating tools, like VMWare Server require you to have a special mother board that allowed such configuration (I mean that allowed emulation of 64 bit system on 32 bit one). Architectural and bits problems, It all always reminds me about old time programming for Windows, Petzold in his excellent book, spent tremendous work trying to explain to people why, for windows programmer, architecture mater. It's amazing that this book was released in 1998 (my version is from year 2001, and still keeps it's price) by current developers are facing this same challenges.

I finally reinstalled my windows system to take advantage of the 64 bit architecture. Unfortunately still I faced some problems in SharePoint installation. The normal SherePoint Server and SharePoint Foundation installer wont work on other operating system then Windows Server 2008. One needs to follow instructions. I would add some comments to this documentation. The command that needs to be triggered to unpack SharePoint Foundation installation is different:

SharePointFoundation.exe /extract:c:\SharePointFiles

And yes, you DON'T need to copy installation to following location:

C:\SharePointFiles

You can do it wherever you want.

The following command didn't work for me, and I didn't need it to install SharePoint:

c:\SharePointFiles\PrerequisiteInstallerFiles\FilterPack\FilterPack.msi

There error I received when trying to run this command was exactly this same as when trying to run default SharePoint installer - it requires Microsoft Server 2008.

If you installed Visual Studio 2010 you DON'T need to install following dependencies (even when you install SharePoint Foundations):

Microsoft Sync Framework
SQL Server Native Client
Chart Controls
SQL Server Analysis Services - ADOMD.Net


You need to install following dependencies:

Windows Identity Foundation (I got mine from here, for Windows 7 64bit version 6.1)


You DON'T need to fire up this instruction

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;
IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;
IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;
IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-HealthAndDiagnostics;
IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ManagementScriptingTools;
IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;
IIS-RequestFiltering;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;
IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-IIS6ManagementCompatibility;
IIS-Metabase;IIS-WMICompatibility;WAS-WindowsActivationService;WAS-ProcessModel;
WAS-NetFxEnvironment;WAS-ConfigurationAPI;WCF-HTTP-Activation;
WCF-NonHTTP-Activation

Just be sure to go to ControlPanel->Programs->IIS and enable all the features underneath IIS, that are showed in the documentation (I mean the SharePoint installation instruction for Windows 7 mentioned before).

Thursday, January 6, 2011

SISAL language




Some time ago I was reading a really good article by MarkCC. Because recently I am struggling with implementation of Knuth's algorithms in my favourite languages (Scheme and recently Haskell) I was looking for something less declarative and more strict (in terms of how algorithm is going to be computed). I found SISAL, a really interesting language designed in 1983 (my favourite year), and with a design that is totally 21 century - the language by design supported concurrency, and was designed to have a Fortran like performance, SISAL is functional and you can compile it's code. Because lately I see only articles that deal with Scala, Groovy and other languages that are well know (from the set of a not main stream languages) I thought that would be a great idea to introduce some completely different programming language that looks at the programming problem from a different perspective. Give it a look.