110
голосов
13ответов
71581 просмотров

How to check if a DateTime occurs today?

Is there a better .net way to check if a DateTime has occured 'today' then the code below? if ( newsStory.WhenAdded.Day == DateTime.Now.Day && newsStory.WhenAdded.Month == DateTime.Now.Month && newsStory.WhenAdded.Year == DateTime.Now.Year ) { // Story happened tod...

3
голосов
1ответов
567 просмотров

Question about modal forms and threads

In the main thread I need to do the following: Create a second thread where I'll show a modal form that will act as an "activity indicator" Start a task (this task MUST be executed from the main thread) Close the modal form created in the second thread. The question is that I don't know how ...

4
голосов
1ответов
2686 просмотров

Java and .NET interop on (RSA) signatures

I'm signing some data on a .net-based smartcard and trying to verify that signature in a java environment - but without success. Smartcard (c#): RSACryptoServiceProvider rsaProvider = new RSACryptoServiceProvider(1024); // In a different method, rsaParams.Exponent and rsaParams.Modulus are set ...

0
голосов
2ответов
190 просмотров

can't understand these xml encoding woes

The following hunk of code (snipped for brevity) generates an xml doc, and spits it out to a file. If I open the file in Visual Studio it appears to be in chinese characters. If I open it in Notepad it looks as expected. If I Console.WriteLine it look correct. I know it's related to encoding, ...

4
голосов
6ответов
1218 просмотров

How can I design a class to receive a delegate having an unknown number of parameters?

I continuously find myself having to write timed windows services that poll outside queues or run timed processes. I consequently have a fairly robust template by which to do this, but I find that every time I write a service to do this, I start with the same template and then write the process ...

2
голосов
3ответов
226 просмотров

Casting problems with connected Generic classes

Here's a thinned out version of the classes I have. public abstract class BaseParent { } public abstract class ChildCollectionItem<T> where T : BaseParent { // References a third-party object that acts as the parent to both the collection // items and the collection itself. publi...

0
голосов
4ответов
1843 просмотров

how to send data over network fast?

i have lots of data like this 1:0x00a4c7d9fb3849... 2:0x79821309bd789c7689c97... 3:0x0178dce67fe898... they are more than 100 per second and speed is the most important thing(network is always busy). what should i use to transfer my data(tcp/ip, pipes, via, etc)? how should i serialize it(Binar...

4
голосов
2ответов
2461 просмотров

Script arguments and Embedded IronPython

I have an embedded scripting engine in my C# application that uses IronPython 2. I create the Python runtime and add a few classes to the global namespace so that the script can import them as modules. However, one (pretty basic) thing I can't figure out is how to send script arguments. I realiz...

0
голосов
2ответов
1428 просмотров

LinqToSql giving 'Specified cast is not valid'

I'm running a stored procedure through L2S and it's returning 'Specified cast is not valid'. The stored proc is returning data when ran manually and when I step thru it, everything is fine until it tries to create the row object in "foreach (var row in result)". var q = new db(); var result = q....

0
голосов
2ответов
200 просмотров

Winforms for a java swing guy [Applying MVC]

I am developing a GUI application in C# using the design mode in VS2008. Now that I am finished with the looks of the application I am ready to add some functionality to it. What really confuses me though, is that VS2008 designer only uses the empty constructor. When developing applications in J...

10
голосов
8ответов
28054 просмотров

How to get server domain name

Can anybody tell me how to get servers domain name in asp.net? (Environment.UserDomainName returns "IIS APPPOOL" string) Thanks for replays, but mostly they are about DNS name of the server, what I need is the domain name. For example when I login via windows authentication I type domain\us...

14
голосов
5ответов
6258 просмотров

Discard Chars After Space In C# String

I would like to discard the remaining characters (which can be any characters) in my string after I encounter a space. Eg. I would like the string "10 1/2" to become "10"; Currently I'm using Split, but this seems like overkill: string TrimMe = "10 1/2"; string[] cleaned = TrimMe.Split(new cha...

0
голосов
4ответов
110 просмотров

Casting woes with generic class which needs to know the specific value of T (out of a possible 30 different types) - is this scalable?

I am working with a 3rd party web testing API which has a Src property for image. What I need to do is say: if (t is HtmlImage) { // Do cast here. } // t is a variable of type T (my generic). However, my cast does not work. The cast is as follows: Controls.HtmlImage img = (Controls.HtmlImage...

2
голосов
2ответов
3767 просмотров

Why does my ASP.Net custom control render two id attributes on my first child control?

I'm writing a small ASP.Net custom control inheriting from CompositeControl. The control is just a panel containing two subpanels with a label in each subpanel. When rendered, I am seeing in the HTML source that the first child control of my custom control gets two id attributes - the first bei...

0
голосов
1ответов
885 просмотров

AJAX change in .NET 4: Sys.Services.AuthenticationService

I'm testing my existing apps in VS 2010, and ran into my first break. ASP.NET AJAX authentication support has changed. Sys.Services.AuthenticationService.set_defaultLogoutCompletedCallback(OnLogoutCompleted); This no longer works. "Sys" is defined, but "Sys.Services" is an undefined object. Do...

68
голосов
6ответов
20045 просмотров

System.Diagnostics.Debug.WriteLine in production code

I should probably know this already, but I'm not sure and I don't see it documented. I use System.Diagnostics.Debug.WriteLine quite often during the development process to be able to track changes to variables or exceptions as I'm debugging the code. This is meant to make development and unders...

4
голосов
2ответов
2309 просмотров

How do I create a queue browser (preview not consume) in C# for an ActiveMQ queue?

I'm using the NMS API for reading/writing ActiveMQ in C#, and I cannot find a way to preview the messages on a queue. I could read and rollback - but that'll make them DLQ eventually. In my previous life, TIBCO had a QueueBrowser object that could be used, and I think JMS had IQueueBrowser as w...

0
голосов
1ответов
110 просмотров

Read and Step into .Net Framework Source Code with VS 2005

I did ask whether this was possible in VS 2008 which was answered in Is it possible to Read and Step into .NET Framework Source Code. However my problem is that I am using 2005 and not 2008. Does anyone know whether this is possible please?? The reason I want to do this is to better understand...

2
голосов
1ответов
2256 просмотров

Load a .NET assembly from a COM ProgID without creating a COM object

A bit of an odd question and probably backwards from what most people want to do, but I'm trying to work around a legacy COM issue. I have two components, both of which are actually .NET assemblies, but for historical reasons one is loading the other as a COM object (the assembly is registered f...

-1
голосов
2ответов
351 просмотров

dynamic programming

Is it possible to use dynamic programming in MonoDevelop for developing iPhone applications using .net?

0
голосов
1ответов
239 просмотров

ASpxGridView Evaluation

I'm evaluating the AspxGridView. I'm interested in peoples experiences of it and whether they would recommend it. I'm also interested in any insight into the following Accessibility Support (to me it looks poor in this regard) The quality of the Xhtml outputted How to deal with change tracking...

-2
голосов
1ответов
253 просмотров

iphone application using xcode

Possible Duplicate: is there any way that we can develop application in .net for iphone can xcode be used to develop iphone applications using .net and is it compatible with windows

3
голосов
1ответов
494 просмотров

Order of calculation and iterations for physics engines

I'm writing a physics engine that uses Verlet integration, and i can't get some constraints to work right. Some (like a bond/weld constraint) are extra "soggy" and aren't stiff enough, while others (like an area constraint) are extra bouncy and send atoms flying. The code for my update ethod in ...

2
голосов
4ответов
306 просмотров

ServiceLayer or Controller?

I have gallery in my project. I save images on the hard drive but tags, descriptions, etc. I save to the database. Working with the database and data validation going through the service layer. Since the user has remove the image, the files will be removed from the hard drive and the record will...

1
голосов
2ответов
215 просмотров

Is the Workflow Foundation Storing State in Memory a Problem?

We have a contractor who has developed a system that uses the workflow foundation in .NET 3.5. One of my colleagues has concerns "around the workflow service storing state in memory and it possibly becoming out of sync with our underlying database". Are his concerns justified?

116
голосов
8ответов
268814 просмотров

How to read attribute value from XmlNode in C#?

Suppose I have a XmlNode and I want to get the value of an attribute named "Name". How can I do that? XmlTextReader reader = new XmlTextReader(path); XmlDocument doc = new XmlDocument(); XmlNode node = doc.ReadNode(reader); foreach (XmlNode chldNode in node.ChildNodes) { **//Read the attr...

1
голосов
1ответов
1802 просмотров

configure IIS 7.0 meta database issue

I am using IIS 7.0 + Windows Server 2008. Anyone has experience to configure the Timer_MinBytesPerSecond configuration items -- either programmatically or manually is fine? I also want to know how to check the current values for Timer_MinBytesPerSecond configuration items (either programmatically...

4
голосов
2ответов
565 просмотров

Retrieving an Expression from a property and adding it to an expression tree

I've tried to simplify this example, as the actual code I'm playing with is more complex. So while this example may seem silly, bear with me. Let's say I'm working with the AdventureWorks database and I decide I want to add a property called Blarg to the Product table that returns an expression...

4
голосов
3ответов
2565 просмотров

How do you upgrade Settings.settings when the stored data type changes?

I have an application that stores a collection of objects in the user settings, and is deployed via ClickOnce. The next version of the applications has a modified type for the objects stored. For example, the previous version's type was: public class Person { public string Name { get; set; }...

4
голосов
3ответов
125 просмотров

Should you have an interface for all objects/classes

As part of process improvements we are trying to ensure that all our projects have suitable unit tests, as there is a bit of education required in house I am trying ascertain what exactly is the best way to ensure we are making our classes as 'testable' as possible. I suspect that we will start...