.net

Thread-safe cache libraries for .NET

Background: I maintain several Winforms apps and class libraries that either could or already do benefit from caching. I'm also aware of the Caching Application Block and the System.Web.Caching namespace (which, from what I've gathered, is perfectly OK to use outside ASP.NET). I've found that, although both of the above classes are te...

Iterating Regex Named Groups

I am trying to iterate each named group in a regular expression (i.e. - (?<name>.*)) and depending on the name of the group set an instance property or add it to a collection. Important part is I will never know the name of the group when using the regular expression so I cannot use the string indexer on my Match. Is there a way to ext...

How can one change a Windows 2000 computer name in .NET 2.0?

I'm trying to change a computer's name (host name) on Windows 2000 using .NET 2.0. The computer is not joined to a domain. Windows XP and higher provides the WMI method Win32_ComputerSystem.Rename, but this is not available in Windows 2000 (reference here). I'm not averse to just calling an external program if I need to, but I also ca...

Embedding An Object Into An Assembly

I have the need to embed an object (A Dictionary) in an assembly. The Dictionary was created and populated within another application. I know I can serialize the dictionary to a file and then embed that file - just wanted to see if there were any preferable methods. I am also unaware if there is a significant performance issue of readin...

SQL IErrorInfo.GetDescription error.Brackets not working

I have the following code. I tried putting brackets around all the tables and parameters with no luck. The query works in Access though. Dim cn As OleDbConnection Dim cmd As OleDbCommand Dim str As String Dim dr As OleDbDataReader DataGridView1.Rows.Clear() Try cn = New OleDbConnection("Provider=microsoft....

Custom PowerShell Host and Converting PSObject back to base type

When hosting the PowerShell runtime is it possible to convert a PSObject back into its original type some how? For example: I have a cmdlet that calls WriteObject and pushes a collection of ClassXzy in the pipeline. When I call PowerShell.Invoke from the host end of things I retrieve a collection of PSObjects with a BaseObject propert...

monthcalendar control selected range not drawing correctly

I have a monthcalendar control in my form and when I select a range, the range just whites out. I checked the titlebackcolor (Highlight) and titleforecolor (AliceBlue) and they are not set to white. Anyone know what I can do to correct this? ...

Creating database structure by using .NET DataSets

What is the easiest way to apply to database changes to the structure (not the data) made to DataSet? Do I need stuff like DataAdaptors? Is it possible to use in this way the DataSet that I configured via Visual Studio wizards? How to access such a DataSet? ...

How do I compose Linq Expressions? ie Func<Exp<Func<X, Y>>, Exp<Func<Y, Z>>, Exp<Func<X, Z>>>

I'm creating a Validator<T> class. I'm attempting to implement the Linq SelectMany extension methods for my validator to be able to compose expressions using a Linq query and validate the final result even when the underlying values change. The following test code demonstrates my intent. var a = 2; var b = 3; var va = Validator.Create...

How can I add the Assembly* values back to my executable?

As part of the solution to another question I asked I have added a resource file to my project. I was able to set the icon for the application in the resource file but I'm not sure how the other attributes (ie: File Version, Description, Copyright, etc.) should be set. I imagine I need to put them in the resource file but I'm not clear o...

Generalizing the interface to a progress bar in a GUI

I'm working on an application that has a main form with a status bar at the bottom. The status bar contains a ProgressBar, and a Label that I want to use to show the user the current progress of some work that is being done. The status bar also contains a label which I want to use like a click-able Cancel button. I've create asynchronou...

Silverlight: How to make my custom control act like a button

Hi there, I have a custom control and I would like it to act like a button i.e. when you hover over it changes a little so it seems "clickable" to the user I actually acheived this using the MouseEnter and MouseLeave events and changing the gradient but... is there a way to apply a style to the user control and say something like Targ...

JIT compiling with missing assembly references

I've come across an intriguing problem. I have an application made of several assemblies. I installed the application but forgot one small non essential assembly. The application appeared to start and work fine until I hit a method that required the use of that assembly. As you might've already guessed I see the "Could not load file or a...

how to share common enterprise code between developers

I work with a team of several developers. We develop and maintain many different products which are related to our company. What are some good ways to share code that does common enterprise tasks such as logging, database access, XML handling, etc? We typically have several different versions of the same or similar classes/libraries...

Passing .Net Stream into IronRuby?

I am using IronRuby to parse Yaml files and then use the parsed document in C#. This is working fine for creating an engine (Ruby.CreateEngine()), and executing the YAML::load(File.open('myFile.yaml')). But, this works well because I can hard-code a string for the file name when I execute a few lines of ruby code. Now, I want to under...

How to refresh ObjectContext cache from db?

We are loading data from db: var somethings = Context.SomethingSet.ToList(); Then someone deletes or adds rows outside of context. Out context still has caches deleted object, because it doesn't know they were deleted. Even if I call Context.SomethingSet.ToList(), our context still contains deleted objects and navigation properties ar...

what's a good enterprise level pdf generation solution?

I'd like to find a replacement for Crystal Reports. Oh how I dislike CR. Ideally I'd like to find a PDF generation tool that has the following: Solid API in .NET Speed: we'd like to generate 1000-2500 pdfs per day WYSIWYG editor hotlinking of image files (logos) good widow/orphan control reasonably good typography control (kernin...

Convert string "dd month_full_name year" to string "yyyy/mm/dd" with .NET

Is there anything standard in C# to transform in to out. I don't mind ad hoc routine either. string in = "1 February 2001" string out = "2001/02/01" ...

Differences between how C# and VB handle named parameters?

Now that C# supports named parameters, I was checking to see if it was implemented the same way VB did it, and found that there is a slight difference. Take for example a library function like this: public static void Foo(string a, string b) { Console.WriteLine(string.Format("a: {0}, b: {1}", a, b)); } In C#, if you call it lik...

Threading vs. Parallel Processing

Microsoft .NET 4.0 introduces new "parallel enhancements" to its framework. I am wondering what the difference between making an application that uses the standard System.Threading functions versus the new parallel enhancements. ...