.net

Appending to a compressed file using GZipStream

Hi guys, I'm trying to use GZipStream to write some application traces (they tend to grow to huge sizes in production). So in this case i need the ability to open an existing file and append to it using GZipStream. All things seem to work well until we try to decompress the file. It seems that on decompression GZipStream reads only the ...

WCF HttpTransport: streamed vs buffered TransferMode

I have a self-hosted WCF service (v4 framework) that is exposed through a HttpTransport-based custom binding. The binding uses a custom MessageEncoder that is pretty much a BinaryMessageEncoder with the addition of gzip compression functionality. A Silverlight and a Windows client consume the web service. Problem: in some cases the ser...

vcl.net to delphi prism

i have some vcl.net apps(delphi 2006 , .net 1.1 ) and i like to port them to delphi.net 2007 . but i like to port it to delphi prism as it has mono support so i can port it on liux and support to latest .net framework(but i know mono supports full .net 1.1),as prism is completely new and vcl is deprecated how to upgrade my app to prism. ...

Performance differences between debug and release builds

i must admit, that usually I haven't bothered swithcing between the Debug and Release configurations in my program, and I have usually opted to go for the Debug configuration, even when the programs are actually deployed at the customers place. As far as I know, the only difference between these configurations if you don't change it man...

Can we initialize an object/collection using LINQ in JSON-like syntax?

Can we do something like this or something similar? var staffs = { "Staff": [ { "ID" : 1, "Name" : "John" }, { "ID" : 2, "Name" : "Mark"} ] }; foreach (var staff in staffs) { Console.WriteLine("ID: {0}", staff.ID); Console.WriteLine("Name:...

Deploying app to production using Debug Mode rather than Release Mode?

I work for a shop that maintains a fairly new app. The app still has its fair share of bugs, with numerous tickets coming in daily. The error information we're given with those tickets is not as useful as it might be because the application was compiled in Release mode, which I read is smaller and faster (makes sense). Are there any r...

VS created MSI installer uninstall issue

I created my msi installer by using VS2008. I have some temp files need to be deleted and want to avoid the auto-repair nightmare. I got two options from experts here and other forum. One of them is set the temp file's ComponentId to null (No other changes). It works but causes another issue. The issue is the uninstall process will not d...

log4net EventLogAppender on windows 7 problems

Hello I have problem with EventLogAppender on the Windows7. Code for config EventLogAppender is: var elAppender = new EventLogAppender { ApplicationName = "MyLog", LogName = "MyLog", Layout = new PatternLayout(default_format), Threshold = Level.Error ...

Regular expression in C# , is this possible?

I never use regular expression before and plan to use it to solve my problem but not quite sure whether it can help me. I have a situation where I need store a rule or formula to build string values like following examples in a database field then retrieve this rule and build the string value. FacilityCode + Left(ModelNO,2) Right(PO,3...

How to find a point that is on the same circle given an angle?

I have the following setting: I know P1, P2 and the angle alpha, now how do i calculate the coordinates of P3? (Note: P3 is on the same circle with origin P1 and radius P1P2) The blue lines indicate the coordinate system ...

Reg Ex negation not working in XML string

I am trying to apply negation on regular expression in .Net. It does not work. When string has valid last name reg ex should not match. For invalid last name it should match. Valid name allows only charecters, spaces, single quote and length between 1-40. Somebody suggested to parse the XML, I don't want to do that. I know there is anoth...

C# Control at Mouse Location Outside of the Application

Is it possible to get a control at the current mouse location if its in a window not known by the application? (not in Application.OpenForms) I implemented a low level mouse hook which can get the mouse location anywhere on the screen, but I can't seem to access controls outside of my application. What I want to be able to do is get ...

MSMQ Messages Are Stuck In The Outgoing Queue

Although my question looks similar to some already found on SO, those post did not help me, so here it is: Given: Two machines on the same segment (naturally in the same domain, actually on the same desk) Both machines are Windows 7 workstations Both machines have disabled firewall Both machines see each other (ping works) There is a ...

Is it possible to define a custom tracking mechanism with the Microsoft sync framework?

I am currently evaluating the Microsoft sync framework as a possible solution to sync data between two SQL databases. The examples I have seen so far rely on "tracking tables" containing the information used to track changes to be synced, with triggers on the main tables to keep them up to date. My database already contains lots of this...

How to stop exception alerts from going bezerk

Let's say you have a .NET system that needs to send out email notifications to a system administrator when there's an error. Example: try { //do something mission critical } catch(Exception ex) { //send ex to the system administrator //give the customer a user-friendly explanation } This block of code gets called hundred...

.NET Memory Consumption Question

Does either of these methods use more memory than the other or put a larger load on GC? Option #1 LargeObject GetObject() { return new LargeObject(); } Option #2 LargeObject GetObject() { LargeObject result = new LargeObject(); return result; } ...

LINQ performance FAQ

I am trying to get to grips with LINQ. The thing that bothers me most is that even as I understand the syntax better, I don't want to unwittingly sacrifice performance for expressiveness. Are they any good centralized repositories of information or books for 'Effective LINQ' ? Failing that, what is your own personal favourite high-p...

.Net: Try...Catch paranoia - where does it end?

I think I have something like "programmer's OCD". I like my code to be esthetical and clean, and I want it to be "perfect" (as in handling all possible situations correctly and pretty). Often I find myself spending a lot of time just going over the same areas again and again to see where I can optimize and where I can fool-proof. So whe...

XmlSchema object from an XML file with inlined Xsd

Hi, In .Net, I'm trying to get a XmlSchema object from Xml file with an embedded Xsd and can not find out how to do it? anybody know? For example if it just an Xml file I can Infer Schema using the XmlSchemaInference class or if its a Xsd I can use XmlSchema class, but can not find away with inlined Xsd. example file is at http://past...

Where is WebResource.axd

Hi, I am looking for the file WebResource.axd (to see its source code) but I dont find it. Does someone know where can I find it ? Thanks. ...