16,004,564 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Henning Dieterichs (Top 38 by date)
Henning Dieterichs
7-Feb-14 13:39pm
View
Reason for my vote of 3 \n In an article about cloning objects, you should at least mention the ICloneable interface. Besides, your CloneFrom method should be virtual, so that CloneFrom behaves still as expected in derived classes. Even more, the method should not clone from another object, but create and return a clone of its own (simply "Clone" instead of "CloneFrom"). This way your clone method behaves polymorphic: The caller does not have to know the concrete type of the object to clone.
So
var a1 = new A(); var a2 = new A(); a2.CloneFrom(a1);
will become
var a1 = new A(); var a2 = a1.Clone();
Henning Dieterichs
2-Nov-12 5:25am
View
Does nobody has any hints / ideas? Or do I have to write my custom xml-editor?
Henning Dieterichs
26-Jun-12 11:58am
View
Now it is published:
http://www.codeproject.com/Articles/404573/Units-of-Measure-Library-for-NET
Henning Dieterichs
26-Jun-12 11:46am
View
Maybe indeed, the point is not clear enough:
I want to get this:
H:\Informatik\C#\SharedAssemblies\HDUnitsOfMeasure\HDUnitsOfMeasureValidator\bin\Debug\HDUnitsOfMeasureValidator.dll
from this:
<ProjectReference Include="..\HDUnitsOfMeasureValidator\HDUnitsOfMeasureValidator.csproj">
<Project>{50D3B367-102B-45E9-8917-C7F7D0BC6565}</Project>
<name>HDUnitsOfMeasureValidator
</ProjectReference>
Henning Dieterichs
14-Jun-12 18:22pm
View
Thank you for your response!
I want to resolve the "project-reference" into an assembly:
Through the "ProjectReferences" property of my task, I get only an array of ITaskItem.
But how can I get the file path to the assembly (i.e. the compiled project in the same solution) from this ITaskItem object?
There is no property like HintPath, in contrast to the normal "References" ITaskItem.
Henning Dieterichs
13-Jun-12 9:54am
View
I will publish my implementation soon here on codeproject.
The system can convert (only by knowing the basic units and their factors) from km/h to mph or meters per seconds, or from centiliter to cubicmeter (I never got it right in math education ;))
My units of measure library will have another (currently top secret) feature, which is depending on this question (http://www.codeproject.com/Questions/403187/MSBuild-Resolve-Project-Reference-to-Assembly), maybe you can imagine what it will be.
Henning Dieterichs
13-Jun-12 9:25am
View
Ok, I've reconsidered your answer, see my solution below.
Henning Dieterichs
13-Jun-12 3:28am
View
Hi, thank you very much for your answer!
The idea sounds good, but I think it gets to complicated when complex units are defined (e.g. km/h or mph), which have multiple parents...
And complex types can have children, too (cubicliter, e.g.).
Greetings,
Henning
Henning Dieterichs
9-Jun-12 14:48pm
View
And what is your question?
I don't understand your problem...
Maybe "Url-Encoding" is a point which could help you.
Henning Dieterichs
20-Apr-12 5:32am
View
I think you have misunderstood the concept of clients/servers (since my explanation is very short, I recommend you reading some network tutorials):
You cannot connect to a TcpClient, as a client is only a client. Use a TcpListener ( = Server), which can be bound to a port and is able to accept multiple clients (AcceptClient or something like this).
Then multiple TcpClients can connect to the same endpoint.
Henning Dieterichs
18-Apr-12 10:11am
View
You shouldn't send the password via SendKeys. Not only because it will be very easy to write a Key Logger (simply watch the windows messages), but also because the password will be sent in plain text and if the browser-window looses and an editor gets the focus, everyone can read the password.
There are only some rare cases, in which this method can be useful, e.g. in a digital password safe like KeePass.
Maybe you should consider writing a browser extension.
Henning Dieterichs
17-Apr-12 16:48pm
View
With this you set the entry (object/)point, not the startup window.
If you change the startup object in WPF, nothing will work anymore.
Henning Dieterichs
12-Apr-12 7:47am
View
What do you mean with "that should stop"?
And how these ten parts should be arranged within this circle?
Henning Dieterichs
11-Apr-12 4:25am
View
If you would show your WSDL, maybe we could help...
But in principle WSDL types != C#-types, Visual Studio maps them. Structs in C# are represented as Sequences in XSD-Schema (WSDL types).
Henning Dieterichs
10-Apr-12 18:20pm
View
We answered in the same second ;)
Henning Dieterichs
2-Apr-12 18:52pm
View
I know this...
My question was not to view the value, but to view the binary representation in memory. But for that I need the address of this variable.
Henning Dieterichs
2-Apr-12 18:50pm
View
Where do I have to type the variable?
>> I already discovered the memory view, but it is only possible to jump to reference-types (like class-instances) by typing the variable name into the address field.
Henning Dieterichs
29-Mar-12 18:35pm
View
Maybe I am the best (yes, pride goes before a fall :) ), but my second solution is not...
This lambda expression is bad, as the intermediate step with "select" is an ugly hack (better: write your own sum-extension-method method which passes both index and value).
Lambda in C# is nothing more than "=>" which represents an anonymous function.
So my first solution is already a complete lambda expression.
What you wanted, is using the default LINQ (language integrated query) in connection with lambda, which is realized through extension-methods on IEnumerable<t>. For LINQ you have not to use lambda-expressions and for lambda-expressions you dont have to use LINQ.
As the most LINQ-extension-methods on IEnumerable<t> returns again IEnumerable<t> and take a Predicate (= Func<t, boolean=""> = delegate boolean (T element)) you can do some cool stuff.
If you want to learn lambda-expressions and LINQ, you should play around with them: define an array (e.g. int[]) and look what methods Intelli-Sense suggest you.
Greetings,
Henning
Henning Dieterichs
29-Mar-12 12:19pm
View
See my update. Not very nice (as it is not really sense-full), but should work.
Henning Dieterichs
29-Mar-12 8:34am
View
http://en.wikipedia.org/wiki/SQL_injection
Henning Dieterichs
29-Mar-12 8:07am
View
You have to check for errors. If an error occur, you have to display it (and only then you can fix it).
Otherwise you get something like "expects parameter 1 to be resource", and you won't get the real error message. The solution you accepted says the same but guesses the error. Don't guess - display the error!
For SQL-Injection read the wiki-article I've linked. If you don't want to read, tell me the URL of your script and you will experience what SQL-Injection is ;)
Henning Dieterichs
29-Mar-12 7:36am
View
CAUTION: Your code is vulnerable to SQL-Injection (see here: http://en.wikipedia.org/wiki/SQL_injection) attacts!
Henning Dieterichs
27-Mar-12 17:40pm
View
Hey!
Who has downvoted my answer?
Is this not that correct solution?
Or is my answer more unprecise as the question?
42 is the only answer to such a question, as the questioner himself did not know the question...
Henning Dieterichs
27-Mar-12 17:17pm
View
No you haven't!
Signing is nothing more than a range where the number is defined to be negative.
The internal representation for -1 is 11111111 11111111 11111111 11111111. If you had used an ulong this would be twice as 01111111 111[...]111 (very big). If you had used an long this would be exactly as big but negative.
So it does not matter whether you have signs or not (at least for the algorithm itself).
And you don't have to reconsider your algorithm!
Henning Dieterichs
27-Mar-12 15:59pm
View
It is saving space ;)
If you know the distribution, you can save space. Nothing else does zip or rar.
But if the distribution is uniformly (i.e. no entropy), in the sum you wont save space (so exe-files cannot be compressed really).
If the distribution is log(n) or something like that, it is more possible that smaller values occur than bigger.
So it will be more frequent that 1 byte (best case) will be written instead of 5 (worst case).
The clue is that the first bit says whether the data will be continued. If the first bit is zero, the value can be reconstructed.
So it is even possible to extend you charset (if you map chars to numbers),as you can represent any large numbers (you could append as much bytes as you want).
I think UTF-8 does something similiar.
If you want examples:
187: 00000000 00000000 0000000 10111011 -> 10000001 00111011 (saving 2 bytes)
597: 00000000 00000000 0000010 01010101 -> 10000010 01010101 (saving 2 bytes)
6: 00000000 00000000 0000000 00000110 -> 00000110 (saving 3 bytes)
- 1: 11111111 11111111 1111111 11111111 -> 11111111 11111111 11111111 11111111 01111111 (one byte lost)
And because of the leading continue-flag you can clearly read it back!
(1 at the beginning of each encoded byte means read it further, 0 means stop here)
Henning Dieterichs
27-Mar-12 15:47pm
View
Hi!
>> makes it incompatible
It is totally equal, that is what I claim.
The "and" will remove all bits but the last 7. The "or" will set the first (i.e. the 8th from right) to '1'. The "(byte)" will remove all bits but the last 8.
So you can leave the "and", as the "(byte)" does already the job and the or sets the first bit anyway to '1'.
Henning Dieterichs
27-Mar-12 14:29pm
View
That is something else.
>> then it will always require 4 bytes
That is not exactly true as you can do some tricks, if you know that value is more often smaller than bigger you can actually save some bytes...
Read my solution.
Henning Dieterichs
22-Dec-11 16:15pm
View
In which way this is a total different "paradigm" (assuming the use of this is not exaggerated so that the object does (or is) nothing)?
I would call it "seperation of concerns" as differnt domains can have independet properties on model-objects.
And that attached properties are totally foreign to .Net is not exactly true:
Extension Methods are in principle the same - and are very usefull when you want to avoid dependencies.
Beside this: My solution is only an alternative - it doesn't mean that I would use this in every case, but there are cases, in which this could be really helpful.
Henning Dieterichs
21-Dec-11 16:48pm
View
>> I'll do better to know the answers before I ask
Even worse: When you know the answer you shouldn't ask ;)
The human beeing isn't able to know all the answers, but there is some basic knowledge for each topic he should know before asking. So I recommend you reading some basic tutorials for C# or at least C.
Henning Dieterichs
21-Dec-11 13:44pm
View
I dont know, you have written that code...
Generally " means string, : means conditional expression in connection to ? - which both are nonsense in a for-loop...
Additionally the "" in the second line makes no sense as it is no valid expression to (it is a single string-literal).
And the ); in the third line is nonsense, too. Either you loop over one line or you enclose the code to loop over with { and }.
What do you want to do with that piece of code?
Henning Dieterichs
9-Nov-11 16:34pm
View
Deleted
Of course ;) - Thanks for your hint!
Henning Dieterichs
1-Nov-11 14:24pm
View
Deleted
Thank you for your improvement! I've updated the article.
Henning Dieterichs
1-Nov-11 10:45am
View
Deleted
Because the Key-Codes are different when converting to int.
Henning Dieterichs
30-Oct-11 7:14am
View
assuming x = X = amount and newAmount = X':
newAmount = amount * (1 + (Y / 100)) which is exactly the same I wrote (1 + Y / 100 = 1.02 if Y = 2)
Henning Dieterichs
26-Oct-11 17:27pm
View
WTF? Look here: http://www.codeproject.com/Questions/274082/Find-host-name-and-ip-address-of-computers-connect
Henning Dieterichs
26-Oct-11 10:14am
View
Deleted
Thats no exactly true, see http://whois.arin.net/rest/nets;q=209.85.229.109?showDetails=true&showARIN=false&ext=netref2 (registered by Google).
As far as I know Google has multiple IPs bound to one domain, so e.g. my nslookup end into "74.125.121.57"
Henning Dieterichs
26-Oct-11 9:37am
View
If you are using Windows 7 (and I think Vista too) you have to enable the telnet-client or use putty ;)
Henning Dieterichs
26-Oct-11 9:23am
View
Which host do you use? "google.com" (which is wrong) or "smtp.google.com" (which should work)?
Show More