I try to do it in the following way:
public String getValue(String service, String parameter) {
String inputKey = service + ":" + parameter;
Set keys = name2value.keySet();
Iterator itr = keys.iterator();
while (itr.hasNext()) {
if (inputKey.equal(itr.next())) {
return name2value.get(inputKey);
...
Hi, I'm making a form at the bottom of the screen and I want it to slide upwards so I wrote the following code:
int destinationX = (Screen.PrimaryScreen.WorkingArea.Width / 2) - (this.Width / 2);
int destinationY = Screen.PrimaryScreen.WorkingArea.Height - this.Height;
this.Location = new Point(destinationX, destinationY + this.Height)...
Hi, I want to copy the row to the new dataset if the previous value in second column isn't the same as the current one (i.e this dataset should have rows with unique values):
DataTable tbl = new DataTable();
DataTable tmpTable = ds.Tables[0];
for( var rowIndex = 0; rowIndex < ds.Tables[0].Rows.Count; rowIndex++ ...
I have a minor problem while checking for elements in a list:
I have two files with contents something like this
file 1: file2:
47 358 47
48 450 49
49 56 50
I parsed both files into two lists and used the following code to check
for i in file_1:
for j in file_2:
j = j.split()
...
I would like to make a cycle over the following elements:
[1,2,11,12,21,22,111,112,121,122,....,222222]
or for example
[1,2,3,11,12,13,21,22,23,31,32,33,111,112,113,... 333333333]
How can I make it in Java? In my particular case I use 4 digits (1,2,3,4) and the length of the last number can be from 1 to 10.
I managed to do it in Pyt...
What is the best way to touch two following values in an numpy array?
example:
npdata = np.array([13,15,20,25])
for i in range( len(npdata) ):
print npdata[i] - npdata[i+1]
this looks really messed up and additionally needs exception code for the last iteration of the loop.
any ideas?
Thanks!
...
I just came across the following code:
for(Iterator<String> iterator = stuff.iterator(); iterator.hasNext();) {
...
}
This strikes me as a sort of misuse of a for... Wouldn't this code be better as:
Iterator<String> iterator = stuff.iterator();
while(iterator.hasNext()) {
...
}
?
Any specific reasons anyone can think of to u...
I want to loop over a series of files in a directory in batches and then exit when the directory is empty.
At $work 'myprog' is actually a program which processes (and archives) incoming email in a Maildir in batches of 100.
I am after something simple I can put into cron.
#!/bin/bash
# Setup
mkdir -p foo && touch foo/file_{1,2,3,4}....
Hi all,
I've set up load balancing using Apache, Tomcat through ajp connector.
Here the config
Apache/httpd.conf
BalancerMember ajp://10.0.10.13:8009 route=osmoz-tomcat-1 retry=5
BalancerMember ajp://10.0.10.14:8009 route=osmoz-tomcat-2 retry=5
< Location />
Allow From All
ProxyPass balancer://tomcatservers/ stickysession=JSE...
I get only one printed result in the foreach echo loop at the bottom of the page.
<?php
defined('_JEXEC') or die('Restricted access');
$db =& JFactory::getDBO();
$query0 = "SELECT * FROM `jos_ginfo` WHERE . . . LIMIT 30";
//echo $query0;
$db->setQuery($query0);
$ginfo = $db->loadObjectList();
//echo
/...
I have been experimenting with PulpCore, trying to create my own tower defence game (not-playable yet), and I am enjoying it very much I ran into a problem that I can't quite figure out. I extended PulpCore with the JOrbis thing to allow OGG files to be played. Works fine. However, pulpCore seems to have a problem with looping the sound ...
I wanted to use the custom field for wordpress to have a different header banner for my site here is my code:
<?php
get_header(); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div id="BodyWrap">
<!--MAIN CONT-->
<div id="mainCont">
<?php get_sidebar(); ?>
<div id="rotateBanner"><?php
// c...
A recurring analysis paradigm I encounter in my research is the need to subset based on all different group id values, performing statistical analysis on each group in turn, and putting the results in an output matrix for further processing/summarizing.
How I typically do this in R is something like the following:
data.mat <- read.c...
Is it possible to loop through a query so that if (for example) 500,000 rows are found, it'll return results for the first 10,000 and then rerun the query again?
So, what I want to do is run a query and build an array, like this:
$result = pg_query("SELECT * FROM myTable");
$i = 0;
while($row = pg_fetch_array($result) ) {
$myArray[$...
I need serious help dividing the positive numbers and the negative numbers.
I am to accumulate the total of the negative values and separately accumulate the total of the positive values. After the loop, you are then to display the sum of the negative values and the sum of the positive values.
The data is suppose to look like this:
...
Please help me to rectify my code.
Here I have described the code what and why I am using... and finally whatI am getting at the end, but the end output is not the way what I want... Please help and tell how I can rectify it...
$count = substr_count($row4['ACTION_STATEMENT'], " IF (NEW.");/*here i will get how many time i will get " IF ...
Hi I am new to programming in C# can some one give me an example of how to write do while loop in C#
EDIT: FYI I am a VB.NET programming trying to make the move to C#, so I do have experience with .NET / VB syntax. Thanks again!
...
I'm trying to process this array, first testing for the presence of a check, then extrapolating the data from quantity to return a valid price.
Here's the input for fixed amounts of items, with no variable quantity.
<input type="checkbox" name="measure[<?=$item->id?>][checked]" value="<?=$item->id?>">
<input type="hidden" name="measure...
<c:forEach items="${myParams.items}" var="currentItem" varStatus="stat">
<c:set var="myVar" value="<c:out var="myVar" />" />
</c:forEach>
I want to concatenate the values of currentItem.myVar and output it at the end of the loop, problem is I can't figure out how to do this...
(Preferably not using Java)
...
I am using jquery to loop through json object... But some how it doesn't seem to work...
Here is my code,
$.ajax({
type: "POST",
url: "Default.aspx/GetRecords",
// data: "{}",
data: "{'currentPage':1,'pagesize':5}",
contentType: "application/json; charset=utf-8",
...