We're growing into something new. Read More
chaniewski

Michal Chaniewski


Discussion

CSS, padding, nested elements, and scrollbars - how to do it properly?

I have structure like this: <div class="comments"> <div class="comment"></div> <div class="comment"></div> <div class="comment"></div> ... <textarea>this allows adding new comments</textarea> </div> Raw Code » with a CSS like this: .comments { width: 250px; padding: 10px; overflow: auto; } .comments textarea { padding: 4px; } Raw Code » So, the question is - how to make textarea 100% wide? width: 100% doesn't work, because padding is added, so the textarea gets a width of 100% + 8px. I'd make it fixed width (242px + padding), and it indeed looks how I want it to, but there is one catch. The catch is overflow:auto; on container. After a number of comments appears, we might get a scrollbar which makes the content area narrower. So, fixed width on textarea doesn't work here properly. How to solve it?

Discussion

Domain-Driven Thinking - Getting rid of Save/Update methods from Repositories with NHibernate

On building on collection semantics for Repositories, avoiding explicit Save/Update operations and taking advantage of Identity Map pattern in NHibernate in order to start thinking in the terms of aggregate roots and object graphs, not database-mapped entities. Good read.

public static Version GetVersionVersion(string assemblyName)
{
    var domain = AppDomain.CreateDomain("versionChecker");
    var assembly = domain.Load(assemblyName);
    var version = assembly.GetName().Version;
    AppDomain.Unload(domain);

    return version;
}

Checking assembly version without loading it (C#)

There are situations, where you want to check a version of assembly, without loading it into current application domain. If assembly is loaded into main application domain, it's stuck there forever - there is no way to unload code, so there is no way to, for example, update the application (files are locked, code is already in memory, etc). Above code allows to implement a scenario of automated updates: small bootstrap assembly checks the version of the application assembly, then downloads update (if any), replaces the files, and then starts the code in newly downloaded file. The code works by creating additional application domain that can be unloaded together with contained assemblies later on. To make the update, bootstrap assembly can't have any reference to the assembly being replaced.