.net

How to serialize a derived class in Silverlight

I created a custom control in XAML, and added some custom properties as well. Now, I want to serialize it to JSON if possible. Here is (essentially) what I have: public partial class MyCustomClass : UserControl { public Dictionary<char, int[]> ValueMap; public int Value { get; set; } } And in the code that handles serializatio...

Good zlib implementation in .NET?

I'm building an network application that needs to be able to switch from normal network traffic to a zlib compressed stream, mid stream. My thoughts on the matter involve boolean switch that when on will cause the network code to pass all the data through a class that I can feed IEnumerable<byte> into, and then pull out the decompressed ...

C# Julian Date Parser

I have a cell in a spreadsheet that is a date object in Excel but becomes a double (something like 39820.0 for 1/7/2009) when it comes out of C1's xls class. I read this is a Julian date format. Can someone tell me how to parse it back into a DateTime in C#? Update: It looks like I might not have a Julian date, but instead the number ...

How to open a file for non-exclusive write access using .NET

Is it possible to open a file in .NET with non exclusive write access? If so, how? My hope is to have two or more processes write to the same file at the same time. Edit: Here is the context of this question: I am writing a simple logging HTTPModule for IIS. Since applications running in different app pools run as distinct processes, I ...

How would a php or java client authenticate if I'm using WCF w/ forms auth?

I have a generic proof of concept WCF service that is using forms authentication to secure access. All works great when my client is .NET (vb code below) Dim client As SupplierServiceClient = New SupplierServiceClient() client.ClientCredentials.UserName.UserName = "[email protected]" client.ClientCredentials.UserName.Password = "password"...

How does RegexOptions.Compiled work?

What is going on behind the scenes when you mark a regular expression as one to be compiled? How does this compare/is different from a cached regular expression? Using this information, how do you determine when the cost of computation is negligible compared to the performance increase? ...

ISAPI Rewrite 3 rule syntax

I'm installing ISAPI Rewrite 3. I'd like to do the following with it: The box serving HTTP documents with ISAPI Rewrite 3 has a hypothetical URL of http://www.foo.com. I want a rule that will point http://www.foo.com/blog to http://blog.foo.com. I don't want a physical redirection. I prefer a proxy so that it doesn't look like we're ev...

Why use Windows Workflow?

What is the benefit of using Windows Workflow foundation (WF) versus rolling your own workflow framework? From what I can tell, WF only provides a pretty bare-bones runtime engine, a bunch of classes, and a schema (XAML-based) for defining workflows. All the hard stuff such as persistence, providing a host process for the runtime, and ...

ASP.NET MVC - MapRoute versus routes.Add (and 404s)

I'm just getting started with ASP.NET MVC. What is the difference between MapRoute and routes.Add ? Should I just be using MapRoute? Can I map multiple routes? Which "maps" take precedence... those you called first or last? I'd like to be able to do something similiar to the StackOverflow does for users. But I would like the URL to fit...

Wpf -how do i listen to window resizing?

I've got a windows forms map in a WindowsFormsHost, and I need it to resize with the window. I'm just not sure what event to listen to, to do this. I need the map to only resize once the mouse is up, otherwise it lags out, and tries drawing itself a million times when you resize a window really slowly. ...

How to convert this sequence to this hash?

Hi there, I'm consuming a webservice from my application in C# .net (2.0) that return values (as string) like this: %23k.%0d%16%c4%8a%18%efG%28%b9c%12%b7%f1%e2%e7j%93 I know that the real value for that is: 236B2E0D16C48A18EF4728B96312B7F1E2E76A93 But I don't know how to convert from the returned value to the real value. Any thou...

A more efficient Regex or alternative?

I have a file with a little over a million lines. {<uri::rdfserver#null> <uri::d41d8cd98f00b204e9800998ecf8427e> <uri::TickerDailyPriceVolume> "693702"^^<xsd:long>} {<uri::rdfserver#null> <uri::d41d8cd98f00b204e9800998ecf8427e> <uri::TickerDailyPriceId> <uri::20fb8f7d-30ef-dd11-a78d-001f29e570a8>} Each line is a statement. struct S...

How to repeat the same ASP.NET MVC action again?

I have an action called List that shows the results of a search. It receives parameters through the querystring because they are optional. My method signature looks like this: public ActionResult List(List<int> categoryIDs, string school, int? stateID, int? page) CategoryIDs is a multi-select box and I am doing everything over a GET r...

ASP.NET MVC - Response.Write code - put it in the Controller, SingleFile or CodeBehind

If you are going to be generating a page as a string and outputting all the content via Response.Write at the last minute where should you put this code? I need to be able to dynamically write a bunch of JavaScript to the client to use some of the new Google visualization jsapi. I noticed this last release of the MVC framework "discour...

"Remember me" with ASP.NET MVC Authentication is not working

I have a standard ASP.NET MVC (RC Refresh) web project, with the standard ASP.NET Membership provider and the Account controller that is included in the project template. When I check "Remember me" in my Login form, I am still not being remembered by the site. (Firefox remembers my username and password, but what I expected to happen wa...

.NET: How to load an image into an ImageList?

i have an image that contains a series of images, e.g.: In the olden days, i would load the image into the ImageList common control using such API calls as: ImageList_Add ImageList_LoadImage IImageList::Add What is the .NET method of achieving the same result with the .NET ImageList class? Note: The image is only an example. My...

Is it possible to send more than one model object to an ASP.NET MVC View?

On my start page, I'd like to display the first items from several different lists that i have on other pages - somewhat like the "recent" page here on SO displays both recent posts and recent comments. In my case I want to list the two most recent posts in a guest book, and the next upcoming event. In order to do this, how can I pass ...

Anyone have any cool code snippets

Code snippets are a pretty underused feature in Visaul Studio and it can really save you alot of time. What custom code snippets do you guys use in your everyday coding? Let me list some of mine: vprop - view state property ane - argument null exception event - definition for an event handler noe - expands into String.IsNullOrEmpty(...

How to get enterprise level programming experience?

Any suggestions on gaining experience? Or where could I see an example (instructions, code, database schema, etc) of an enterprise level application? Oh, and make it .NET. I want to get experience writing enterprise level programming, but do not work at a company that has other developers or projects at this level. This term gets thro...

Parse filter expression using RegEx

I have a query filter written in human readable language. I need to parse it and convert to the SQL where clause. Examples are: CustomerName Starts With 'J' becomes CustomerName LIKE 'J%' and CustomerName Includes 'Smi' becomes CustomerName LIKE '%Smi%' The full expression to be parsed may be much more complicated such as C...