.net

Document Viewer C# control

I want to create simple file viewer. What control should i use to view office documents (word,excel) in my application. ...

How to compress a string in .net c# and decompress it in flash as3?

Hi, I have to load a large xml in flash and I'm trying to send it compressed. To do that I tried to zlib compress the string and send it base64 encoded. In flash I turn the string into a byte array and use its uncompress() method. So far I tried: ZLIB.NET byte[] bytData = System.Text.Encoding.UTF8.GetBytes(str); MemoryStream ms = new ...

How can I programmatically determine the size of my desktop?

I'm trying to save / restore the window size, state and position of a System::Windows::Forms::Form and want to make sure that if the window was previously on another monitor and the app is started up when only a snogle monitor is available, that it puts itself somewhere on-screen. So how can I determine the current desktop size and whet...

When to use WCF data services and when not ?

For which applications or development scenarios the usage of WCF Data Services makes sense and when other technolgies are the better choice (for example WCF RIA Services, ADO Entity Framework, classical ADO.NET, simple services or whatever) ? ...

Proxy servers from a .net developers perspective

I was wondering if anyone can recommend a good book / web site / blog or article (anything!) that can help demystify the proxy, not in terms of its use as a product, but purely from a .net developers point of view. I know that in SOA systems, somewhere along the line you're bound to bump into a proxy, and this (in my experience) usuall...

Remoting set timeout

.Net remoting is used in my brownfield application. We decided to set timeouts for our remoting methods. System.Collections.IDictionary properties = new System.Collections.Hashtable(); properties["name"] = Ipc_Channel_Name; properties["timeout"] = 1 * 1000; IChannel clientChannel = new IpcClientChannel(properties, null); ChannelServic...

RedGate shows percents instead of milliseconds

I tried to compare RedGate performance profile on two different machines and to my surprise the on one RedGate shows milliseconds but no code text (there is no source) and on another it shows code text with percentage against worked lines. How can I see milliseconds? P.S. I am sure I picked Wall Clock in settings on both machines. ...

C++/CLI Explicitly Load Managed DLL at runtime (the equivalent of LoadLibrary for Unmanaged)

Problem 1: Is there a way to explicitly load a library at runtime instead of at compile time in C++/CLI. Currently I am using the .NET "Add Reference" at compile time. I would like to explicitly load a managed dll. Is there the .NET equivalent of LoadLibrary? Update: Thanks to Randolpho Assembly::LoadFrom example from MSDN Assembly^ ...

How can i return list looping select to monitor datagrid with linq?

How can i return list from looping select statements with linq. i need list<list<T>> but i dislike this method. how can i do that? public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { ISt...

PC Cursor (sometimes) stuck at SizeAll caused by Logitech G9

We've noticed some strange Cursor behavior, which we suspect is a result of one of our Cursor canging methods. Just sometimes, our pc keeps showing the SizeAll cursor. Everywhere, in every application. Now, we never use the SizeAll cursor anywhere in our code, but we can "Unstuck" the cursor when following code is executed. We suspect t...

Compare two list elements with LINQ

I'm trying to find a LINQ expression to compare two list elements. What i want to do is: List<int> _int = new List<int> { 1, 2, 3, 3, 4, 5}; _int.Where(x => x == _int[(_int.IndexOf(x)) + 1]); Unfortunately, only the last +1 jumps out of the list's range. How can I compare one item with its next in the list in a LINQ expression? ...

.NET 3.5 Web Application - Porting to 64Bit - Potential issues

Hi, I have an existing ASP.net 3.5 web application. This is tested and working in a 32 bit environment. There is a plan to move this application to a 64 bit environment. As a first step, the plan is to compile the entire application in "Any CPU" Is anyone aware of any plan / checklists that can be used in porting from 32-bit to 64-bit...

How should I concatenate strings?

Are there differences between these examples? Which should I use in which case? var str1 = "abc" + dynamicString + dynamicString2; var str2 = String.Format("abc{0}{1}", dynamicString, dynamicString2); var str3 = new StringBuilder("abc").Append(dynamicString).Append(dynamicString2).ToString(); var str4 = String.Concat("abc", dynamicS...

How can I append values to a 2D array?

I am new to MATLAB, and I can't fathom this from the documentation. function GotData(sender, args) interval = args.DataBlock.TimeIntervalInMicroseconds; doubles = args.DataBlock.AsDoubleArray(); x = 0; complexCount = length(double(doubles))/2; DATA = zeros(complexCount); for index = 1:(complexCount-1) rea...

How to get table name of a column from SqlDataReader

I have an SQL query I get from a configuration file, this query usually contains 3-6 joins. I need to find at run time, based on the result set represented by SqlDataReader, to find the name of the table for each column. Here are some thing that don't work: SqlDataReader.GetName returns the column name but not the table name. SqlData...

Rhino.Mocks produces InvalidCastException when returning polymorphic object

I'm using Rhino.Mocks 3.6 for the first time. I'm trying to create a stub for an interface that returns an inherited type (B). When I try to do this, it will generate an InvalidCastException trying to convert some proxy object to the base class (A). For example: class A {} class B : A {} interface IMyInterface { A GetA(); } // C...

Does .NET equal C#?

Does being a .NET developer mean knowing C# or mean knowing something else? What books should I read if I want to be a .NET developer? ...

Inject Array of Interfaces in Ninject

Consider the following code. public interface IFoo { } public class Bar { public Bar(IFoo[] foos) { } } public class MyModule : NinjectModule { public override void Load() { Bind<IFoo[]>().ToConstant(new IFoo[0]); // ToConstant() is just an example } } public class Program { private static void ...

Is it possible to call a function from and dotnet asseble from a MS SQL query?

Is it possible to call a function from and dotnet asseble from a MS SQL query? ...

Using many System.Timers.Timer objects

I have an application which makes use of System.Timers.Timer objects to do expirations and email notifications and such. Currently the system has a couple hundred timers alive at once, but we are going to be expanding the usage of the app and that number might start scaling into the thousands (probably no higher than 10,000). I can't fi...