.net

Resize image gdi+ graphics .net

I have this method for shrinking down an image for a website that I'm working on: static byte[] createSmallerImage( BlogPhoto blogPhoto, int newMaxWidth, int newMaxHeight) { Image img; using (MemoryStream originalImage = new MemoryStream(blogPhoto.BlogPhotoImage)) { img = Image.FromStream(originalImage);...

Recording and saving sounds from applications?

I Would like to make an appliaction in c# (or vb.net) that records every sound that comes out from the speakers when i tell it to, and when im finished i want to push a button and save it as an mp3 (or some other format). So far i have only found APIs that can record something from a microphone. My Question is: Is there anything in th...

Get pathes of assemblies used in Type

hi I need a method that takes a Type and returns the pathes of all assemblies that used in the type. I wrote this: public static IEnumerable<string> GetReferencesAssembliesPathes(this Type type) { yield return type.Assembly.Location; foreach (AssemblyName assemblyName in type.Assembly.GetReferencedAssemblies()) { yield return ...

Maximum value vs. size of long and double in .NET

It's known that in .NET size of both long and double is 8 bytes. However, double can store significantly larger number than long. How can it be, considering that double also needs to store data on digits after decimal point? Shorter version of the question: Math.Pow(2, 64) == long.MaxValue Math.Pow(2, 64) < double.MaxValue ...

Count word occurrences in a text field with LINQ

How can i get the occurrences count of a Word in a database text field With LINQ ? Keyword token sample : ASP.NET EDIT 4 : Database Records : Record 1 : [TextField] = "Blah blah blah ASP.NET bli bli bli ASP.NET blu ASP.NET yop yop ASP.NET" Record 2 : [TextField] = "Blah blah blah bli bli bli blu ASP.NET yop yop ASP.NET" Record 3 : ...

Is HttpClient from WCF REST Starter Kit Silverlight compatible?

I know in earlier versions of the WCF REST Starter Kit the HttpClient class was not usable from Silverlight. Has that changed? I did a couple of quick searches and didn't find anything that gave a clear answer. ...

What exactly happens when my process is killed?

I have a mixed process with native and managed code, running on Windows server 2003. When I kill my process from within process explorer it goes into a state of 100% cpu and stays like that for a while (sometimes even 10 minutes) before going away. During this time I cannot "kill" it or do anything else. What exaclty happens to a proce...

WPF, xaml Cad or drawing app examples?

I am trying to learn WPF and xaml and am writing a cad style geometry app for my kids. Does anyone know of an existing example written in VB.net? C# is fine as well. Thanks! EDIT: Any thoughts/examples on how to structure such an app? TIA ...

Lutz Roeder's HTML Writer only returns 2 characters in SaveHtml() method

I've downloaded Lutz Roeder's Html Writer for use in a .NET WinForms app in order to avoid the IE-dependency issues mentioned in other threads here on SO. The HtmlControl class SaveHtml() method only seems to return the first two characters however, which (not surprisingly) are always " For now, I've implemented a workaround by adding ...

What's the .Net replacement for File.Type FileSystemObject property?

In classic Asp we used the File.Type property to get the friendly name associated with a file type from the registry (e.g. "Text Document" for ".txt"). The FileInfo class which generally replaces the old COM object doesn't replicate this feature and so far I'm not having much success in my search of a replacement. ...

hook a hotkey from windows logon screen

hi i built a program that hooks the keyboard and when some hotkey pressed it openning the door (that connected to the COM1 serial port of the computer). this works fine, until i locking the computer (winkey+L). i want to be able to open the door with the same hotkey from the logon screen. i using Windows XP & C#. how do i do that? t...

How to disable conversion message when opening Office 2007 doc using Office 2003?

I am working on a C# application which opens Excel workbooks using Interop. It works fine except for one annoyance: when opening an Excel 2007 document on a machine using Excel 2003, a small message pops up saying "File conversion in progress". Does anyone know of a way to prevent that message from appearing at all? ...

(.Net) suggestions on making a config file for a program?

I'm not necessarily referring to app.configs, but a custom configuration file that would store my program's state whenever a user hits a "save" button. In my example, it's a UI builder that allows the user to choose which "fields" are to be displayed on the left and right columns in a two-column screen, along with the order of the field...

Non-standard UI in C#

Hey, I'm still learning C#, and I know don't know about WinForms yet but I will very soon. However I want to know how I would create an application which shows a customized notifier, like Growl on a Mac. Here's a mock up: Could anyone point me in the right direction? And I know I should learn more about C# before trying this, but I'v...

Is EXE locked (vs DLL)?

If I put all my controls inside the EXE, is it accessible from outside like it would be accessible when it's placed in a DLL? ...

Lucene.Net TermQuery wildcard search

Hi, I have a lucene index I am trying to do a wildcard search. In index i have a character like '234Test2343' I am trying to do the search like %Test%.. My lucene syntax looks like string catalogNumber="test"; Term searchTerm = new Term("FIELD", "*"+catalogNumber+"*"); Query query = new TermQuery(searchTerm); I don't get the results ...

Complete XML Schema Validation

I am looking for a tool that will tell me all of the XML Schema validation failures. All the other tools I have looked at so just tell me the first couple, and then I have to fix those before it will tell me the next errors. I realize that some errors may be dependent on other nodes being in different orders, but things like data types...

The C# compiler and memory management

Hello. I'm doing a compiler design class on the topic of memory management. I am reading about garbage collection and noticed that most of that low level stuff takes place with C/C++ code. I have a few questions about the c# compiler. Was .net framework part for memory management written in c/c++? How does .net manages memory? Does the...

Can I use a base class method to enable a variety of ui controls in .net?

I need to write a delegate for a worker thread that will handle a wide variety of form controls (buttons, textbox, list...) enable method. I'm thinking they must all be derived from a base class that handles the enable property, but I'm not finding any documentation, nor am I sure how to call the method. ...

Enumerators and Thread-safety

Just to make sure, say that i have this code: this.allObjects = [some linq query]; and have two methods that both read (not modify) this IEnumerable, are they safe to call in parallel? Just looping through a IEnumerable should be safe right? ...