InternetException

Posts

Expression parsing and nested properties

· 729 words · ~3 min read · updated · in .NET, C#

In one of projects I was working on, I needed to get property value from property path and property path from expression. First, lets cover second case. With expression in form of nested property value:

()=>object1.object2.object3.object4

we cannot take simple value of some property, because we have only root object, object1.

Read the whole thing →

WebSocket libraries comparison

· 1786 words · ~8 min read · updated · in .NET

#WebSocket #async #ASP.NET MVC #NuGet

Web project often requires to push data to clients as fast as possible, whenever it is necessary without waiting for client request. It is perfect for website with real time communication between users, like with online communicators for example. Or document collaboration tools. Or maybe system status updates on long running calculation/tasks performed by server. In every case two way communication mechanism is ideal.

Read the whole thing →

Ninject and WCF

· 817 words · ~4 min read · updated · in .NET, ASP.NET

#Ninject #WCF #API design

Ninject is very simple and in the same time powerful IoC container. I used it in few project and had very little or none problems. Most of the time getting instances from Ninject kernel requires simple line with binding expression, or even this is sometime unnecessary if type is self bind able (i.e. if it is concrete class with parameterless constructor). Little harder is getting Ninject to work with WCF. You cannot just bind interfaces types because proxies which implements them are created through .NET mechanism. Luckily WCF system is very flexible and mostly can be changed/extended with custom functionality.

Read the whole thing →

Entity Framework and Base Entity class

· 906 words · ~4 min read · updated · in .NET, Entity Framework

#AutoMapper

Entity Framework does great job with taking care of entities changes and entities collection internally. And its uses almost plain POCO objects. Almost because collections of dependents data like in 1 to many tables relationship needs virtual keyword. Its understandable since EF needs to track what happens to collection. For instance lets have 2 tables: Customer and dependent Order.

Read the whole thing →

Ninject and Entity Framework

· 730 words · ~3 min read · updated · in .NET, C#, Entity Framework

#Ninject

Last time I wrote about problem with testing Entity Framework in Visual Studio 2012. During working on this project I also encounter problems with configuration of Ninject to allow injecting Entity Framework classes from its Patterns extension. To be frankly this was not much a problem then lack of documentation. I just was forced to experiment with Ninject and new-thing-for-me Entity Framework Patterns extension.

Read the whole thing →

Entity Framework Patterns extension and Unit Test in Visual Studio 2012

· 646 words · ~3 min read · updated · in Entity Framework, Visual Studio

#Unit tests #reflection #NuGet #Ninject

Yesterday I was trying to make work simple test class in VS2012. I did not know what was wrong exactly. It was first project when I tried to glue together Entity Framework with repository pattern and Ninject as IoC container. Because of the fact that this was first time for solution like that I was sure that it is me, or rather source of my problem was indeed my code. But let’s not skip ahead.

Read the whole thing →

Line in WebGL and why you gonna do this on your own.

· 842 words · ~4 min read · updated · in HTML5, JavaScript

#canvas

WebGL as method for generating 3D graphic in browser and it is pretty powerful. You can do really awesome things with this, like porting Quake 2 to JavaScript or creating model of human body . But all of this 3D object are complex collection of hundreds or thousands triangles. What if you just want to draw a simple thin line? Luckily OpenES have support for that. So it is possible. Lets see how to do that.

Read the whole thing →

Cartezian coordinate system in HTML 5 canvas

· 135 words · ~1 min read · updated · in HTML5

#canvas

Normally canvas 2D context is using custom coordinate transform where Y coordinates are flipped vertically. Here is image with example (taken from http://diveintohtml5.info/canvas.html ; it is great book and you should read it :) ) It is a bit inconvenient to use if you are drawing some shapes with points given in classic Cartezian coordinate system.

Read the whole thing →

Simple 2D graphs

· 773 words · ~3 min read · updated · in HTML5, JavaScript

#canvas

While writing application for my Masters Degree diploma I was required to came up with simple library for creating simple 2D graphs in the browser. Today I decided to share it with the rest of the world :)

Read the whole thing →

Curious Case of Visual Studio project compatibility.

· 320 words · ~1 min read · updated · in .NET, Visual Studio

Recently I was asked at work for quick review of small project. It was created (or updated) in newest version of Visual Studio - 2012. I don’t have installed VS 2012. I could install it, yes, but it would be just waste of time since browsing through code in that project took me only few hours. So I decided to try to open that in VS 2010.

Read the whole thing →

Why I don't like Python anymore.

· 1551 words · ~7 min read · updated · in Python

It was few years back on my first year of studies, when my friend told me about Python. Then it was great for me. One-liners could read ftp folders, web pages, interact with operation system, list comprehension, injecting code into life programs, nested functions, procedural as object oriented programming styles etc. etc. All of this in builtin libraries with simple but yet quite functional editor, supported with great documentation. I wrote my first studies project in Python and I was proud with it a little ;) During next years I was using Python for writing simple scripts to automate my professional work as PHP programmer. Python was and I still think is better language then PHP. After that I started to work as .NET/C# developer. It has different syntax but C similarities let me to learn it quite quick. Framework .NET is powerful tool also so I didn’t touch Python for 2 or 3 years at least for anything longer then few lines.

Read the whole thing →

Using Matlab from C# application.

· 1606 words · ~8 min read · updated · in .NET, C#, Matlab

While writing an application for my Masters degree diploma, I wrote a simple application that was using COM Matlab server. I have found it hard to use it mainly due to lack of documentation, which is really basic with only few code examples for C#. I guess writing programs that use Matlab for calculating is not encouraged by MathWorks, you would became competition that way :) Nonetheless, I accomplished why I was required to do, so I decided to share this with the rest of the world.

Read the whole thing →

Server controls in separete assembly part 2

· 795 words · ~3 min read · updated · in .NET, ASP.NET, C#

Yesterday I was writing about creating server controls in separate assembly . Today I will cover more complicated example then simple “Hello World!” control. My goal was to create text box that will take handler method to run when validation event will be triggered, and when validation fail will show appropriate message. Text box with builtin validation would be nice, since you always should validate user input , right? But lets start creating our control.

Read the whole thing →

Server controls in separate assembly

· 394 words · ~1 min read · updated · in .NET, ASP.NET, C#

In my project I wanted to create text box control with builtin configurable validation. ASP.NET definition in .aspx or .ascx file would get validation function by name. But I do not wanted to create just .ascx file with text box. I could not then reuse that control in other projects and it certainly would be nice, right? Creating such server control from code is not hard, but maintainability of HTML code in C# (it cannot be done other way) is not good. It’s pain really. Why Microsoft would create way to automatically create C# code from .ascx, .aspx files is mystery for me.

Read the whole thing →