.net

Problems when deploying small .NET 3.5 apps

I wrote some small apps using .NET 3.5 but now I am stuck with deployment problems. My customer will likely to be pissed off when he learns that he will have to download a 231megs dependency (.NET framework 3.5) which installs for 30 minutes (!!!) on an average machine. All, just to run my tiny apps. Offline distribution is also problem...

Looking for a simple scripting language that can integrate with .NET easily.

We have a number of electronic test technicians with next to no programming experience. I would like a scripting language that is easy to learn with simple forgiving syntax that can integrate with .NET and invoke exposed static or singleton instance methods easily. What scripting language can meet these requirements? Note: Perl is elim...

Which is the best way to improve memory usage when you collect a large data set before processing it? (.NET)

When I have to get GBs of data, save it on a collection and process it, I have memory overflows. So instead of: public class Program { public IEnumerable<SomeClass> GetObjects() { var list = new List<SomeClass>(); while( // get implementation list.Add(object); } return list; ...

How to Get the length of a TypeCode

I'm sure this is an easy question, but I don't have an answer for. Here's the senario and the question. I have an array that was stored using in a particular format. The format contains a Header record with muntiple detail records following it. The header of the record tells me what TypeCode was used to store the data, for instance I...

how to make transparent background with freeimage?

I use freeimage.net in my web project. I rotate a picture(.jpg) with RotateClassic function,but after that the background is black. How to make it transparent? thanks for any help. ...

How to prevent memory overflow when using an IEnumerable<T> and Linq-To-Sql?

This question is related to a previous question of mine That's my current code IEnumerable<Shape> Get() { while(//get implementation yield return new Shape(//... } void Insert() { var actual = Get(); using (var db = new DataClassesDataContext()) { db.Shapes.InsertAllOnSubmit(actual); ...

Which is better, and when: using statement or calling Dispose() on an IDisposable in C#?

Suppose I have the following: using(var ctx = DataContextFactory.Create(0)) { ... Some code ... } Why not just do the following and lose a couple of curly braces?: var ctx = DataContextFactory.Create(0); ctx.Dispose(); Thanks for the advice! ...

VB.NET language and Nothing : why is it the way it is ?

This is a question about the VB.NET language. Since I am using it every day, I just try to understand the motivations behind some of its constructs. I just find out that this line : If myObject Is Nothing then is as correct as this one is : If Nothing Is myObject Then Same results. Using ildasm, we can see that these lines are tra...

Can a call to WaitHandle.SignalAndWait be ignored for performance profiling purposes?

I just downloaded the trial version of ANTS Performance Profiler from Red Gate and am investigating some of my team's code. Immediately I notice that there's a particular section of code that ANTS is reporting as eating up to 99% CPU time. I am completely unfamiliar with ANTS or performance profiling in general (that is, aside from self...

Where is the right place to re-initialize variables in a loop?

Which is the right approach and why? string initializeme = string.Empty; StringBuilder AppendToMe = new StringBuilder(); for(int i=0; i < 10; i++) { initializeme = string.Empty; //Is this the right place to initialize? if(expressionThatEvalsTrue) initializeme = SomeMethodReturningString(); if(!string.IsNullOrEmpty(i...

.net How to measure time taken to download just the httpPost body excluding httpPost headers and upload data

One HTTP POST request/response transaction consists of Upload Request Ηeaders Upload Request Βody Download Response Headers Download Response Body I'm looking in .net to measure the time it takes for no 4 above (response body) alone. Is there an event sink or clever use of .net api (marking that the POST headers...

Generating Invoices

I need to generate invoices in large batch which will be transformed to EDI and transported to our HQ. There is an order table with all the orders coming in. At some point in the day I have to grab a set (about 1k) and generate the invoices. Where would be the best place to generate the invoice numbers? On SQL Server backend? Or grab ...

I need a scripting language that can be hosted by a .net application with the following features.

I need to be able to expose "commands" that make calls to the host. I need to have simple easy to read syntax. It needs to be easy to pick up by non-programmers. An example would be as follows: Host Application: ScriptHost.AddCommandBinding("MyCommand", delegateToMyHandler, parameterDefinitionsStruct); Script returnval = MyComma...

Process.Start() and the Process Tree

How can I use Process.Start(), but have the launched process not in the same process tree as the launching process? Consider this sample console application: using System; using System.Diagnostics; using System.Threading; internal class Program { private static void Main(string[] args) { Console.WriteLine("Starting ie....

How do get clean URLs like Stackoverflow?

On some .NET driven sites URLs don't end with asp.net page names, like default.aspx, instead they use a pattern http://sitename.com or http://sitename.com/subdirectory/subdirectory. The site is mapped as sub directories off the root, ie. /tags, /users, /badges, the URLs would be /tags, /users, /badges respectively. StackOverflow, to use...

SharePoint features: How can I use wildcard assembly versioning?

I think this is likely to be a generic .NET assembly loading question, but in my specific case, I want my SharePoint Features to point to an assembly whose versioning is associated with the correct SVN revision number. My assemblies are now versioned as mentioned in this article. I'd like to be able to just configure my SharePoint feat...

Database access in GUI thread , bad isn't it ?

I'm working through some MSDN examples, and some books on ADO.Net. What they all have in common is using the point/click/drag-drop design time feature in Visual Studio to develop database applications, binding data sets to controls etc. And the resulting code does all DB access in the GUI thread, as far as I can tell. This sounds like b...

C++/CLI switch on String

In other .NET languages such as C# you can switch on a string value: string val = GetVal(); switch(val) { case "val1": DoSomething(); break; case "val2": default: DoSomethingElse(); break; } This doesn't seem to be the case in C++/CLI System::String ^val = GetVal(); switch(val) // Compile error { // Snip } Is there a sp...

Is the from keyword preferable to direct method calls in C#?

Of these two options: var result = from c in coll where c % 2 == 0 select c; var result = coll.Where ( c => c % 2 == 0 ); Which is preferable? Is there any advantage to using one over the other? To me the second one looks better, but I would like to hear other people's opinions. ...

Using a stored procedure in entity framework, how do I get the the entity to have its navigation properties populated?

Hi, Entity framework is cripplingly slow so i tried using a stored procedure but i ran into this problem.. Entity Framework allows you to define a stored procedure that produces an entity. However my entity has 'navigation properties' which are not being populated when using this method. Is there a work around? Thanks ...