Alright, so my title sucked. An example works better:
input = 'check yahoo.com'
I want to parse input, using the first word as the "command", and the rest of the string as a parameter. Here's the simple version of how my non-Pythonic mind is coding it:
if len(input) > 0:
a = input.split(' ')
if a[0] == 'check':
if l...
I am trying to create an object that is capable of handling query-like conditional statements. This is so I can 'join' two conditions together to create a dependency between them based on the type of 'join' being used. I currently have a simple object that contains the following methods:
public function addCondition ( Condition $conditi...
I am new to Perl. Does anyone know why Perl has 'elsif' and not 'elseif'?
I am doing something like this:
$somevariable = 0;
if ($idcount==5)
{
//do something
if (somestatement is true) // 1
{
$somevariable = 1;
}
}
elsif ($idcount > 1 && somevariable = 0)
{
//do something else here
}
The code never comes to ...
I'm having a strange problem. I have the following code:
dbg("condwait: timeout = %d, %d\n",
abs_timeout->tv_sec, abs_timeout->tv_nsec);
ret = pthread_cond_timedwait( &q->q_cond, &q->q_mtx, abs_timeout );
if (ret == ETIMEDOUT)
{
dbg("cond timed out\n");
return -ETIMEDOUT;
}
dbg calls gettimeofd...
For example. there are 3 variables, 1 is a must, 2 and 3 are eithers so 3 can be false as long as 1 and 2 are true, 2 can be false as long as 1 and 3 are true.
if(xmlhttp.responseText.indexOf("type:SearchList~")>=0 && (obj == "hDrop" || obj == "iDrop")){
}
Isn't working for me
Can anyone spot the problem?
...
There are a few ways to do this in javascript.
Foremost and most readable and flexible is probably:
if (a){
//b
}
else {
//c
}
Something else that only* works with assigning and is less readable is:
var foo = 'c';
if (a){
foo = 'b';
}
My main question, though, is about the last two methods I can think of:
var foo = a ...
Hello
I am trying to set up a user creation wizard where the user can only go to the page that corresponds to the current step in the wizard that the user is on.
I have already sorted out the state machine functionality. The current state is stored in the DB. This is not the problem
The problem is how to redirect the user to the right...
Here is the code I am looking at.
foreach ($header as $idx => $field) {
if (stripos($field, 'foo') !== false) {
$cols['foo'] = $idx;
} else if (stripos($field, 'bar') !== false) {
$cols['bar'] = $idx;
} else if (stripos($field, 'brr') !== false) {
$cols['brr'] = $idx;
} else if (stripos($field, '...
Working with some VBA code in Access that when a very specific set of conditions are met it will pop up an InputBox asking for a integer. So far so good.
Private Sub Command10_Click()
If Not IsNull(mrf) Then
If min <> max Then
If qty <= min Then
mrf = GetParamValue
End If
End ...
I'm trying to find a way to display one link to an IE user and another link to all other browsers using javascript or conditional comments (or whatever it takes).
Basically...
//pseudo code
<!--[if IE]>
<a href"ie-only.html">click here!</a>
<!--[else]>
<a href"all-other-browsers.html">click here!</a>
<![endif]-->
I don't thin...
I am trying to come up with a query to report revenue. It will require 2 tables: clicks and offers. Revenue is calculated by the number of conversions * commission for the offer. Conversions are stored in the clicks table in a field called "conversionDate", and the commission for each offer is stored in the offers table.
There needs ...
Hi all,
I have child classes, each carries a different type of value along with other members. There may be a LongObject, IntObject, StringObject, etc.
I will be given a value, which can be a long, int, string, etc., and I have to create a LongObject, IntObject, StringObject, etc., respectively.
Would it be faster to overload a met...
I have a situation which I have solved in two different ways, but was wondering what people thought about the options, and if they have any other alternatives...
The system is processing "intervals" of data.
All the data is allocated to an "interval"
The interval is represented by an "interval_start" DATETIME in the Fact table
A...
Hello,
I am involved with a software project written in Qt and built with qmake and gcc on Linux. We have to link to a third-party library that is of fairly low quality and spews tons of warnings. I would like to use -W -Wall on our source code, but pass -w to the nasty third-party library to keep the console free of noise and clutter...
I am trying to enhance my Logger class with some conditionals to control what to log and where to log. I've got two kinds of logging functions:
public static class Logger
{
[Conditional("Logging"), Conditional("VerboseLogging")]
public static void Log(string msg, string filename)
{
// log to file
}
[Conditio...
I am trying to apply conditional formatting of certain table cells in my ReportViewer control. I understand how to apply conditions by comparing data that resides in the same row, for example, the following will color a cell RED if the Cost is higher than the revenue:
=IIf(Fields!Cost.Value > Fields!Revenue.Value, "Red", "Black")
My ...
I have an If Statement block similar to the below which is failing with the error -
PLS-00103: Encountered the symbol "SELECT" when expecting one of the following....
Begin
If (select count(*) from Table1) > 0 then
dbms_output.put_line('Test');
end if;
end;
I have similar Case statement which works fine
select
case
...
I am trying to clean up my CruiseControl.NET configuration so that the sections are easier to maintain and new projects are easier to create. For instance, I currently have the following:
<cb:define name="project">
<project name="$(name) ($(milestone)) [$(env)]">
<category>$(category)</category>
<workingDirectory>$(dir)\$(name)\$(...
in a table two of columns are billable(bit),billabledate(datetime).i want billable date to be not null if billable is not null.
...
I have two tables: "user" -> "order"
TABLE: user
user_id
-----------
u1
u2
TABLE: order
order_id | user_id | flag
-------------------------
o1 | u1 | fA
o2 | u2 | fB
Y need obtain all users counting how many times have orders with flag 'fA'
RESULTS WHAT I NEED:
user_id | orders
----------------
...