|
Andrew Stoute wrote: I might be being too much of a control freak though.
Not at all. The backup to this is documenting that it cannot accept whitespace and you may even rewite the code to strip leading and trailing whitespace characters to defend against it.
|
|
|
|
|
You're also testing what would happen based on the types of data that you're sending it. If, somewhere down the road, the data you're sending the method changes, you may need to document that the method can handle those changes as expected, such as sending a string of space and tab characters.
Personally, I would be checking to see if an actual string was passed in, THEN stripping the data of leading and trailing whitespace if required and then checking for an empty string. String.IsNullOrEmpty doesn't check to see if the string contains non-whitespace characters.
|
|
|
|
|
Dave Kreskowiak wrote: Personally, I would be checking to see if an actual string was passed in, THEN
The parameter only accepts strings, making this test superfluous.
Dave Kreskowiak wrote: stripping the data of leading and trailing whitespace if required and then checking for an empty string. String.IsNullOrEmpty doesn't check to see if the string contains non-whitespace characters.
Personally, I don't care for "whitespace"; if a user wants to store three spaces, a tab and a newline, then that's what gets stored. The only place where you "might" want to check it, is when validating input. Remember the NT4-server shutdown dialog? Required a non-null "reason". Did it help? No, a single period was "reason" enough.
|
|
|
|
|
Eddy Vluggen wrote: The parameter only accepts strings, making this test superfluous.
You would check for mull before trying to work with the string?? I don't see how that's superfluous.
Eddy Vluggen wrote: Personally, I don't care for "whitespace"; if a user wants to store three
spaces, a tab and a newline, then that's what gets stored. The only place where
you "might" want to check it, is when validating input.
User's aren't the only source of input that makes your code go "WTE!?" Foreign systems, poor XML files, non-normallized data in a database you inherit, corruption from a poor communications channel, ... the list goes on. You can get a blank or string formatted in some way your code doesn't expect from any number of sources. I was always taught that a method should be written to defend itself against pontentially bad data.
|
|
|
|
|
Dave Kreskowiak wrote: You would check for mull before trying to work with the string?? I don't see how that's superfluous.
"NullOrEmpty".
Dave Kreskowiak wrote: poor XML files
XML doesn't care much for whitespace.
Dave Kreskowiak wrote: I was always taught that a method should be written to defend itself against pontentially bad data.
I'm not putting an XML-validator in there
|
|
|
|
|
Hi!I want to give choice to users to view product image in list or in gallerie depending of how he want to view the product.As many e-commerce webite.How to do that?
|
|
|
|
|
If a question is this abstract, I can only suggest to hire a developer.
|
|
|
|
|
Hi, im trying to develop a program for win98, i work with 2.0 VS 2008, in the develop machine all runs ok. at client i receive
application has generated an exception that could not be handled 0xffe31701(-1894655), Thread ID=0xffe31395(1895531)
if someane knows wath can i do, please help.
and please don't start with the Win98. replace it it's not an option, its on board in a big machine.
Thanks.
|
|
|
|
|
I don't think you will get anywhere with this, Windows 98 has been dead a long time. The .NET framework was never designed to work under such an old version of Windows so it is unlikely that any .NET application will work.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Did you install the .NET Framework? Keep in mind that there's no EventLog , those classes will not work.
caradri wrote: and please don't start with the Win98. replace it it's not an option
It's also no longer a supported platform.
|
|
|
|
|
caradri wrote: and please don't start with the Win98. replace it it's not an option, its on
board in a big machine.
Sorry, but that is your problem. .NET is not designed to run on Windows 98; the minimum spec from Microsoft is Windows XP.
|
|
|
|
|
.NET's 2.0 minimum is Win2000, with Service Packs.
|
|
|
|
|
When I looked this up before answering, this[^] page indicated the min version was XP.
|
|
|
|
|
Fair enough. Only remembered it since I had a Win2k machine here somewhere with .NET 2. Wikipedia has more details than MSDN;
Version 2.0 without any Service Pack is the last version with support for Windows 98 and Windows Me. Version 2.0 with Service Pack 2 is the last version with official support for Windows 2000 although there have been some unofficial workarounds published online to use a subset of the functionality from Version 3.5 in Windows 2000.[5] Version 2.0 with Service Pack 2 requires Windows 2000 with SP4 plus KB835732 or KB891861 update, Windows XP with SP2 or later and Windows Installer 3.1 (KB893803-v2)
|
|
|
|
|
Never mind, I found the SP1 page which indicates the minimum is Win2K. Still not Windows 98 though.
|
|
|
|
|
i had this working in the past but the develop environment change to VS2010. there must be something with the things that the compiler do.
|
|
|
|
|
If you're using VS2010, did you accidentally create the project targeting .NET 3.0, 3.5 or 4.0??
|
|
|
|
|
I had a win98 develop machine and developing for 98 works ok. today my develop environment change and come back from the past this issue.
|
|
|
|
|
Win98 only supports a limited set of the classes of .NET2.0, and only without service-packs. Your development-machine doesn't change that. And yes, when you run into a problem using ancient software, support is virtually non-existing.
|
|
|
|
|
well...i think the issue is clear, i have to user something else. i'm have 10 year programming in .net, so..., what people use to programm at 98?
|
|
|
|
|
C, C++, VB, .NET (pre SP1) or one of many other languages.
|
|
|
|
|
caradri wrote: what people use to programm at 98?
Dunno, I do not know people who still support the platform. It's unreliable (pre-NT) and no new security-updates are provided by Microsoft.
Why Win98? Wouldn't Ubuntu with Mono be a better choice? Means you could use anything in .NET 4.
|
|
|
|
|
Hey guys,
Im fairly new to this so please bear with...
I'm using the tutorial @ http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html
to allow the user to select dates from a calendar
however I can't seem to get it working could someone please advise if I am going about this the wrong way...
'jquery.datePicker.js & datePicker.css' can be downloaded at near the top of the page on...
http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/index.html
1)copy the code in the '•jquery.datePicker.js ' inside my <script> tags in my view
2) copy the datePicker.css code into my css file
3) paste the following into the top of my view page:
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
<script type="text/javascript" src="scripts/date.js"></script>
<script type="text/javascript" src="scripts/jquery.datePicker.js"></script>
This does not work...iv tried doing the first demo and replacting the .js data inside my <script>tags wit $(function()
{
$('.date-pick').datePicker();
});
and then adding the following to .css
/* located in demo.css and creates a little calendar icon
* instead of a text link for "Choose date"
*/
a.dp-choose-date {
float: left;
width: 16px;
height: 16px;
padding: 0;
margin: 5px 3px 0;
display: block;
text-indent: -2000px;
overflow: hidden;
background: url(calendar.png) no-repeat;
}
a.dp-choose-date.dp-disabled {
background-position: 0 -20px;
cursor: default;
}
/* makes the input field shorter once the date picker code
* has run (to allow space for the calendar icon
*/
input.dp-applied {
width: 140px;
float: left;
}
could someone please tell me what I am doing wrong?
Thanks
J
|
|
|
|
|
You do realise that this is the .NET forum and not the JavaScript forum don't you?
modified 3-Dec-12 13:24pm.
|
|
|
|
|
I want to allow the class to create only one object instance.
I want to make visible the class ouside the assembly but restrict to only one assembly.
What needs to do?
Please suggest me.
|
|
|
|