Welcome to WindowsClient.net | Sign in | Join

Zuker On Foundations

The realm of .NET (WPF, WCF and all around)

July 2008 - Posts

Text Trimming Using CSS

There is a non-so-familiar way to apply trimming to text in HTML using simple CSS.

In order to apply a certain width on an element and together ensure that its innerText will be bound to that and will be trimmed accordingly, we can do the following:

<span class="LongTextContainer">Very long text here.. Bla Bla Bla</span>

.LongTextContainer
{
   width: 300px;
   position: fixed;
   overflow: hidden;
   text-overflow: ellipsis;
   white-space: nowrap;
}

The text-overflow determines that the text will be trimmed while showing ellipsis in the end.

This seems to do the trick quite perfect.

Read additional information in this post.

Posted: Jul 29 2008, 02:44 PM by Amir Zuker | with no comments
Filed under:
Building a WCF Smart Router - The Beginning

In one of my projects I was working on building a smart router facade using WCF.

The general idea -
The consumer will have an actual endpoint to the router.
The router intercepts the client messages, performs all sort of necessary operations and processing, then sends the message to the actual service.

This is called a "smart" router since it's not playing the part as a simple pass-through router.
It actually provides service virtualization, interception of messages and passing it along to the appropriate endpoint, taking into mind Management, Monitoring and Governance. A sort of ESB.
The idea was to support most configurations and profiles of common services all around.

The project was not trivial to write. Plus, it's pretty far from being truly 100% complete.

I will write a series of posts illustrating the key points I had encountered throughout the project, there were quite many.

For the meantime, a good place to start would be reading the following articles by Michele Leroux Bustamante -

Building a WCF Router, Part 1

Building a WCF Router, Part 2

Posted: Jul 25 2008, 06:04 PM by Amir Zuker | with 3 comment(s)
Filed under:
Text manipulation - Title Case

A nice way to convert text to title-case using the .NET framework.

Title Case - First Letter Of Every Word Is Upper

CultureInfo.CurrentCulture.TextInfo.ToTitleCase("some text"); //Returns "Some Text"

Note that you should ensure the input passed to the method is all in lower case, otherwise you will encounter scenarios where this would not work.

 

Posted: Jul 22 2008, 07:08 PM by Amir Zuker | with no comments
Filed under:
Mimetypes required for VSTO and ClickOnce

Via this post.

Following mime types should be registered in ISS, when using VSTO and ClickOnce:

.application
application/x-ms-application

.manifest
application/x-ms-manifest

.deploy
application/octet-stream

.deploy
application/x-ms-vsto

Posted: Jul 22 2008, 07:06 PM by Amir Zuker | with no comments
Filed under:
Get executing assembly file path location

Very simple piece of code to get the path where the executing assembly is located.

private static string GetApplicationPath()
{
   return Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
}

Posted: Jul 15 2008, 11:01 AM by Amir Zuker | with no comments
Filed under:
Velocity Cache Project

The CTP version of Velocity had been released a while back.

It certainly has great benefits.

Here's a link to Bart's post going over this release, worths the check.

From Bart's post:

Introduction

But first... what's in a name? Multi-tiered distributed applications are common-sense nowadays and with cloud computing within reach the need to build scalable distributed services has never been bigger. One of the core aspects in enabling those scenarios is to have intelligent caching of objects, not only to reduce the number of accesses to the underlying data source but also to boost availability by employing scale out techniques. Obviously, developers want to be able to do all of this without having to worry about the complexities that this brings, having to deal with load balancing and availability themselves. That's where Velocity comes into play.

The core idea is very straightforward: we have a cache that behind the scenes is distributed and replicated across a bunch of machines called the cluster. Storing data in the distributed cache is as easy as calling some Add or Put method, and retrieving it is as easy as calling Get. With some creative stealing from the documentation we end up with the following picture:

image

An important thing to emphasize is the fact the cache clients deal with regular .NET objects all the time and don't have to worry about storing those objects. Indeed, .NET serialization takes care of the rest. There are more concepts to it such as cache eviction policies (when objects are removed from the cache, such as least-recently used or LRU), the distribution mechanism where simple clients just contact the cluster "in the cloud" through any cache host and get redirected to whatever host the object is available on versus routing clients that have awareness of object placement through a routing table. Other important pieces include the supported concurrency models and associated locking mechanisms but let's not go there in this introductory post.

Posted: Jul 05 2008, 01:57 PM by Amir Zuker | with 1 comment(s)
Filed under: ,
Page view counter