.net

Stream.Length throws NotSupportedException

I am getting a error when attempting stream.Length on a Stream object sent into my WCF method. Unhandled Exception! Error ID: 0 Error Code: Unknown Is Warning: False Type: System.NotSupportedException Stack: at System.ServiceModel.Dispatcher.StreamFormatter.MessageBodyStream.get_Length() How do you get the length of the stream...

Programmatically Add a Reference to a Visual Studio Project

I want to programmatically add references to Visual Studio projects. This is for creating an add in tool to Visual Studio. What I want to do is use an API of some sort. What I don't want to deal with is just editing the XML of the project file (.csproj, .vbproj). Is there any knowledge out there on how to do this? I couldn't find anythi...

Access Sitecore items via .NET web service

Has anyone had luck with using a .NET web service to access Sitecore items? I have a number of web applications on my server that are still in Coldfusion. I'd like to be able to call a web service to pull down items, but when I tried to do this I got an exception "Sitecore.Data.Items.Item cannot be serialized because it does not have a p...

how to select top 1 from each group after order by

Hi all, I have 3 columns/fields as part of a generic list: strID, seq, unit there are a bunch of strIDs that belong to the same unit and they each have a different seq. I'm interested in the row that has the minimum seq per unit(the leader of the group). How would I accomplish this with a LINQ query (a tsql query would also be fine)...

Split large file into smaller files by number of lines in C#?

I am trying to figure out how to split a file by the number of lines in each file. THe files are csv and I can't do it by bytes. I need to do it by lines. 20k seems to be a good number per file. What is the best way to read a stream at a given position? Stream.BaseStream.Position? So if I read the first 20k lines i would start the positi...

Looking for continuous integration host,or an alternate solution

Hi, We are a team of remote developers.We want to get CI into our project(dotnet 3.5).Are there any hosts providing CI solutions? If not,how can I go about setting this up?What are my options? thanks ...

Capturing specific exceptions (from third parties) without doing string matching

I have repeatedly found myself in situations where I want to catch an exception (in .net), but there may be multiple exceptions with different messages that I want to handle differently. When I view the exception in a debugger, I usually cannot find any piece of metadata that shows me a unique number representing that particular excep...

which data structure is good for temporary big binary data storage?

Plan to have a data structure to store temporary binary data in the memory for analysis. The max size of the data will be about 10MB. data will be added at the end 408 bytes at a time. no search, retrieve operations on those temporary binary data. data will be wipe out and the storage will be reused for next analysis. questions: w...

Does Linq to Entities Include work across calls?

If I have something like this: x = from f in first.Include("second") where f.id == 1 select f y = from s in second where s.first.id == 1 select s Will two queries be sent to my database? I realize that I could just set y = f.second to ensure that only one call is made, but I frequently want to factor my code such that...

.Net checker for windows

Hello. I'm developing an application in C# based on the .Net Framework. The problem is that on certain computers there is no .Net. So is there a app (preferably free) that can check it and suggest a download if no .Net is available that i can run during the installer, or an app that wraps my assembly with the .net assemblys so that i wo...

Help me for Json unknown problem

I'm working with a project that use Twitter API to get mentions timeline of my account and it return as Json, problem is I cant run it because of this error Could not load file or assembly 'Newtonsoft.Json, Version=3.5.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The system cannot find the file s...

Where do you store your connection strings?

In all my VB6 applications, connection information was stored in encrypted fields in the database. Nobody has access to the database and if anyone did, all they would get to see was a bunch of encrypted values. There was always a flaw with this method. Fetching the connection information required using a hard-coded id/password in the ap...

How to convert IntPtr of HIMAGELIST to Bitmap/Image

I am trying to use an HIMAGELIST from an unmanaged dll which gives me the result as an IntPtr. Is there a way for me to turn this IntPtr into a Bitmap or an Image so I can use it for Winforms buttons, as in: myButton.Image = intPtrImage ...

Is there any way to break lost or idle connections TCP/IP in the PostgreSQL 8.4 in a Windows Server 2008?

I've asked: http://stackoverflow.com/questions/3366619/how-to-break-connections-tcp-ip-by-keepalive-postgresql-without-changing-anything And now, I want to confirm: My system (C#.NET, NHibernate and Active Record) is running with a database PostgreSQL 8.4 and a Windows Server. I need a way to break idle or lost TCP/IP connections and u...

Question about Entity Framework: Why do we need to remodel our generated models by visual studio?

Hi I am reading the Entity Framework 4.0 recipe. In chapter 2, it has a bunch of recipes for modeling our entities relationship ( Table per Type, one to many, ...) basing on the relationship table. My question is that EF will automatically create models to match our database tables relationship already. So why do we need to remodel our ...

Why can I access a WSDL file from a browser, but not from application?

We've having trouble deploying a web service that works in our development environment, but not in production. Part of the problem is that our production servers are load-balanced, so to upgrade one of the servers, we have to take it out of the load-balance and try to test the sever in isolation, which is a challenge. The computer I'm ...

Transparent pictureboxes flickers when moved with mouse

I have made a card game built of pictureboxes. The empty places a card can be put in is an empty picture box with a transparent background and a 3d border. And then I have a current card which is also a picturebox which is moved by a MouseMove event. As soon as I drag a card over the transparent PictureBoxes there is a card left all ov...

Shared desktop solution/api for Windows 7

I write software for an IT consulting company that supports a number of clients that will (very) soon be migrating from Windows XP to Windows 7. One of the tools we use is Ultra VNC Single Click, which lets us connect to a client computer and share the user's desktop. Eventually, I wrote an application that sits on the user's desktop a...

log4net: writing a header to each rollover log segment

I have a RollingFileAppender that rolls over the log file when it reaches a specified file size. This works great. Is there a way to have log4net insert a header at the top of each newly created log file? Alternatively, is there a way to be notified by log4net when a roll over occurs so that I can write this header myself? ...

Problems hosting a WPF control in a windows form

I have a Winform application and want to to use WPF inside this application. I add a WPF user control to my VS project. Then I take a ElementHost control from the toolbox and put it on a form. After that I build the solution. The problem is now, when I want to embed the WPF control with "Edit Host Content" into the ElementHost controlI...