.net

Active code in XAML properties

I have a situation where I want UIElement to have a top margin of ((this.height / 2) - 70) Currently, the XAML property is Margin="0, 40, 0, 0" How can I combine the equation above into my XAML? I know this is probably simple, but I can't figure out what terms to search for. ...

real time network usage statistics monitoring/capture?

Hi, I would appreciate any advice from experience from the community regarding the following challenge I've given myself - i.e. any pointers re best approach / direction here? Requirements Allow collection / real-time-monitoring of network usage from a users Windows PC to a specific set of IP addresses (or DNS names), on a per applic...

XML Serialize instead of JSON in .NET

Is there a way to fill out a class using XML data instead of JSON? Example in marc's excellent answer. I would like everything to be as close to that code except the input is an xml file instead of json. ...

Spring.net + NHibernate + .net MVC : Spring.Objects.Factory.UnsatisfiedDependencyException

With Sqllite provider,it works. But with sybase provider,it thows exception. Exception: Error thrown by a dependency of object 'SybaseAse-12' defined in 'assembly [Spring.Data, Version=1.3.0.20349, Culture=neutral, PublicKeyToken=65e474d141e25e07], resource [Spring.Data.Common.dbproviders.xml] line 1436' : Unsatisfied dependency ...

Structure is an value type, Then why don't compiler gives any error when string is declared within struct.

Why below written code doesn't gives error even when string is a reference type. public struct example { public int a; public string name; }; public void usestruct() { example objExample= new example(); MessageBox.Show(objExample.name); } EDIT Modifying Jon Answer, I have few more Questions. public struct Example ...

Can we use Open XML format for office 2003 files?

Hi, I want to read MS word files which were created using older office tool (office 2000 or office 2003). Currently I am using Office.Interop API with C#, but this API is slow and buggy. It throws COM exceptions which are somewhat difficult to handle. Recently (today morning ;) ) I came to know about Open XML format for working on offi...

Framework change causes exception: Cannot marshal '': Invalid managed/unmanaged type combination ... ?

From my managed code (let's call it MyLib) I am using a library (let's call it OtherLib) that is basically a wrapper around some c++ code (I have never seen the wrapper code or have had access to its source, nor will I have it). When my calling library is targetting the 3.5 framework all is good and dandy. When I make it target .NET 4.0...

How can we pass class instances to view ?

Hello Everybody I just wonder that can we pass any type of class instances to view which is not exist in our Model repository.for example i just want to show property values of any class instance which exist in .net framework such as List, ListArray and others. Edit: Question is edited cause misunderstanding possibility. ...

How do I create a file AND any folders, if the folders don't exist?

Hi folks, imagine i wish to create (or overwrite) the following file :- C:\Temp\Bar\Foo\Test.txt Using the File.Create(..) method, this can do it. BUT, if i don't have either one of the following folders (from that example path, above) Temp Bar Foo then i get an DirectoryNotFoundException thrown. So .. given a path, how can we re...

Type test in F# on sequences, general equality test

Hello, I am trying to test equality of two elements. Why do I get the error: "does not have any proper subtypes and cannot be used as the source of a type test or runtime coercion", in the first pattern match: let eq a b = match (a,b) with | :? (seq<_>*seq<_>) -> Seq.map2( fun xA xB -> xA=xB ) a b ...

Exit code from Windows Forms app

How do i return a non-zero exit code from a Windows Forms application. Application.Exit() is the preferred way to exit the application, but there is no exit code argument. I know about Environment.Exit(), but that is not a nice way to close the application loop.... ...

Generate many combinations of numbers based on...

Hey All, I was just wondering if there's a way to generate many different combinations of numbers and letters, based off of just one number/letter? For example: From just this one String: 234jk43fc7898cfg58 We could generate MANY different combos like: HGYTD786Gjhghjg76fghf8 8976sgh8976 cv34905bv7 435bv4875bvg487bv 45b6467ne456n 4n5...

ASP.NET - Local & Production Servers - Control ID Difference

Hi All I am having this problem. Locally everything is working fine. Once I upload the published version on production the IDs of all elements will have a different prefix. I know that the prefix is caused by using master pages, but why it is different from local to production? See Image ...

Which .net charting library should I use?

I would like to draw a realtime chart on a WindowsForm. My platform is the .Net Framework 3.5. What the library should offer: Free as in beer The results should be pretty... (My standards for pretty are rather low though) a HeatMap type of chart would be a big plus possibly a lot of data - we are talking about several hundred n...

How to encrypt data in sql server and decrypt it in .net apps

I want to encrypt some passwords in sql server and have a c# app decrypt them. Obviously I can create an SP to decrypt the required password for me and pass this to the c# app, but this means sending the plaintext password over network. So I want to be able to encrypt my password in sql server (using passphrase, certificate etc), w...

Free iPhone like controls for .NET CF

Hello Everyone, I'm developing a mobile project that I really want to look good. I love the way the iPhone controls look and I'm wondering if anyone knows of any free UI components that can help me make my app look more like the iPhone? Specifically, I'm really wanting a GREAT looking listbox. Any ideas? Thanks! ...

Best way to handle .NET json [1,2,"three"]

-edit- Maybe there is a solution by using attributes? I found the weirdest json. It looks like the string below. The only way i can think of to handle it is to use an object array. I never seen ints and strings mixed in an array below. I am then forced to typecast. Is there a better way to get the ints and string? NOTE: The first arra...

findall in List<T>

I can't find any FindAll method in my List, how can i select objects from the List that respond to a specific criteria, without using the old iterating method? List<oPage> mylist = new List<oPage>(); my oPage class has a property called Title of type string. I added a few items of oPage inside myList. now i want to select all items ...

Trying to anticipate behaviour of .NET TcpClient.GetStream() regarding ephemeral port usage in multithreaded environment

Hi, I'm wondering if anyone has experience of this... I'm in the process of multithreading a currently serial process that makes request via a .NET TCPClient to a remote server. We know connect to the remote server on the same port via multiple threads, as we have several instances of the serial processing application running connecti...

Can Reactive Extensions (Rx) be used across machine boundaries?

Vaguely remember seeing some discussions on this quite a while back but haven't heard anything since. So basically are you able to subscribe to an IObservable on a remote machine? ...