Validating C# base class constructor parameter

After running Code Analysis in VS2010 beta (FxCop for previous versions) I’m getting the following warning: In externally visible method ‘Identity.Identity(WindowsIdentity)’, validate parameter ‘windowsIdentity’ before using it. The constructor is: public Identity(WindowsIdentity windowsIdentity) : base(windowsIdentity.Token) { init(); } for a class defined as: public class Identity : WindowsIdentity My question is, how do I validate … Read more

Value from last inserted row in DB [duplicate]

This question already has answers here: How to get a value from the last inserted row? [duplicate] (14 answers) Closed 8 years ago. Is there some way to get a value from the last inserted row? I am inserting a row where the PK will automatically increase due to sequence created, and I would like … Read more

Designing a conditional database relationship in SQL Server

I have three basic types of entities: People, Businesses, and Assets. Each Asset can be owned by one and only one Person or Business. Each Person and Business can own from 0 to many Assets. What would be the best practice for storing this type of conditional relationship in Microsoft SQL Server? My initial plan … Read more

How to access mysql database using shell script?

Is there a way I can access MySQL database using shell script? want to do some selects and some inserts on multiple tables? It will be great if you can give some sample code as I am new to scripting. Answer This link seems to have the information you want. mysql -u user -p … Read more

How represent multiple similar foreign keys in ERD database diagram?

I’m making an ERD of my database, and am stuck with a little dilemma. Consider the tables foo and bar. foo has three columns that are foreign keys, referencing to bar‘s primary key. My question is: in the ERD do I represent this with just one line between those two tables, or do I use … Read more

Multimap Space Issue: Guava

In my Java code, I am using Guava’s Multimap ( by using this: Multimap<Integer, Integer> Index = HashMultimap.create() Here, Multimap key is some portion of a URL and value is another portion of the URL (converted into an integer). Now, I assign my JVM 2560 Mb (2.5 GB) heap space (by using Xmx and Xms). … Read more

What to use for Size argument in Database.AddOutParameter when returning a string?

I’m getting a string as an output parameter, and need to know what to set for the Size argument in the call to AddOutParameter. I know I could just use some huge number, like int.MaxValue, but want to know best practices. In SQL Server, the column is actually a uniqueidentifier type. The T-SQL statement being … Read more

Incrementing values in django database

I want to increment the value in the database without having to perform a hit on the db to find the actual value. Effectively, I would like to do something like this… but this does not work. Any elegant solutions? P.objects.filter(username=’John Smith’).update(accvalue+=-50) THANKS! Answer Check out Django’s F() object. You can combine it with update() … Read more