.net

LINQ-like or SQL-like DSL for end-users to run queries to select (not modify) data?

For a utility I'm working on, the client would like to be able to generate graphic reports on the data that has been collected. I can already generate a couple canned graphs (using ZedGraph, which is a very nice library); however, the utility would be much more flexible if the graphs were more programmable or configurable by the end-use...

Custom XML Serialization, how to write custom root element?

I'm probably just doing this wrong, i know. I'm using custom serialization and when the xml is generated it's putting the class name as the root element Example: <MyClassName> <MyIntendedRootNode> <ObjectType> <Property1/> <Property2/> ... I'm invoking the serialization by calling xmlserializer.Serialize(writer,Me) so ...

Loose coupling of COM in C# or How to avoid COMException 0x80040154

I have a .Net 2 C# application I am developing which uses a VB 6 generated COM DLL. The VB DLL is updated frequently any my application crashes with a System.Runtime.InteropServices.COMException (0x80040154). The part of the COM DLL I use does not change but the version (and CLSID) will. The "Specific Version" option for the reference ...

How to display images without taking up huge amounts of RAM

I'm working on a silverlight project where users get to create their own Collages. The problem When loading a bunch of images by using the BitmapImage class, Silverlight hogs up huge unreasonable amounts of RAM. 150 pictures where single ones fill up at most 4,5mb takes up about 1,6GB of RAM--thus ending up throwing memory exceptions. ...

How to design WCF Contracts?

We are designing a WCF layer which can be invoked either by a Asp.Net or a WinForm application. Our Application contains too many Entities. We have basically two choices. If we design WCF Contract around these entities then we get too many Contracts e.g IPartyService, IUserService, IPaymentService etc. So, I may end up with 30-40 Contr...

Getting TypeConverter error that makes no sense

I have a TypeConverter for a TopMostNode class. It extends ExpandableObjectConverter. The TopMostNode has two properties. Setting those in the property grid results in correctly serialized code to the designer. However, if I type in text for the property, I get a "Property value is not valid" error and the details say: Object of type...

CPU/GPU Monitering. (Tempature, current speed, etc) in C#

Im looking for a way to moniter system statistics, Here are my main points of interest: CPU Tempature CPU speed, (Cycles per second) CPU Load (Idle percent) GPU Tempature Some other points of interest: Memory useage Network Load (Traffic Up/Down) My ultimate goal is to write an application that can be used for easily running in...

How do I copy new binaries to C:\Program Files?

I'm creating a Windows app that automatically updates itself. I'm not using ClickOnce for a variety of reasons. When I try to File.Move() my updated files to C:\Program Files on Windows 7, I get the following error: Access to the path 'C:\Program Files\<company>\<app>\<app.exe>' is denied. I am not given a UAC prompt. The exe that I am...

Automate Form login in website using Webbrowser control

I'm automating form login in a certain site using the WebBrowser control. Having the client id of the textbox, password and button login, I'm able to do it. The question is, can I still do it without identifying the id of the button and simulate a click? ...

Errors when attempting to publish aspx files via webdav

Hi there. After I installed the .net framework 3.5 to my iis box (which didn't have any previous version of .net fraemwork), I'm not long able to upload the aspx page via WebDav with MS Expression Web. I got the "HTTP/1.1 403 Forbidden " error message. Also I got this error "Server Application Unavailable" when trying to open the aspx...

Is it good to use .settings for storing controls text data?

In my WinForms applications I often put the controls text data (form title, labels texts, button captions, etc.) into a .settings (feature automatically generated by Visual Studio - based on the ApplicationSettingsBase class). In particular, Add a form or a control. In Solution Explorer add a new string item into the application scope ...

Is it possible for an object to "pin" itself and avoid garbage collection?

I'm trying to write a drop-in replacement for System.Media.SoundPlayer using the waveOut... API. This API makes a callback to a method in my version of SoundPlayer when the file/stream passed it has completed playback. If I create a form-scoped instance of my SoundPlayer and play something, everything works fine because the form keeps ...

What control will be best for Buddy List?

I'm developing a xmpp chat client in C#.NET. I'm little confused about what control should I use for Buddy list. Buddy list will consist of status icon, name & his buddy pic. Can u please recommend that what control will be best for me to use? (Do u think that ListView will be appropriate?) Another question, I'm using agsxmpp. Does it s...

.Net equivalent for the TTimer Delphi component

Exist a .net class equivalent to the TTimer delphi component? TTimer is used to simplify calling the Windows API timer functions SetTimer and KillTimer, and to simplify processing the WM_TIMER messages. Use one timer component for each timer in the application. The execution of the timer occurs through its OnTimer e...

Forms Auth: have different credentials for a subdirectory?

My website has forms authentication, and all is well. Now I want to create a subdirectory and have it also password-protected, but! I need the subdirectory to use a completely different set of logins/passwords than the whole website uses. Say, for example, I have users for the website stored in the "Users" table in a database. But for t...

Is XML Serialization in .Net case sensitive?

I did not find any documentation which explicitly states whether XML serialization is case-sensitive or not. Suppose I have following class: class Test { public int Field; public string field; } Will I have any problems when XML serializing this class becuase it contains two fields having same name differing only in case? CLARIFICAT...

What's the best way to access a website from a Windows Service?

I'm struggling to write a Windows Service that accesses a website, logs in using stored credentials, and downloads the HTML to parse it. What do you think is the best way to go about this? ...

An elegant / simple way to check whether internet is available or not.

I did a quick search on how to check whether Internet is available or not. Most of them talked about making InterOp calls to wininet.dll. One of the answers pointed towards System.Net.NetworkInformation namespace. Exploring the namespace I found a class Ping which could be used to pinging to our servers from code, and checking whether s...

how to find the max index of a string from variable in c#?

suppose i have a string as string[] _strFile; foreach (ListViewItem item in listview1.Items) { string _strRecFileName = item.SubItems[5].Text; _strFile = _strRecFileName.Split('\\'); } in my listview i have a string as \123\abc\hello\.net\*winxp* now i want to get the last value...

Export GridView to Excel

using Matt's util code (a bit edited for Unicode text) public class GridViewExportUtil { /// <param name="fileName"></param> /// <param name="gv"></param> public static void Export(string fileName, GridView gv) { HttpContext.Current.Response.Clear(); HttpContext.Current.Response.ContentType = "applic...