|
Pete O`Hanlon wrote: It seems that he wants to redefine how mathematics works.
Thanks for the chuckle - that might just be the case.
I wanted to give the author the benefit that it might just be a language issue, though.
It isn't enough to do well in life.
One must do good when and where one can.
Otherwise, what's the point?
|
|
|
|
|
double answer;
if(dbNumber == 9.5)
{
answer = 9.05;
return answer;
}
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
The people in the lounge said I should google for the answer to a programming question but I do not know what search engine to use
|
|
|
|
|
ROTFL !!!!
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Hi,
Try using this
double d = 9.5;<br />
d = Math.Floor(d) + ((Math.Floor(d) + 1) - d) / 10;<br />
Paras Kaneriya The difference between genius and stupidity is that genius has its limits.
|
|
|
|
|
Hi
I've been searching through multiple articles on this topic,
however,
what I'm not finding is a simple way to count decimals. I simply want to count
how many decimals are in the string, unfortunately everything in regex seems to involve
replacing the decimals...and regex seems really heavy way of doing something that should
be simple.
Any thoughts on this topic?
-----------------------------------------------------------
Completion Deadline: two days before the day after tomorrow
|
|
|
|
|
jgasm wrote: I simply want to count
how many decimals are in the string, unfortunately everything in regex seems to involve
replacing the decimals...and regex seems really heavy way of doing something that should
be simple.
If you know the string always has a decimal:
Int32 decimalCount = text.Split('.')[1].Length
If it doesn't always have a decimal, it gets much more complicated :
Int32 decimalCount = text.IndexOf('.') > -1 ? text.Split('.')[1].Length : 0;
Share and enjoy.
Sean
|
|
|
|
|
Count significant decimal places? This is rather rough:
[System.STAThreadAttribute]
static void Main(string[] args)
{
int d ;
args [ 0 ] = args [ 0 ].Trim( new char[] { '0' } ) ;
d = args [ 0 ].IndexOf ( '.' ) ;
if ( d >= 0 )
{
d = args [ 0 ].Length - d - 1 ;
}
else
{
d = 0 ;
}
System.Console.WriteLine ( d ) ;
}
|
|
|
|
|
Thank you so much for the reply.
However, Sean's answer was exactly what I was looking for.
-----------------------------------------------------------
Completion Deadline: two days before the day after tomorrow
|
|
|
|
|
If you don't need the results of the Split for something else then mine is likely more efficient.
Here it is with the Conditional Operator:
int d ;
args [ 0 ] = args [ 0 ].Trim( new char[] { '0' } ) ;
System.Console.WriteLine
(
( d = args [ 0 ].IndexOf ( '.' ) ) == -1 ? 0 : args [ 0 ].Length - d - 1
) ;
|
|
|
|
|
A similar question was asked in the microsoft.public.dotnet.languages.vb newsgroup two days ago. Here's the code that I suggested, converted to C#, and assuming that the decimal separator is a period:
int pos = text.IndexOf('.');
int decimalCount;
if (pos == -1) {
decimalCount = 0;
} else {
decimalCount = value.Length - pos - 1;
}
It's about ten times faster than splitting the string.
If you want it in few lines:
int pos = text.IndexOf('.');
int decimalCount = (pos == -1) ? 0 : value.Length - pos - 1;
---
single minded; short sighted; long gone;
|
|
|
|
|
Hello All,
My Problem Is I Have A Ledger Which Have Values Like:
jan feb mar april may june july...... dec
Ajay 0 1 2 0 10 8
Anu 0 55 54 88 45 77 ......
...
..
Now These are marks of students in a particular subject for everymonth
Teacher has to enter these marks in the matrix way as i shown above.
I m Unable to FInd ne such control in asp.net
Editable grid doesnt work for me. as i cant fill any garbage data in any table.
Any suggestions? I m in terrible situaton.
Please Help me.
(I m A Novice)
Thanks To ALL
Sanchit Jain
|
|
|
|
|
If the only thing preventing you from using the standard grid is that any old garbage data can be put in it, why not do some client-side or server-side validation of the data?
p.s. this question might be better asked in the ASP.NET forum.
|
|
|
|
|
hi all,
is there a(ny) way to check whether a cell value is empty or not ?
when i try to do (for an empty cell): string.isnullorempty(datagridview.rows[i].cells[j].value.tostring());
i get this error: object reference not set to an instance of an object.
i'd like to know if there is any solution for my problem.
thanks in advance.
MFA
|
|
|
|
|
Try this: string.IsNullOrEmpty(datagridview.rows[i].cells[j].value as string);
|
|
|
|
|
You can use this rather
datagridview.rows[i].cells[j].Text
Paras Kaneriya
|
|
|
|
|
I need to perform an action if I drag to an area outside of the control being dragged from. Namely an error message and a return. I can't figure out how to do this.. help! pleeeeze and thank you 
|
|
|
|
|
You could Capture the mouse using theControl.Capture = true. This way, I believe you'll get drag and drop events even if your mouse is outside of the control.
I'm not certain it will actually work, however. Might be worth looking into.
Outside of crazy capture the mouse schemes, I don't know that this can be done within the confines of the .NET framework.
|
|
|
|
|
when the connection is successfully connected (means if only the user logged into the sql server)need to show the message "successfully logged on".
not just the connection opened before the server validate the user.
could any one help me with this..
|
|
|
|
|
MessageBox.Show("Successfully logged on");
|
|
|
|
|
You won't get an open connection if the user (info) is invalid. Or are you seeing something else?
|
|
|
|
|
Our organization is currently developing an SDLC process for managing development projects. Would anyone be willing to share what your organization is currently doing?
What we are looking for is when our development department is approached with a project, we want to first deliver to the requestor an SDLC type statement of work where everything is outlined and the proceedure that we will follow.
Before going throught the hassle of creating ours from cradle to grave I was hoping to see what others have already created?
Thanks in Advance
|
|
|
|
|
fuziononline wrote: Before going throught the hassle of creating ours from cradle to grave I was hoping to see what others have already created?
So your hoping to see our C# implementations of SDLC?
|
|
|
|
|
More specifically I work in a application design department that designs in c#. They have just now decide to provide application development and are now in the process of defining the process that we will use to develop.
I'm tasked with coming up with the SDLC and also the way to document it (i.e. paperwork, statement of work, contract) that we give to the deparment that is requesting development.
|
|
|
|
|
fuziononline wrote: I work in a application design department that designs in c#
Not sure how to respond to that. See if this helps:
Implementation (or coding) Reducing a design to code may be the most obvious part of the software engineering job, but it is not necessarily the largest portion.
link[^]
also SDLC[^]
|
|
|
|
|
There are a lot of different lifecycle models to choose from and each one has pros and cons.
Do you currently have any level of process in place that governs how software projects are run? It doesn't have to be something formally documented. If so, try to pick a model that resembles that process as close as possible and then refine the model from there.
The main thing is that no model is perfect and no model will completely fit your business without modification (to either the business, the model, or both).
In general, the documentation steps that should be followed are:
- Define the business requirements (high level, business-oriented requirements). This is what the software needs to do, problems it needs to solve, etc. in order for it to be competitive in the market.
- Define the technical requirements for each business requirement. The technical requirements define how the business requirement will be met by the software. Each business requirement can map to one or more technical requirement, but generally one technical requirement should map to one business requirement. This also should cover any integration points to other systems that might be needed.
- (Optional)Define a lower-level set of technical requirements that map to a single higher-level technical requirements. Again, one high-level technical requirement could have multiple lower-level technical requirements.
The developers would work from one of the technical requirement docs. The QA group would base their test plans on the buisness requirements, and the test plans should be written at the same time as the business requirements.
As for actual development cycles, there are many different models and you should choose the one that works the best for you. I have found that the best approach is using short cycles (3-4 weeks each). Each cycle has a clearly defined set of goals and requirements that need to be met. At the end of the cycle, everything is reviewed and things that didn't get completed become part of the next cycle. This allows the business stakeholders to see progress and everyone to evaluate that progress against the business needs early enough where changes and/or rework aren't as painful. (They will always be painful, but it's much easier to loose a few weeks worth of work than a few months.)
The bottom line is that you need to evaluate all of the different models and make the best choice you can. Then figure out what pieces of the model and/or business need to be modified or adapted to work for you. It may be a trial-and-error process until you get things right, but as long as you're not constantly changing tactics every few days (or even few weeks) it shouldn't be a problem.
The key to a process is that you want to build something that allows for consistent repeatability.
Another thing to consider is that SDLC processes should also include things like how QA testing is performed, how builds are performed (automated builds are the best), and how the software is released.
|
|
|
|