.net

Where to store a connection string used by many applications in the same machine?

At my shop we are used to store connections strings in the .config file. But when we had to update it in several applications in the same machine someone gave the idea of storing it on the windows registry. Is this a good idea? What are the implications (security)? ...

Calling .NET web service from blackberry eclipse project error

i can't seem to figure what i'm doing wrong. i am simply trying to call a .net web service method from my BB application. when i call a method that DOES NOT require parameters, i get a valid string response and everyone is happy. however, when i call a method that requires parameters (and i pass those parameters within the invoke() call)...

Prevent ArrayList.Add() from returning the index

Hi, is there a way to supress the return value (=Index) of an ArrayList in Powershell (using System.Collections.ArrayList) or should I use another class? $myArrayList = New-Object System.Collections.ArrayList($null) $myArrayList.Add("test") Output: 0 thanks in advance Milde ...

Will Decimal or Double work better for translations that need to be accurate up to .00001?

I'm an inspector at a machine shop. I have an html report generated by another inspector that has some problems I need to fix. This isn't the first time: I need something better than PowerShell and RegEx. (Fear not internet warriors, I know I shouldn't use RegEx for html. I'm using HtmlAgilityPack now.) I'm aware there are a lot of simi...

Path.Combine and the dot notation

I'm looking for something akin to Path.Combine method that will help me correctly combine absolute and relative paths. For example, I want Path.Combine(@"c:\alpha\beta", @"..\gamma"); to yield c:\alpha\gamma instead of c:\alpha\..\gamma as Path.Combine does. Is there any easy way of accomplishing this? Needless to say, I also want to ...

Getting Started with Sync Framework

I'm having some trouble getting started with the Sync Framework. In doing research, it looks like the Sync Framework is a better fit for what we need than replication or a custom-rolled solution. Basically, we need to keep some datasets synced from our central office with every store in the company to overcome shortfalls with crappy DS...

Creating a Dib by only specifying the size with GDI+ and DotNet...

I have just recently discovered the difference between different constructors in GDI+. Going: var bmp = new Bitmap(width, height, pixelFormat); creates a DDB (Device Dependent Bitmap) whereas: var bmp = new Bitmap(someFile); creates a DIB (Device Independent Bitmap). This is really not usually important, except when handling very l...

IDictionary<TKey, TValue> in .NET 4 not covariant

The IDictionary<TKey, TValue> in .NET 4 / Silverlight 4 does not support covariance, i.e. I can't do a IDictionary<string, object> myDict = new Dictionary<string, string>(); analog to what I can do with IEnumerable<T>s now. Probably boils down to the KeyValuePair<TKey, TValue> not being covariant either. I feel that covariance should...

Cannot copy file, even though FileIOPermission is granted in C#

I was trying out the FileIOPermission in Windows 7 in .NET 3.5. I have been a Windows XP user and was granted this permission as I was an administrator I wrote the following code, testing to see if I could write to C:\Program Files\Outlook...... static void Main(string[] args) { Console.WriteLine("Am I an administrator? " + new Win...

XamlReader of XPS files throws cannot find resource.

I trying to read in a XPS file with XamlReader.Load ( XMLReader ). Some XPS files read in and I can walk through perfectly. One of the XPS files I am working, that displays correctly in IE, gives the following exception: Cannot convert string '/png/1.png' in attribute 'ImageSource' to object of type 'System.Windows.Media.ImageSource'. C...

.net - AccessViolation when interacting with native DLL for the first time

This is a little bit of a weird one, and my first foray into the world of .net so I'm hoping that I'm missing something fundamental :) Background: I have a native/Qt c++ DLL that I am wrapping for use in .NET, C# in this case. I have a Qt app that uses this DLL successfully, without memory leaks, etc. I have created a c++/CLI wrapper...

.NET MVC links on IIS 5.1 produces 404 error when Wildcard mapping is implemented.

I have a simple MVC site with ActionLinks to content such as "FAQ" and "About Us". I have set up the virtual directory in IIS Manager and set the mapping (no wildcard mapping option in IIS 5.1) for ".*" to point to aspnet_isapi.dll. This allowed me to bring up the home page and view it. However, when I click on any of the action links, I...

Control.invoke and parent control

Hello, Lets say I have a form called MainForm and a control on it: somelabel. In order to access these controls from another thread I have to use Invoke method. e.g: somelabel.Invoke(...); However I can also access the label through the form like this: MainForm.Invoke(...) //Code for manipulating somelabel Is there any difference ...

Jquery postback, maintain same tab after postback

I'm using jquery tab and following js method, how and what can i modify it to maintain state of tab between postbacks? (This resets tabs to first tab after page_load) $(document).ready(function() { //When page loads... $(".tab_content").hide(); //Hide all content $("ul.tabs li:first").addClass("active").show(); ...

Does resizing a control in WPF resize its StackPanel?

I have a Canvas inside of a StackPanel in my WPF Designer in Visual Studio 2008. At runtime I plan to resize the Canvas so its client rect is a certain size (borders and other parts are just added onto that size). When I resize the Canvas, will the Width/Height of the StackPanel adjust itself accordingly? This is important since I have o...

DateTime day ending 24:00 (midnight)

I have a customer that wants to see midnight represented as the end of the prior day. Example var date = DateTime.Parse("1/27/2010 0:00"); Console.WriteLine(date.ToString(<some format>)); Display: 1/26/2010 24:00 I believe this is valid in the ISO 8601 standard. (see this) Is there any way to support this in .net (without an u...

xmlserializer not correctly deserializing schema with import

I've been trying to deserialize an xml file in C# with classes generated from schemas in xsd.exe. Unfortunately only part of the file is being properly deserialized, the rest is returned as null for reasons I can't work out. My process is as follows: Starting with the myschema.xsd file from which the C# code is generated: <?xml versio...

Acrobat Opening in Full Screen Mode

I am having an issue with displaying a PDF in an iframe in asp.net. When the pdf shows up it is showing up without the Acrobat toolbar that allows the user to zoom and print. This is causing a major hassle for our customers because they cannot read the PDF in the size that it is. If you try and set Acrobat to not show the PDF in the b...

Moonlight 2 vs Silverlight 3: huge performance gap

I have tried the simple test "Silverlight 2.0 animation test" at http://bubblemark.com, surprisingly Moonlight provided only 26 fps on Linux. Windows/Silverlight 3 gave me 192 fps on the exact same machine. Why is Moonlight so much slower than Silverlight? This performance gap is really important if you are planning to develop high fps,...

javascript and combo boxes

I have a combo box in a Form View and onchange i want to access a javascript function just as i'd normally do any drop down list. However, it doesn't seem to be even getting to the function function Showused() { alert('eric'); } <telerik:RadComboBox ID="RadComboBoxProvided" onchange="javascript: Showused();" runat="server" Widt...