How do I find the largest number in an array?

I am trying to find the biggest number in an array and the corresponding position. For example if the array was {0,1,5,4,2,9} the solution would be 9 and the corresponding position would be 5. My current solution is for (int m=0; m<=Storage...
more »

2017-07-18 23:07 (0) Answers

Set dbGetQuery to return integer64 as integer

By default when I use dbGetQuery() from the DBI package it returns columns of type integer64 as the integer64 class of the bit64. I then use dplyr to try and filter and manipulate my results but come into issues as dplyr does not support objects of...
more »

2017-07-18 17:07 (1) Answers

Why are vectors created by ':' integer?

Why are vectors created using : of the type integer and vectors created using c() of type double? a <- 1:7 typeof(a) # "integer" class(a) # "integer" b <- c(1,2,3,4,5,6,7) typeof(b) # "double" class(b) # "numeric" ...
more »

2017-07-18 12:07 (1) Answers

Alternating Bitwise concatenation in C

I want to concatenate two integers a, b in C like this: If a has the bitwise representation a_1 a_2 a_3 a_4... and b has the bitwise representation b_1 b_2 b_3 b_4... I want my result to be a_1 b_1 a_2 b_2 a_3 b_3 a_4 b_4. For example: a = 5 = 0101...
more »

2017-07-18 10:07 (1) Answers

Defining variable type

ALL, According to this the maximum integer value is unsigned long. So if I have a value which is bigger the only way is to use double, right? Or there is another alternative? Here is my code: unsigned long id; retcode = SQLPrepare( stmt, qry, SQL...
more »

2017-07-16 18:07 (3) Answers

VB.NET - Can't get Integer to work

I'm working with Windows Forms Application in Visual Studio 2015, using .NET Framework 4.5.2. So I'm making a simple program which includes a label to display a value. The label (called lblMoney) displays the currency (in this case, $) and then the v...
more »

2017-07-15 23:07 (3) Answers

Compression of short sequences of 16-bit integers

I have to compress a set of 8 lists of 9 16-bit signed integers, e.g.: a = [1 2 3 4 5 6 7 8 9] b = [10 11 12 13 14 15 16 17 18] c = [19 20 21 22 23 24 25 26 27] d = [28 29 30 31 32 33 34 35 36 37 38] e = ... We don't have control on the numbers...
more »

2017-07-14 17:07 (0) Answers

How can I show the integer in listview?

I want to show the for loop numbers on the listview, but it doesn't work. App's Layout public class MainActivity extends AppCompatActivity { private ListView marksixlist; private Button mRandombtn, mCleanbtn; private TextView mText; private ArrayLi...
more »

2017-07-14 16:07 (0) Answers

Writing a blank instead of an integer in Fortran

I have a few 110-element vectors. They sometimes have a value from 0 to 9, but their default value is -1. I'd like to print a blank if a cell's value is -1; print their value otherwise. I'm printing several things in an output line so I can't use ...
more »

2017-07-14 06:07 (1) Answers

Converting Integers into Timedelta objects?

Im just struggling with a little bit of basic syntax here, but I am a little confused because Im doing it the exact way it was explained in class. from datetime import datetime depart_date = input("Get departure date(YYYY-MM-DD)") depart_time = inp...
more »

2017-07-13 23:07 (1) Answers

Loops and Sentinel Values

I'm having trouble writing a program that reads in a set of integers and outputs the sum of the integers preceeding a sentinel value using a loop. For example, the input would be a set of values 1 2 3 4 5 0. The sentinel value would be 0 and the int...
more »

2017-07-12 08:07 (2) Answers

Integer to Datetime SQL

I need convert this integer "1469416462" to datetime in format dd-mm-yyyy hh:mm:ss . Any ideas? My Intent: select CONVERT (datetime,1469416462) ...
more »

2017-07-11 19:07 (1) Answers

Java Double doesn't Multiply Correctly

I have a double and a integer value and I wan't to multiply them. My code look completely normal but I get wrong output. Is there something I don't know or is this a bug? double db = 1.2; int m = 3; System.out.print(String.valueOf(db*m))...
more »

2017-07-11 14:07 (0) Answers

couldn't search integers in elasticsearch

I'm new to elasticsearch, i am using amazon's elasticsearch 5.3. this is my json data [ { "Sl. No.": 5, "Code No.": "0101.21.00", "Name of Commodity": "Live Horses" }, { "Sl. No.": 6, "Code No.": "0101.29.00", "Name ...
more »

2017-07-11 12:07 (1) Answers

R integer (date) to number

I have a matrix date that looks like this: Date Time 1 2017-05-19 08:52:21 2 3 2017-05-20 22:29:29 4 2017-05-20 15:21:35 Both date$Date and date$Time are integers. I would like to obtain a new column like this: Date ...
more »

2017-07-10 11:07 (2) Answers

R - 64-bit version of combnPrim in gRbase

The combnPrim function from the gRbase package can only handle integers up to .Machine$integer.max = 2147483647 because it uses R base as.integer: combPrim <- function (x, m, simplify = TRUE) { if (length(x) == 1 && is.numeric(x)) ...
more »

2017-07-10 10:07 (0) Answers

What will be the appropriate data type?

Note:-Here my doubt is regarding selection of appropriate data type for variable product in code written by me (code is attached). Ques: Given an array A[] of n integers, the task is to find a subsequence of size k whose product is maximum among all...
more »

2017-07-07 22:07 (0) Answers