.net

Questions from agency staff about c# , sharepoint , .NET position, what shoul I reply ?

Recently I have applied for a job through the agency. She emailed me with this questions: Please email me back with your experience in the following: .NET Framwork .NET Remoting ASP.NET C++ C# Web Services Networking COM interop ADO.NET Sliverlight TDD Composite UI Application Block OO design 1) please detail what experi...

Building smarter connectionStrings for use Live / Local

Currently we are running multiple Sitecore projects. Whenever the projects go live we create new repositories in our subversion system. The downside in this case is, that when we go live we edit the connectionstring obviously, so that the connectionstrings correspond to the live servers instead of our local servers we run on. When a pers...

Stop XDocument url encoding strings

I am trying to create an XML file to conform to someones XSD this XSD allows for XHTML content within its description tag. I have cut short the method hierarchy but basically it does the following: using System.Xml.Linq; public static XDocument Create() { XDocument doc = new XDocument( new XDeclaration...

Writing 'CONTAINS' query using LINQ

Given the output of query: var queryResult = from o in objects where ... select new { FileName = o.File, Size = o.Size } What would you consider the neatest way to detect if a file is in the queryResult? H...

Switch `ConnectionStrings` between local and remote with Linq to SQL

First, by Remote I mean a central dedicated SQL Server on our Network. By Local I mean a local SQL Express install. My situation is in house only. No cloud services, external sites, etc. My app allows the user to work disconnected but in order to minimize traffic and a few other issues as well I would like to allow them to connect st...

Programming huawei E220

I have a 3G Huawei E220 modem. How can I programme or interact with the modem from c# or vb.net. I've tried looking if there's some sort of sdk or api but have not been able to find anything. Can someone tell me how to get started with this. I'd like to able to inisiate a connection and then log tranfer statistics. There's a network conn...

How to put variable value inside value of resource file

Hi, I have been working with resource files for a while now and I was wondering if there is some nifty way I don't know of yet to put variables inside a resource value. A simple example: You have bought #amountOfBooksBought books. My current way of working would be to declare two resource values (for 2 labels): BoughtBooksAmo...

C#/.NET analysis tool to find race conditions/deadlocks

Is there a tool that analyses .NET code and finds race conditions? I have a bit of code that has a public static property that gets or creates a private static field. It also has a public static method that sets this field to null (...yes, I know!..) As there are no locks around either of these methods, it's a safe bet that things'll ...

Flash colour when value in ListView cell changes

I have a ListView (shown below). I would like the cells to flash a colour when the value displayed changes (ideally one colour for increases, one for decreases). I know how to write the animation for the colour (below), and I'm pretty sure I need to use a cell template so I can hook a trigger up to the style to start the animation. I'm ...

Help Repainting a Line

I am doing a custom control (inherited from VisualBasic.PowerPacks.LineShape), that should be painted like as standard one, but also having a Icon displayed near it. So, I just overrided OnPaint like this: protected override void OnPaint(System.Windows.Forms.PaintEventArgs e) { e.Graphics.DrawIcon(myIcon, StartPoint.X, StartPoint.Y...

Prevent orphaned objects in DB4O when updating fields

I want to store Person objects in DB4O. The Person Location field can be changed over time. So I retrieve a person from the DB and call a method to set the location field to a new Location object. (I want the Location objects to be immutable i.e. DDD Value Objects). This works, however the previously assigned Location objects remain the...

.net object equality

Hello, Lets say we have two objects o1 & o2 defined as System.Object, in my situtaion o1 & o2 can be any of the following types: String Int32 Double Boolean DateTime DBNull So how can I check that o1 & o2 are equal, therefore are the same object or both have the same type & value. Can I just do o1 == o2 or do I need to do o1.Equals...

Send SMS C#.net

Hi, Is there any free gate way or a way that I can use to send SMS from my code. ...

What is the easiest set of tools to get started with Source Control, TDD, and CI for Microsoft.Net 2008/2010

I work on a team with three other developers and one business analyst writing internal business applications. We're primarily building apps in ASP.Net, and do so in a very 2003-ish way. It's like going back in a time machine. Although two of the other developers are amenable to learning new things, one of the developers is not. He's ...

Making code "CAS-safe" and "environment safe"

Hi, I read an article about making code reliable in different environments (what with CAS having an influence), and one technique was to use .GetExecutingAssembly(...) for accessing resources in an assembly (Eg text files). Is there any other useful technique? I ask as some stuff I am writing will be demo'd from another machine. Thank...

.net web service: Can't add service reference, only web reference

I have an existing project that consumes web services. One was added as a service reference, and the other as a web reference. I don't recall why one was added as a web reference, but perhaps it's because I couldn't get it to work! The existing service reference for the one web service works fine, so it's not a .net version issue. I c...

Automate logon to https site

My new ISP requires me to login for each session of internet usage. After a session gets timed out, it redirects to the provider website (https), where I have to enter the username and password. Since it logs out and terminates session I cannot schedule downloads during night. I was thinking of some way to automate this, probably write a...

Is it possible for a PDF produced by a component to match the line wrapping of a WPF TextBlock exactly?

We have a WPF application that has a print preview dialog. When we create the PDF to match this print preview dialog, we want the PDF to show a 100% match. For instance, we have a WPF TextBlock with a set height and width and some content that wraps in the text block. We then want to recreate this text exactly in the PDF. So far we h...

Paging with LINQ for objects

How would you implement paging in a LINQ query? Actually for the time being, I would be satisfied if the sql TOP function could be imitated. However, I am sure that the need for full paging support comes up sooner later anyway. var queryResult = from o in objects where ... select new ...

C#: Dynamic parse from System.Type

I have a Type, a String and an Object. Is there some way I can call the parse method or convert for that type on the string dynamically? Basically how do I remove the if statements in this logic object value = new object(); String myString = "something"; Type propType = p.PropertyType; if(propType == Type.GetType("DateTime")) { ...