.net

Does naming conventions make better maintainable code?

I like to give my variables, methods and objects descriptive names. Obviously not going overboard, but let me give you a couple of examples. public class Account { public decimal Balance { get; set; } } Account account = new Account(); account.Balance = 1000; Some people would opt to go for the following, which really does not ma...

.net MVC culture

What's the best approach to develop multilanguage MVC web application?. What I envision is having a drop down with several language preferences on the master page. Selecting the language option would change the site's language/culuture. The site would also use a different suffix for each language option. for example selecting a languag...

Weird behaviour of MD5 hashing

Dear all, I have faced aweird problem with the following code, the code below suppose to stop after one iteration, but it just keep going. However, if I remove the last "result_bytes = md5.ComputeHash(orig_bytes);" then it will work. Does anyone face similar problem before? MD5 md5; byte[] orig_bytes; byte[] res...

.Net - Com PVariant Param

Hi @ all, I am a little stuck with a strange Problem. I need to control some Hardware via a 3rd Party Active-X typelibrary. My program is written in C#. The Problem is one API / COM call needs a ref to a PVariant - So if I get it correctly a Pointer to a Variant. To make things worse, this is just the first address of an Varaint Array w...

MAPI for out of office Rules

Hi, I need to read and modify "out of office" rules (not subject, body or enabled flag) using MAPI, or any other API if possible, for example I need to read to whom the mails should be forwarded and to modify this field. Do you know any samples, url, starting point or anything else what could help me achive this thanks almir ...

Access to system imagelist

Hi, I am creating a treeview which wil have folder images for directories and want to know if there is a way to access the system image list so that I can display the system default folder image. Thx Mark. ...

.net x.509 timeout

here is my code HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("https://localhost/main.aspx"); webRequest.Timeout = 60000; oStore = new StoreClass(); oStore.Open( CAPICOM_STORE_LOCATION.CAPICOM_CURRENT_USER_STORE, storeName, CAPICOM_STORE_OPEN_MODE.CAPICO...

How can I determine the accessibility of a MemberInfo instance?

I know the BindingFlags are used to fetch public and non-public members from a Type. But is there a way to determine if a MemberInfo instance (or derived like PropertyInfo, MethodInfo) is public or not (after it was returned from one of the methods on Type)? Thanx, Marc ...

.NET Regular Expression: How to get a text enclosed by two tags

Hello. I am working with ASP.NET and need to manage with a string typed by the user in order to extract some information. The user enters a normal text, words and numbers, but sometimes he may type a mathematical expression in MATHML, these expressions are always an xml string enclosed by the tag. I want to extract from the typed text e...

How to display tiff, png images in ASP.NET.

How to display tiff, png images in ASP.NET or windows application in IE browser. ...

special case for update panel

i have a button , this button makes a post back for the page(the normal case),, and i have an update panel contains some controls .. when click the button the update panel is not affected by the button,and when adding trigger for this button on the update panel,, the other controls (which are not in the update panel)are n't affected .. ...

Programming against interfaces & Entity Framework 4.0

I'm trying to figure out if it would be possible to stick to the mantra "Program against an interface, not an implementation." while using the Entity Framework 4.0. While I found a page explaining how to stick to aforementioned rule while using Linq-to-SQL (look here) I'm very keen to know if it would be possible to do that with the Ent...

Openssl smime signature with .NET

Hi everyone, For an application I'm developing I need to create a signature file before I can upload files. The documentation of it explains how to do this with openssl: First you need to prepare your key: $ openssl pkcs12 -in certificate.pfx -passin pass:xxxxxxxxxx -out pem -clcerts -nokeys $ openssl pkcs12 -in certificate.pfx -passi...

C# XML serialization error

Hi there, I have an XML dox like this: <?xml version="1.0" encoding="utf-8"?> <Server Manufacturer="SQL" Version="1"> <Database Name="Test123" > <Devices> <Device Name="Testdata" ..../> <Device Name="Testlog" ..../> </Devices> </Database> </Server> I want to deserialize it like this: var database = (Database)x...

How to implement caching in dedicated caching service in .net 3.5/ 4.0 ?

Hi, I need to develop a dedicated caching service ( either a WCF service or a .Net remoting service or other implementation) to cache the data (monitoring data of .net3.5 Latency measuring application) from Database ( SQL Server 2005) which can then be consumed by 2-3 windows services( .net 3.5 WCf services) so that they do not need ...

Best practice on folder layout in revision control?

Hi, I'm just coming into a company on what is essentially my first gig as a team member rather than the sole Windows developer, and I'm not liking the current version control setup. We're developing for Windows machines using VB.net at the moment, with live software dating back to VS2005, being updated to newer Visual Studio versions a...

Memory leak during object construction in .NET

http://www.devx.com/tips/Tip/5573 The above post states that there will not be memory leak during object construction. How about the code below? Will this cause any memory leaks? I see that the memory usage for the sample application increases slowly (in task manager) even after forcing the GC collection. namespace WindowsFormsApplica...

How to create a custom observable collection using ConcurrentDictionary, INotifyCollectionChanged, INotifyPropertyChanged

Hi All I am trying to create an ObservableConcurrentDictionary. This object will be used in a multithreaded application, and it's data is used to populate a control via the controls ItemsSource property. This is the implementation i have come up with: public sealed class ObservableConcurrentDictionary<TKey, TValue> : ConcurrentDiction...

Rhino Mocks Restub function

Sometimes I stub dependencies in test class setup and then want to restub some of them in concrete test. But Rhino mocks remembers only the first stub value and it is a bit inconvenient. someStub.Stub(x => x.SomeMethod(1)).Return(100); var value1 = someStub.SomeMethod(1); someStub.Stub(x => x.SomeMethod(1)).Return(200); var value2 = som...

Primary Key issues when Migrating "Legacy" SQLite Databases to use the Entity Framework

I have recently started work on a project that has already been running for several years. The application is written in c# using Windows Forms for the UI and SQLite for the database. The database is currently accessed using ADO.NET via the System.Data.SQLite namespace. From time-to-time clients have received application and database up...