.net

Time stamp parsing from the beginning of a string in C#

Hi all, I am working on re-writing an existing Java software solution in .NET. At one point, the Java solution reads a time stamp at the beginning of a string, simply like this: SimpleDateFormat dateFormat = new SimpleDateFormat(timeFormat); dateFormat.setLenient(false); try { timeStamp = dateFormat.parse(line); } catch (ParseExce...

Prevent a specific assembly from being added to my factory project?

I've created a factory assembly that can process any type of transaction (that supports ITransactionType). I can add more transaction types in separate assemblies, all of which will work with the factory without it needing to be recompiled (which is one of the benefits of a factory). There is an actual list of transaction types that ca...

SqlParamater updating values in a loop - side effects

I have a stored proc that takes one integer parameter. I am calling this in a loop (I would rather use an In but Stored proc is outwith my control). So I have one SqlParameter object who's value is updated each time round a loop. I have a vague memory of there being a side effect to this? Does this ring any bells? (.NET 2.0 / SQL Ser...

Is there something similar to the Severity enumeration in the BCL?

Simple question. :) Is there an equivalent to the Microsoft.VisualStudio.Package.Severity enumeration in the .NET Framework Base Class Library (BCL)? ...

Determine when a mouse hook has handled the last message. Winforms, .Net

I have a form, that acts like a drop-down, that I display non-modal. I attach a mouse hook to the form to determine when the mouse is clicked out of it, so that I know to close it - by setting Visible = False. Because I want the HookProc to handle the last click, I can't dispose the Hook or my Dropdown until I'm sure that my event handl...

Should we use the same business classes on server and client?

Imagine you have business domain model on server application and you are going to develop rich client application. You can use DTO to transfer data to client and changes to server or use WCF services and generate new classes on the client. Another way is to transfer the same objects as you use on server in your business logic layer. T...

Global variables and DLL files

I want that global variables that sit in some DLL will be seen from other DLLs and EXE of that project. I included in that VB file "Option Explicit On" as the first line . But still no one can see my variables that were defined in that file . I made that all DLLs of that project depend to that one with the definition , but nothing help...

NHibernate Session Management in Console App

I have core library of code which has multiple front ends. One front end is a WCF service, another is a console app that just launches some long running commands which perform financial calcs and other business logic. I am trying to figure out how to manage my ISession in the console app. I 'could' just have one session per "command", bu...

Alternative to installing IIS locally to access IIS remotely?

I have an app that accesses information about websites running on IIS on a remote machine, using DirectoryEntry objects (in System.DirectoryServices). Any client machine that runs the app needs to have IIS installed or the app throws a System.Runtime.InteropServices.COMException when it accesses the IIS information. Is there a way I ca...

TextInfo.ToTitleCase doesn't work properly, any better solutions?

I'm trying to make my article title well-formatted, I'm currently using TextInfo.ToTitleCase for formating. It does well on most of jobs, but it's not that perfect. For example: Original String: war and peace Expected Result: War and Peace Actual Result: War And Peace Microsoft also use above as the example, it's obviously a known p...

Easiest way to call Java from C#?

We have a major body of code in Java that runs on the desktop that we want to reuse with a MS.NET user interface (desktop rather than web). Any do's or don'ts would be very welcome. ...

what type of collection suits to webservices at .Net?

Hi all, wanna ask for your opinion. What would be the best object (Array, List<>, Collection,...) used in webservice when returning list of business objects. Like a list of customer or history list. Some ideas: because I want minimize amount of data transafered between client and server because I want simplify xml serialization I dont...

.Net app.config in library project

I have a console application project and library project (dll) in one solution. The library project has app.config file where I store a connection string to database. The console application references this dll. When I compile the console application and deploy it with the library I am not able to access the app.config file that belo...

What is the best way to write a validation layer for SQLite

I'm using an ADO.net provider of SQLite. I want to steer around some of the "features" of SQLite, like allowing a string in an integer field and allowing a string longer than n in a field of type varchar(n). What is the best way to achieve this kind of validation? Stored procedures? triggers? I'm looking for a generic solution that appli...

Is it possible to intercept an outgoing SMS message on Windows Mobile?

I am interested in writing an app that will intercept an outgoing SMS message and process it in some way before it is sent. Is that possible in the .NET compact framework? I have seen documentation to intercept and incoming SMS but not outging. If it is not possible in .NET, is there some other way that It can be done? ...

Mail doesn't get send untill I terminate my application - System.Mail.Net

Dear community. I have written some simple code, to send en auto generated email, using the System.mail.Net namespace. It works like a charm, but there is one little problem. The mail does not get send, untill my whole application is terminated. Does any of you have a workaround for this? Here is the code I use (c#): try { ...

Setting array values without knowing its type

Hey I have an array of MyType s in an object similar to the setup below, I want to be able to set the value of an index on myObject as it is, I cannot change the declaration of MyFunction. /*...*/ MyType [] myTypedArray = new MyType[100]; MyFunction(myTypedArray); /*...*/ function MyFunction(object myObject) { myObject[0] = new My...

"Must Know" IIS features for .NET Architect/Lead

What all IIS features in regards to maintain application/optimization should an .NET (ASP.NET) architect or team lead should be aware of? LIST of features HTTP Compression. This option significantly improves bandwidth utilization and application performs much faster. Load Balancing (chris-lively) Sessions (chris-lively) Different opti...

windows service : configuration UI implementation options

I have a simple windows service, that might need to be configured on-the-fly (a COM port to listen to). I have done the UI as a console app that connects to the windows service through WCF, it works and fun. Question: Is it a good idea to develop a MMC Snap-in to control the windows service? Would it be cool? Note: I haven't done any...

.Net Windows Forms ListView OwnerDraw LargeImageList leak

Hello there, I'm ownerdrawing .Net Windows Forms ListView control and see a very strange bug/behavior when I need to draw an image from the associated LargeImageList. When the View type is a type where LargeImageList is used (Tile, LargeIcon, etc.), I draw item images from the LargeImageList. At that condition, I see a huge memory incr...