Matlus
Internet Technology & Software Engineering

Matlus - Internet Technology & Software Engineering

C# to Html Syntax Highlighter using Roslyn

Ever since Roslyn was announced I’ve had a few ideas about what I’d want to do with Roslyn. Primarily there are two things I’d love to use Roslyn for:
  1. Code generation – Generating code in such a way that I would have more semantic information about the existing code and thus be able to generate code in a “smarter” way.
  2. C# to Html syntax highlighting – There are a few solutions out there but for one reason or another, I’m just not happy with them.
At the time of this writing the Roslyn project does not support attributes or partial methods[...]

Disrupting the World Wide Web - Innovating the World Wide Net

We’ve been in the World Wide Web "phase” for a little over 2 decades. A lot has happened and a lot has changed in this period. This post is not about what has happened but rather what will, or needs to happen next. In my mind it is inevitable and as an entrepreneur or business if you want to stay ahead of the “S” curve, this is the time to get cracking. The World Wide Net is about getting out of and beyond the box. But first let me level-set a couple of terms for this discussion[...]

WCF 4.0 Getting Started

In this post we'll be looking at build a simple WCF client and WCF service application. You'll be up and running in no time guaranteed. In WCF 4.0 (in contrast to earlier versions), things have gotten a lot easier in as far a configuration is concerned. WCF 4.0 stresses convention over configuration. So we'll first get our client and service up and running using conventions (no configuration at all) and then we'll take a look at how we would configure things if we need to. But rather than using the config file we'll programmatically configure things[...]

ASP.NET Response.Redirect Performance Issue

This is a short post and I'm writing this because I've seen a lot of people using or and not using the overloads:
So rather than repeat the same thing over and over, I've decided to write a blog post about it in the hopes that others may find it and learn from it[...]

HttpWebRequest - Asynchronous Programming Model/Task.Factory.FromAsyc

The Asynchronous Programming Model (or APM) has been around since .NET 1.1 and is still (as of .NET 4.0) the best/recommended solution for asynchronous I/O. Many people go down the route of using a multi-threaded approach to try get speedup when the workload is I/O bound. Using multiple threads to do I/O bound tasks such as Disk I/O and Network I/O, won't (in most cases) give you any speed up and in fact could end up hurting performance. If the workload is compute bound (rather than I/O bound) then it makes complete sense to use multiple threads (provided you have multiple cores and the work is fairly long running and so justifies the overhead of spawning and managing multiple threads), as discussed in this post [...]

Linq - SelectMany

The linq SelectMany method is probably one of the most powerful method on the Enumerable class but sadly also of of the most difficult to understand. As per the the MSDN documentation for Enumerable.SelectMany, this method is described as:
Projects each element of a sequence to an IEnumerable<T> and flattens the resulting sequences into one sequence
[...]

Data Parallel – Parallel Programming in C#/.NET

In .NET 4.0 Microsoft have introduced a slew of support for parallel programming. Parallel programming is not something you can ignore any more since CPUs are not getting any faster but instead the number of cores per CPU is increasing and unless we as software engineers begin to use all cores available on a given machine our software is not going to get any faster. There was a time when multiple CPUs were only available on servers and server side application platforms such as IIS are inherently multi-threaded so if we were building an ISAPI or ASP[...]

Getting the No Of CPUs and Cores

Using WMI (Windows Management Instrumentation) it is really simple to get the all kinds of weird and useful information about the hardware of a computer. Here I use from the assembly/namespace to get at information on the CPU. In particular:
  • No of Cores
  • No of Logical Processors
  • No of Physical Processors
  • Hardware Bitness (32/64 bit etc.)
  • CPU Architecture (x86, x64, Itanium etc.)
Categorized Under:  
Tagged With:   

Code Gem: Snippets 

Posted on

IAsyncResult–Making Existing methods Asnchronous

The APM or Asynchronous programming model has been in .NET since the beginning. There are quite a few BCL classes that use this programming model to effectively provide asynchronous methods to methods that also have synchronous counterparts. But what if you want to make one of your existing methods asynchronous? In this post I show you how simple it is to make an existing synchronous method available as an asynchronous method. Before we go down that route, let me say that I assume you're somewhat familiar with using asynchronous methods[...]

Stop/Start Windows Service

There are two code snippets presented in this post. Both of them deal with starting and stopping Windows Services. One option is to use the command line option via C# and so as to make the usage of this code more object oriented while the other option is to use the class that's part of the .NET framework. Nothing spectacular really, but the purpose of me posting these code snippets is so its out there for those who are trying to figure this out and for me if/when I need to do this kind of thing again[...]

MSSQL–Reset Identity seed

There are times when I need to reset the identity seed value for tables with identity columns. Its rare that I need to do this and so this post is really a "note to self" if you will. But maybe others might find it handy as well:     Change 'sometable' to the name of your table. If you need to set the seed value to something other than zero, change the last parameter in the call from 0 to what you need[...]

Linq Group By - Finding Duplicates

This post is a little snippet on using Linq to find duplicates in a list of objects where a specific property of the object is used to find the duplicates. In this particular example, the objects are and in addition to other properties each lesson has a property and what we need to do is find all lessons where the is a duplicate of another lesson. In order to solve this we use and we group by the [...]

svcTraceViewer - Debugging WCF Sevices

This is a quick post about Debugging WCF Services and using svcTraceViewer. I'm writing this because I spent over half an hour trying to figure out what was wrong with one of my WCF services and then another half hour trying to figure out where to find svcTraceViewer. Once I figured out all of this the error happened to be really simple (the class I was trying to serialize was not marked with the attribute! If I were doing the same thing in ASP.NET or Quartz I would have seen the exception the first time and fixed it in the next second[...]

Fastest Website on the Planet!

During the design and development of Quartz for ASP.NET and Orion, performance was an extremely important area I focused on. Optimizing a framework such as Quartz for ASP.NET is important because other websites and application will be built using it and I believe it is imperative that frameworks pay close attention to performance[...]

Orion - A Blog Engine

Orion is a high performance blogging engine written using the Quartz for ASP.NET framework. This blog is now powered by the Orion engine, so what you see by way of features, function and speed (responsiveness) is what you get with the Orion engine and of course the Quartz for ASP.NET framework. I was initially using WordPress for my blog (this blog) and eventually just got tired of having to deal with some of the nuances of WordPress and more specifically the theme I was using[...]

Data Access Layer CodeGen

In an earlier article (DataReader Wrappers – Type Safe) I talked about using a DbDataReader wrapper class that allowed you to use a DbDataReader in a strongly typed way giving you the following additional benefit: The ability to use a DbDataReader as an IEnumerable<T>, giving is a performance advantage over other options because there is only ever one instance of the wrapper class created no matter how many records you've got[...]

OAuth C# Library

OAuth is a security protocol that enables a user to grant a third-party access to her web resources without sharing her password. OAuth 1.0 was published in December 2007 and quickly become the industry standard for web-based access delegation. Then in June 2008 a minor revision (OAuth 1.0 Revision A) was published, which fixed a security hole in the previous specification. OAuth 1[...]
Quartz
for
ASP.NET

Posted on 10th November, 2010

by Shiv Kumar

Categorized Under: Programming/ASP.NET

Tagged With: MVC Performance Quartz for ASP.NET

MetaWeblog
API
C#
Library

Posted on 12th January, 2011

by Shiv Kumar

Categorized Under: Programming/ASP.NET

Tagged With: Orion Quartz for ASP.NET

Data Access
Layer
CodeGen

Posted on 19th December, 2010

by Shiv Kumar

Categorized Under: Programming/C#

Tagged With: ADO.NET CodeGen Data Access DbDataReader Performance

OAuth
Library
C#

Posted on 6th December, 2010

by Shiv Kumar

Categorized Under: Programming/C#

Tagged With: Federated Identity OAuth Open Id

High
Performance
Class Factory

Posted on 23rd November, 2010

by Shiv Kumar

Categorized Under: Programming/C#

Tagged With: Design Pattern Factory Performance

ChangeType<T>
Changing the
type of a variable
in C#

Posted on 8th November, 2010

by Shiv Kumar

Categorized Under: Programming/C#

Tagged With: Change Type TypeConverter

Razor
Engine
Host

Posted on 5th November, 2010

by Shiv Kumar

Categorized Under: Programming/C#

Tagged With: CodeGen Razor Razor Host Templating Engine

Problems
with
ASP.NET MVC
Framework
Design

Posted on 27th October, 2010

by Shiv Kumar

Categorized Under: Programming/ASP.NET

Tagged With: Design Pattern Framework Design MVC MVC3

ASP.NET MVC3
Razor
View
Engine

Posted on 4th October, 2010

by Shiv Kumar

Categorized Under: Programming/ASP.NET

Tagged With: MVC3 Razor

Html5
File Upload
with
Progress

Posted on 25th September, 2010

by Shiv Kumar

Categorized Under: Html 5/File Upload

Tagged With: File API File Upload XMLHttpRequest