kenegozi.com

<form id='kenegozi' action='post'></form>

   
2007 Jun 28

Things I Learned About Software

tagged as: miscellanea | personal

Following Scott's post, here are my listings (is four okay?):

Four things I learned about software (in University, not College):

1. If you'll help a friend with a red-black tree implementation in C++, he'd eventually help you with an assembler precompiler in C.

2. Software Engineering is the only course where you can write a fully working program, with no compile warnings, with all tests green, and still get 60 out of a 100. (I'm sorry that my printing method was named ToString, while supposedly in ADA I should name it Put to keep convention with the language)

3. The good looking gals usually do not attend CS classes. If they do, they take DB Basics and DBMS implementations.

4. Watefall / BUFD is the ONLY WAY to manage software projects. I've had a 6 points course that dealt almost only on that. And they gave me 10% off the grade for doing a final design document without the proper fonts and colors.

 

Three things I learned about software while not in the university:

1. A code you write alone is bad. At least get someone to do code-review, and at best, pair program, or open-source your code so it'd get looked at.

2. You can either eat Pizzas, or have a loot of sugar-loaded-coffe mugs. If you do both, you'll get fat. (that ofcourse, unless you are a gal who attended a non DB related CS course, and then you're screwed anyway).

3. O.O. languages is not the only way to go. Static typing is not always the best thing. Javascipt is actually a programming language.

4. Scrum / XP / TDD / IoC / DI / MVC / UnitOfWork

2007 Jun 28

Redirecting syndication link from dasBlog's one to the new one

tagged as: asp.net 2.0 | c# | monorail | blog engine

Today I was informed by Dror that although I managed to redirect all requests to html/aspx url's on my blog (the ones that dagBlog was using) to the new pemalink format, I forgot to do the same for the old syndication link.

So that link was http://www.kenegozi.com/blog/SyndicationService.asmx/GetRss and now it's http://www.kenegozi.com/Blog/Syndication/Atom.aspx

I could've used the monorai redirection module that is already in use on my blog, but I chose to do it differently, with a dedicated handler, just to show how easy it is do to such stuff, even without a full blown redirection engine.

So, I've added this:

public class SyndicationRedirectionHandler : IHttpHandler 
{
    #region IHttpHandler Members
    public bool IsReusable
    {
        get { return true;}
    }

    public void ProcessRequest(HttpContext context)
    {
        context.Response.StatusCode = 301;
        context.Response.Redirect("http://www.kenegozi.com/Blog/Syndication/Atom.aspx");
    }

    #endregion
}

and that line into web.config:

<add verb="*" path="SyndicationService.asmx" type="KenEgozi.Com.Weblog.SyndicationRedirectionHandler, KenEgozi.Com.Weblog"/>

Voila.

2007 Jun 24

Regionerate - c# region maker

tagged as: tools | castle | activerecord | monorail

Check out this nice tool from Omer Rauchwerger.

 

It could help a team to manage a coding convention. Should be very useful in Open Source environments. For example, when committing changes to castle project (or sending a patch) there is a coding standard than needs to be followed. Regionerate could help a lot with that effort.

 

I need to see if it can select methods and properties by attributes. It could then help making MonoRail controllers and ActiveRecord decorated classes more readable (region of all actions with a "SkipFilterAttribute", region of "Property" and region of "HasMany", etc.)

 

UPDATE:

Silly me, I forgot to mention that I found about this great tool at Roy Osherov's blog. A very good one, that is. Many Agile related stuff, and funny little things, too. So go on and subscribe to it's feed.

2007 Jun 22

VS 2008 Javascript Intellisense + PrototypeJs => isFunToScriptBrowsers == true

Checkout the latest post of Scott Guthrie.

Is the long awaited JS IDE will be VS2008?

Now it's a matter of adding ///<summery> tags to prototype.js and maybe people would really stop being afraid of developing javascript code.

Now that's a good reason to switch to VS2008, combined with the fact than you can hold to your current .NET distribution.

2007 Jun 20

Eagerly loading multiple collections in one roundtrip

tagged as: activerecord | nhibernate

Today at work I did a session with my team, showing them several methods to query the DB in a NH/AR enviroment.

When we talked about eager fetching, I said that doing it for more than one collection in one query isn't good (as advised in hibernate's site), since it might build up a rather large cartesian product.

Why? If we have a type Entity, that looks a bit like that:

class Entity
{
    ...
    [HasMany ...]
    public IList<Item> Items ...

    [HasMany ...]
    public IList<AnotherItem> AnotherItems ...
    ...
}

An eager fetch will do:

SELECT *
FROM
    Entities INNER JOIN
    Items ON Entities.Id = Items.EntityId INNER JOIN
    AnotherItems ON Entities.Id = AnotherItems.EntityId 

The result length will be e*i*a, where e is the number of rows in Entities table, i is the number of rows in Items table , and a .. (you fill the blank).

But, luckily for us, NH is keeping a single concrete copy of each entity in a session. Ayende is abusing that in a way, that makes the above possible, without the 3rd (or more) dimention in the cartesian product.

How it works? Using a MultiCriteria, he is getting his entities, eagerly fetching one collection at a time. So it would return e*i+e*a rows. So for the first query, NH will populate the Entity instances, with the first collection (Items) populated. For the second query, NH will populate *another* Entity instances with the second collection (AnotherItems) populated. But, since it's in the same session, actually the first Entity instances (with Items already populated) will get their AnotherItems collection populated.

That's why at the end of the snippet, you see that he actually deals with list[0]. That's where the first set of references is placed, and the other items in that list (list[1] ... list[n]) are just copies of the references to the same Entity objects.

Quite a similar approach was seen when Ayende has shown us how to eager fetch using SQL (at the end of the post). The query there returns an array of Message items and an array of User items, but the User instances actually are wired to their Message instances, so he is using only the first array.

2007 Jun 20

Visual Studio 2008 will target multiple .NET runtimes

tagged as: visual studio | tools

That's a big announcement.

After all, even VS2005 was actually calling csc.exe rather that calling some magical inner stuff as in 2002/2003.

I hope that this also means better addin development support, so great projects like CVSI and ActiveWriter, could become even better.

Do you think they'd enable a "Compile for Mono" option?

2007 Jun 16

The daily quote: "the single best thing any ASP.NET developer can learn right now is MonoRail"

tagged as: castle | monorail | aspview

taken from Karl Seguin post about his .net wishlist:

Thinking beyond the common request to implement an MVC pattern, I’d be great if the ASP.NET team could rethink the current model and life cycle. It leaks badly in any complicated scenario. 6 years after its release, I still don’t fully understand it, and I’m ready to bet that I’m in the overwhelming majority. The only time it doesn’t leak is when you don’t need any of the fancy stuff it tries to do. I’m almost at the point where I just don’t use .NET if I’m building a heavy web-based application. Forget learning an O/R mapper, test driven development or understanding domain driven development, the single best thing any ASP.NET developer can learn right now is MonoRail.

Could not agree more ...

2007 Jun 15

AspView - a little bugfix

tagged as: tools | castle | monorail | aspview

If you are an AspView user you might have noticed a problem.

If you setup a nullable-value-type parameter with a default value other than null, then you'd get a casting error.

 

example:

<%
    int? someInt = default(int);
%>
some markup 
<% if (someInt == default(int)) DoSomething();%>

 

it happened because of the way GetParameter worked

GetParameter is a method that gets a view parameter value from the view's properties collection (PropertyBag, Flash, Request.Params, etc.). It's located in the AspViewBase class (the base class for each and every view in the AspView world).

 

So, now it's fixed, and a test was added to make sure it'll stay that way.

 

As soon as google.com will be accesible again, you'd be able to check out and build.

UPDATE:

I'm too tired (3am here). The sources are on castle contrib and not on google, so you'd find them here

2007 Jun 15

I am using live.com from the wrong reason

tagged as: miscellanea

How strange.

After the GoogleReader failure last week, now it seems that every google site is down. I cannot access google.com, google.co.il, gmail, reader, or calendar. my own search page that uses google ajax search api is down, too.

So I'm bound to use live.com for now.  Not too bad it is, however a bit slower than google.com, and way slower than my own google-driven kenegozi.com

 

 

image

I hope gmail will be back soon.

 

UPDATE:

google analytics is down, too. It's making my blog uneasy.

 

Just a thougt. Is it happening only here? has my router started disliking google to the point of refusing network connections?

 

UPDATE:

google is back, alive and kicking.

I can finish the email I'm was working on when it went down, and finally send it. Smashing. (hey - it's 3:30am here, so cut me some slack)

2007 Jun 11

That Old Marshmallow Maze Spell

tagged as: miscellanea

That's why Steve Yegge is my favorite blogger.

 

I say that one should not only know WHAT he's talking about, but one should also know HOW to say what he has to say.

2007 Jun 11

Default value for value type parameter in AspView does not work

Today we tried to have this in a view's parameters section:

 

<%

    int id = default(int);

%>

 

It won't work.

Internally, AspView looks for a parameter (in the PropertyBag, Flash, Form, QueryString etc.) with the name "id".

Now if it is not found, it should set to "default(int)". The problem is duw to a bug in AspViewBase (which is the base class for all views) that sets a null value if the property is not found, thus failing the cast to value type (you cannot (int)null).

 

I'll add a test, fix the bug, and commit it, hopefully by this weekend.

 

Meanwhile, we "solved" the problem by using:

 

<%

    object id = default(int);

%>

2007 Jun 6

Full blog comments feed

tagged as: monorail | aspview | blog engine

The newest addition to the blog engine.

From the subversion commit comment:

 

Some refactoring to avoid code duplication
Added support for CommentsAtom - a feed with all of the comments in a blog, used for tracking purposes by the blog writer

 

Now you can access http://the_blog_url/Syndication/CommentsAtom.aspx and get a feed of all the comments.

Useful as a tool for the blog writer, as it enables tracking of comments all over the blog

 

as usual  -  sources are here.

Subscribe

Statistics

283
440

Related Books

Related Jobs

Related Ads

search page | Blog's home | About me