Oren Eini

CEO of RavenDB

a NoSQL Open Source Document Database

Get in touch with me:

oren@ravendb.net +972 52-548-6969

Posts: 7,590
|
Comments: 51,218
Privacy Policy · Terms
filter by tags archive
time to read 1 min | 95 words

Adam Bosworth write about a talk he gave in ICSOC04.

The subject? Keep It Simple, Stupid!

"The engineering is hard, but the user model is simple and sloppy."

"A moving object appears to shrink in the direction of motion as seend by a stationary observer." -- Albert Einstein

"If it was easy, the hardware people would take care of it." -- Tech Support Slogan

[Listening to: Linda Ronstadt - Heat Wave - - (02:46)]

Lambada in C#

time to read 9 min | 1626 words

Sriram Krishnan attempts to create lambada in C#, and James Robertson sneers at the attempt.
Peronally, I don't understand why she took the string approach even if she wanted to remain general. Delegates are perfectly possible to move a delegate around in a type-safe manner.

Here is a possible solution1, it works for both static and instance methods.

     1: using System;
     2: using System.Collections;
     3:  
     4: namespace Lambada
     5: {
     6:     class Mai2n
     7:     {
     8:         private static string[] words = {"dog","cat","mink"};
     9:         delegate void StringDelegate(string args);
    10:         delegate string RetStringDelegate(string args);
    11:         delegate void IntegerDelegate(int i);
    12:  
    13:         private static void PrintInt(int i)
    14:         {
    15:             Console.WriteLine("Integer: " +i);
    16:         }
    17:  
    18:         private static void PrintStr(string str)
    19:         {
    20:             Console.WriteLine(str);
    21:         }
    22:  
    23:         private static string Capitalize(string str)
    24:         {
    25:             if(!Char.IsUpper(str,0))
    26:                 str = Char.ToUpper(str[0])+str.Substring(1);
    27:             return str;
    28:         }
    29:  
    30:         private int multiplyBy;
    31:         public void Multiply(int i)
    32:         {
    33:             Console.WriteLine("Multiply by "
+ multiplyBy +": " + i*multiplyBy);
    34:         }
    35:  
    36:         public static void Main(string[] args)
    37:         {
    38:             Mai2n m = new Mai2n();
    39:             m.multiplyBy = 2;
    40:             Map(new StringDelegate(PrintStr),words);
    41:             Map(new IntegerDelegate(PrintInt),new int[]
{1,3,5,7,11,13});
    42:             Map(new StringDelegate(PrintStr),
    43:                 ReturningMap(new RetStringDelegate(Capitalize)
                         ,words));
    44:             Map(new IntegerDelegate(m.Multiply),new int[]
                             {2,4,6,8,10});
    45:         }
    46:  
    47:         public static void Map(Delegate d, IList list)
    48:         {
    49:             foreach (object o in list)
    50:             {
    51:                 d.DynamicInvoke(new object[]{o});
    52:             }
    53:         }
    54:  
    55:         public static IList ReturningMap(Delegate d, IList list)
    56:         {
    57:             ArrayList al = new ArrayList(list.Count);
    58:             object ret;
    59:             foreach(object o in list)
    60:             {
    61:                 ret = d.DynamicInvoke(new object[]{o});
    62:                 if(ret!=null)
    63:                     al.Add(ret);
    64:             }
    65:             return al;
    66:         }
    67:     }
    68: }

Here is the output of the above program:

dog
cat
mink
Integer: 1
Integer: 3
Integer: 5
Integer: 7
Integer: 11
Integer: 13
Dog
Cat
Mink
Multiply by 2: 4
Multiply by 2: 8
Multiply by 2: 12
Multiply by 2: 16
Multiply by 2: 20

 

1 Possible restrictions about no error checking, validation etc apply :-)

 

"A coat hanger is 44 inches long when straightened." -- Fact of lifes

"Quality assurance: A way to ensure you never deliver shoddy goods accidentally." -- Tech Support Slogan

"If you yelled for 8 years, 7 months and 6 days, you would have produced enough sound energy to heat one cup of coffee." -- Fact of lifes

[Listening to: Better Than Ezra - One More Murder - - (04:39)]
time to read 2 min | 318 words

Brad Abrams asks about a site for long bets, and get an answer in a comment that the site is call Longbets.org.

The curious thing about it that I run a cursory search and, naturally, there is a long running bet for a peace between Israel and the Palestinians because of some improvements in water technologies (didn't investigate the spesific technology).

Registerring isn't free, so I answer this arguement here:

The reasons for Israel & the Palestinians conflict1 are much deeper than water conflict. The issue is deeply embedded within the culture of both people. The conflict is about land, and religion, a way of life and a culture. We live within two steps of one another, but we are very different.

To think that solving the water supply would end the conflict is to be hopelessly naive.

My bet?
There will be no resolution2 to the Israel - Palestinians conflict in the next five years3.

1 I'm using very neutral language here.

2 Resolution defined as:

  • Israel formally acknowledge a Palestinian state.
  • Israel trasfer full responsability for the internal affairs of this Palestinian state, including in security matters.
  • The Palestinians formally renounce the Right to Return
  • The Palestinians stop the propoganda against Israel in all goverment controled media and in the schools.

3 By God, I so hope that I'll have to swallow those words.

time to read 1 min | 139 words

It's not generics, and it's not SQL Server Express, or anonymous delegates.

It's VS.Net 2005 ability to show me the content of unhandled exceptions that while debugging. VS.Net 2003 just show me an ugly dialog, with 2K5, I can check what the problem is, and in 99% it's just one second change.

I'm currently exploring NHibernate and I'm getting a lot of those exceptions, and it's annoying to stop debuggin, put try/catch blocks, read the exception message, explore inner exceptions and then make a single change, and then it works.

It makes a short task much longer than neccecary. Anyone knows about an add-in for VS 2K3 that does this? I would move to VS 2K5, but it doesn't support Resharper, and I'm addicted to it.

Here be Bugs

time to read 3 min | 594 words

Perhaps I shouldn't be a developer, I seem to have much better future as a tester, I find so many bugs when I try to program.

My most recent experiment was with NHibernate. I'm not asking for much, all I want is a bug tracking database that I can put to use on my personal projects. Unfortantely, BugZilla and I didn't get along and I finally removed it.

I can't get Sql Server or MSDE to install on this computer, probably because I install/uninstalled so many times (including SQL Server Express betas) that now I get an install that seems to work, but leave me with a server (probably) but no way to access it (which is why I'm not sure that I've the server).

I couldn't find a bug tracking software that work with MySql/SqlLite/Access/Files that I would like. Meaning that it was free, easy to install (read: didn't require me to jump throught hops) and optionally offer smart client features (IE, windows application).

There are  all sorts  of  bug  tracking  software  that  I tested, but nearly all of them either require Ms Sql Server or were ports from linux that required me to install strange stuff on my computer just to test them. Considerring the amount of works that it takes, I wasn't willing to make the effort.

I'm reading a lot about O/R Mappers so I decided to try NHibernate due to the excellent review by Scott Bellware.

As I mentioned, I want a bug tracking software, so I decided to try a proof-of-concept bug tracking with NHibernate. I installed MySql and was very surprised by the quality of the tools (There is a reason why I insist on using only .Net tools when possible, the UI is usually better.) I wish that I'd something similar to use on Sql Server Express (and no, the Express Manaager doesn't come close.)

NHibernate is a port of Hibernate, so it's pretty mature design-wise (still learning it, can't comment on the quality of the code) but it has one big problem, and that is its documentation. I only now got it to work on my machine, and I've been trying for over a day to just pull a value from MySql Server and then print it to the screen. I'm happy to confirm that I finally managed it.

The second problem that NHibernate has is poor error reporting, the main problem was that I didn't reference MySql.Data.dll assembly, so it couldn't connect to MySql, but the error I got was "problem in find" with an inner exception complaining about NullArgumentException in Activator.CreateInstance().

Usually I'm very relucant to debug other people code, especially when it's such a big undertaking. You need to learn the code to debug it, and that usually take quite some time. But I was angry, it was at friday morning and it's raining outside, so I didn't care. Eventually I found out the problem, and right there in the comments it tells me that I need to reference MySql.Data.dll and then it silently fail if I don't.

This is a case where a single assertion would've saved a lot of trouble.

Anyway, it's working now, so I'm going to continue to experiment.

I'll post my results soon.

time to read 1 min | 99 words

Frans Bouma talks about Peter Torr post regarding firefox security, his conclustion is that Peter is somehow in denial.

Personally, I find that Peter was right on the mark. Yes, Firefox is more secured than IE (for the time being) but what Peter was talking about were flaws in the way Firefox handle it security UI now. And saying that IE does worse (and in those spesific case, it doens't) help no one.

Those problems are real one, and they won't go away with finger pointing.

Firefox trust

time to read 2 min | 220 words

I've been a loyal Firefox user for quite a bit, but I completely agree with Peter Torr when he criticize Firefox secuirty problems.
He sums it up very nicely:

·Installing Firefox requires downloading an unsigned binary from a random web server

·Installing unsigned extensions is the default action in the Extensions dialog

·There is no way to check the signature on downloaded program files

·There is no obvious way to turn off plug-ins once they are installed

·There is an easy way to bypass the "This might be a virus" dialog

FUTURE POSTS

  1. RavenDB & Distributed Debugging - 2 days from now
  2. RavenDB & Ansible - 5 days from now

There are posts all the way to Jul 21, 2025

RECENT SERIES

  1. RavenDB 7.1 (7):
    11 Jul 2025 - The Gen AI release
  2. Production postmorterm (2):
    11 Jun 2025 - The rookie server's untimely promotion
  3. Webinar (7):
    05 Jun 2025 - Think inside the database
  4. Recording (16):
    29 May 2025 - RavenDB's Upcoming Optimizations Deep Dive
  5. RavenDB News (2):
    02 May 2025 - May 2025
View all series

Syndication

Main feed ... ...
Comments feed   ... ...
}