Kamis, 07 April 2011

Silverlight: How to Communicate with Desktop Application via HTTP

IntroductionThis article is a free continuation of How to Receive Messages from a Desktop Application and How to Send Message to a Desktop Application where the Silverlight application communicates with the standalone .NET application via TCP. In this article, I would like to show how to implement the communication via HTTP. The example below implements a .NET application as a service and a

Android Fundamentals: Working With Content Providers

The TutList application that we’ve been working with has a pretty big flaw right now: the article data is not “live”, but static content. In this tutorial, you take several more steps towards a flexible and expandable solution by modifying the application to act as a data-backed content provider. The Android framework uses a concept called content providers to enable applications to share and use

WCF ExceptionHandling in Silverlight

I have recently done some LOB application development in Silveright in which we used a WCF service to communicate to the backend. There was an unexpected surprise that Exceptions throw in the WCF service were not transferred to the Silverlight Client! In Silverlight you always get a System.ServiceModel.CommunicationException: The remote server returned an error: NotFound.... error. We wanted to

Getting something better than “Server not found.” from WCF in Silverlight

When developing applications in Silverlight it is inevitable that you will need to perform a request back to the server for data or processing. The common practice is to use Windows Communication Foundation (WCF). I find that WCF usually handles all of my needs and it works well when everything is happy and just right. However, if anything is not in its correct place, we can have tons of problems

HttpContext.Current returning null when using NetTcpBinding in WCF4

When using NetTcpBinding, not all of the features of WCF are available, particularly those using HTTP. NetTcpBinding removes a dependency on HTTP (and IIS as a result, allowing the service to be hosted in WAS instead.) HttpContext.Current is one of the features in WCF that is not available when using NetTcpBinding.Read more: WF, WCF, and AppFabric notes Posted via email from Jasper-net

Memcached for Dummies

The other day I was chatting with a colleague about Memcached.  Eviction policy came up, and I casually mentioned that Memcache isn't strictly LRU.  But a quick Bing search said Memcache is LRU, like this Wikipedia entry.  Hmm, I was 99.9% sure Memcache is not LRU, something to do with how it manages memory, but maybe I was wrong all these years.  After reading through some Danga mailing lists

How to implement Template Binding in Silverlight Custom Control?

Continuing to our 2nd chapter of the series here on Silverlight Custom Control. In this chapter we will discuss on dynamically setting the Content and other properties to our Custom Control that we implemented earlier. After reading this article, you will be able to create properties and set content dynamically to your control.  So, lets start describing them and learn something again today.

10 Steps to Initiating an OpenStack Cloud Service

OpenStack currently consists of three main components: Nova (Compute), Swift (Object Storage), and Glance (Image Service). There are some other projects such as a dashboard and mobile apps as well. You can see the full list here. This is great start, but in order for OpenStack to compete long term, other infrastructure and platform services will need to be brought in. I’d like to talk about the

טיפ: איך לעבוד עם jQuery בתוך ויז’ואל סטודיו 2010

כדי לספק ממשק משתמש עשיר וחוויתי באפליקציות Web, קשה להמנע כיום משימוש בספריית JavaScript כלשהי. jQuery היא ספריית ה- JavaScript הפופולריות ביותר כיום, ואם עדיין לא יצא לכם להתנסות בה, כדאי שתציצו במדריך jQuery באתר וובמאסטר. פוסטים קשורים שכדאי לקרוא: NuGet – תשתית קוד פתוח לניהול ספריות ותוספות לאפליקציות Web jQuery בגירסה 1.5.1 כעת תומך באינטרנט אקספלורר 9מיקרוסופט תורמת קוד ל- jQuery (מנוע

Mono Android and iPhone Updates

Today we are happy to release Mono for Android 1.0 as well as MonoTouch 4.0.Both products allow you to use the C# language to write applications that run on Android and iOS devices. Both products are based on the latest Mono 2.10 core. The Parallel Frameworks can be used to write more elegant multi-threaded code across all devices, and automatically takes advantage of multiple cores available on

3 simple and effective tips to improve your classes in C#

The other day I was taking a look to a C# Web application develop by a co-worker. The application was fine and it delivered the functionality proposed. Nevertheless, I found some common errors (or things to improve) in the way the classes were written. Let’s go ahead with some simple and useful tips to write C# classes. Tip # 1: Define only one class per file.C# allow us to define more than one

MonoTouch 4.0

We just released MonoTouch 4.0, a product to build iOS applications using C# and .NET. We also released our new Mono for Android product.New in MonoTouch 4.0MonoTouch 4.0 is a major upgrade to our product as it upgrades the Mono runtime engine from the old, trusted and friendly Mono 2.6 to the latest and greatest Mono 2.10 core, these are some of the new features available as part of this upgrade

Microsoft clarifies HTML5 v Silverlight

Microsoft has learned its lesson and, not wanting to alienate or spook its Silverlight developers yet again, has posted a carefully crafted blog post that explains its position vis-a-vis Sliverlight and HTML5.  Only a short time ago Microsoft upset a lot of developers by claiming that HTML5 was the way of the future, a fine sentiment, and that Silverlight was only for Windows Phone 7 - not such

How to design a Custom Control by editing the Part Template?

This is a continuation to my previous post "How to create a Custom Control in Silverlight?" In this tutorial part, we will discuss on the template and modify our basic template to give a better look as per our need. In this chapter, we will learn about template Part and how to modify the existing template.  Read out more to learn in depth about Custom Control in Silverlight. This will benefit you

HTML vs. Silverlight vs. WPF

At Readify we focus on the Microsoft stack - WPF, Silverlight, and ASP.NET. The bulk of our projects are ASP.NET, some are Silverlight, and even less are WPF (though the WPF projects tend to be bigger in scope, so they're probably about even). Usually the customer has decided on a technology stack before we arrive, and they've engaged us to help plan/design/build/ship the application. Sometimes

Silverlight 5 Beta Here, HTML 5, Sterling Feedback and More

I have a few things to cover on this post. I want to start with Silverlight 5 but stay tuned for some information about how you can learn more and ask direct questions about the Sterling database.  Silverlight 5 Beta is Here The Silverlight Team just officially announced that the Silverlight 5 beta will be available next week at MIX 2011. This is an exciting milestone because the new version will

Developing Native Android Applications: Not as Hard As You Might Think

Two months ago, my boss asked me to try and build a native Android application based on the mobile website I had created for the university's annual Maryland Day festival. Both he and I are part of an IT initiative in our department tasked with figuring out how best to provide IT services to smartphone users on campus, and while we have in-house expertise in iPhone development, none of us were

April MSDN magazine out now

This month’s MSDN magazine is online and ready for reading. April’s hot topic is Windows Azure – here are the highlights: Windows Azure Development: CQRS on Windows Azure Learn how Command Query Responsibility Segregation represents a shift from more classic, three-tier application architecture toward a message-based, asynchronous pattern. We walk you through a reservation booking app to

Error Handling – The C++ Way

In my experience as software developer, I noticed that there are lots of people that write in C++, but do not use exceptions. They prefer to use return codes instead. I guess that this is caused by the late addition of exceptions in the C++ standard. Whatever the reason is, personally, I prefer to use exceptions as an error handling technique. Almost 10 years ago I started programing in Object

Tron legacy

How the Tron:Legacy movie was filmed. I spent a half year writing software art to generate special effects for Tron Legacy, working at Digital Domain with Bradley "GMUNK" Munkowitz, Jake Sargeant, and David "dlew" Lewandowski. This page has taken a long time to be published because I've had to await clearance. A lot of my team's work was done using Adobe software and Cinema 4D. The rest of it got

Getting the CLR Version

The .NET common language runtime (CLR) is the run-time environment that executes managed code developed in .NET languages such as C# and Visual Basic. The version of the CLR varies for different versions of the .NET framework. Common Language RuntimeThe common language runtime (CLR) is a core part of the .NET framework. It is responsible for executing managed code created using languages such as

Type conversions with implicit and explicit operators

Introduction In this article I'm going to describe about how to use type conversion operators (implicit & explicit) in user-defined classes. We commonly come across situations in which a same real-world entity is represented in two different classes. For ex. when integrating two sub-systems into one, we see an entity is represented as Author in one sub-system and as Writer in other.  Although, in

Why override ToString()? Use DebuggerDisplayAttribute instead

Debugging and Runtime InspectionThe Visual Studio 2010 debugger is an awesome tool, no doubt about it. It's likely the most powerful and capable debugger ever developed for Windows or any other platform. And yet, there are times when you wish it 'knew' or exposed more detail. When you're debugging a runtime instance of your application or inspecting a mini-dump to gain insight into the state of

Dapper - a simple object mapper for .Net

FeaturesDapper is a single file you can drop in to your project that will extend your IDbConnection interface. It provides 3 helpers:Execute a query and map the results to a strongly typed Listpublic static List ExecuteMapperQuery(this IDbConnection cnn, string sql, object param = null, SqlTransaction transaction = null) Example usage:public class Dog{    public int? Age { get; set; }    

Google Python Class Day 1

Welcome to Google's Python Class -- this is a free class for people with a little bit of programming experience who want to learn Python. The class includes written materials, lecture videos, and lots of code exercises to practice Python coding. These materials are used within Google to introduce Python to people who have just a little programming experience. The first exercises work on basic

My Experiences in Silverlight 4 : Writing re-usable Controls

These days I am working on Silverlight and creating Custom controls which would be re-usable in another projects. And when you set out to write re-usable Silverlight controls, Silverlight toolkit is the best code to look up to. When you download the Silverlight toolkit. The toolkit installer also copies source code of the toolkit at           “%Program Files%\Microsoft SDKs\Silverlight\v4.0\

Login / Registration Form: Ideas And Beautiful Examples

All throughout the modern web, we are seeing a growing amount of places for user input. These include shopping carts, interactive web games, and most certainly website registration forms. It seems that not only should designers be focusing on page design, but form aesthetics are also equally vital role. Consider how many forms you may have filled out over the course of your Internet history.

Video Tutorial: Android Application Development - BaseActivity

Class 5, Part 1. This video comes from Marakana's 5-Day Android Bootcamp Training Course which Marko Gargenta taught in San Jose, CA earlier this year. Now, that you've created the Timeline activity, you're going to give it an options menu that will allow users to toggle the service on/off. Instead of copying and pasting code that we've already written, we're going to again refactor the code.

Decompiler Design - Introduction

IntroductionDecompilation is a form of reverse engineering of computer programs. Its goal is to convert a compiled binary file into a source file. One may want to do this for several reasons, such as to understand how a program works, or to try to modify a program to enhance it or fix a bug. Decompilation has been around for many years, probably ever since people started to compile programs from

DBX vs. Visual Studio and WinDbg: Part 1, Calling Functions

I’ve recently had an enlightening experience teaching a C++ Debugging course to a group of developers who are transitioning from a Solaris environment to Windows and Visual Studio. This hasn’t been an easy transition for them, and the course wasn’t easy to teach—specifically, because one of the most discussed topics was feature parity between DBX (the debugger of choice for C++ applications on

C# Tutorial - Triple DES Encryption

The Data Encryption Standard (DES) has been around since the 70's, enjoyed wide-spread adoption, and has since been retired due to its small key length and ease of brute-force attacks. Triple DES, which is basically the same approach times three, aimed to remove the practicality of attacks while keeping the same basic algorithm. Although it's slowly being replaced by AES, triple DES is still a

Java: Ignore/Trust an invalid SSL cert for https communication

Very Once a while you will need your Java app to talk to a pre prod server (Web Service) over https, but you face the issue is that SSL is not a valid/expired/self signed cert...  You may get an error that looks likeorg.springframework.web.client.ResourceAccessException: I/O error: sun.security.validator.ValidatorException: PKIX path building failed:

RecoverableException for .NET Framework Solutions

Do you remember the good ol' days before the ApplicationException class in the .NET Framework became "persona non grata"? I sure do. If you were to look at .NET code that I wrote years ago, you'd probably see ApplicationException being used all over the place. After all, this seemed like a great way to differentiate between "expected" errors in your code (e.g. a violation of some business rule)

Text Encoding and WCF

For the most part setting the encoding (UTF-8, UTF-16, etc.) on a WCF service is pretty simple:  set textEncoding on basicHttpBinding/wsHttpBinding or encoding on a textMessageEncoding in a customBinding.  It works in almost all cases, but there’s a surprising number of ways of indicating the encoding of message: the content type of the messagean XML declaration at the start of the messagea BOM (

Selasa, 05 April 2011

Virtual Function in C#

Unlike Java, when developing in C# the functions we define aren't automatically virtual. Turning a function into a virtual one involves with several steps. The following video clip (hebrew) explains how to define a virtual function and explains its meaning.  Read more: Life Michael Posted via email from Jasper-net

30 Very Useful Add-ons That Works Great With Firefox 4

The totally redesigned Firefox 4 was launched on 23rd March, 2010 and some of you may be giving it a try. I hope you are liking the new version of Firefox that has come up with great speed enhancements, new and minimal looks, pin-up your favorite web apps like Windows 7, panaroma view of your tab pages to battle tab clutter, do not track features to block your browsing behaviors and much more.

Silverlight: Xaml Blend Namespace Error Not Resolved

XAML Namespace http://schemas.microsoft.com/expression/blend/2008 is not resolved. This error can occur when certain Xaml elements added by blend have not been properly ignored during non design/debug situations and Blend or Visual Studio reports such error. To resolve the error one must add the mc:Ignorable attribute to the namespace declarations to inform the Xaml compiler to ignore a specific

Dirty Dirty Silverlight Hack... - Silverlight 4 Hack: Use Native/Desktop CLR Without COM Registration

Here is a hack of the month. Jeremiah is probably my favoriate Silverlight Prodagy and he has done it again with this wonderful hack, 'Use Native/Desktop CLR Without COM Registration' I like the first line, "WARNING: Information and code here can easily be abused. Please do not use it as a crutch in application planning, but more for utter despair or experimentation. Thus I wrote this blog post

The principles of Microsoft Metro UI decoded

Issue presentedMetro in itself has its own design language attached, they cite a bunch of commandments that the overall experience is to respect and adhere that is to say, someone has actually sat down and thought the concept through (rare inside Microsoft UX). I like what the story is pitching and I agree in most parts with the laws of Metro that is to say, I am partially onboard but not

How to create a Custom Control in Silverlight?

I am working on Silverlight since 3 years and during the initial period I had a fear on creating Custom control. I was more confident creating UserControls during first one and half year of my job. But when I started working on custom controls, I came to know the power of custom control and all the fear gone out of my eyes.  It's around 2 years, I am working on it and every time I am exploring

First look at the future of application deployment on Windows 8: AppX

In an app-centric world, Windows 8 will be adopting the trend full-on with a Swiss Army Knife full of new tricks. One of which is a new universal application deployment system called AppX which I’ve been recently been able to take a first look at. Although Windows 8 will disrupt many components of applications, including how they are written (Immersive) and distributed (application store), AppX

How to sniff web traffic from Marketplace-based Android applications

There are cases when it is necessary to track the outgoing and incoming traffic related to Android applications. However, Android as a platform is not really friendly towards this kind of operations. The most common way I am analyzing the traffic that is targetting a mobile device is by setting an ad-hoc wireless network while my computer is connected to a wired connection. Both Windows Phone 7

So many interfaces!

Today, another question from StackOverflow, and again, presented as a dialogue as is my wont.The MSDN documentation for List says that the class is declared as public class List : IList, ICollection, IEnumerable,                        IList, ICollection, IEnumerableDoes List really implement all those interfaces? Yes.Why so many interfaces?Because when an interface like IList

Senin, 04 April 2011

SLAAC Attack – 0day Windows Network Interception Configuration Vulnerability

Windows machines compromised by default configuration flaw in IPv6As anyone who has watched the reimagined Battlestar Galactica will tell you, Sixes are trouble. They are undoubtedly alluring, but all the while they are working covertly, following The Plan, right under the noses of their targets. Nobody realizes the true nature of the threat until it’s too late. The Internet also has its own Six,

New Flex Touchscreen Interface Demonstrated Using Google Maps

At Interaction 2011, a research group including members from Osaka University demonstrated a new control interface for touchscreens that flexes when scrolled. In the demonstration, the flex interface was used with Google Maps. This method treats content on the screen as an elastic, flexible material. Parts of the content that are normally pushed outside the screen by scrolling are distorted to

Snow – A Slick And Modern Web UI Kit

Each individual element has been hand-crafted with attention to detail for a truly pixel perfect result, and all layers are grouped and organized for ease of use. This UI kit was designed for us by MediaLoot. Read more: Spyre studios Posted via email from Jasper-net

Efficient Paging In Silverlight 2.0

When it comes to ASP.NET, I am a huge fan of efficient code, and one of the most efficient ways to retrieve data from the server is to use paging. Paging has been around for a long time now, but it is not available out of the box in Silverlight 2.0. I thought this was a good time to demonstrate how to consume a WCF service in Silverlight, and to create efficient server side paging using LINQ.

ListBox Paging in Silverlight 4 using DataPager control

Prior to Silverlight 4, implementing paging in an application would require the developer to create controls, that would allow the user to move from one page to another. Check an old article by Malcolm Efficient Paging In Silverlight 2.0 which shows how to create and consume a WCF service in Silverlight 2.0 and use efficient server side paging using LINQ to page through event log data. With the

GPS spoofing the new game in town

There have been comments and minor warnings about GPS spoofing before, but now we have examples of it in action and it turns out to be very easy. GPS and location awareness in general is increasingly popular because it allows applications to deliver a local experience. The very nature of the sort of application that provides local information makes it difficult to see why anyone would bother to

Analyzing a Stuxnet Infection with the Sysinternals Tools, Part 1

Though I didn’t realize what I was seeing, Stuxnet first came to my attention on July 5 last summer when I received an email from a programmer that included a driver file, Mrxnet.sys, that they had identified as a rootkit. A driver that implements rootkit functionality is nothing particularly noteworthy, but what made this one extraordinary is that its version information identified it as a

Using Memory-Mapped Files

IntroductionMemoryMappedFile is an interesting new class in version 4.0 of the .NET Framework which resides in the System.IO.MemoryMappedFiles namespace. A memory-mapped file is a feature of the Windows operating system which allows memory to be shared between two or more processes running on the same machine. It requires much less overhead than other methods of inter- process communication such

10 tips on working fast in UNIX

Have you ever amazed to see someone working very fast in UNIX, firing commands and doing things in mille seconds? Yes I have seen and I have always inspired to learn from those gems of guys. This article or tutorial or whatever you call it I have dedicated to share UNIX command practices I follow to work fast, quick or efficiently in UNIX. I work for financial services industry and my work

Free Borland C++ 5.5 Compiler

Abstract: The free Borland C++ 5.5 Compiler official download pageThe new official page for the free Borland C++ Compiler download is http://www.embarcadero.com/products/cbuilder/free-compiler.  Visit the free C++Builder Compiler download page to:Download the free C++ compiler - the classic 5.5 version of the Borland C++ compiler Learn about C++Builder Starter - a low-priced entry-level edition

Anatomy of a .NET Assembly - The CLR Loader stub

In Windows XP and above, the OS loader knows natively what to do with .NET executable assemblies, and fires up an instance of the CLR. However, .NET also runs on Windows 98, ME, NT 4.0, and 2000. When you run a .NET assembly on the older operating systems, the CLR has to be loaded somehow. This is the job of the CLR loader stub; a section of native code within a .NET assembly. Executing a PE

Exploring Cocoa with MonoMac and C# – Chapter 1 – Getting Started – Part 1

Below, you will find the outline of what you will learn in this chapter:What you need.Getting Setup. Installing MonoMac add-inMonoMac from source.What you need:Readers will need several things to effectively use these tutorial articles: Apple Macintosh: You need an Apple Macintosh to build and deploy an application targeting the Apple Macintosh Desktop using Cocoa. If you do not want to layout

Create your first RESTful service with WCF 3.5

What is REST: read more about REST here  REST is a term coined by Roy Fielding in his Ph.D. dissertation to describe an architecture style of networked systems.  REST is an acronym standing for Representational State Transfer.Problem with SOAP: In particular web scenarios, it is necessary to have high interoperability and to use only XML messages for transmitting over HTTP without the advantage

NHDatabaseScopes

Project DescriptionNHDatabaseScopes is bunch of examples how to effectively do integration testing with NHibernate and embedded database (SQLite and MS SQL Server Compact Edition). It is not meant as production ready library. OverviewExamples in this project were created with two goals in mind: isolation and speed. There is one issue with keeping execution time low enough when doing integration

+1’s: the right recommendations right when you want them—in your search results

Our goal at Google is to get you the most relevant results as quickly as possible. But relevance is about relationships as well as words on webpages. That’s why we recently started to include more information from people you know—stuff they’ve shared on Twitter, Flickr and other sites—in Google search results. Today we’re taking that a step further, enabling you to share recommendations with the

NoSQL explained correctly (finally)

Now here is a definition of “NoSQL” that I can agree with:A very interesting write-up with one little oversight: you’re wrong. I am part of a large program to write a NoSQL database for military applications. It’s not a backlash against paying Oracle (the DoD has a blanket license for Oracle installations) or a philosophical stance by the hippies in the defense arena; it’s the fact that RDBMSs

Cross machine communication between .Net Application using WCF

When service and client both are of .Net and resides on different machines then we choose preconfigured netTcpBinding to publsih WCF Service to the client. netTcpBinding is best suited when both client and service are of .Net and communicating to each other either over Intranet or Internet. Since both the service and client are in .Net, so performance of this binding is very much optimized for

Compiler Internals - How Try/Catch/Throw are Interpreted by the Microsoft Compiler

IntroductionBefore I start with my article, I would like to mention some important things. The most important fact you should always keep in mind is that this article is not (and should not be) a detailed reference on x86 exception handling, but a first introduction on it. While some things probably are not exactly represented as they are done in the real world, the article sheds some light on

Examples of COM Automation in Silverlight 4

IntroductionIn the previous article we talked about COM automation support introduced in Silverlight 4 and we said that COM automation is available only for Silverlight OOB (Out-of-Browser) applications that have Elevated Trust, and that's one of the security restrictions imposed by Silverlight. Today, we're going to talk about COM automation in more details and give few Silverlight examples that

הלוח העברי בעזרת TSQL (2)

לפני כשנה מאיר דודאי ציטט קוד לפונקציה שמחשבת את התאריך של פסח, וגם שאל בקריצה אם טרם יצרתי פונקציה כזו בעצמי. למען האמת יש לי סקריפט פשוט שמחשב את התאריך המדוייק של פסח מיציאת מצרים ועד לביאת המשיח: וברצינות- הפונקציה הנ"ל (ניתן למצוא אותה כאן בצירוף פונקציות נוספות) מתבססת על נוסחה שפיתח גאוס - מתמטיקאי גרמני שהיה אולי גדול המתמטיקאים מאז ומעולם, ואם לא- אז בוודאי בחמישיה הפותחת; ואשר נועדה

Parse XML Documents by XMLDocument and XDocument

IntroductionThis article demonstrates how to parse XML documents using "XMLDocument" as well as "XDocument". Background"XML" and the parsing of XML documents are very old topics and it is not very common for us to directly work on XML documents. But once a while, you may find that you are given some raw XML documents and you need to parse them. This article is to demonstrate how to use the two

C# Convert Generic Type

I am posting this because I didn't see a simple solution on the first few hits when searching the net.If you have a generic class of type T and you want to using it with basic types such as int, long, etc. You can use the following method to do the casting: class myClass{   private int myVal;   public T Get()   {      return ((T)(Convert.ChangeType(myVal, typeof(T))));   } }enum SomeEnum { One

How to install Zimbra Desktop on Ubuntu 10.10 (Maverick)

Zimbra Desktop is the next-generation email and collaboration client.The free Zimbra Desktop client allows you to meld the online and offline worlds – storing and synching your email, calendar, contacts, files and documents in the cloud, yet having them locally accessible when on the road. Zimbra Desktop aggregates information across accounts (Zimbra, Yahoo! Mail, Gmail, Hotmail, etc.) and

How to find startup ideas that make money

I am glad that my previous blog post Sorry, your “cool” webapp is probably not going to make money received good response and generated a lot of debate. What I discussed in that blog post was that most of the so called startups or webapps which are based on “game-changing” or “cool” ideas never end up making any money. So, if your aim is to make money, pursuing such ideas can be risky. While

Symbian OS becomes OpenSource

Symbian OS , Nokia’s popular mobile OS is now opensourced .Nokia , in its blog post recently accounced that it is making its primary Mobile OS – Symbian available for its platform development partners . Th sourcecode of SYmbian is made available at https://collab.symbian.nokia.com/home , a site that is dedicated in providing tools & services to support development on the Symbian operating

Dynamically load embedded assemblies – because ILMerge appeared to be out.

At work, I started building a .net assembly that would probably find its way into a number of the server processes and applications around the shop. This particular assembly was going to end up containing quite a number of external open source references that I didn’t want to expose to the consumer of my library. I set out to solve several simple requirements.Easy to use. Should be nothing more

WCF streaming inside data contracts

In order to support transferring of large messages (e.g., uploading or downloading a large file), WCF added support (since its first version) to streaming message transfer – unlike the default behavior, which is to buffer the entire message prior to sending it to the wire (or delivering it to the application layer, in the receiving end). Buffering has lots of advantages – it is faster, it allows

Способы размещения служб WCF. Часть 3: размещение в среде Windows Process Activations Services

Windows Process Activation Service (WAS)  - это среда, которая управляет активацией и жизненным циклом рабочих процессов, в контексте которых выполняется служба WCF. Модель WAS, в отличии от IIS предоставляет возможность использовать не только протокол HTTP, но и такие протоколы как TCP, Pipes и др. WAS является дополнением к IIS и включена в Windows Server 2008. WAS имеет следующие преимущества:

How Can You Load Test WCF Services?

There are several techniques that have been created to load test WCF Services. These include commercial and open source tools like WCF Load Test available on CodePlex. I have seen several packages over the past few years to perform load testing on web pages and web services including the load testing tools built into Visual Studio. Some were easy to setup, others not so much. WCF Services are

Little-known gems: Atomic conditional removals from ConcurrentDictionary

ConcurrentDictionary, first introduced in .NET 4, is an efficient dictionary data structure that enables thread-safe reading and writing, meaning that multiple threads may all be accessing the dictionary at the same time without corrupting it.  It supports adding through its TryAdd method, conditional updates through its TryUpdate method, non-conditional adds or updates through its

NHibernate Id Generator With Suffix

I had recently the need for using an id generator with two requirements:Is DB-independentAllows data generated in different sites (DBs) to be merged into a centralized DB I already knew about HiLo generator, and it seemed fine, except that the generated ids, on different sites, would most probably clash, unless I would setup a particular configuration leaving lots of room, and would constantly

MySQL tools released by Google

Various tools for managing, maintaining, and improving the performance of MySQL databases, originally written by Google. Libraries:pylib/db.py: Easily execute queries in parallel on a sharded databaseDepends on MySQLdb. Most tools here depend on it.permissions_lib/: Manage MySQL permissions in a Python-based format parser_lib/: Parse SQL and apply rules based on the parsed outputDepends on

C# Threading free book

Free online book about C# multi-threading. Explains just everything from the very begging Why ? Where ? How? and continue to very granular of inter-thread safe locking technics  and multi-process communication.  Including latest classes/samples for .NET Framework 4 Introduction and ConceptsJoin and SleepHow Threading WorksThreads vs ProcessesThreading’s Uses and MisusesCreating and Starting

Minggu, 03 April 2011

How To Find Which Control Raised PostBack

There are times in asp.net when I really want to know which control in the page raised caused the page to post back. An easy way to find this is to register an event with the control that raises PostBack and cast the sender property to the appropriate control as shown below. As shown in the above code I am casting the sender property to the appropriate control to find out which control raised

Google Talk Guru

Google Talk now has a chat bot called Guru that will answer your questions - but don't get too excited for a guru it doesn't understand much and could do better.  Google Talk Guru is a simple bot that lets you ask questions using Google Talk. You can phrase your questions in a fairly natural sort of English and Google's search engine and other servers will attempt to find an answer for you . You

ClickOnce Licensing HTTPHandler

IntroductionI've recently been working on a small application I intended to sell publicly and I was faced with the dilemma of how to deploy it for an individual user. My initial approach was with an MSI but this seemed a bit clumsy, especially around updating, and required me to learn quite a bit about installers that I didn't really care for. ClickOnce seemed like a much simpler alternative so

Cracking Stuxnet - a beginner's guide

Ralph Langner is the German control system security engineer who discovered what the Stuxnet virus was supposed to attack - i.e. the Iranian nuclear program. In a TED Talk he explains how he worked out what the virus was doing and, if you are not a control security specialist, it's quite an eye opener. The Stuxnet Windows worm was discovered in July 2010 and at first it was a mystery. It was

Even more about CPUs: What is CPU Caching?

Well, the slowest steps in the fetch-execute cycle are those that require accessing memory (Englander, 2007). CPU caching is a technique developed to minimize the impact that accessing memory has on the overall processing performance of a CPU. The technique involves placing a small amount (or multiple amounts) of high-speed memory between the CPU and main memory. This memory is referred to as

Little-known gems: Atomic conditional removals from ConcurrentDictionary

ConcurrentDictionary, first introduced in .NET 4, is an efficient dictionary data structure that enables thread-safe reading and writing, meaning that multiple threads may all be accessing the dictionary at the same time without corrupting it.  It supports adding through its TryAdd method, conditional updates through its TryUpdate method, non-conditional adds or updates through its

ASP.NET: Obfuscating the Querystring

Some time ago I answered somebody's post on the MS C# newsgroup. This person was trying to "pass a connection" to another ASP.NET application from a redirect or a link and couldn't figure out how to do it. Of course, you wouldn't be able to pass the connection object itself (nor should you even try) but you could put the connection string to create it on the QueryString, grab it back out in the

More on Cores: Single Core? Dual Core? Quad Core? What's the Difference?

The core of a processor refers its components, along with system memory, that facilitate the fetch-execute cycle by which computers read (fetch) and process (execute) the instructions of programs. Although the physical implementation of a chip depends upon its architecture, all CPUs consist of two logical components: the arithmetic/logic unit (ALU) and the control unit (CU) (Englander, 2003).

Open Window, Dialog or Message Box from a ViewModel – part 2

In my previous post I have shown how to open a Window bound to a view-model triggered by the view, using a simple Action. In this post I'll show how to open a Window, triggered by the view-model. Opening a window directly by the view where the view decides when a Window should be opened, is an incorrect approach since the view shouldn't make that decision. This decision belongs to the Application

C# Adds Duck Typing, Latin keyword

It’s that time of year when I announce another new C# feature: robust duck typing.The C# language team chose a syntax that makes duck typing an opt-in feature, you specify it by using the new ‘duck’ keyword. Compare these two type definitions (note bold text): public class Foo{    public int Compare(Foo right) { ... }}public anatis Foo{    public int Compare(Foo right) { ... }} The first case is

SQL Server: TSQL Script to Get Hard Drives Detail

Recently, I need a script which can provide me detail (Driver Letter, Drive Label, Free Space, Used Space etc) of all installed hard drives. I found following script by G. Rayburn very helpful. Valid for versions: SQL Server 2005 and aboveNote: Before executing script, don't forget to enable Ole Automation Procedures from Surface Area Configuration or using sp_configure. /************************

Deciphering a SOAP fault with a 400 status code

Recently working with a partner I came across a solution for a limitation in WCF error handling.  The root of the issue is a difference between SOAP 1.1 and SOAP 1.2 in the allowed HTTP status codes when a SOAP fault is returned.  For SOAP 1.1, the status code must be 500 “Internal Server Error”.  For SOAP 1.2, it varies based on the type of the SOAP fault.  For env:Sender, the status code is 400

Jumat, 01 April 2011

Permutations in C# Using Recursion

IntroductionRecently, while searching for a method to descramble a string of characters, I came across an article by Alexander Bogomolny, entitled ‘Counting and Listing All Permutations’. The article, from Interactive Mathematics Miscellany and Puzzles, introduces three separate algorithms all capable of generating a list of permutations for a given set of elements. To rewrite a word descrambler

6 steps to implement DUAL security on WCF using User name + SSL

Introduction and Goal Basics Transport and Message level security Step 1:- Customize ‘WsHttp’ Bindings with security mode and credential type Step 2:- Create your custom validator class Step 3:- Define runtime behavior  Step 4:- Define SSL for your WCF service Step 5 :- Consume WCF Service Step 6: Run your WCF service Source codeMy other WCF articles Introduction and Goal In the article we will