Ganeshkumar S's Q&A profile
.NET Development How to wrap 'if(foo) Throw new Exception()'
Hi, I am working on a new project... now, I normally like to bullet-proof my code with Debug.Assert() statements... However, I'd like to do a similar thing, only instead I'd like an Exception to be thrown if the assertion is false... I tried making this function: Public Shared Sub AssertThrow( ByVal assertion As Boolean , ByVal exception As Exception) If Not assertion Then Throw exception End If End Sub Now, the way I use this is like this: instead of If Not (1+1=2) Then Throw New Exception("I am really bad at math") End If AssertThrow(1+1=2,new Exception("I am really bad at math") This works great, just as expected - the problem though, is that there i ...Show All
Commerce Server Discount Priority???
I want to apply all the discounts maintained below: 1. Contract Discount 2. Product Discount 3. Order Threshold Discount 4. One of the lowest rank discount among some other discounts. How can I handle this situation in the Commerce Server Hi Sachin, What do you mean "find min rank in the discount" Discounts all have a priority and are applied from highest priority (lowest number) to lowest priority (highest number) See All Discounts -> Set discount priorites in the Marketing Manager UI. The source code for the Order Discount component is not available. What are you trying to do that it does not implement Thanks, David ...Show All
Visual C# Accessing the methods of a generic parameter
This has me stumped: public XmlElement AddChild<T>( ref T parent) where T : XmlNode { XmlDocument d = ( typeof (T).Equals( typeof ( XmlDocument ))) d = parent : d = parent.OwnerDocument; } why does this fail to function XmlDocument is derived from XmlNode and it has a method called CreateElement which XmlNode and other derivatives do not. Now I'd like to pass in a node of any particular type and create child beneathe it so I need access to the XmlDocument object. I could do and was doing it, by passing it explicitly as in: public XmlElement AddChild<T>(XmlDocument document, ref T parent) where T : XmlNode But, it turns out that the XmlNode derivatives all have a property named OwnerDocument which ident ...Show All
Visual Studio Team System MS Project - Seeing all information about a WI in Project
In MS Project, is there a way to see ALL information about a Work item I know if you get an error while publishing it will display a box with all the information about that work item, but I have only seen that box when getting an error. (The box contains all history, description, title's etc.. something you'd see in Visual Studio almost). Is there a way, a command, or anything, to get that box to show up on demand It would be so helpful, and would stop my boss from having to put the WI # in a web page to view the details. (His laptop is so bad it smokes when running visual Studio). Here's a surefire way to get this screen: -Open up project -Get a list of WOrk Items -Change the Resources Names to something like: RYan Tern ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Mouse Events
How can I set up the mouse so that when I click on an object that it rotato 90 deg each time. Dose any one know how to to mounted aobject to a other object 2D or 3D What do you mean "mounted object" Have an object move when another moves Sounds like you want a parent/child relationship - make one object a member of the other and update the child after updating the parent. ...Show All
Visual Studio 2008 (Pre-release) Metadata Exchange Not Working In IIS?
I want to display the metadata similar to a wsdl. I read that you should address your service that is being hosted in IIS like so in order to get the metadata http://localost/myfirstservice/service.svc/mex . However I keep getting page not found. Here is my configuration settings in my web.config file: < system.serviceModel > < services > < service name = " MyService " behaviorConfiguration = " MEXGET " > < endpoint binding = " wsHttpBinding " contract = " IMyService " /> < endpoint address = " mex " binding = " mexHttpBinding " contract = " IMetadataExchange " /> </ service > </ services > ...Show All
Game Technologies: DirectX, XNA, XACT, etc. Why is Game not a singleton?
I'm a bit puzzled by this - why is the game class not a singleton, i.e. there is and can be only ever one instance of it. I can't quite see any sensible reason to have more than one of them, but as it doesn't seem to be a singleton, I have to hold a reference to it anywhere I want to access game services from. Otherwise I could have just written Game.Instance.Services when I wanted access to them. Or perhaps I have missed something obvious (I know I can make my class that is derived from Game use this pattern, I'm just curious as to why it wasn't done like this in the framework in case I shouldn't be doing it either). Fluxtah wrote: Is there a reason you dont want to do th ...Show All
.NET Development Visual studio .NET 2003 and the compact framework 2.0
Is the compact framework 2.0 compatible with .NET 2003 I installed the 2.0 SDK/compact framework. But if I try to reference it, first I have to browse to find it (system.dll for instance) in the 2.0 folder. Then I get an error message. Is there something that has to be done to tell Visual studio to use 2.0 instead of 1.0 Thanks in advance. ...Show All
Visual Studio Express Editions Long Delays when accessing files
Anytime I attempt to retrieve a file, or save one, VB2005 Express first does a real long access to to net, sometimes it's so resource intensive it freezes my computer, then eventually alows me to continue navigating to the file. If I disable my network adapter it acts normally. What is ittking for and how do I make it stop. After a great deal of trouble I was finally able to uninstall all "express" packages from my computer. I will have to wait for a computer to become available in order to reinstall them on a non-production computer. That's a pity, though, as I desperately wanted to learn VB.NET and start this project using only that and SQL. ...Show All
Software Development for Windows Vista More vista bugs ? How do you determine if UAC is enabled ?
Hello, Just testing with Vista RC2 (downloading RTM as I write this) and I would like to know if anyone knows how to correctly determine in a c++ program whether UAC is currently enabled on the machine Also when UAC is turned off, and one is not logged in as an administrator, "RunAs" in ShellExecute() no longer seems to allow the execution of a task as a full admin. This seems to apply to Microsoft's own applications too. Try running the task manager (CTRL+Shift+Esc) on a none admin account, with UAC turned off, and then click on the shielded "Show processes from all users" The task manager restarts itself, and nothing else happens. If the shielded button does not work, then why is it shown A jolly poor show IMHO. Jus ...Show All
Visual C# Enum.Equals vs ==
Hi, I have another newbie question. I was looking at documentation for the ' Enum.Equals() ' method at the msdn2 website, Enum , and I was wondering what is the difference between using something like; enum Mammals { Cat, Dog, Horse, Dolphin }; Mammals myPet = Mammals.Cat; Mammals yourPet = Mammals.Dog; if (myPet.Equals(yourPet)) { } // and this statement if (myPet == yourPet) { } Does one method have an advantage over the other At the msdn2 website they don't even mention "==" in the documentation. Which method is the acceptable standard and considered a best practice Thanks, Erica Enum.Equals is declared as "bool Equals(object)" which means that enum value passed in would need to be boxed &a ...Show All
SQL Server Log Shipping will not restore tran logs on secondary server
We're planning to implement log shipping on our databases, and I have been toiling with it all weekend trying to get it to work on some test databases. The result is the same whether I do it via the wizard or manually via T-SQL. I am using 3 servers, all SQL Server 2005 Standard SP1. All 3 SQL Servers are configured identically. When I setup log shipping, it initializes with no problems. When it processes the first tran log file, it restores it with no problem. Every successive log file thereafter is not restored. No errors are generated. The only outright indication of a problem is that the monitor server shows that there has not been a recent restore. The backup and copy both suceed. The restore claims to suceed. If I review the ...Show All
Windows Forms How can I catch the enter key throughout my application?
I have an application with several forms, panels and user controls. The application uses a barcode scanner. Whenever a barcode is scanned, my application receives a string followed by the enter key as if someone would have typed the barcode with the keyboard and would have hit 'enter' when done. I added an OnKeyDown event to a list view that I have in a panel to grab the barcode. The problem is that if the focus is not given to the list view, the scan is lost. In my case, there is not a single spot where I could place the OnKeyDown event handler to fit all cases. I need to have a single handler across the entire application, how's that possible I would prefer not to use a timer to constantly give the focus to a certain control which ...Show All
Visual Studio 2008 (Pre-release) Locking Hints and LINQ
Hi there, is it possible to do locking hints like NOLOCK or pessimistic locking hints in DLINQ and LINQ for Entitities as well as in eSQL Thanks Tim Hi, Though the code snippet doesn't show the other operations performed on the associated connection, the error message suggests that you have pending results associated with another query (open datareader) on the same context/connection. Since this thread doesn't specify any requirements, let me list out various options here to get around this problem: 1. Let's say, you want to deal with two queries within one context, you need to make sure MARS setting is enabled in the connection string (supported with MS SQL Server 2005 or higher). Make sure ...Show All
Visual Basic Game Nim
Hi guys i have a problem a am working on a code for the game Nim and i am so far done but there is a litle problem i dont know how to write the code for who wins. player or Computer. Please help me with that. The game generates a random number between 15-30 and the player and the computer have to take 1 2 or 3 stones. the one who takes the last stone lost. Public Class Form1 Private Sub cmdDone_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdDone.Click 'Terminates The Program Me .Close() End Sub Private Sub cmdnew_Click( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdnew.Click 'Generates Random Numbers Betwe ...Show All
