addition

Javascript: Add +1 to number that starts with 0 (like 01, 02, 03) and keep the zero

Hi, I like to add (+1) to a number. But problem is my number can sometimes have 0 preceding it. Like 01, 02, 03, 04. So I like result to be: mockup01 + 1 = mockup02 mockup11 + 1 = mockup12 How can that be achieved? Example of how I would use it would be if I had filename named mockup_01.htm and change it to mockup_02.htm Thanks! ...

Addition of an integer to a pointer

In following code, #include<stdio.h> int main() { short a[2]={5,10}; short *p=&a[1]; short *dp=&p; printf("%p\n",p); printf("%p\n",p+1); printf("%p\n",dp); printf("%p\n",dp+1); } Now the output I got was : 0xbfb45e0a 0xbfb45e0c 0xbfb45e04 0xbfb45e06 Here I understood p and p+1, but when we do dp...

Question with R. Element wise multiplication, addition, and division with 2 data.frames with varying amounts of missing data in a given row.

I have a various data.frames with columns of the same length where I am trying to multiple 2 rows together element-wise and then sum this up. For example, below are two vectors I would like to perform this operation with. > a.1[186,] q01_a q01_b q01_c q01_d q01_e q01_f q01_g q01_h q01_i q01_j q01_k q01_l q01_m 3 3 3 3 ...

Bulk adding items

Present Scenario, A custom page where complaints being logged by any authenticated users are added as items to a SharePoint lists. Whenever new complaints are logged a unique reference number gets generated and the new item will get added in the one of the SharePoint lists. Each item has few columns like, the category of the complaint ...

Excel VBA Double Addition Error

I'm having a hard time explaining this one. The following function is being used as a worksheet formula. A value of "empty" simply means that the cell was empty and, therefore, there is no value. Given the values {empty, empty, 0.8, 0.2}, the following function is sometimes returning off the wall values like 5.55111512312578E-17. In ...

CUDA Basic Matrix Addition - Large Matrices

Hi all, I'm trying to add two 4800x9600 matrices, but am running into difficulties... It's a simple C=A+B operation... Here is the kernel: __global__ void matAdd_kernel(float* result,float* A,float* B,int size) { int x=blockIdx.x*blockDim.x+threadIdx.x; int y=blockIdx.y*blockDim.y+threadIdx.y; int idx=x*y+x; ...

adding military time in string representation

So what I am trying to do is add two strings together in the form of military time. Here is the example. Time1 = "01:00"; Time2 = "04:30"; Adding the two together would produce "05:30". This seems incredibly simple, but it has been a long long day for a new learner. Any help would be greatly appreciated. ...

Change filename by 1 every time (bash script)

I'm making a (bash) script for mass keyfile generation. I need the script to name the first generated keyfile "1", the next "2" and so on - So I need every filename to be the previous filename + 1. The script so far: #!/bin/bash #Files in directory dir=$(ls -U -l /home/user/keyfiles|wc -l) name= #script target=/home/user/keyfiles/$na...

Why does adding two decimals in Javascript produce a wrong result?

Possible Duplicate: Is JavaScripts Math broken? Why does JS screw up this simple math? document.write(.1 + .2) // 0.3000000000000004 document.write(.3 + .6) // 0.8999999999999999 The first example is greater than the correct result, while the second is less. ???!! How do you fix this? Do you have to always convert decimal...

jQuery addition of multiple text box values

Hi all, I have a new task to do and im not sure the best way to approach it with jQuery. Basically a client wants 'x' amount of text boxes (for quantity) each with a plus/minus button/icon to the side of it and as you click on each one, all the relative fields update. e.g. (if there were 3 options in a page) qty [ 0 ] + - qty [ 0 ] +...

VB.NET - Want to add together two nullable types - how? (i.e. var1 + var2 where both are nullable and vari1=Nothing, Var2=5 results in Nothing)

I have: Dim nVar1 As Long? Dim nVar2 As Long? Dim nVarSum As Long? nVar1 = Nothing nVar2 = 5 nVarSum = nVar1 + nVar2 I would prefer the result to end with nVarSum being 5, instead of Nothing. I understand if you add something to an unknown value, you will end up with "somthing + unknown" or x+5 will always equal "x+5" not "5" be...

Why does the OpenCL vector addition Nvidia SDK example use async writes?

The vector addition example has this code: // Asynchronous write of data to GPU device ciErr1 = clEnqueueWriteBuffer(cqCommandQueue, cmDevSrcA, CL_FALSE, 0, sizeof(cl_float) * szGlobalWorkSize, srcA, 0, NULL, NULL); ciErr1 |= clEnqueueWriteBuffer(cqCommandQueue, cmDevSrcB, CL_FALSE, 0, sizeof(cl_float) * szGlobalWorkSize, srcB, 0, NULL,...