|
Thanks PIEBALDconsult both of those answers may be of some use, I must admit to leaning towards the dictionary simply because its a) simple b) can hold as many statuses as the user may want to create.
Admittedly not sure how the end developer may interact with the dictionary but perhaps thats me just being dumb as not coded it yet.
|
|
|
|
|
int[][] num = {
int[]{0, 4, 3, 4},
int[]{1, 3, 0, 0},
int[]{0, 0, 0, 0},
int[]{3, 1, 3, 0}
};
how to use LINQ to found that follow the location (vertical)
0,0
1,0
2,0
3,0
In case, result is 2;
How to count the value larger than zero?
|
|
|
|
|
try:
from n in num
from z in n
where z > 0
select new Point(n,z)
|
|
|
|
|
|
Give this a shot. The tough part was trying to figure out how to get the indexer (using Select func)
var q = from n in num.Select( ( a, index ) => new { IX = index, Arr = a } )
from z in n.Arr
where z > 0
select new {
RootIndex = n.IX,
Value = z
};
This'll flatten out the matrix and only return index/values where value > 0
|
|
|
|
|
I've a application running now with a database connection and wanna make a deployment of it
I tried much things. So that's why I'm asking now is there a easy guide to follow where I can see what to do.
My connection string is hard coded, after I deployed the application it's still hard coded what is the way to let the Data Source (Computer Name) change automaticly to the new computername where it is installed?
(return @"Data Source=KONING-AF02EAF7\SQLEXPRESS;Initial Catalog=KringVrienden;Integrated Security=True";)
SofwareI'm using:
Visual Studio 2008.
SQL Server 2005
SQL Management Server 2005
Please help me.
Dennis,
|
|
|
|
|
I am assuming that each of your target machine has a db server installed.
In your program use System.Environment.MachineName to get the machine name. Use this instead of the hard-coded machine name in your connection string.
Hope this helps.
|
|
|
|
|
Rather than including your development machine name, simply use ".\SQLEXPRESS" or "(local)\SQLEXPRESS" as this will point to instance "SQLEXPRESS" on the local machine.
|
|
|
|
|
what is meant by threading? Muhammad Farooq Qadri, Ghousia Public School and Ghousia Institute of Fast Technology (GIFT), Khuiratta Azad Kashmir
Muhammad Farooq Qadri, Khuiratta AJK
|
|
|
|
|
Dude,
You've posted this FOUR times.
http://msdn.microsoft.com/en-us/library/3e8s7xdd(VS.71).aspx
Regards,
Rob Philpott.
|
|
|
|
|
Well, its like posting the same question several times. I would suggest you go to google and try there, there are over 500,000 articles.
Bob
Ashfield Consultants Ltd
Proud to be a 2009 Code Project MVP
|
|
|
|
|
what is meant by threading? Muhammad Farooq Qadri, Ghousia Public School and Ghousia Institute of Fast Technology, Khuiratta Azad Kashmir
Muhammad Farooq Qadri, Khuiratta AJK
|
|
|
|
|
what is meant by threading? Muhammad Farooq Qadri, Ghousia Public School and Ghousia Institute of Fast Technology, Khuiratta Azad Kashmir
Muhammad Farooq Qadri
|
|
|
|
|
|
code project is really a big project, working for IT development. Muhammad Farooq Qadri, Ghousia Public School and Ghousia Institute of Fast Technology, Khuiratta Azad Kashmir
Muhammad Farooq Qadri
|
|
|
|
|
|
string str = null;
can u tell, In the above line of code, what shall be teh memory consumption by the variable str
|
|
|
|
|
Well, str is a reference type which doesn't reference anything, so it will be just the size of reference itself. I think this will be 4 bytes for the reference itself, and a further 8 for synchronisation and other .NET internal stuff. So, likely 12 bytes.
Regards,
Rob Philpott.
|
|
|
|
|
Rob Philpott wrote: and a further 8 for synchronisation and other .NET internal stuff.
Can u please tell where should i read the detailed meaning of the above quoted line ?
|
|
|
|
|
Actually, I got that wrong. The extra 8 bytes would be on the heap if your reference was not null. So, just 4 bytes on a 32bit machine. Trying to find a good reference for this stuff now.
Regards,
Rob Philpott.
|
|
|
|
|
Can't find anything on the net I'm afraid. I'm sure there's lots out there if you look around though. Also, consider reading one of Jeffrey Richters books - they are excellent on this sort of stuff.
Regards,
Rob Philpott.
|
|
|
|
|
|
Dear techies..
Nice if you could please help me with sorting an arraylist i have which contains objects of type 'card', which inturn contains 2 enums - rank and suit.
The arraylist normally contains 7 card objects. eg :
spades 3, hearts 4, spades 1, diamonds 4, spades 2, clubs 4, spades 4
The sorted arraylist should be like:
spades 1,spades 2,spades 3,spades 4,clubs 4,hearts 4,diamonds 4 - with the suits together with sorted ranks
Many thanks in advance..
|
|
|
|
|
|
You want to call .Sort on your ArrayList, the problem being though that Sort doesn't know how to compare two cards in order to do the sort.
To tell it this, you'll either need to extend 'card' to implement IComparable, or create a new seperate class which implements IComparer. Either way, you'll need to create a method which compares two cards. Compare suits first, and then if they are the same, the 'rank'.
Regards,
Rob Philpott.
|
|
|
|