|
If you don't trust your developers, fire them and hire new ones
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
Five bucks says you'll get the diagram wrong the first time anyway.
Then you'll be paying all your developers to sit around doing nothing while they wait for you to fix it.
|
|
|
|
|
ellllllllie wrote: dghdfghdfghdfghdgh
or maybe he needs to learn that randomly banging on a keyboard serves no useful purpose in software development
led mike
|
|
|
|
|
Thats what intellisense is for! It turns random banging into code
|
|
|
|
|
HAHAHHAA bad reply like you but funny.
If some one is old and don't know the new and the powerfull technologie don't say(it is better).
I mean if i have an uml diagram and i wanna to create the corrsponding code so i think that it is possible to limit my classes to the uml diagram maybe by creating this diagram in .net ....
so if someone know the right answer .... if not let his tangue inside his mouth
dghdfghdfghdfghdgh
|
|
|
|
|
does it a reference to learning logical data center for visual studio
dghdfghdfghdfghdgh
|
|
|
|
|
|
So I'm trying to find a way to bind CheckBox::Enabled to an expression that looks at a unary operation of a column in two rows of a DataTable that I'm pulling using an XSD generated by VS2005. I know I can do this through a validation event, however I'd like to do it through the designer if at all possible.
Pretty much I'd like to bind checkboxobject.Enabled to:
(someDataRow["column"]==value || nextDataRow["column"]==value)
Any thoughts on how I might be able to do this?
|
|
|
|
|
Without knowing what the conditions are to either turn on or off the checkbox. If its where value equals true....
if(someDataRow['column'] == true || nextDataRow['column'] == true)<br />
checkbox.Enabled = true;<br />
else<br />
checkbox.Enabled = false;
or you could use...
checkbox.Enabled = someDataRow['column'] == value ? true : false;<br />
if(checkbox.Enabled == false)<br />
checkbox.Enabled = nextDataRow['column'] == value ? true : false;
There are many ways to accomplish this task, good luck.
Just because we can; does not mean we should.
|
|
|
|
|
BAH!!
I've already done this. I can just set a filter in a binding source and bind Enabled to any column containing a positive integer value in that source.
Thanks for your input KK. If I wind up putting code in the validation event, that's probably what I'll do.
|
|
|
|
|
Hello there,
i am using a Whirlpool hash function on a password resulting in a 512bit digest.
then with this digested pass i am encrypting data with Rijndael(256bit).
Considering that the digested hash is double the size i need .Should i :
a) double encrypt my data (the data i am talking about is relatively short max 100 char)
b) encrypt it once using an algorithm to select 32bytes out of the 64bytes of the digested pass
c) find an other hash generator
d) use a 512bit encryption
for c) and d) can you point me somewhere where i can find such algorithms implemented in c#.
Thank you all for your help.
ps: sorry for posting the same in two forums, but i think that it belongs to both.
|
|
|
|
|
If you're happy with everything else just change the hash, MD5 is 32byte(256 bit)
Here[^]
Dave
|
|
|
|
|
MD5 is not recommended since 1996. But thank you anyway.
|
|
|
|
|
REBD wrote: MD5 is not recommended since 1996
? It's still in wide use in many production environments.
You could just use half of the 512bit hash you already have.
Dave
|
|
|
|
|
DaveyM69 wrote: ? It's still in wide use in many production environments.
Which does not imply you should still use it for newer applications.
modified 12-Sep-18 21:01pm.
|
|
|
|
|
true, no other suggestions or ideas ?
There is a difference between knowing the path and walking the path.
|
|
|
|
|
MD5 is fine for this application. The algorithm you are using to turn the password into the key has to exhibit a good random distribution (dispersion I think the term is), which MD5 does fine.
With the current weaknesses in MD5, if someone knew the password and the key they may be able to construct another password that hashes to the same key. (Thats with one round of MD5, I'm pretty certain that with two rounds they would be pretty close to stuffed).
If giving the password a bit of the ol SHA1, base64ing that and MD5ing the result makes you feel better, then do that
|
|
|
|
|
After a Linq discussion here a couple of days ago I found that
foundCollection = this.FindAll(data => data.ID > 0);
or
foundItem = this.Find(data => data.ID == ID);
inside a generic list was faster then using foreach.
I now want to use a method of the single item's class (data.ToCustomListViewItem) and return List<CustomListViewItem>
Is this possible?
I can do it using a foreach but would rather use an expression like those above.
Working example using foreach
public List<CustomListViewItem> CustomListViewItems()
{
List<CustomListViewItem> ReturnList = new List<CustomListViewItem>();
foreach (DVD thisDVD in this)
{
if (thisDVD.ID > 0)
{
ReturnList.Add(thisDVD.ToCustomListViewItem());
}
}
return ReturnList;
}
Dave
|
|
|
|
|
First, the performance gains by using FindAll or Find instead of a foreach are probably minimal, and not worth rewriting swaths of code. That said, you should use LINQ to imrpove readability of code. Also, the declarative nature of LINQ opens the door for real optimizations like PLINQ[^].
To answer your question, couple ways you can do this:
var listViewItems = from movie in dvds
where movie.ID > 0
select movie.ToCustomListViewItem(); That uses LINQ extension methods and should work just fine.
Another way is to use methods on your List<T> object itself:
List<DVD> dvdsWithPositiveId = dvds.FindAll(movie => movie.ID > 0);
List<CustomListViewItem> listViewItems = dvdsWithPositiveId.ConvertAll(movie => movie.ToCustomListViewItem());
|
|
|
|
|
Thank you for your response. The ConvertAll method may be what I was looking for. I'll try it now!
I did some benchmark tests and Linq performed consistantly 30% slower than a foreach but the second method (is this 'lambada'?) performed 20% faster than a foreach loop. That was simply searching for one objects ID property within a collection of objects.
Dave
|
|
|
|
|
LINQ is using lambda expressions as well. A lambda is essentially just a function you pass into another function. Both examples I gave were using lambdas under the hood.
The reason the List<T> methods may be slightly faster is because they've tuned it to a specific implementation (which is an array under the hood). The LINQ stuff might work slower because it doesn't know about any specific implementation; all it knows about is that it's working on IEnumerable<T> , which means it have to use a foreach to iterate over it, which is fast, but perhaps not as fast as List<T> highly optimized implementation as you point out.
Another thing to keep in mind is that because LINQ is declarative, it opens up real big optimizations that can happen under the hood. For example, say you have a quad processor. Given the following code:
var listViewItems = from movie in dvds.AsParallel()
where movie.ID > 0
select movie.ToCustomListViewItem();
Your query will now run approximately 4 times as fast as your List<T>.FindAll call, thanks to multiple cores. And since we'll be seeing more and more cores in the future, the above query will keep running faster and faster the more cores become available, with no extra work on your part. (A MS guy recently said Intel supplied them with an experimental 32-core desktop processor. When the day comes that we're all running 32 core processors, the above code will run about 32x as fast as List<T>.FindAll .)
.....Now, in regards to optimizing your code....
30% sounds good, but it may not be that big in practice. For example, if a foreach over your DVD collection takes 10 milliseconds, and a List<T>.Findall takes only 7 milliseconds, that's a 30% difference, but that's an indistinguishable 3 milliseconds to the end user. Big woop. Unless that code is in a hot loop being called millions of times, it makes no difference whether you use foreach, LINQ, or some List<T> method call.
My advice is this: make your code readable before doing optimizations, and optimize only the stuff that really matters. In this case, List<T>.FindAll and List<T>.ConvertAll is only slightly less readable than the LINQ version, so do what you please. But bear in mind, these kind of micro-optimizations are more or less worthless -- it's much more important to write easily-readable code.
|
|
|
|
|
Points taken and all lessons learnt!
Thank you for taking the time to explain it thoroughly. I'll persevere with my LINQ (and now PLINQ) leaning
Dave
|
|
|
|
|
How do I add PLINQ? Google has turned up System.Concurrency.dll or the standard System.Threading. I can't find System.Concurrency.dll and even though the System.Threading namespace is available I can't find PLINQ anywhere and Object Browser says it can't find it or the AsParallel() method.
I'm using Vista running VS2008/.NET 3.5
Edit: Here[^], Parallel Extentions if anyone else is looking!
Dave
modified on Wednesday, February 13, 2008 6:44 PM
|
|
|
|
|
Looks like you found it. Keep in mind PLINQ is in CTP -- early preview release, it's by no means finished. It will probably be included in .NET 4. But if you're using LINQ today, it will be easy to move to PLINQ in the future.
|
|
|
|
|
Is their a way to sort of serialize the data of a WPF richtextbox to save the formatting of the text in the control so it can be sent to an Access Database? I am working in the .NET framework 3.0.
Any help would be much appreciated
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|