.net

How to encrypt a password for saving it later in a DB or text file

I want my application to save the password encrypted in a DB or in a text file. How can I do that assuming that the DB or text file can be open by anyone. Duplicate http://stackoverflow.com/questions/287517/encrypting-hashing-plain-text-passwords-in-database Not duplicate I'm asking for code specific for .NET EDIT: I'm saving the...

Using FolderBrowserDialog on a Removable Device / Removable storage

I'm working on a simple copy tool to copy files off digital cameras. I've written the file copy code, I've got everything hooked up nicely. The issue I have seems to be with the FolderBrowserDialog. In Vista (I haven't checked XP yet), I can browse to the directories on the camera. However the FolderBrowserDialog will not let me select ...

On a C# Web Service can I find a unique thread ID or some ID for logging purposes?

I am running a Web Service in C# .NET 3.5. I want to log various calls. However since many users are hitting the same functions at once it is difficult to tell which log call belongs to which. In a C++ life we used a thread Id. What is the equivalent in C#? I have tried System.Diagnostics.Process proc = System.Diagnostics.Process.G...

.NET ORMs - What advantage does NHibernate (or SubSonic or whatever) give over using Entity Framework?

I'm wondering, what are the main reasons for not to use the built-in Entity Framework? I've read that it's disliked because of its bad implementation, but is this all? And is it still true? (I don't remember the publish date of the article) I know there exist a lot of options, but why should I consider switching? I only have a little e...

Effective way of making negative of image without external dlls

Hello, That is the solution to make a negative from a image in C# Windows Forms without any dlls and in a effective, fast way? ...

OracleParameter and IN Clause

Is there a way to add a parameter to an IN clause using System.Data.OracleClient. For example: string query = "SELECT * FROM TableName WHERE UserName IN (:Pram)"; OracleCommand command = new OracleCommand(query, conn); command.Parameters.Add(":Pram", OracleType.VarChar).Value = "'Ben', 'Sam'"; ...

Grouping data with Linq or not possibe?

I have a List of concrete objects. Some require to be analyzed to take a decision to which one will be kept (when the group contain more than 1 occurence). Here is a simplified example: List<MyObject> arrayObject = new List<MyObject>(); arrayObject.Add(new MyObject { Id = 1, Name = "Test1", Category = "Cat1"}); arrayObject.Add(new M...

How to get a regular expression to match items with spaces

The following regular expression works if there is no space character, but if the input has a space character, it doesn't work (it seems like a link but JavaScript doesn't work). How can I change it? The regular expression should work for both World and The World. Dim makebkz As String Dim pattern As String = "\(bkz: ([a-z0-9...

Talk to USB device and vice versa from Flex

My co-worker is challenged with taking user input in Flex and using that data to execute commands on a USB device. We figured we would need to have a socket server running on the machine in order to do this. We want to send objects with byte arrays etc, not just strings. Is there anything out there that could help us? Do we need to writ...

SQL Injection in .NET

Hi I was wondering if anyone knew of some good websites detailing prevention for SQL injection for .NET web applications. Any resources would be greatly appricated, thank you. ...

Is it one-to-one or Component ? Nhibernate Mapping

Assume that I have Person and Address Classes and they have different tables in DB. One Person can have one Address Class in it. This is the important part for me. One Person can have only one Address as it s child element and i want to keep them in different tables in DB. Normally i know that i need to hold them in the same table, but...

Return day int value from function?

i try to write any code about days: function xyz("13.02.2009") { return value= 6; } function xyz("12.02.2009") { return value= 5; } function xyz("14.02.2009") { return value= 7; } but how? tihs method is good but i need C# times specific codes(like timespan...) DayOfWeek day = DateTime.ParseExact("13.02.20...

Can I get the functionality of MsgWaitForMultipleObjects in .Net CF?

We're migrating a C++ application to .Net CF. We need to monitor both the UI and several external events. I therefore wonder if we can get the same functionality of MsgWaitForMultipleObjects in the unmanaged world also in the managed world? Edit: P/Invoke is not the complete answer I'm seeking, since what I meant was that we want the fu...

How can I detect a USB disconnect event? (Windows, .NET C# application)

Hi, Currently how I do this is I poll for a masked list of USB devices (masked specifically for the device I'm working with) and if it's there, I continue, if not then I notify the user that the device is not connected. The method for getting a list of USB devices is provided for me through a USB peripheral controller chip manufacturer...

InitializeComponent in both constructors, or in one with constructor inheritance?

Is there any practical difference in terms of effects on the component model between: class MyComponent : Component { public MyComponent() { InitializeComponent(); } public MyComponent(IContainer container) { container.Add(this); InitializeComponent(); } } and: class MyComponent : Component { ...

Problem calling rest service

I'm calling.a rest service (the task service sample from the rest starter kit) using a channel factory by using this code: WebChannelFactory factory = new WebChannelFactory(new WebHttpBinding(), new Uri(http://localhost:61825/Service.svc)); TasksService.IService proxy = factory.CreateChannel(); var i = proxy.GetTasks("Dimitri"); works...

Concatenate strings instead of using a stack of TextBlocks

I want to show a list of Customer objects in a WPF ItemsControl. I've created a DataTemplate for this: <DataTemplate DataType="{x:Type myNameSpace:Customer}"> <StackPanel Orientation="Horizontal" Margin="10"> <CheckBox"></CheckBox> <TextBlock Text="{Binding Path=Number}"></TextBlock> <Text...

XML XSL Transform From Stream

Hi I have a memory stream in which I use XMLTextWriter to write out some XML. What I want to do is transform this XML using the XSL.transform feature. The thing is I don't want to create a temp. XML file, I want to somehow use the stream to Transform it into the XSL. Thank you for any suggestions. ...

What can you do in MSIL that you cannot do in C# or vb.NET?

All code written in .NET languages compiles to MSIL, but are there specific tasks / operations that you can do only using MSIL directly? Let us also have things done easier in MSIL than C#, VB.NET, F#, j# or any other .NET language. So far we have this: 1. Tail recursion 2. Generic Co/Contravariance 3. Overloads which differ only in re...

Selecting attribute values with html Agility Pack

I'm trying to retrieve a specific image from a html document, using html agility pack and this xpath: //div[@id='topslot']/a/img/@src As far as I can see, it finds the src-attribute, but it returns the img-tag. Why is that? I would expect the InnerHtml/InnerText or something to be set, but both are empty strings. OuterHtml is set to ...