.net

20 Trivia Questions or 20 Programming Examples – Interviewing Approaches

If you were tasked with hiring some new programmers for your business, and had the choice to only pick from one of the approaches listed below, what approach would you take and why? Approach 1: Asking several question about the syntax of a particular language that can be looked up in a book. You know, questions like what is the diffe...

WSDL base64binary not consistent in .Net

I have a WSDL of a Java webservice that has two types. This is the first: <xs:complexType name="attachImageToOrder"> <xs:sequence> <xs:element minOccurs="0" name="image" type="xs:base64Binary"/> <xs:element minOccurs="0" name="orderId" type="xs:long"/> </xs:sequence> </xs:complexType> This is the second type: ...

How can you tell which tnsnames.ora file is used by a .net call?

I have multiple versions of Oracle and it saved tnsnames.ora files all over the place. Older ones got stored in program files under oracle but newer ones got stored under an app directory in my hard drive. I'm using the .net libraries provided by Oracle to connect with a .net app and it's telling me it cannot find the name I want to co...

Have to use C# dll to call C++ dll?

Do I have to create a C# DLL to call C++ DLL or I can call it directly from my C# application? ...

Bug in enumerable.range?

I have this code: public enum MyEnum { First = 6, Data1 = 6, Data2 = 7, Data3 = 8, Data4 = 9, Data5 = 10, Last = 10, Invalid = -1 }; Enumerable<int> _myTypes = Enumerable.Range((int)MyEnum.First, (int)MyEnum.Last); This creates an enumerable with elements from 6 to 15. I have equivalent code starting with 1 and it works as expected. ...

.NET MVC - Where to check IsInRole() in Global.asax?

In which part of the Global.asax lifecycle can I safely 'use' the User object? I'm using the default forms authentication and noticed the following: Sub Application_BeginRequest() 'Context.User Is Nothing End Sub Sub Application_AuthenticateRequest() 'Context.User Is Nothing End Sub Sub Application_AuthorizeRequest() 'Cont...

Why does handling cancel closing make my .NET application crash?

I used the answer from this thread: http://stackoverflow.com/questions/474679/capture-console-exit-c Whenever I close the console, I get a "--- has stopped working." from Windows 7. Any idea? ...

Book to learn Winforms Controls

Hi I am a beginner with .NET and Winforms, I have a lot of experience with C++ but I would like to learn more about the individual controls available with .NET. Whats the best book that would show the use of the various controls that can be used with WinForms (like progress bar, status bar, etc) thanks to you all in advance. ...

.NET MVC Forms authentication - debug IsInRole()?

I'm using Forms authentication on my MVC website. I administrate users and roles using the default ASP.NET Configuration option in Visual Studio. All good so far. I can successfully do Page.User.IsInRole("Moderator") in a View. True is returned as expected. However when calling Context.User.IsInRole("Moderator") inside Global.asax's Ap...

Does inline code keep the method [which wrote in it] in memory after finishing executing?

Hi all, Depending on what I know, when I define a method in C#, the local variables in this method will be released from memory after finishing executing the block of this method [when GC wants], but if I have an inline callback in a method, will these local variables be released from memory also ? In the following example, the [x] va...

Modify Dictionary values

.NET 2 The standard: foreach(KeyValuePair<int,int> entry in MyDic) { entry.Value += i; // does not work :( i++; } Recommendations? ...

Is it possible to have a composite id that can be edited in NHibernate?

I have a situation where I have tables that have many columns used as a composite primary key, worse off business logic requires these to be mutable. I am using nhibernate and have no problems mapping for loadig/saving these. However I need to be able to update the property values and have these changes be reflected in the DB when i ...

what 3rd party control is used for the menu in inFlow Inventory applications

I want to implement a menu similar to the one used in the inFlow Inventory application. I see that the mozbar.dll is referenced but i cant get it to work in my application, and it is probably beyond my skill level to implement. Does anyone have any suggestions for other controls that might replicate the look and feel of the menu used i...

Shoe-horning Integration and System tests into a Unit Test Framework

As shown in a domain-manager article, I am interested in creating an integration test harness that creates a server and many clients, where all of them are running within a single process. But once I achieve this goal I will be very tempted to execute such integration & system tests from within a unit testing framework (NUnit or VS Team...

Why is my configuration manager disabled in Visual Studio 2010?

I just started working on a new project, and I can't sent the build action to Debug/Release This is a huge problem! I have another solution on my system that, when opened, allows me to change the solution configuration. So it must have something to do with this specific solution??? ...

Query a printer to determine the postscript inputslot tray numbers

I'm trying to figure out a way to programmatically determine a printers inputslot tray to number definitions for use in generating postscript. I have gathered a collection of PPD files and collated information that way but it seems stupid to be limited to only the printers i have the PPD's for - would be better to interrogate the printe...

How to integrate with Blackberry Push Service from .NET

Is there a simple way to initiate push messages to RIM's "Blackberry Push Service" from .NET? The documentation only discusses using the Java SDK. I'm not familiar with how to interop with Java from .NET (and I can't find any documentation on the raw webservices), so if anyone has any guidance or experience to share it would help a lot. ...

Windows service runs like a scheduler service, not able to resolve dependent assembly references at run time.

I have a windows service which runs like a scheduler, it extends an interface which can be implemented by other classes to become plugin to this service. All plug-ins (eg Plugin1, Plugin2...) would be dropped in sub folder of PlugIn such as PlugIn\Plugin1, PlugIn\Plugin2 respectively. At runtime each of the subfolders (Plugin1, Plugin2) ...

SOAP, using prefixes in tags <xx:tag>

I am bad with SOAP. A third party SOAP service gave me example code to use for their api. The code that they give (which I copied to my solution EXACTLY) does not spit out a required prefix before all the tags. Right now, the code they give me causes me to make requests/responses that have no prefix to all the tags... <tagName /> . H...

Is TransactionScopeConnections in the data application block thread safe?

I have been studying the code for TransactionScopeConnections as I need to implement something similar and I am having trouble understanding the intent of the thread handling logic. In the method GetConnection transactionConnections is first locked to retrieve a list of connections and after the lock is released the list of connections i...