Been having a discussion on whirlpool about using break statements in for loops. I have been taught and also read elsewhere that break statements should only be used with switch statements and with while loops on rare occasions.
My understanding is that you should only use for loops when you know the number of times that you want to lo...
Hi all,
Wondering what the best way to trigger a function ( so I can perform a graceful exit ) in a C++ console application on Ctrl+C is?
...
In Eclipse I can set all kinds of preferences for coding style. I'd like to be able to enforce these as an ant task to make the build break.
Can anyone give me an example of how to enforce eclipse coding styles in an Ant task?
(I KNOW about PMD, checkstyle etc - none of these EXACTLY match the eclipse preferences for coding style. I w...
Within a Foreach loop in SSIS is there a way that if a task fails you can break out of the loop to the next iteration?
I am looping over xml files and performing a lookup using values within this file, if the lookup doesn't return any values i'd like to report on this and then not perform any other tasks for this file. If there is no e...
I noticed strange behavior in IE7 that does not occur in Firefox.
If you notice in "testing 2" "div",when I add 2 line breaks at the bottom of this div,
it does not respect margin set up for this div, and "test 3" div is right below it without margins. When I remove "br" then "test 2" and "test 3" divs have margins between them.
Is this...
I have heard several times in my career that the break operator is evil because it may cause internal exceptions (at least in older languages) or something else. I never thought so. But I would like to ask you if I am mistaken. And if I am, why? It happens in all languages?
Duplicate: Break Statements in the Real World
...
There are companies that don't allow lunch break(s). In my country (Romania) there is a law that forces the companies to 1 hour of lunch break for the employees.
As a programmer, I can't work continously for more than 4 hours and not have my coherence and my productivity go down.
However I've seen many people in the US and not only US ...
I have a very large loop that loops a 1000 rows. I exit the loop if magic value 1 is found. If magic value 1 is not found but magic value 2 is found then the loop needs to skip to the beginning. Right now I am using a switch, some ifs and a goto. I have read that goto is not the best way. Is there a better way to make this work?
...
I'd like to show no more than n characters of a text field in search results to give the user an idea of the content. However, I can't find a way to easily break on words, so I wind up with a partial word at the break.
When I want to show: "This student has not submitted his last few assignments", the system might show: "This student ha...
I have a Gridview control on an ASP.Net page with fixed width cells. The data coming from the database occasionally comes over as a contiguous string of characters. When there are dashes in the string, it will break so as not to upset the width of the layout. If there are no dashes (specifically, I'm dealing with underscores), the string...
I'm having a hard time taking my mind off of work projects in my personal time. It's not that I have a stressful job or tight deadlines; I love my job. I find that after spending the whole day (8-10 hours) writing code and trying to solve problems, I have an extremely hard time getting it out of my mind. I'm constantly thinking about ...
Hi,
I am working on a project in C# that will produce a Word document using the Word Automation API.
I would like to insert page breaks at specific points in the generated document and I am currently doing this successfully with the following code:
// Generate page break
object pageBreak = WdBreakType.wdPageBreak;
wordApp.Selection.In...
How do I exit a while loop immediately without going to the end of the block?
e.g.
while(choice!=99)
{
cin>>choice;
if (choice==99)
//exit here and don't get additional input
cin>>gNum;
}
any ideas?
...
I've got a handle to a Java Process instance and its associated streams. It's a console program. I'd like to simulate a break sequence. On Windows this is Ctrl-C. Is this possible without natives?
The reason for doing this: the console program is a command-line console itself, controlling a virtual machine for another language. The user...
Hi,
is there a way to "word break" a long http address in iphone safari?
Currently with a long http address:
i.e.
h t t p://long/website/address/to/be/displayed/on/iphone/safari
safari will render it in one line, thus affecting the page and the other contents where user has to scroll horizontally now.
is there a way for safari to dis...
I'm writing a custom class in C# and I'm throwing a couple exceptions if people give the wrong inputs in some of the methods. If the exception is thrown, will any of the code in the method after the throw still be executed? Do I have to put a break after the throw, or does a throw always quit the method?
...
I have a site that displays other sites through an iframe on certain pages. It does this in order to display a toolbar that is relevant to the reader (like Facebook and Owly does). However, when the user chooses to leave the original site I want the bar to go away. As you might gather, I don't control the sites in the iframe, and they're...
Hi,
I use a php form processor script that works fine. Except when users submit text in a multi-line text field, any line breaks or new lines are stripped out of the resulting string variable that is passed on. This often makes it unreadable by whoever receives the form results.
I'm no php expert but am sure the answer lies in the code...
Hey everybody,
I'm currently struggling with two problems about the java.util.logging.Logger:
1) I'd like to have a (convenience-)method like the "info()/fine()" methods, only that those methods should not insert a line break after the output (functionality like System.out.print and println). I've already overridden the format() method ...
consider the following delphi pascal code:
var
tc: TComponent
begin
{ do something to get tc }
repeat
if(tc is TDBEdit)then begin
if(check_something_about_edit(tc))then break;
do_something_else_edit(tc);
break;
end else if(tc is TBMemo) then begin
if(check_something_about_memo(tc))then break;
do_something_else_...