I've been wondering this for a while - is there a way to code/program breakpoints...? Conditionally? For example, can I specify something like - "when this variable becomes this value, break and open the debugger"? (Would be quite useful, especially in long loops when you want to debug loop execution of a late loop value.)
I suppose thi...
I try to simplify conditionals in:
for ( int t=0, size=fo.getPrintViewsPerFile().size();
t<size && t<countPerFile;
t++)
{
// ...
}
, more precisely:
t<s && t<c
You need to compare two times, then calc the boolean value from them. Is there any simpler way to do it? If no, how can you prove it? I can simplify...
I'm using Python and I want to use regular expressions to check if something "is part of an include list" but "is not part of an exclude list".
My include list is represented by a regex, for example:
And.*
Everything which starts with And.
Also the exclude list is represented by a regex, for example:
(?!Andrea)
Everything, but no...
hi there!
what's the best practise to break a loop?
my ideas were:
Child Find(Parent parent, object criteria)
{
Child child = null;
foreach(Child wannabe in parent.Childs)
{
if (wannabe.Match(criteria))
{
child = wannabe;
}
else
{
child = Find(wannabe, criteri...
I've got a stored procedure with a select statement, like this:
SELECT author_ID,
author_name,
author_bio
FROM Authors
WHERE author_ID in (SELECT author_ID from Books)
This limits results to authors who have book records. This is the Books table:
Books:
book_ID INT,
author_ID INT,
book_title NVARCHAR,
featured_book B...
Ruby has conditional initialization. Apparently, Java does not or does it? I try to write more succintly, to limit the range as small as possible.
import java.io.*;
import java.util.*;
public class InitFor{
public static void main(String[] args){
for(int i=7,k=999;i+((String h="hello").size())<10;i++){}
...
I'm trying to make a random image appear on the press of a button. So it generates a random number, and the switch algorithm swaps the chosen image with the one in the imgview. but I want a switch in the settings app to toggle which set of images to use. I know pretty much how to do it...it's just that it doesn't work. I'm missing some ...
EDITED FOR TYPO -
How can I check one thing AND THEN another, if the first is true?
For example, say I have a shopping basket object, and I only want to do something if the basket has been created AND it isn't empty.
I've tried:
if ((basket) && ([basket numberOfItems] >0))...
But the second condition is evaluated even if the first...
hi
i want to design a theme for postnuke cms.
and want to use css condition in the template files.
postnuke use smarty tag like
<!--[if $n eq ''] -->....<!--[/if]-->
so when i use
<!--[if lt IE 7]>....<![endif]-->
it gives some errors about tags.
what can i do?
...
in DOS batch files, In an IF statement, is it possible to combine two or more conditions using AND or OR ? I was not able to find any documentation for that
Edit - help if and the MS docs say nothing about using more than one condition in an if.
I guess a workaround for AND would be to do
if COND1 (
if COND2 (
cmd
)
)
but th...
Hi all,
Can anyone suggest best way to avoid most if conditions? I have below code, I want avoid most of cases if conditions, how to do it ? any solution is great help;
if (adjustment.adjustmentAccount.isIncrease) {
if (adjustment.increaseVATLine) {
if (adjustment.vatItem.isSalesType) {
entry2.setDebit(adjustmen...
Imagine a worksheet with 30 pieces of information, such as:
A1= Start Date
A2 = End Date
A3 = Resource Name
A4 = Cost
....
A30 = Whatever
B1 = 1/1/2010
B2 = 2/15/2010
B3 = Joe Smith
B4 = $10,000.00
...
B30 = Blah Blah
Now imagine a third column, C. The purpose of the third column is to determine WHICH report that row of data needs to ...
I am just beginning Haskell, but from all the online tutorials I've found I can't seem to find if there is one accepted way to do a conditional control statement. I have seen if-else, guards, and pattern matching, but they all seem to accomplish the same thing. Is there one generally accepted/faster/more efficient way than the rest?
...
I have tried to ask a variant of this question before. I got some helpful answers, but still nothing that felt quite right to me. It seems to me this shouldn't really be that hard a nut to crack, but I'm not able to find an elegant simple solution. (Here's my previous post, but please try to look at the problem stated here as procedural ...
Why this code works fine:
<?php if (**is_page**('4')) { ?>
<style type="text/css">
body {background-image:url("<?php bloginfo('template_url'); ?>/images/bac4.jpg");}
</style>
<?php } else ?>
and this not:
<?php if (**is_category**()) { ?>
<style type="text/css">
body {background-image:url("<?php bloginfo('template_url'); ?>/im...
I have two methods A and B only after the success of two methods i have to insert into database... So is this a valid conditional Statement in c#?
if(A() && B())
{
//insert into db
}
After the execution of method A i have to execute B If both are successful i have to insert...
...
I would like to have a pair of TextFields depenging on a value. And the "y"-value should be adjusted depending on the empty space.
When the value is "0" I would like to hide the TextField.
I.e. I would like to hide the staticText and the textField if the parameter red is equal to "0" and have the blue values moved up, in the jrxml-code...
I'm wondering if it's possible to conditionally add a parameter in a call to a method.
For example, I am rendering a bunch of links (six total) for navigation in my Site.Master:
<%= Html.ActionLink("About", "About", "Pages") %> |
<%= Html.ActionLink("Contact", "Contact", "Pages") %>
<%-- etc, etc. --%>
I'd like to include a CSS clas...
Hello,
var val = $("#desc").val(); // input box
var val2 = $("#type").val(); // select box
if((val=='') || (val2 == ''))
{
alert("err");
}
else { // codes }
when i select dropdown and not type anything on inputbox, the alert err still comes out?
how to make it when dropdown is selected, it goes to else clause?
...
Just to get it out of the way...
Premature optimization is the root of all evil
Make use of OOP
etc.
I understand. Just looking for some advice regarding the speed of certain operations that I can store in my grey matter for future reference.
Say you have an Animation class. An animation can be looped (plays over and over) or not lo...