FAQ Database Discussion Community


Change 2 values in a sting

string,tsql,increment,manipulation
I have the following string 2014/15 passed as a parameter to my procedure and I need to increment the 4 and 5 by 1 so I end up with 2015/16. Obviously the string is a VARCHAR so I can't use any normal arithmetic functions, nor DATEADD. The parameter must be...

How to increment the value of an int variable? [closed]

java,android,increment
I would like to increment the value of an int variable whenever a user taps on a button, but right now the value gets incremented only once. This is what I use to increment the value of the variable p. @Override public void onClick(View v) { int p = 1;...

How to increment a value in a text file and generate corresponding incremented ouput text files?

bash,text,awk,increment
I have these type of bash text files : #!/bin/sh #SBATCH --partition=mono-shared #SBATCH --cpus-per-task=1 #SBATCH --ntasks=1 #SBATCH --time=05:00:00 #SBATCH --mail-user= #SBATCH --mail-type=ALL #SBATCH --clusters= module load rdkit srun /opt/xxx /home/rand/data/DB_split/DB_0001.txt 0.001 /models/computetd/ /home/rand/DBIS_results/DB_0001 I have 455 input text files. I want to generate 455 correponding bash files. Each bash files...

C conditional increment

c,condition,increment,temporary
Consider the following code: int a=0 , b=1 If (a == --b) Printf b Is b now 0 or 1? In other words- is the increment temporary or not? Thank you!...

jQuery/Svg : increment value “dur” when key is pressed

javascript,jquery,svg,increment,keycode
I would like to increase the speed of my element #Object when I press a key. The HTML code: <path d="M 0,70 A 65,70 0 0,0 65,0 5,5 0 0,1 75,0 75,70 0 0,1 0,70Z" fill="#FF6600"> <animateTransform id="object" attributeName="transform" type="rotate" from="360 0 0" to="0 0 0" dur="3s" repeatCount="indefinite" /> </path>...

Ansible variable assigment

variables,increment,roles,ansible,ansible-playbook
I want to run a role 10 times in a playbook and only on the 5th run of that role, I want it to run the second shell cmd from within that role. How can I address that ? Playbook: - name: bla bla hosts: ALL remote_user: root vars: some_variable:...

SQL increment on click (using ajax)

jquery,mysql,sql,ajax,increment
I'm working on a simple button that will allows to increment a line in my table. Thanks to AJAX, when the button +1 is clicked, it is replaced by a -1 button. But the problem occurs when I click once on +1, then -1 and a second time on +1....

Move parent child picture by 1px with a timer

javascript,image,replace,timer,increment
I’m trying to recreate Space Invaders. But only in Javascript without jQuery etc. Now I create for the Rockets a “family”: var image = document.createElement('img'); image.setAttribute('src', 'Rakete.gif'); image.setAttribute("style", "position:absolute; left:" + x2 + "px; top:bottom; bottom:55px;"); And I use this to add it to the body: document.body.appendChild(image); Now my question:...

How to make an increment followed by a decrement continuously?

c++,loops,processing,increment
I am trying to obtain an increment that goes up from 0 to n, then decreases from n-1 to 0, and repeats the cycle over and over. In this example written in Processing, I would like the background to go from black(i=0) to white(i=255) incrementally then white to black incrementally...

Add up parameters in for loop

bash,variables,increment
I've implemented a function which contains a while for loop defined as follows: func() { ... for i in "[email protected]"; do enum="source" sourceID=$i ret_ID $FILE_NAME $sourceID $enum ID=$req_ID ((ID+=ID)) done echo $ID } The function ret_ID parses a file which contains some variables as param1=0x00000001 param2=0x00000400 param3=0x000008000 ... No matter...

Increment variable while storing infromation loop bash

bash,variables,while-loop,counter,increment
I need to increment key while also storing information. For example: key1=value key2=value and so on... count = 7 while [ $count -gt -1 ] do key$count=${array[$count]} let count=$count-1 echo $key done Any help is appreciated....

Unexpected behavior when combining increment operator with pointer dereferencing

c,pointers,increment
For a program that I'm currently working on, I am using code which includes this operation: *(a+++5) = 5; //increments a and adds 5 to it, then dereference that address This behaves unexpectedly. The value 5 appears to be stored in the location (a+4), which is strange, because nothing is...

Fuelphp ORM unexpected results when adding to model property

php,orm,model,increment,fuelphp
I have a model that tracks views. It's a very basic model as you can see below. There are currently only 2 methods. One queries the database, and one to add to the views table. The function that checks the table returns either a view object, or null. It's a...

Mysql replace all id's to make a correct sequence

mysql,phpmyadmin,auto-increment,increment
I was wondering if it's possible in mysql to reassign auto incremented ID's so that they will follow eachother up. Currently I have deleted rows and because of that my ID's are as follow 1 2 3 8 9 14 Is it possible to run a query that will replace...

Javascript, how it works? var i =1; i= i++ * 2; // 2 [duplicate]

javascript,increment
This question already has an answer here: ++someVariable Vs. someVariable++ in Javascript 4 answers please read, before post answer. No answer to this question in post: ++someVariable Vs. someVariable++ in Javascript var i = 1; i = i++ * 2; // i = 2, .. why not 4 ?...

ios core plot increase CPTPlotSymbol clickable area

ios,graph,core-plot,increment,clickable
I am using core plot library for showing Scatter plot in my app. I am creating CPTPlotSymbol like this :- CPTMutableLineStyle *symbolLineStyle = [CPTMutableLineStyle lineStyle]; symbolLineStyle.lineColor = [CPTColor blackColor]; CPTPlotSymbol *plotSymbol = [CPTPlotSymbol ellipsePlotSymbol]; plotSymbol.fill = [CPTFill fillWithColor:blueColor]; plotSymbol.lineStyle = symbolLineStyle; plotSymbol.size = CGSizeMake(5.0 , 5.0); Then graph point are...

Increment per File

java,file,folder,increment
Below is some of my code. I am going through a folder, pulling every image, and finding the RGB value of every pixel, and determining which ones are blue. I am trying to only increment per file, but for some reason, it is continuing and adding every file's increment. try...

Instance variable increment in bean on button click JSF 2.2

java,xhtml,increment,jsf-2.2,instance-variables
My xhtml file has a command button as so :- <h:commandButton id="routeAddButton" action="#{routeStatic.add_new_route}" value="Add New Route" /> I am trying to control the visibilty of panelGrids using a boolean array. <h:panelGrid id="route1Grid" columns="2" rendered="#{routeStatic.rendered[0]}" > likewise <h:panelGrid id="route2Grid" columns="2" rendered="#{routeStatic.rendered[1]}" > and so on. On each button click I am...

Increment from zero to number in a set time

javascript,math,setinterval,increment
I am trying to increment from 0 to a number (can be any number from 2000 to 12345600000) within a certain duration (1000 ms, 5000 ms, etc). I have created the following: http://jsfiddle.net/fmpeyton/c9u2sky8/ var counterElement = $(".lg-number"); var counterTotal = parseInt(counterElement.text()/*.replace(/,/g, "")*/); var duration = 1000; var animationInterval = duration/counterTotal;...

How to Increment variable in java every 24 hours , every week, every month? [closed]

java,date,time,increment
I have 3 variables whose values I want to increment by 1 every 24 hours , every week and every month. The JAVA program will be running continuously during the time period.

How to loop over session variables and set new ones if they are set

php,loops,foreach,session-variables,increment
Basically I want to check if a number is set, if not set, set it, else increment the number and set the incremented number, if the maximum number (12) is set, exit and throw an error. The logic seems to defeat me. "if is not set *number*, set it; stop...

Is i=i+1 an undefined behaviour?

c,increment,undefined-behavior
I'm using codeblocks and it is giving a different output to other compilers and I can't find a solution to it.What's the undefined behaviour in this program and is there any solution to avoid it? This is the code to print the nth number in a number system with only...

Increment a string with letters?

javascript,jquery,increment
I need to increment a string from.. let's say aaa to zzz and write every incrementation in the console (is incrementation even a word?). It would go something like this: aaa aab aac ... aaz aba abb abc ... abz aca acb And so on. So far I have incremented...

Creating an auto incrementing loop within a function in python

python,loops,tkinter,increment
I'm trying to set up a loop that keeps track of a number of ordernums as well as assign a nw ordernum to each new order in increasing value. Here's the full code: *This is the fixed code using Klaus D. 's advice import tkinter from tkinter import * from...

servo increment in python

python,increment
servoMin = 500 servoMid = 1500 servoMax = 2500 servoTilt1 = 1500 servostep = 100 def servo1_up(): servoTilt = servoTilt1 + servostep if servoTilt > servoMax: servoTilt = servoMax port.write("#15P%dT100\r\n" % servoTilt) Hello, Been writing some code to run a servo motor, but I can not seem to get it...

Need help incrementing a parameter in UIView.animateWithDuration in swift

ios,swift,delay,increment,animatewithduration
thanks in advance for any help. I have an IBOutlet Collection of buttons that I am trying to present on screen sequentially. They all start off screen fine, but as they animate in, I'd like each button to be presented on screen 0.05 seconds after the previous button. I can't...

Incremental Integer in JCanvas text

javascript,jquery,html5-canvas,increment,jcanvas
I'm trying to increment text value everytime I click on the rectangle. What am I doing wrong ? I don't understand because the call to my var works in drawText but doesn't in setLayer. I looked at "setLayer" source code, who's working with '+=' syntax, but text is a String...

How to Copy (and increment) Multiple Instances of a File Using Batch File

batch-file,copy,backup,windows-ce,increment
I need to create a batch file that copies a file and increments it upon placing it at the destination. Example. copy C:\TEMP\MyDoc.txt E:\MyData\ Essentially, I need this copy command to copy every time I start it (which it does now just fine). I would like it to increment the...

Why are my values in this function not incrementing?

python,increment
The function war has three values that I am trying to increment. They are playerOneWins, playerTwoWins, and ties. Whenever I pass variables through this function, all of the code in the function is performed properly except the incrementing. Can anybody offer me clues as to why that is? import random...

Can't increment variable in Swift - not throwing any errors

swift,increment
(I'm very new to programming, so layman-friendly answers are certainly appreciated) I'm working on a game played with two teams. I have a button that does a check for which team is up and then updates that team's score. The code runs with no errors but the score doesn't update...

Counter not working after jumps - assembly language

loops,assembly,counter,increment
For some reason, when i switch to mouse input switch back to keyboard input for my program, increasing and decreasing the counter has no effect. It works perfectly in the first loop where we input characters. Here is the program guys, any advice? look at whatspeed jump for reference after...

Java value plus variable++

java,operators,increment
Consider the following code int val1 = 3; val1++; int val2 = val1++; System.out.println(val1); System.out.println(val2); Val1 value = 5; Val2 value = 4; Why is the value of Val1 "5"? As I understand it it should be 4, because: at line1 it is assigned value of 3, on line2 1...

Increment Row value in excel on each button click

excel,vba,row,increment
in excel macro I need to increment row each time I click the button. Sort of Next value function that should be read from the datasheet. Also this value needs to be returned to a cell in a different sheet. This is the code I have, how do I increment...

Using for loop to iterate two variables together

python,for-loop,numpy,increment
How do I go about doing something like this? Say I have an array x = np.array([1,2,3,4,5]) of length 5, for i,j in range(len(x)): I want i and j to increment together. This is throwing me an error message: TypeError Traceback (most recent call last) <ipython-input-4-37d0ddc3decf> in <module>() ----> 1...

Are Parse Counters Multi-threaded?

ios,multithreading,parse.com,increment,decrement
I am creating an app that will increment/decrement a value by 1 or 2 based on responses from users. If multiple users try to change the value at the same time, will it work correctly? My example code is: PFObject *gameScore = [PFObject objectWithClassName:@"GameScore"]; [gameScore setObject:[NSNumber numberWithInt:1337] forKey:@"score"]; [gameScore saveInBackground];...

Increment value by 1 using Wordpress by pressing button

php,sql,wordpress,increment
I have a Wordpress website and I want to have a page where if you press a button it increments a stored value by 1. I would prefer for the page to refresh once the button is pressed to show a page with the new integer value. I am not...

Increment wrt TCC , GCC [duplicate]

c,increment,ansi-c
This question already has an answer here: Why are these constructs (using ++) undefined behavior? 11 answers I am skipping header files and void main... Code 1:- int a = 5 , c ; c = a++ + ++a + a++; a = 5; printf("%d %d",a++ + ++a +...

SQL Server or SSIS code for incrementing

sql-server,ssis,increment
Input ID 12345 12346 12346 12387 12568 12387 12387 Output ID - Value 12345 - 1 12346 - 2 12346 - 2 12387 - 3 12568 - 4 12387 - 5 12387 - 5 I have an input like shown above and I need an output also shown. So looking...

Variable does not increment in probability program

java,for-loop,increment,probability
I have three classes. A super class probability, a subclass Eating and a runner class Person. The goal is for certain methods to be "triggered" when conditions are met in a for loop. Eating (method dox) will increase the variable weight. Once weight is greater than 120, then the probability...

python list controlled increment

python,list,increment
I'm trying to increment a python list of numbers like an abacus. list = [0,0,0,0] units = 4 def m(list, units): for e in range(len(list)): if units: list[e] = list[e] + 1 units -= 1 This code works fine in that if I run m(list, units) the list will be...

C++ - strange time mesurements with and without if statement

c++,if-statement,increment,performance-testing
I stumbled upon a strange duration difference between two equivalent increment syntax. if(seed != state) ++i; this notation measures 2.25 ms per 1048576 iterations i += (seed != state); and this 2.80 ms per 1048576 iterations. Shouldn't the second notation be a bit faster than the first? It is to...

Incrementation not showing in MessageBox and variable values being changed

c#,operators,increment
I have two questions about this code... Why is that at line 10 it starts keeping the current value. For example, int a = 7 (a += 4) Which is 11 is brought over to the next line of code (a -= 4) now making it 7. Instead of just...

Python initializing variable in a nested loop

python,increment,nested-loops
i want the the variable genCounter to reset to zero when the iteration of the inner loops has completed. however it returns the first value of genreSet and does not go farther to increment the genCounter variable. kawa is a genrator object. Thanks in advance.. kawa = self.getFile() genList =...

Increment number in string C++ [duplicate]

c++,string,int,increment
This question already has an answer here: Converting an int to std::string 7 answers I'm trying to increment the name of the file based on the number associated with the filename. If I make the variable postFix an int type, it gives an error (understandably) since I can't concatenate...

Periodic to incremental (data reduction)

matlab,data,increment,reduction,periodic-processing
it's some time i was thinking about solving this problem. I have a registration of angular data (Angle(~20000,1)) variating between 0 and 355 (a potentiometer attached to a rotary testing machine), and I wanted to convert it in an incremental form, since I want the final total angular displacement. The...

Increment/Decrement byte (char) in c++ with over/under-flow

c++,byte,overflow,increment,underflow
What is the best way to increment/decrement a byte in c++ while taking into consideration the overflow and underflow? For example, I have: char c = random byte; c += 0xB; In case c <= 0xF4, this will work well, but any value above that would cause an overflow. Likewise,...

C++ Pointer increment query

c++,c,function,pointers,increment
I have a working code for a function which takes a character and a number and forms a string by duplicating that character that number of times. Here is a piece that works perfectly fine. char * buildstr(char c, int n) { char * pc = new char[n+1]; for (int...

Incrimenting value DOWN wont print out

java,variables,if-statement,for-loop,increment
Having an issue printing the results of i when I'm incrementing DOWN starting from startVal and ending at endVal with an increment of incVal. the first if statement is printing correctly and I had THOUGHT that the second else if statement should be fairly similar however even though my original...

Why am I getting weird increments in my for loop?

javascript,for-loop,increment
I have been testing ways to check individual characters in a string for a numeric value. I set up a for loop that goes through them, but when I'm logging it to the console, I get a weird response: isNumeric: function(n){ for(var i = 0; i < n.length; i++){ console.log("Looping...

how to simplify an img array that uses many drawable ressources

android,arrays,android-studio,drawable,increment
I have an array which contains several drawables needed by my main java code I use this to call them when needed: mImagesArray = new int[]{R.drawable.img_0, R.drawable.img_1, R.drawable.img_2,...,R.drawable.img_m} this direct implementation method works but imagine if i have an array containing +100 images, I would call each drawable value from...

Why does increment using ++ work with strings in javascript?

javascript,type-conversion,increment,unary-operator
Normally when I get the value of a form input with jQuery I am obliged to convert it to a number before performing any mathematical operations. For instance, using the unary plus operator to convert, and then increment: var x = +$(this).val(); x += 1; But for some reason ++...

PHP - Create unique id number for each item

php,count,increment
I have an image array loop, and it successfully loops through my image items. However, I need to give the 'data-slide-index' attribute for each item a unique number, starting from 0, adding 1 for each following item (0 - 9 if there are ten images in total). I realize this...

Incrementing the last of a period-separated sequence of numbers in a batch file

batch-file,versioning,increment
I have a batch file which performs part of a software build process. It pulls the current tag name out of the build system, and puts it into a generated C source file. If the source is not being built from a tag, it gets the name of the latest...

Excel auto increment decimal value in column until max value has reached in column

excel,decimal,increment
I'm looking for a solution to auto increment decimal value in a column until maximum value has reached for each column. I have managed to make an formula for column A { =SUM(B3+0,1) } By dragging down cell 1 to a maximum value that i require, however this is not...

Modify Date type (Java) [duplicate]

java,date,increment
This question already has an answer here: Adding days to a date in Java 6 answers need some help here with the Date type. I'm managing a CreditCard class with the following parameters public class CreditCard extends Card{ Date monthlyFee; double amount2pay; public CreditCard(StandardAccount yourAssociatedBankAccount,Date monthlyFeeDay) { super(yourAssociatedBankAccount); monthlyFee=monthlyFeeDay;...

Python- add to dictionary based on an incrementing value in 2 lists

python,list,dictionary,increment
I have 2 lists which i have created and added an incrementing value to each item. The reason being that the values in each list are to be joined together in a dictionary. However the values in each list are not a 1 to 1 pair..this is why i added...

How do I auto-generate an integer value for each time a user input a string value?

java,arrays,oop,increment,getter-setter
Description: My program asks usres to create a person's account by entering some information (i.e. name, amount..). This things are done in a while loop so that the task can be repeated again and again. The all info is stored in a file with ArrayLists. I have getter and setter...

Conditional $inc in MongoDB query

database,mongodb,nosql,increment
I have a survey system with documents like this: { "_id" : ObjectId("555b0b33ed26911e080102c4"), "question" : "survey", "subtitle" : "", "answers" : [ { "title" : "option 1", "color" : "#FFEC00", "code" : "opt1", "_id" : ObjectId("555b0b33ed26911e080102ce"), "votes" : 0, "visible" : true }, { "title" : "option 2", "color" :...

turn_counter does not reset jquery

javascript,jquery,increment
I'm trying to build a jQuery Tic-tac-toe game. I'll paste the entire thing so you only have to use 1 file. The issue I'm having is that after each win/tie, the clearboard() function needs to reset the board as well as all assigned classes from the previous game. Now it...

PHP + SQLi - Auto incrementing ID's

php,mysql,mysqli,increment,auto
I've come across a problem where in my PHP, for some reason I have to define what the ID is or I get my "die" message, even though the table structure is set to auto increment, here is my PHP: $query = mysqli_query($link, "INSERT INTO users (username, email, passhash, reg_ip,...

Android EditText with numeric input type : the increment doesn't work

android,android-edittext,increment
I have an EditText edit_text with numeric input type and I want to do an increment of the variable in it when I press the button "+". I try this code but doesn't work. I get a FATAL EXCEPTION. @Override public void onClick(View v) { String value = edit_text.getText().toString(); int...

vb.net increment string with prefix

vb.net,string,integer,increment
I'm sure this question has been asked before, but I can't find exactly what I'm after. I have a string which has a string, then a dash, then a number, e.g. "TERM-01" which happens to be the name of an electrical terminal in a switchboard. I want to increment it...