.net

How do I customize the auto-generated comment when using .NET CodeDom Code Generation?

I'm using CodeCompileUnit and CSharpCodeProvider to generate some source code. It adds the header below to all generated code. Is there a way to customize the comment so it says something else? // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.3053 // // Changes to this file may cause i...

Unpublished / restricted items in Sitecore showing standard values

Is it in usercontrols / xslt renderings possible to check wheter an item has it's publishing restricted or is not publishable in the Sitecore CMS? We get some situations where we explain users of the CMS how to set publishing restrictions and get back questions about items showing standard values on the website. For example: I have an ...

How to register a non-strong-name assembly to be loaded as if it were in the GAC?

One of our partners provided us with an assembly we need to access from our application. Unfortunately, this is not strong-name so we can't install it to the GAC. And we can't place it in the same place as our executable. Is there a solution for this? EDIT: This will be a temporary solution only for testing, when they go RC, we will ha...

What does <??> symbol mean in C#.NET?

Possible Duplicate: What is the ?? operator for? I saw a line of code which states - return (str ?? string.Empty).Replace(txtFind.Text, txtReplace.Text); I want to know the exact meaning of this line(i.e. the ?? part).. ...

Debugger not stepping into different projects

Is it possible for a web project built on .NET framework 4.0 step into a project built on .NET framework 2? If so, how would I set this up? These 2 projects are in different solutions. When I do a "Go to definition" from the web project, it opens up the metadata. In debug mode, the debugger never "steps into" the method. ...

matcher library for .net

Does any matcher libraries exist for .net? I am talking about a library like the hamcrest library for java... ...

Displacement map in .Net

I have built a Flex application that composes image resources, color layers, blurs etc to generate images (99% of the drink images in www.absolutdrinks.com are generated by this app). One of the effects used by the app is Flash's ability to apply displacement map filter in which x- and y- offset for an image is defined by a 2D image (sy ...

File permissions across user profiles

I am using ClickOnce deployment for a Windows Forms application and I need configuration information on a machine basis that persists across deployments and across user profiles. As such, per user configuration does not help. I would also like the configuration file to be easily accessible with a text editor in a well known location on...

Visual Studio 2008 Office Interop 2003 vs 2007

I am developing an add-in for Microsoft Excel, using Visual Studio .NET 2008. The add-in creates a single toolbar button, which can be clicked to launch a form, which can be used to add values from a database into the cells of the active spreadsheet. 1) A requirement is that the tool be available in both Excel 2003 and in 2007. 2) A...

Are events the OO equivalent of GOTO?

Was just thinking about this question while trying to figure out some code written by our previous developer. Trying to trace out how control of the program was happening reminded me of the bad old days of BASIC, where it was hardly ever obvious the execution path of a program. Is this more a symptom of event abuse, or is there a struc...

XSD - how to allow elements in any order any number of times?

I am trying to create an XSD, and trying to write the definition with the following requirement: Allow child element specified to appear any number of times (0 to unbounded) Allow child elements to be in any order I looked around and found various solutions like this: <xs:element name="foo"> <xsl:complexType> <xs:choice minO...

WCF WebServiceHostFactory And HttpContext

I have an application which exposes a WCF web service using the WebServiceHostFactory. We use an HttpModule to add a NHibernate session to the current HttpContexts items collection when the request enters, and then close the session when the request exits. The problem I am seeing is that intermittently the session is no longer present in...

Create WinForms ComboBox with non-selectable items

How to create combobox control with non-selectable items? For example, such groupnames or categorynames which visually divide items in dropdownlist into some groups or categories. ...

Hash Code in SQL Server?

I am trying to solve a unique problem. Thanks for any help with this. Is there an easy way to generate some kind of a hash code for a record based on several of its field values? I thought about just creating a view with an extra column that concatenates all of the values that I want to check, but I'm checking to see if there is a bet...

save image files in C#

How can we save image files (types such as jpg or png) in C#? ...

entlib 5 and structuremap

I am trying to configure entlib 5 with a structuremap. All examples are mostly based on Unity Container, can you point me to the link / example for structuremap and entlib 5 configuration? ...

What Namespace is the Default attribute for properties on UserControls?

I found half of the answer here to my question when searching "what is the attribute to set the default value of a User Control property in the designer where you change it and it bolds". However the answer neglects to mention the namespace it is in. Searching through Object Browser yields hundreds of classes/properties with the name D...

Left Join and Where Clause

Query - Select * FROM tbl1 LEFT OUTER JOIN tbl2 ON tbl1.id = tbl2.id AND tbl2.col2 = 'zyx' AND tbl2.col3 = 'abc' WHERE tbl1.col1 = 'pqr' Here I'm doing left outer join and using 'and' along with join. (First I was using joins 'and' part in 'where' but my results were not correct) My q...

Comma or semicolon-delimited AutoComplete TextBox

I would like to have a TextBox that supports AutoComplete and lets users type multiple words separated by a comma or semicolon, offering suggestions for each word. I have a standard TextBox with textBox.AutoCompleteCustomSource.AddRange(new[] { "apple", "banana", "carrot" }); textBox.AutoCompleteMode = AutoCompleteMode.SuggestAppend; t...

HTTP POST complex requests with .NET

I have a Web Service method developed using .NET 3.5 (VS2008) which expects a few strings (username, password, subject, file type) and a binary document coded in Base64. I enabled both SOAP and HTTP POST. While SOAP works perfectly, it is not possible to send HTTP POST requests. The server responses with "Server was unable to process re...