I need help refactoring this multi-loop thing. Here is what I have:
Campaign has_many Contacts
Campaign also has many Models which are templates: (Email, Call, and Letter).
Because I am looking for overdue on each, I created an array called Event which I'd like to loop through that contains ['email', 'call', 'letter'].
I need a list ...
Hi all,
Ich have a problem in postgres function:
CREATE OR REPLACE FUNCTION linkedRepoObjects(id bigint)
RETURNS int AS $$
DECLARE catNumber int DEFAULT 0;
DECLARE cat RECORD;
BEGIN
WITH RECURSIVE children(categoryid,category_fk) AS (
SELECT categoryid, category_fk
...
Hey all,
I'm making a templating system where I instantiate each tag using a foreach loop. The issue is that some of the tags rely on each other so, I'm wondering how to get around that ordering from the looping.
Here's an example:
Class A {
public $width;
__construct() {
$this->width = $B->width; // Undefined! Or atleast not...
I did my own feature using this:
function save(title, url)
{
for (var i = 1; i < localStorage.length; i++)
{
localStorage["saved-title_" + i + ""] = title;
localStorage["saved-url_" + i + ""] = url;
}
}
function listFavs()
{
for (var i = 1; i < localStorage.length; i++) {
console.log(localStorage["saved-fav-title_" + i + ...
I am a beginner with Python and trying few programs. I have something like the following WHILE loop construct in Python (not exact).
IDLE 2.6.4
>>> a=0
>>> b=0
>>> while a < 4:
a=a+1
while b < 4:
b=b+1
print a, b
1 1
1 2
1 3
1 4
I am expecting the outer loop to loop through 1,2,3 and 4. And I kno...
Alright, i had this homework recently (don't worry, i've already done it, but in c++) but I got curious how i could do it in python. The problem is about 2 light sources that emit light. I won't get into details tho.
Here's the code (that I've managed to optimize a bit in the latter part):
import math, array
import numpy as np
from PIL...
I'm having a problem with select for update in jdbc. The table i'm trying to update is the
smalldb table, i'm having problems-- i'm using select for update which does a lock on the selected row
the update statement is --
String updateQ = "UPDATE libra.smalldb SET hIx = ? WHERE name = ?";
the select statement is --
rs = stmt1.execut...
In prototype the cumbersome for:
for (i=0; i<10; i++) { ... }
can be written as
$R(0, 10).each(function(i){ ... });
Is there an equivalent of range in JQuery ?
...
I'm creating a usercontrol that will have a series of LinkButtons.
I've declared all of my link buttons at the top of my class
LinkButton LB1 = new LinkButton();
LinkButton LB2 = new LinkButton();
//...
LinkButton LB9 = new LinkButton();
now I'd like to be able to create a loop to access all of those link buttons so I don't have to w...
I currently have a php loop running exactly how I need it with proper validations (in both php and javascript) with one exception, if the month is less than 2 digits, (i.e. 1,2,3,4), I need for a '0' to appear before:
01 - January
02 - February
...
10 - October
My code for the loop is currently:
<select name="Month">
<...
hello.
In general (or from your experience), is there difference in performance between for and while loops?
What if they are doubly/triply nested?
Is vectorization (SSE) affected by loop variant in g++ or Intel compilers?
Thank you
...
hi,
how to get in python from string not one character, but two?
I have:
long_str = 'abcd'
for c in long_str:
print c
and it gives me like
a
b
c
d
but i need to get
ab
cd
I'm new in python.. is there any way?
...
This is somewhat of a simple question, but for the life of me, I cannot figure out how to exclude something from a zsh for loop. For instance, let's say we have this:
for $package in /home/user/settings/*
do
# do stuff
done
Let's say that in /home/user/settings/, there is a particular directory ("os") that I want to ignore. Logica...
Hi everyone,
I have a bit of an array headache going on. The function does what I want, but since I am not yet to well acquainted with PHP:s array/looping functions, so thereby my question is if there's any part of this function that could be improved from a performance-wise perspective?
$var = myFunction ( array('key1', 'key2', 'key3'...
I have two for each loops and I am trying to output something different for each second result:
foreach ($wppost as $wp) {
$wp_title = $wp->post_title;
$wp_date = strtotime($wp->post_date);
$wp_slug = $wp->post_name;
$wp_id = $wp->ID;
// Start Permalink Template
$wp...
what is considered best-practice in this case?
for (i=0; i<array.length(); ++i)
or
for (i=array.length()-1; i>=0; --i)
assuming i don't want to iterate from a certain direction, but rather over the bare length of the array. also, i don't plan to alter the array's size in the loop body.
so, will the array.length() become constant ...
Hi, i'm trying to effect a number of movieclips inside another movieclip, in this case set the alpha to 20%.
But all i get is an error message. (TypeError: Error #1010: A term is undefined and has no properties. at array_fla::MainTimeline/frame1())
Anyone knows why it's not working?
var myClip = new mcClip;
addChild(myClip);
myClip.x...
Hai.
I am using Face book Connect FQL Queries to extract my profile photo url that is src_big,src_small URL.
But i am always getting the empty array in below delegate
(void)request:(FBRequest*)request didLoad:(id)result
My FQL query is.
NSString* fql = [NSString stringWithFormat:@"SELECT src_big,src_small FROM photo WHERE pid IN...
i got a code of 100-200 rules for making a table. but the whole time is happening the same.
i got a variable $xm3, then i make a column . next row, i got $xm2 and make column. next row, i got $xm1 and make column.
so my variables are going to $xm3, $xm2, $xm1, $xm0, $xp1, $xp2, $xp3.
is there a way to make a forloop so i can fill $xm a...
The problem is that I am trying to make certain tiles blocked so the player cannot walk on them. However, it's only reading the FIRST tile which is board[0][0] and everything else is not checked....
What am I doing wrong? :(
Here's my code:
import java.applet.*;
import java.applet.Applet;
import java.awt.*;
import java.awt.Canvas.*;
...