print "<ul>";
foreach ($arr as $value) {
echo("<li>" . $value[storeid] . " " . ($value[dvdstock] + $value[vhsstock]) . "</li>");
}
print "</ul>";
Will output
•2 20
•2 10
•1 20
•1 20
•1 10
I was wondering how I would adapt this loop so it outputs the total values for each &value[storeid]
•1 50
•2 30
Thanks very much :)
...
Hi,
This is a powershell/AD/Exchange question....
I'm running a script against a number of Users to check some of their attributes however I'm having trouble getting this to output to CSV. The script runs well and does exactly what I need it to do, the output on screen is fine, I'm just having trouble getting it to directly export to c...
I wrote a .sh file to compile and run a few programs for a homework assignment. I have a "for" loop in the script, but it won't work unless I use only integers:
#!/bin/bash
for (( i=10; i<=100000; i+=100))
do
./hw3_2_2 $i
done
The variable $i is an input for the program hw3_2_2, and I have non-integer values I'd like to use. How c...
I am trying this code:
entLoop:for(var i:*in entities) {
for(var i2:*in ignoreEntities) {
if(entities[i].type==ignoreEntities[i2]) {
continue entLoop;
}
}
}
Why is it not working? The error is:
Target of continue statement was not found.
...
I'm blanking on the best way to paste a list of strings together to go into an SQL statement... I'm having trouble with the separator bar | printing at the beginning when I don't want it to:
foo = "blah"
paste_all_together = NULL
for (n in 1:4) {
paste_together = paste(foo ,sep = "")
paste_all_together = paste(paste_all_tog...
I am trying to do is to loop this HTML and get a nested array of this HTML values that i want to grab.
It might look complex at first
but is a simple question...
html
<div class="configureData">
<div title="Large">
<a href="yellow" title="true" rel="$55.00" name="sku22828"></a>
<a hre...
I am looping thru looking at the values of a Node.
If Node = B, then B has one of two possible meanings.
--If Node = A has been previously found in the file, then the value for A
should be sent as 1.
--If Node = A has NOT been found in the file, the the value for A should
be sent as 2.
where file is the xml source to be...
I'm building a tagger. After a user submits a tag, ajax returns:
{"returnmessage":"The Ajax operation was successful.","tagsinserted":"BLAH, BLOOOW","returncode":"0"}
I want to take the tagsinserted and loop through it, and during each loop take the item in the list and insert it on the HTML page. suggestion on how to do this right?
...
Does anyone see anything wrong with the following:
$.ajax({
url: '/tags/ajax/post-tag/',
data: { newtaginput : $('#tag-input').val(), customerid : $('#customerid').val()},
success: function(data) {
// After posting
alert(data);
arr = data.tagsinserted.split(',');
alert(arr);
//Loop th...
How awful is it - or is it perfectly acceptable - to index a loop on an enumeration?
I have an enumeration defined. The values of the literals are default values. The assigned values do not have any significance, will not have any significance, and the values of any literals added in the future will also not have any significance. It's ...
I'm using this program to play na audio file:
music = pyglet.resource.media('file.wav')
music.play()
pyglet.app.run()
I have a problem: I can't do anything after this program. How to stop the audio file when is played? It's look like a loop.
...
Hey,
Basically I've got some structs of type Ship which are going to go on a board which can have a variable width and height. The information about the ships is read in from a file, and I just need to know the best way to make sure that none of the ships overlap.
Here is the structure of Ship:
int x // x position of first part of shi...
I am working with a PHP foreach loop and I need it to output some specific HTML depending on which array value it is spitting out.
Everytime that the foreach loop hits a $content['contentTitle'] I need it to insert a new table and then from there carry on. Essentially I want the for the loop to spit out a new table everytime a new conte...
Hi!
I'm building a simple application. It's a user interface to an online order system.
Basically, the system is going to work like this:
Other companies upload their purchase orders to our FTP server. These orders are simple XML files (containing things like customer data, address information, ordered products and the quantities…)
I...
In Python, if I were to have a user input the number X, and then the program enters a for loop in which the user inputs X values, is there a way/is it a bad idea to have variable names automatically increment?
ie:
user inputs '6'
value_1 = ...
value_2 = ...
value_3 = ...
value_4 = ...
value_5 = ...
value_6 = ...
Given the following block of HTML:
<ul id="taglist">
<li><a name="45" href="">Product 1</a></li>
<li><a name="1146" href="">Product 2</a></li>
<li><a name="13437" href="">Product 3</a></li>
<li><a name="51" href="">Product 4</a></li>
</ul>
Is it possible for JQUERY to return a STRING, one variable with the name values:
alert(taglists...
When running the following code I get no output but I cannot work out why.
# include <stdio.h>
int main()
{
fputs("hello", stdout);
while (1);
return 0;
}
Without the while loop it works perfectly but as soon as I add it in I get no output. Surely it should output before starting the loop? Is it just on my system? Do I...
What's the beste way to show a list with 20 images in rows of 5? Or, in other words, how do I clean up this ugly snippet?
<div class="row">
<% @images.each_with_index do |image, index| %>
<% if index != 0 && index % 5 == 0 %>
</div><div class="row">
<% end %>
<%= image_tag image.url %>
<% end %>
</div>
...
I will try to show this by an example:
class DogShelter
{
private $dog;
public function handleDogDirect( )
{
$this->dog = trim( $this->dog );
$this->dog = rtrim( $this->dog, 'abc' );
$this->dog = strtolower( $this->dog );
$this->dog = basename( $this->dog );
}
public function handleDogIndirect( )
{
...
So I'm a beginner in XML DOM and JavaScript but I've run into an issue. I'm using the script to display my XML data in a table on an existing site. The problem comes in nesting a loop in my JavaScript code.
Here is my XML:
<?xml version="1.0" encoding="utf-8"?>
<book_list>
<author>
<first_name>Mary</first_name>
<last_name>Abb...