text:
Q: Arduino: Undefined reference to `I2CRW::readByte(unsigned char, unsigned char)' Ive been making a library as a test before I make a bigger library for my IMU code. When inlcuding the library i get the following error.
> \\uoa.auckland.ac.nz\engdfs\Home\cjay511\Documents\Arduino\sketch_may19a/sketch_may19a.ino:303:
> undefined reference to `I2CRW::writeByte(unsigned char, unsigned char,
> unsigned char)'

It comes up whenever I call a function from my custom header file. Ive looked at the solutions on stackoverflow and things like deleting the build folder and rebuilding didnt help.
Code (taken out the #define for the registers coz theres heaps)
 #include <Wire.h>

#include <i2crw.h>

// Specify sensor full scale
int Gscale = 0;
int Ascale = 0;
float AccelRes, GyroRes; // scale resolutions per LSB for the sensors

int16_t accelCount[3];  // Stores the 16-bit signed accelerometer sensor output
float ax, ay, az;       // Stores the real accel value in g's
int16_t gyroCount[3];   // Stores the 16-bit signed gyro sensor output
float gx, gy, gz;       // Stores the real gyro value in degrees per seconds
float gyroBias[3] = {0, 0, 0}, accelBias[3] = {0, 0, 0}; // Bias corrections for gyro and accelerometer
float SelfTest[6];

// parameters for 6 DoF sensor fusion calculations
float GyroMeasError = PI * (40.0f / 180.0f);     // gyroscope measurement error in rads/s (start at 60 deg/s), then reduce after ~10 s to 3
float beta = sqrt(3.0f / 4.0f) * GyroMeasError;  // compute beta
float GyroMeasDrift = PI * (2.0f / 180.0f);      // gyroscope measurement drift in rad/s/s (start at 0.0 deg/s/s)
float zeta = sqrt(3.0f / 4.0f) * GyroMeasDrift;  // compute zeta, the other free parameter in the Madgwick scheme usually set to a small or zero value
float deltat = 0.0f;                              // integration interval for both filter schemes
uint32_t lastUpdate = 0, firstUpdate = 0;         // used to calculate integration interval
uint32_t Now = 0;                                 // used to calculate integration interval
float angle;

uint32_t delt_t = 0; // used to control display output rate
uint32_t count = 0;  // used to control display output rate

I2CRW i2crw;

void setup() {
  // put your setup code here, to run once:

  //Wire.begin();
  Serial.begin(38400);
  uint8_t c = i2crw.readByte(MPU9150_ADDRESS, WHO_AM_I);
    // Get magnetometer calibration from AK8975A ROM

  if (c == 0x68) // WHO_AM_I should always be 0x68
  {
    Serial.println("MPU9150 is online...");

    MPU9150SelfTest(SelfTest);
    Serial.println("Senpai, My acceleration trim values");
    Serial.print("x-axis self test: acceleration trim within : ");
    Serial.print(SelfTest[0],1);
    Serial.println("% of factory value");

    Serial.print("y-axis self test: acceleration trim within : ");
    Serial.print(SelfTest[1],1);
    Serial.println("% of factory value");

    Serial.print("z-axis self test: acceleration trim within : ");
    Serial.print(SelfTest[2],1);
    Serial.println("% of factory value");

    Serial.println("Senpai, My gyration trim values");
    Serial.print("x-axis self test: gyration trim within : ");
    Serial.print(SelfTest[3],1);
    Serial.println("% of factory value");

    Serial.print("y-axis self test: gyration trim within : ");
    Serial.print(SelfTest[4],1);
    Serial.println("% of factory value");

    Serial.print("z-axis self test: gyration trim within : ");
    Serial.print(SelfTest[5],1);
    Serial.println("% of factory value");

     if(SelfTest[0] < 1.0f && SelfTest[1] < 1.0f && SelfTest[2] < 1.0f && SelfTest[3] < 1.0f && SelfTest[4] < 1.0f && SelfTest[5] < 1.0f)
      {
        Serial.println("Senpai I have Passed my Selftest!!");
        delay(3000);
        calibrateMPU9150(gyroBias, accelBias); // Calibrate gyro and accelerometers, load biases in bias registers
        Serial.println("My biases, senpai");
        Serial.print("Acceleration bias X: ");
        Serial.println((int)(1000*accelBias[0]));
        Serial.print("Acceleration bias Y: ");
        Serial.println((int)(1000*accelBias[1]));
        Serial.print("Acceleration bias Z: ");
        Serial.println((int)(1000*accelBias[2]));

        Serial.print("Gyration bias X: ");
        Serial.println(gyroBias[0],1);
        Serial.print("Gyration bias Y: ");
        Serial.println(gyroBias[1],1);
        Serial.print("Gyration bias Z: ");
        Serial.println(gyroBias[2],1);

        delay(3000);
        initMPU9150();
        Serial.println("Awaiting command from Senpai");
      }
      else
      {
        Serial.println("Senpai, You are wrong");
      }
   }
  }

void loop()
{
 if(i2crw.readByte(MPU9150_ADDRESS, INT_STATUS) & 0x01)
  {
    Serial.println("Data read byte set");
  }
  else
  {
    Serial.println("Data read byte NOT SET");
  }
      readAccelData(accelCount);
      //getAccelRes();
      AccelRes = 2.0/32768.0;

      readGyroData(gyroCount);
      //getGyroRes();
      GyroRes = 250.0/32768.0;

      ax = (float)accelCount[0]*AccelRes;
      ay = (float)accelCount[1]*AccelRes;
      az = (float)accelCount[2]*AccelRes;

      gx = (float)gyroCount[0]*GyroRes;
      gy = (float)gyroCount[1]*GyroRes;
      gz = (float)gyroCount[2]*GyroRes;

      Now = micros();
      deltat = ((Now-lastUpdate)/1000000.0f);
      lastUpdate = Now;

      angle = gz*deltat;

    Serial.print("average rate = "); Serial.print(1.0f/deltat, 2); Serial.println(" Hz");
      Serial.println("I bought Senpai the Acceleration and Gyration Values");
      Serial.println("");
      Serial.print("ax = "); Serial.print((int)1000*ax);
      Serial.print(" ay = "); Serial.print((int)1000*ay);
      Serial.print(" az = "); Serial.print((int)1000*az); Serial.println(" mg");

      Serial.print("gx = "); Serial.print( gx, 1);
      Serial.print(" gy = "); Serial.print( gy, 1);
      Serial.print(" gz = "); Serial.print( gz, 1); Serial.println(" deg/s");
      Serial.println("");
      Serial.print("angle = "); Serial.println(angle,1);

delay(1000);
}

void readAccelData(int16_t *acceldata)
{
  uint8_t rawdata[6];
  i2crw.readBytes(MPU9150_ADDRESS, ACCEL_XOUT_H, 6, &rawdata[0]);
  acceldata[0] = (int16_t)((rawdata[0]<<8)|(rawdata[1]));
  acceldata[1] = (int16_t)((rawdata[2]<<8)|(rawdata[3]));
  acceldata[2] = (int16_t)((rawdata[4]<<8)|(rawdata[5]));
}

void readGyroData(int16_t *gyrodata)
{
  uint8_t rawdata[6];
  i2crw.readBytes(MPU9150_ADDRESS, GYRO_XOUT_H, 6, &rawdata[0]);
  gyrodata[0] = (int16_t)((rawdata[0]<<8)|(rawdata[1]));
  gyrodata[1] = (int16_t)((rawdata[2]<<8)|(rawdata[3]));
  gyrodata[2] = (int16_t)((rawdata[4]<<8)|(rawdata[5]));
}

void initMPU9150()
{
  i2crw.writeByte(MPU9150_ADDRESS, PWR_MGMT_1, 0x01);
  i2crw.writeByte(MPU9150_ADDRESS, CONFIG, 0x03);
  i2crw.writeByte(MPU9150_ADDRESS, SMPLRT_DIV, 0x04);

  uint8_t c = i2crw.readByte(MPU9150_ADDRESS, GYRO_CONFIG);
   i2crw.writeByte(MPU9150_ADDRESS, GYRO_CONFIG, c & ~0xE0);
  i2crw.writeByte(MPU9150_ADDRESS, GYRO_CONFIG, c & ~0x18);
  i2crw.writeByte(MPU9150_ADDRESS, GYRO_CONFIG, c | Gscale << 3);

  c =  i2crw.readByte(MPU9150_ADDRESS, ACCEL_CONFIG);
  i2crw.writeByte(MPU9150_ADDRESS, ACCEL_CONFIG, c & ~0xE0); // Clear self-test bits [7:5]
  i2crw.writeByte(MPU9150_ADDRESS, ACCEL_CONFIG, c & ~0x18); // Clear AFS bits [4:3]
  i2crw.writeByte(MPU9150_ADDRESS, ACCEL_CONFIG, c | Ascale << 3);

   i2crw.writeByte(MPU9150_ADDRESS, INT_PIN_CFG, 0x22);
   i2crw.writeByte(MPU9150_ADDRESS, INT_ENABLE, 0x01);
}

void calibrateMPU9150(float * dest1, float * dest2)
{
  uint8_t data[12];
  uint16_t ii, packet_count, fifo_count;
  int32_t gyro_bias[3] = {0,0,0}, accel_bias[3] = {0,0,0};

  i2crw.writeByte(MPU9150_ADDRESS, PWR_MGMT_1, 0x80);
  delay(100);

  i2crw.writeByte(MPU9150_ADDRESS, PWR_MGMT_1, 0x01);
  i2crw.writeByte(MPU9150_ADDRESS, PWR_MGMT_2, 0x00);
  delay(200);

// Configure device for bias calculation
  i2crw.writeByte(MPU9150_ADDRESS, INT_ENABLE, 0x00);   // Disable all interrupts
  i2crw.writeByte(MPU9150_ADDRESS, FIFO_EN, 0x00);      // Disable FIFO
  i2crw.writeByte(MPU9150_ADDRESS, PWR_MGMT_1, 0x00);   // Turn on internal clock source
  i2crw.writeByte(MPU9150_ADDRESS, I2C_MST_CTRL, 0x00); // Disable I2C master
  i2crw.writeByte(MPU9150_ADDRESS, USER_CTRL, 0x00);    // Disable FIFO and I2C master modes
  i2crw.writeByte(MPU9150_ADDRESS, USER_CTRL, 0x0C);    // Reset FIFO and DMP
  delay(15);

// Configure MPU9150 gyro and accelerometer for bias calculation
  i2crw.writeByte(MPU9150_ADDRESS, CONFIG, 0x01);      // Set low-pass filter to 188 Hz
  i2crw.writeByte(MPU9150_ADDRESS, SMPLRT_DIV, 0x00);  // Set sample rate to 1 kHz
  i2crw.writeByte(MPU9150_ADDRESS, GYRO_CONFIG, 0x00);  // Set gyro full-scale to 250 degrees per second, maximum sensitivity
  i2crw.writeByte(MPU9150_ADDRESS, ACCEL_CONFIG, 0x00); // Set accelerometer full-scale to 2 g, maximum sensitivity

  uint16_t  gyrosensitivity  = 131;   // = 131 LSB/degrees/sec
  uint16_t  accelsensitivity = 16384;  // = 16384 LSB/g

  // Configure FIFO to capture accelerometer and gyro data for bias calculation
  i2crw.writeByte(MPU9150_ADDRESS, USER_CTRL, 0x40);   // Enable FIFO
  i2crw.writeByte(MPU9150_ADDRESS, FIFO_EN, 0x78);     // Enable gyro and accelerometer sensors for FIFO  (max size 1024 bytes in MPU-9150)
  delay(80); // accumulate 80 samples in 80 milliseconds = 960 bytes

// At end of sample accumulation, turn off FIFO sensor read
  i2crw.writeByte(MPU9150_ADDRESS, FIFO_EN, 0x00);        // Disable gyro and accelerometer sensors for FIFO
  i2crw.readBytes(MPU9150_ADDRESS, FIFO_COUNTH, 2, &data[0]); // read FIFO sample count
  fifo_count = ((uint16_t)data[0] << 8) | data[1];
  packet_count = fifo_count/12;// How many sets of full gyro and accelerometer data for averaging
  for (ii = 0; ii < packet_count; ii++) {
    int16_t accel_temp[3] = {0, 0, 0}, gyro_temp[3] = {0, 0, 0};
    i2crw.readBytes(MPU9150_ADDRESS, FIFO_R_W, 12, &data[0]); // read data for averaging
    accel_temp[0] = (int16_t) (((int16_t)data[0] << 8) | data[1]  ) ;  // Form signed 16-bit integer for each sample in FIFO
    accel_temp[1] = (int16_t) (((int16_t)data[2] << 8) | data[3]  ) ;
    accel_temp[2] = (int16_t) (((int16_t)data[4] << 8) | data[5]  ) ;
    gyro_temp[0]  = (int16_t) (((int16_t)data[6] << 8) | data[7]  ) ;
    gyro_temp[1]  = (int16_t) (((int16_t)data[8] << 8) | data[9]  ) ;
    gyro_temp[2]  = (int16_t) (((int16_t)data[10] << 8) | data[11]) ;

    accel_bias[0] += (int32_t) accel_temp[0]; // Sum individual signed 16-bit biases to get accumulated signed 32-bit biases
    accel_bias[1] += (int32_t) accel_temp[1];
    accel_bias[2] += (int32_t) accel_temp[2];
    gyro_bias[0]  += (int32_t) gyro_temp[0];
    gyro_bias[1]  += (int32_t) gyro_temp[1];
    gyro_bias[2]  += (int32_t) gyro_temp[2];

}
    accel_bias[0] /= (int32_t) packet_count; // Normalize sums to get average count biases
    accel_bias[1] /= (int32_t) packet_count;
    accel_bias[2] /= (int32_t) packet_count;
    gyro_bias[0]  /= (int32_t) packet_count;
    gyro_bias[1]  /= (int32_t) packet_count;
    gyro_bias[2]  /= (int32_t) packet_count;

  if(accel_bias[2] > 0L) {accel_bias[2] -= (int32_t) accelsensitivity;}  // Remove gravity from the z-axis accelerometer bias calculation
  else {accel_bias[2] += (int32_t) accelsensitivity;}

// Construct the gyro biases for push to the hardware gyro bias registers, which are reset to zero upon device startup
  data[0] = (-gyro_bias[0]/4  >> 8) & 0xFF; // Divide by 4 to get 32.9 LSB per deg/s to conform to expected bias input format
  data[1] = (-gyro_bias[0]/4)       & 0xFF; // Biases are additive, so change sign on calculated average gyro biases
  data[2] = (-gyro_bias[1]/4  >> 8) & 0xFF;
  data[3] = (-gyro_bias[1]/4)       & 0xFF;
  data[4] = (-gyro_bias[2]/4  >> 8) & 0xFF;
  data[5] = (-gyro_bias[2]/4)       & 0xFF;

// Push gyro biases to hardware registers
  i2crw.writeByte(MPU9150_ADDRESS, XG_OFFS_USRH, data[0]);// might not be supported in MPU9150
  i2crw.writeByte(MPU9150_ADDRESS, XG_OFFS_USRL, data[1]);
  i2crw.writeByte(MPU9150_ADDRESS, YG_OFFS_USRH, data[2]);
  i2crw.writeByte(MPU9150_ADDRESS, YG_OFFS_USRL, data[3]);
  i2crw.writeByte(MPU9150_ADDRESS, ZG_OFFS_USRH, data[4]);
  i2crw.writeByte(MPU9150_ADDRESS, ZG_OFFS_USRL, data[5]);

  dest1[0] = (float) gyro_bias[0]/(float) gyrosensitivity; // construct gyro bias in deg/s for later manual subtraction
  dest1[1] = (float) gyro_bias[1]/(float) gyrosensitivity;
  dest1[2] = (float) gyro_bias[2]/(float) gyrosensitivity;

// Construct the accelerometer biases for push to the hardware accelerometer bias registers. These registers contain
// factory trim values which must be added to the calculated accelerometer biases; on boot up these registers will hold
// non-zero values. In addition, bit 0 of the lower byte must be preserved since it is used for temperature
// compensation calculations. Accelerometer bias registers expect bias input as 2048 LSB per g, so that
// the accelerometer biases calculated above must be divided by 8.

  int32_t accel_bias_reg[3] = {0, 0, 0}; // A place to hold the factory accelerometer trim biases
  i2crw.readBytes(MPU9150_ADDRESS, XA_OFFSET_H, 2, &data[0]); // Read factory accelerometer trim values
  accel_bias_reg[0] = (int16_t) ((int16_t)data[0] << 8) | data[1];
  i2crw.readBytes(MPU9150_ADDRESS, YA_OFFSET_H, 2, &data[0]);
  accel_bias_reg[1] = (int16_t) ((int16_t)data[0] << 8) | data[1];
  i2crw.readBytes(MPU9150_ADDRESS, ZA_OFFSET_H, 2, &data[0]);
  accel_bias_reg[2] = (int16_t) ((int16_t)data[0] << 8) | data[1];

  uint32_t mask = 1uL; // Define mask for temperature compensation bit 0 of lower byte of accelerometer bias registers
  uint8_t mask_bit[3] = {0, 0, 0}; // Define array to hold mask bit for each accelerometer bias axis

  for(ii = 0; ii < 3; ii++) {
    if(accel_bias_reg[ii] & mask) mask_bit[ii] = 0x01; // If temperature compensation bit is set, record that fact in mask_bit
  }

  // Construct total accelerometer bias, including calculated average accelerometer bias from above
  accel_bias_reg[0] -= (accel_bias[0]/8); // Subtract calculated averaged accelerometer bias scaled to 2048 LSB/g (16 g full scale)
  accel_bias_reg[1] -= (accel_bias[1]/8);
  accel_bias_reg[2] -= (accel_bias[2]/8);

  data[0] = (accel_bias_reg[0] >> 8) & 0xFF;
  data[1] = (accel_bias_reg[0])      & 0xFF;
  data[1] = data[1] | mask_bit[0]; // preserve temperature compensation bit when writing back to accelerometer bias registers
  data[2] = (accel_bias_reg[1] >> 8) & 0xFF;
  data[3] = (accel_bias_reg[1])      & 0xFF;
  data[3] = data[3] | mask_bit[1]; // preserve temperature compensation bit when writing back to accelerometer bias registers
  data[4] = (accel_bias_reg[2] >> 8) & 0xFF;
  data[5] = (accel_bias_reg[2])      & 0xFF;
  data[5] = data[5] | mask_bit[2]; // preserve temperature compensation bit when writing back to accelerometer bias registers

  // Push accelerometer biases to hardware registers
  i2crw.writeByte(MPU9150_ADDRESS, XA_OFFSET_H, data[0]); // might not be supported in MPU9150
  i2crw.writeByte(MPU9150_ADDRESS, XA_OFFSET_L_TC, data[1]);
  i2crw.writeByte(MPU9150_ADDRESS, YA_OFFSET_H, data[2]);
  i2crw.writeByte(MPU9150_ADDRESS, YA_OFFSET_L_TC, data[3]);
  i2crw.writeByte(MPU9150_ADDRESS, ZA_OFFSET_H, data[4]);
  i2crw.writeByte(MPU9150_ADDRESS, ZA_OFFSET_L_TC, data[5]);

// Output scaled accelerometer biases for manual subtraction in the main program
   dest2[0] = (float)accel_bias[0]/(float)accelsensitivity;
   dest2[1] = (float)accel_bias[1]/(float)accelsensitivity;
   dest2[2] = (float)accel_bias[2]/(float)accelsensitivity;
}

void MPU9150SelfTest(float * testdata)
{
  uint8_t rawData[4];
  uint8_t selfTest[6];
  float factoryTrim[6];

  i2crw.writeByte(MPU9150_ADDRESS, ACCEL_CONFIG, 0xF0);
  i2crw.writeByte(MPU9150_ADDRESS, GYRO_CONFIG, 0xE0);
  delay(250);
  rawData[0] = i2crw.readByte(MPU9150_ADDRESS, SELF_TEST_X);
  rawData[1] = i2crw.readByte(MPU9150_ADDRESS, SELF_TEST_Y);
  rawData[2] = i2crw.readByte(MPU9150_ADDRESS, SELF_TEST_Z);
  rawData[3] = i2crw.readByte(MPU9150_ADDRESS, SELF_TEST_A);

 // Extract the acceleration test results first
   selfTest[0] = (rawData[0] >> 3) | (rawData[3] & 0x30) >> 4 ; // XA_TEST result is a five-bit unsigned integer
   selfTest[1] = (rawData[1] >> 3) | (rawData[3] & 0x0C) >> 2 ; // YA_TEST result is a five-bit unsigned integer
   selfTest[2] = (rawData[2] >> 3) | (rawData[3] & 0x03) ; // ZA_TEST result is a five-bit unsigned integer
   // Extract the gyration test results first
   selfTest[3] = rawData[0]  & 0x1F ; // XG_TEST result is a five-bit unsigned integer
   selfTest[4] = rawData[1]  & 0x1F ; // YG_TEST result is a five-bit unsigned integer
   selfTest[5] = rawData[2]  & 0x1F ; // ZG_TEST result is a five-bit unsigned integer

  // Process results to allow final comparison with factory set values
   factoryTrim[0] = (4096.0*0.34)*(pow( (0.92/0.34) , (((float)selfTest[0] - 1.0)/30.0))); // FT[Xa] factory trim calculation
   factoryTrim[1] = (4096.0*0.34)*(pow( (0.92/0.34) , (((float)selfTest[1] - 1.0)/30.0))); // FT[Ya] factory trim calculation
   factoryTrim[2] = (4096.0*0.34)*(pow( (0.92/0.34) , (((float)selfTest[2] - 1.0)/30.0))); // FT[Za] factory trim calculation
   factoryTrim[3] =  ( 25.0*131.0)*(pow( 1.046 , ((float)selfTest[3] - 1.0) ));             // FT[Xg] factory trim calculation
   factoryTrim[4] =  (-25.0*131.0)*(pow( 1.046 , ((float)selfTest[4] - 1.0) ));             // FT[Yg] factory trim calculation
   factoryTrim[5] =  ( 25.0*131.0)*(pow( 1.046 , ((float)selfTest[5] - 1.0) ));             // FT[Zg] factory trim calculation

    for (int i = 0; i < 6; i++) {
     testdata[i] = 100.0 + 100.0*((float)selfTest[i] - factoryTrim[i])/factoryTrim[i]; // Report percent differences
   }
}

Header (.h)
/* I2C library to read and Write Bytes from MPU 9150*/
#ifndef I2CRW_h
#define I2CRW_h

#include "Arduino.h"
#include <Wire.h>

class I2CRW
{
public:
    I2CRW();
    void writeByte(uint8_t address, uint8_t subAddress, uint8_t data);
    uint8_t readByte(uint8_t address, uint8_t subAddress);
    void readBytes(uint8_t address, uint8_t subAddress, uint8_t count, uint8_t * dest);
private:
};
#endif

.cpp
#include "Arduino.h"
#include "i2crw.h"
#include <Wire.h>

I2CRW::I2CRW(){
}

void writeByte(uint8_t address, uint8_t subAddress, uint8_t data)
 {
     Wire.beginTransmission(address);  // Initialize the Tx buffer
    Wire.write(subAddress);           // Put slave register address in Tx buffer
    Wire.write(data);                 // Put data in Tx buffer
    Wire.endTransmission();           // Send the Tx buffer
 }

 uint8_t readByte(uint8_t address, uint8_t subAddress)
{
  uint8_t data; // `data` will store the register data
  Wire.beginTransmission(address);         // Initialize the Tx buffer
  Wire.write(subAddress);                  // Put slave register address in Tx buffer
  Wire.endTransmission(false);             // Send the Tx buffer, but send a restart to keep connection alive
  Wire.requestFrom(address, (uint8_t) 1);  // Read one byte from slave register address
  data = Wire.read();                      // Fill Rx buffer with result
  return data;                             // Return data read from slave register
}

void readBytes(uint8_t address, uint8_t subAddress, uint8_t count, uint8_t * dest)
{
  Wire.beginTransmission(address);   // Initialize the Tx buffer
  Wire.write(subAddress);            // Put slave register address in Tx buffer
  Wire.endTransmission(false);       // Send the Tx buffer, but send a restart to keep connection alive
  uint8_t i = 0;
        Wire.requestFrom(address, count);  // Read bytes from slave register address
  while (Wire.available()) {
        dest[i++] = Wire.read(); }         // Put read results in the Rx buffer
}

Any help would be appreciated. Dont think you need my whole sketch but I put it up just in case.
Thanks
Sahan

A: I suppose that the problem is that you have declared a class IWCRW, in "i2crw.h", with some methods (writeByte() and two different readBytes()), but you haven't implemented they.
If you look at the cpp file ("i2crw.cpp", I suppose), you have implemented the constructor
I2CRW::I2CRW()

and three function that aren't related with I2CRW class
void writeByte(uint8_t address, uint8_t subAddress, uint8_t data)

uint8_t readByte(uint8_t address, uint8_t subAddress)

void readBytes(uint8_t address, uint8_t subAddress, uint8_t count, uint8_t * dest)

I suppose your intention was to implement the three IWCRW method but you have forgot the I2CRW:: part before the name of the functions.
Solution: correct, in cpp class file, the function implementation in method implementation
void IWCRW::writeByte(uint8_t address, uint8_t subAddress, uint8_t data)

uint8_t IWCRW::readByte(uint8_t address, uint8_t subAddress)

void IWCRW::readBytes(uint8_t address, uint8_t subAddress, uint8_t count, uint8_t * dest)

p.s.: sorry for my bad English.


text:
Q: Sum column , on a distinct count when a certain value is met CREATE TABLE `vote_days` (
 `id` int(10) unsigned NOT NULL AUTO_INCREMENT,
 `t_id` int(11) NOT NULL COMMENT 'title id',
 `r_id` int(11) NOT NULL COMMENT 'release id',
 `l_id` int(11) NOT NULL COMMENT 'language id',
 `e_id` int(11) DEFAULT NULL COMMENT 'episode_id',
 `unix_day` int(11) NOT NULL,
 `votes` mediumint(8) unsigned NOT NULL DEFAULT '0',
 PRIMARY KEY (`id`)
)

16000~ rows example , year spread.
https://www.db-fiddle.com/f/amvnHkVnFS3YBFYUJNRcbx/0
This table is the amount of (user) votes for each day (in unix timestamp format).
We got Movie and Tv titles.  (t_id).
TV titles have an e_id ( episode id) ,on movies the e_id is NULL.
It got different formats ( releases) and different languages (l_id).
Question :   I want to get the sum of all votes for each movie titles , but I want to split the votes for TV shows by the amount of episodes. In certain time-frames ordered by the total amount of votes ( Most popular).
Is there a more efficient (performance wise) way to do this ?
SELECT
t1.*,
(SUM(t1.votes) / (CASE WHEN t1.e_id IS NULL THEN 1 ELSE COUNT(DISTINCT(e_id)) END) ) as total_votes

FROM `vote_days` t1
  GROUP BY t_id
ORDER BY total_votes  DESC

A: In general, I think the query is good for MySQL 5.7. I don't see a way of improving it unless you jump into MySQL 8.x and you want to use CTEs.
The big change I would add is to create an index that could theoretically improve performance. Only the execution plan will tell, however:
create index ix1 on `vote_days` (t_id, e_id, votes);

I would improve the syntax a little bit (minor chnges to clear out some confusions) and I would rephrease it as:
SELECT
  *,
  (
    SUM(votes) /
    CASE WHEN max(e_id) IS NULL THEN 1 ELSE COUNT(DISTINCT e_id) END
  ) as total_votes
FROM `vote_days`
GROUP BY t_id
ORDER BY total_votes DESC

redpajama_set_name: RedPajamaStackExchange


text:
Q: Warrant AWS Python Cognito Error: User pool client ******** does not exist I am trying to use the Python library for using AWS Cognito called capless/warrant. Every time I try to instantiate, by using this function:
u = Cognito('your-user-pool-id','your-client-id')

(using my user-pool-id and my client-id, I have checked a ton!), I get this error:
An error occurred (ResourceNotFoundException) when calling the SignUp operation: User pool client ********** does not exist.

I have tried getting rid of everything in the user pool ID but "us-east-2", but this also doesn't work. Has anyone gotten this or know how to solve it? Thank you!

A: Try with your region name.
u = Cognito('your-user-pool-id','your-client-id',user_pool_region='us-east-2')


text:
Q: Channel ID different in MS Teams iOS Mobile App different from ID in MS Teams desktop client We've built a Custom Tab for Microsoft Teams and use the context (TeamId, ChannelId) to show corresponding information on that tab.
Since a month or two this no longer works for the (iOS) mobile App for Microsoft Teams. Investigating the issue it turns out the ChannelId that Microsoft Teams is publishing in the context, differs between MS Teams Desktop App and MS Teams Mobile App. More precise: no matter what channel you are opening in the iOS MS Teams App the ChannelId of the General channel (which equals TeamId) is passed in the context as ChannelId (instead on the ChannelId at hand).
Please note: in the past our Custom App has worked perfectly in both Apps, so something changed in the MS Teams Mobile App. To me it seems really odd that the ChannelId published in Mobile App is different from the one published in Desktop Client (and Graph API).
How can we come to an ChannelId that is the same across all Apps on all platforms?


text:
Q: performance optimization of snap points using drag and drop in RaphealJS I have a demo page where I am looking at the performance of around 300 points that an object should snap to when being dragged.
http://jsfiddle.net/digiguru/rVFje/
I have optimized it by loading the bounds of each "snap" point into 4 arrays when the drag is started.
var circleT = [];
var circleR = [];
var circleB = [];
var circleL = [];

var start = function (event) {
    this.ox = this.attr("cx");
    this.oy = this.attr("cy");
    var threshold = 15;

    for (var myCircle in circles) {
        circleT[myCircle] = circles[myCircle].attr("cy") - threshold;
        circleR[myCircle] = circles[myCircle].attr("cx") + threshold;
        circleB[myCircle] = circles[myCircle].attr("cy") + threshold;
        circleL[myCircle] = circles[myCircle].attr("cx") - threshold;
    }
    circle.animate({ r: 20,fill: "#319F40", "stroke-width": 1 }, 200);
},

Then in the move event we use the following to calculate the dragged object from each of the snap points...
move = function (mx, my) {
    var inrange = false;
    var mouseCX = this.ox + mx;
    var mouseCY = this.oy + my;
    var lockX = 0;
    var lockY = 0;

   for (var myCircle in circles) {
        if ((circleT[myCircle] < mouseCY
             && circleB[myCircle] > mouseCY )
            && (circleR[myCircle] > mouseCX
                && circleL[myCircle] < mouseCX )) {
           inrange = true;
           lockX =  circles[myCircle].attr("cx");
           lockY =  circles[myCircle].attr("cy");
        }
    }
    if (inrange) {
         this.attr({
            cx: lockX ,
            cy: lockY
        });
    } else {
        this.attr({
            cx: mouseCX ,
            cy: mouseCY
        });
    }

},

Genrally performance, is good, but you can notice frames dropping on slightly older IE browsers (IE8 and below). Is there a ninja way to improve performance at all? Perhaps I can improve the 4 if statements? Would using another javascript library like processing JS yeild better results?

A: Currently you consider every circle on every iteration. You could improve performance by considering fewer circles using a technique similar to this.
http://en.wikipedia.org/wiki/Quadtree
Basically, create bounding boxes for collections of circles. If the circle you are dragging is out of bounds then don't consider any circle within the bounding box. I hope this helps.


text:
Q: In Xamarin, Use OnIdiom with OnIdiom Why MergedWith ResourceDictionary attribute's doesn't support OnIdiom feature ?
This code works good:
<ResourceDictionary.MergedWith>theme:PhoneTheme</ResourceDictionary.MergedWith>

This one set the MergedWith property to null :
<ResourceDictionary.MergedWith>
    <OnIdiom x:TypeArguments="x:String">
        <OnIdiom.Phone>theme:PhoneTheme</OnIdiom.Phone>
        <OnIdiom.Tablet>theme:TabletTheme</OnIdiom.Tablet>
    </OnIdiom>
</ResourceDictionary.MergedWith>

Is there any solution to use a different theme between the phone idiom and the tablet idiom ?

A: You can't currently do this in XAML at this stage, however you can work around it with a codebehind file. I use the Application xaml and codebehind to dynamically change the themes. Then just do the standard inheritance for the Phone and Tablet themes to common colors, styles, etc. Only overriding what is needed in each Iodiom specific theme.
MyApp.xaml
<Application ...>
    <ResourceDictionary x:Name="appTheme"> <!-- Name the Resource Dict //-->
        ...Any converters, etc
    </ResourceDictionary>
</Application>

MyApp.xaml.cs
public partial class MyApp : Application
{
    public MyApp()
    {
        InitializeComponent();
        // Toggle appTheme.MergedWith based on Idiom
        appTheme.MergedWith = Device.Idiom == TargetIdiom.Phone ? typeof(PhoneTheme) : typeof(TabletTheme);
    }
}

A: It isn't support right now, but has been coined on the Xamarin Forums.
A workaround could be to create seperate pages for phone and tablet and dependent on the idiom show one page or the other. On that page you can have it's own theme. I guess that's the best you can do at this time.


text:
Q: iOS SDK Convert Address to GPS I'm not a developer, so I appreciate your patience with me as I ask for help. We've hired a dev house to build a native iOS app and have a feature that pulls several address fields from our back-end to place multiple "pins" on an in-app Google maps display. Sometimes it works - sometimes it doesn't - and when it doesn't, it gives the user their current location. The address fields in the database have all been directly copy/pasted from Google Maps online so we know the addresses are formatted exactly as Google recognizes them.
I searched and found this topic which seem to indicate that this should be easily do-able with proper coding:
Geoencode Address to GPS Coordinates (to do with another API)
I also found a few other posts that deal with this issue on Android (How can I find the latitude and longitude from address?), and iOS but using addresses from within the app (Convert address to longitude and latitude).. ours are being pulled from a database.
Our developer has given us a work-around that requires us to manually go in and "place" the pins for every address in our back-office, which is super laborious as we have thousands of entries to correct and no way to know which are not showing correctly until a user tries to access them.
My question is this - shouldn't this be something that can be rectified with proper coding?
If it is possible, is there specific formatting requirements that we're not adhering to?
I'm posting in lieu of the developer because he feels like he's given us a fair method to solve it - however, I would prefer a more universal and less labor intensive solution.
THANKS ALL

A: This isn't the answer, its comments that are too long to fit in the comment section.
What does this mean exactly :""place" the pins for every address in our back-office"? That may not necessarily be laborious as a coder could write a script (a small program) to do it rather than a person do it manually. However that is not to say that is the correct approach, and it certainly doesn't sound like it.
I have not used google maps myself on iOS so what I am saying is not definitive, but I certainly cannot see why CLGeocoder cannot be used to convert your addresses to co-ordinates. If your addresses are not in the correct format then I also cannot see any reason why your developer cannot deal with that in the app and convert them to the format CLGeoder requires if it can't deal with them.
Can you provide an example of the address format you have in your database.
However IF your developer is competent and diligent there may be a reason why that is not feasible, have you asked them for a detailed explanation and justification exactly why they cannot use CLGeocoder or something else? (This thread here suggests its not very accurate, iOS: ReverseGeocoding Using CLGeocoder Vs. Google Geocoder API. Though the posting is a few years old now and that situation may have changed).
Its your app and you are paying the developer,  so ask them  to explain their work-around solution and why its necessary in their opinion and then post their response here.
You may have a competent developer who knows what he's doing, but you may have an "Always Cheaper" one https://www.pinterest.com/pin/21462535695146328/
But its not possible to know without knowing their reason and justification for asking you to put the pins in your back office.


text:
Q: A GCD summation $\sum_{\gcd(i,n)=1} \gcd(i-1,n)$ Let $$\ n=p_1^{a_1}p_2^{a_2}p_3^{a_3}\ldots$$ where $p_1,p_2\ldots$ are prime factors of $n$.

Show that
  $$\sum_{i=1,\,\gcd(i,n)=1}^n \gcd(i-1,n) = \prod_{} (a_i+1)(p_i-1)p_i^{a_i-1}.$$

I was able to prove it for $n$ having only one prime factor, but I don't know how to proceed for the general case. Assume $\gcd(0,n)=n$.

A: The RHS of your identity is $\tau(n)\phi(n)$, which was very suggestive, so I made some google search and I found the what you want to prove is known as Menon's identity, but in that link there is no proof about this result, however I found another link where this identity is proved. The proof only uses elementary number theory.
By the way, Menon's identity has been generalized in different ways. Here are some of them:

*

*Menon's identity and arithmetical sums representing functions of
several variables

*A generalization of Menon's identity

*A generalization of Menon's identity with respect to a set of polynomials

*Another generalization of the gcd-sum function


text:
Q: How to pass long as string on url for json response in loopj Just started learning loopj. how to pass long {id} on url as string?
I have a method in client like this,
  public static void getAllByIdForSpinner(Context context, String url, Header[] headers,
        RequestParams params, AsyncHttpResponseHandler responseHandler) {
                     client.get(context, getAbsoluteUrl(url), headers, params, responseHandler);
                    }

and in mainactivity
 myRestClient.getAllByIdForSpinner(MainActivity.this, "ExampleRestService/product/" +id,
                headers.toArray(new Header[headers.size()]), null, new JsonHttpResponseHandler()

I tried few things. But nothing worked for this method.


text:
Q: How do I drop a very specific table in Postgresql (public.pg_ts_parser vs. pg_catalog.pg_ts_parser)? I am having a problem upgrading my Postgresql 9.2 database to 9.4. The problem I have is that I have these tables that are incompatible for an upgrade:
public.pg_ts_dict.dict_init
public.pg_ts_dict.dict_lexize
public.pg_ts_parser.prs_start
public.pg_ts_parser.prs_nexttoken
public.pg_ts_parser.prs_end
public.pg_ts_parser.prs_headline
public.pg_ts_parser.prs_lextype

Postgresql says that I should delete these tables and the upgrade should work. I am currently trying to figure out how to do this.
Postgresql has pg_catalog.pg_ts_parser and pg_catalog.pg_ts_dict. These are system catalogs and can absolutely not be removed, nor do I want to. I want to remove the public.pg_ts_* tables.
More specifically I want to dump the tables, upgrade the database, and then restore both public.pg_ts_parser and public.pg_ts_dict. However every time I try to dump or drop the tables, it defaults to the system catalog. Which I don't want. How can I specify these exact tables? Thanks for any help in advance.
-------EDIT------
Here are the commands I am running to dump the tables.
pg_dump -Fc -t public.pg_ts_dict -t public.pg_ts_parser > file.dump

pg_dump: No matching tables were found

Here is a variation
pg_dump -Fc -t pg_ts_dict -t pg_ts_parser > file.dump

The second variation contains the dump of the system catalog pg_ts_dict and parser not the public version. However, it is very confusing because the contents of the file.dump contains these lines of code among @ signs and ^ signs.
DROP TABLE pg_catalog.pg_ts_dict;

    ^@^@^@pg_catalog^@^@^@^@^@^@^H^@^@^@postgres^@^D^@^@^@true^A^A^@^@^@^C^@^@^@^@^@^@^@^@^@ ^G^@^@^@^@^@^@^@^@^A^@^@^@0^@^A^@^@^@0^@
^@^@^@pg_ts_dict^@^C^@^@^@ACL^@^A^@^@^@^@<86>^@^@^@REVOKE ALL ON TABLE pg_ts_dict FROM PUBLIC;
REVOKE ALL ON TABLE pg_ts_dict FROM postgres;
GRANT SELECT ON TABLE pg_ts_dict TO PUBLIC;
^@^@^@^@^@^A^A^@^@^@^@
^@^@^@pg_catalog^A^A^@^@^@^@^H^@^@^@postgres^@^E^@^@^@false^@^B^@^@^@54^A^A^@^@^@^C^@^@^@^@^@^@^@^@^@7^@^@^@^@^@^@^@^@^@^D^@^@^@1259^@^D^@^@^@3601^@^L^@^@^@pg_ts_parser^@^E^@^@^@TABLE^@^B^@^@^@^@ö^@^@^@CREATE TABLE pg_ts_parser (
    prsname name NOT NULL,
    prsnamespace oid NOT NULL,
    prsstart regproc NOT NULL,
    prstoken regproc NOT NULL,
    prsend regproc NOT NULL,
    prsheadline regproc NOT NULL,
    prslextype regproc NOT NULL

Not sure what to make of this.

A: Your call should actually work as is:
pg_dump -Fc -t public.pg_ts_dict -t public.pg_ts_parser > file.dump

You can use a wildcard to include all tables starting with pg_ts_.
pg_dump -Fc -t 'public.pg_ts_*' > file.dump

On the Linux shell, you may need the extra quotes. (Related question on dba.SE.) Remove the quotes in Windows.
To make it abundantly clear you could exclude the same tables from pg_catalog explicitly. Normally, this is not necessary, but something seems to be abnormal in your case.
pg_dump -Fc -t 'public.pg_ts_*' -T 'pg_catalog.pg_ts_*' > file.dump

The documentation:

Also, you must write something like -t sch.tab to select a table in a
  particular schema, rather than the old locution of -n sch -t tab.


text:
Q: Is it possible to use SSM parameters in environment variables for a lambda? I know in Cloudformation you can create Parameters using SSM, but I really want to know if you can use SSM in environment variables for a lambda.
I know I can put the SSM paths and use the sdk in the code to get those values, but maybe there is a way to make that automatically without fetching values from code.
Thanks

A: You can directly fetch the values within CloudFormation from parameter store and pass it as an environment variable to the lambda using dynamic reference.
For example:
  ServerlessTestLambda:
    Type: AWS::Serverless::Function
    Properties:
      CodeUri: src
      Handler: test-env-var.handler
      Role: !GetAtt BasicLambdaRole.Arn
      Environment:
        Variables:
          ParamStoreVar: "{{resolve:ssm:/test/ssmparam:3}}"
      Events:
        LambdaSchedule:
          Type: Schedule
          Properties:
            Schedule: rate(3 minutes)

This is the lambda I created to test, and as you can see the value of the key would be replaced for the environment variable ParamStoreVar
Note - You cannot replace ssm securestring in the environment variable for obvious security reasons.
For more information:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html

A: You can also define it as a parameter and then reference it in your template. One advantage to doing it this way is that you don't have to worry about specifying the version number. (I can imagine that there may be circumstances where people would say "¿No version number is an advantage? Bah!".)
Parameters:
  SomeParameter:
    Type: AWS::SSM::Parameter::Value<String>
    Default: '/path/to/my-param'

...

MyFunction:
  Type: AWS::Serverless::Function
  Properties:
    ...
    Environment:
      Variables:
        MY_ENVIRONMENT_VAR: !Ref SomeParameter

When you look at the Parameters tab in CloudFormation (in the AWS Console) now you'll only see the string '/path/to/my-param' next to the key SomeParameter; however, when you go look at your Lambda function (in the environment variables section), you'll see that it has resolved to whatever value is stored for the parameter named /path/to/my-param.


text:
Q: Achievement System I'm coding an archievement system as it follows:
IAchievement - Interface that all achievements must implement
AchievementManager - Class that with a user id checks for all achievements
My idea was to have a shared function on ArchivementManager as I could performe something like
AchievementManager.checkUser(userId)

Or
AchievementManager.check(userId, achievementId)

Anyhow the AchivementManager should call a function check for each IAchievement implementation.
As it does not make any sense to have an instance for each Achievement I'm checking I was expecting to be able to declare the check method as Shared / Static. So inside the AchievementManager I could just call for
AchivementXXX.check(userId)

But I can't declare shared functions in my interface.
Is there any workaround? It is a bad aproach to inmplement an achievement system?
Edit:
This is not for a game but a website in ASP.NET

A: If your approach is to define an interface, then yes it would make sense to have the AchievementManager hold an instance of each relevant achievement type.
This also makes sense because one would expect the achievement instances to need to exist, for example in order to track various game state and listen to various game events so that they can detect that the achievement has been achieved. Otherwise, how would achievements implement their Check method?

A: You could implement your Interface in a Superclass Achievement and then declase the class as MustInherit. So every Achievement inherits from the Superclass and can override the unique parts.
Your check method could be set to nonoverridable so that nobody can tinker with it

A: So following on from the comment, you have some options here..
public class AchievementA : AchievementBase
{
  public void GetAchievementForAByUser(int userId)
  {
       base.CheckId(userId);
  }

 }

public class AchievementB : AchievementBase
 {

  }

 public class AchievementManager : IAchievement
{
    protected void CheckId(int userId)
{

}

}
Your interface IAchievement will implement a contract of methods which are available to each subclass of achievement.

A: There is also a way without using interfaces and inheritance:
class Achievement {
    private Predicate<UserId> actualCheckUser;

    public bool CheckUser(UserID userId) {
        return actualCheckUser(userId);
    }

    public Achievement(Predicate<UserId> checkUser) {
        if (checkUser == null) {
            throw new ArgumentNullException("checkUser");
        }
        actualCheckUser = checkUser;
    }
}

You call achievement's method to check if a user has it. If you represent an achievement as a type, then achievement's method is a type's method, in other words, a static method. But you can't have static methods in interfaces. If you represent achievements as objects, then achievement's method is a plain old object's method.
But you have to make this method behave differently in different instances of Achievement class. One way to do this is, indeed, make CheckUser abstract and override it, but then you again need to declare a separate class for each achievement. Another way is to use delegates — you plug it in your achievement object, and that's it. Under the hood it too leads to creation of an additional class.
Personally, I don't know which design is better, but I assume thar metaprogramming, in terms of types, is harder than OOP, in terms of objects.

A: I know this post is a almost a year old, but why not use DI? Example:
interface IAchievement {
    void Check(User user);
}

class UserMade200PostsAchievement : IAchievement {

    void Apply(User user) {
            var postCount = _repo.AsQueryable<Post>().Count(x => x.CreatedByUserId == user.Id);
            if (postCount >= 200)
                //apply achievement, insert some data, whatever

    }

}

Register all:
//Note this may not be the exact command, depends on your choice of IoC container
container.RegisterInterfaceImplementers(typeof(IAchievement));

public class AchievementManager {

    //All instances of IAchievement injected
    private IAchievement[] Achievements

    public AchivementManager(IAchievement[] achievements) {
        Achievements = achievements;
    }

    public void Check(User user) {
        foreach(var a in achivements)
            a.Apply(user);
    }

}

This way when you add a new Achievement, it gets picked up automatically.


text:
Q: Need dotJEM/Angular-Routing Help - View won't update with new template I am trying to figure out why the first time I come to the "audit" state the "audit.content" execute; but subsequent calls to "audit" state from the "audit" update my "audit.content" view.
Any help with this is much appreciated.
Thank you.
Here are the details of my dotJEM/Angular-Routing:
I have an index file that has a jemView in it like so:

I have a new-audit-view.html page that has two nested jemViews in it like so:

Here is my application.js file:
angular.module('OReillyAutoPricingWebApp',
[
    'dotjem.routing'
])
// Configuration of the routes for linking to different view of the application.
.config(['$stateProvider', '$routeProvider', function ($stateProvider, $routeProvider) {
    $routeProvider
        .otherwise({redirectTo: '/audit-review-tab' });

    $stateProvider
        .state('home', { route: '/', views: { 'main.content': { template: 'views/review-audits.html'} } })
        .state('audit', { route: '/audit/:auditItemListType', views: {
            'main.content': {template: 'views/new-audit-view.html'},
            'audit.actions': {template: 'partials/audit-action-items.html', controller: 'StoreAuditItemController'},
            'audit.content': {template: ['$location', function ($location) {
                var resourceLoader = new NoesisCode.ResourceLoader(),
                    partialUrl = ($location.search().url !== undefined)? $location.search().url: "",
                    templateHtml = ($location.search().url !== undefined)? resourceLoader.loadXMLDoc(partialUrl): "";

                return templateHtml;
            }], controller: 'StoreAuditItemController'}}
        })
        .state('audits', { route: '/audits', views: { 'main.content': { template: 'views/review-audits.html'} } })
}]);

A: I need to add the $transitionProvider service to the configuration. And then implement the transition like so:
$stateTransitionProvider
        .transition('*', 'audit', function ($view){
            $view.clear('audit.content');
            $view.update('audit.content', {template: ['$location', function ($location) {
                var resourceLoader = new NoesisCode.ResourceLoader(),
                    partialUrl = ($location.search().url !== undefined)? $location.search().url: "",
                    templateHtml = ($location.search().url !== undefined)? resourceLoader.loadXMLDoc(partialUrl): "";
                console.info("inside audit.content view");

                return templateHtml;
            }], controller: 'StoreAuditItemController'});
        });


text:
Q: How to relate between multi-color function in JSP with the bit datatype value retrieved from database MySQL Updated: 5/5/2015
Firstly, what I understand about bit datatype in SQL is that it will return value  1 or 0 and 'True' or 'False' only. And secondly, I learn how to change background and text color of elements in HTML from (http://www.javascripter.net/faq/changehtmlelementcolor.htm) which when I look its source code (Ctrl+U), I understand it using getElementById to get the element's color. However, I don't know how to relate this two different knowledge and use it in my JSP page.
Because I didn't get 10 reputation here, so it is hard to explain the situation without the pictures but I try my best.
There is this situation where I have a virtual table in my JSP page where it has column MONTH and the rows are the Application Name
There will be indicator where there are 4 color that assign for Heavily in used period(green), Data retrieved from other application/maintenance(blue), Involve system maintenance (brown), Not involve system maintenance (white/no color)

<form name="frmParam" action="web2AppOverview.jsp" method="POST">

    App Name:
 <%renderDropDownList3(out, "reqContentID",  arrAppName,  requestValue.contentID ,"onchange=\"onParamChange()\"");%>

    <input name="reqSearch" class="iform" type="submit" value="Search">

</form>

     Not involve system maintenance / display only / osolete system

     Involve system maintenance

     Data retrieved from other application/maintenance

     Heavily in used period

    No
    App Name
    Month
    Developer

    Jan
    Feb
    Mar
    Apr
    Mei
    Jun
    Jul
    Aug
    Sept
    Oct
    Nov
    Dec

  <%if(!requestValue.strSearch.equals("")){
 if(arrTimeline.size() > 0){
  for (int rowCount=0; rowCount < arrTimeline.size(); rowCount++) {
   Timeline timeline  = (Timeline) arrTimeline.get(rowCount);

%>

    <%=rowCount+1%>
    <%=timeline.strAppName%>
    <input type="hidden" id="contentID<%=rowCount%>" name="contentID<%=rowCount%>" value="<%=timeline.contentID%>">

      <%/***MONTHS****/
   ConnIntranet = cnHR();
   String act = getParam(request,"act").trim();
   try{
     String jan="",feb="",mar="",apr="",may="",jun="",jul="",aug="",sept="",oct="",nov="",dec="";
  String white="", brown="", blue="", green="";
  String sqlMonths = " SELECT DISTINCT fjan, ffeb, fmar, fapr, "
                     + " fmay, fjun, fjul, faug, fsept, foct, fnov, fdec"
                     + " FROM intAppOverview "
                     + " WHERE intcontentsID = "
                     + toSQL(timeline.contentID,TextTYPE)+
      " AND fdevid IS NULL";
     //out.print(sqlMonths);
  %>

  <%}catch(Exception e) {out.print(e);}%>

     <% /***DEVELOPER****/%>

     <% try{
            String devId = "";
   ResultSet rs=null;
   String sql = " SELECT fstaffid, fstaffname FROM hrconfirm" +
      " WHERE fstaffid <>'' AND fstatus <> 'Part Time' " +
      " AND fEstatus='Y'"+
      " AND fdept = 'SODEMC' ORDER BY fstaffname";
      PreparedStatement stmt = ConnIntranet.prepareStatement(sql);
      synchronized(stmt){
   rs = stmt.executeQuery();}
 %>
    <input type="hidden" name="act" value="<%=act%>">
    <select class="iform" id = "devId<%=rowCount%>" name="devId<%=rowCount%>" >
    <option value=""></option>
    <%   while(rs.next()){
    devId = getValue(rs,"fstaffid");
    if(devId.equals("")){%>
    <option value="<%=devId%>" selected><%=getValue(rs,"fstaffname").trim()%></option>
    <%    }else { %>
    <option value="<%=devId%>"><%=getValue(rs,"fstaffname").trim()%></option>
    <%    }
   }stmt.close();%>
    </select>
    <% out.print("Add");
    }catch (Exception e) {out.print(e);}%>

    <% try{
    ResultSet rs=null;
    String sql = " SELECT i.fdevid, i.fdevname FROM intAppOverview i "+
        " INNER JOIN hrconfirm h "+
        " ON i.fdevid = h.fstaffid"+
        " WHERE h.fdept = 'SODEMC'"+
        " AND i.intcontentsID = "+ toSQL(timeline.contentID,TextTYPE);
    PreparedStatement stmt = ConnIntranet.prepareStatement(sql);
    synchronized(stmt){
    rs = stmt.executeQuery();}
    while(rs.next()){
      String devId  = getValue(rs,"fdevid").trim();
      String devName  = getValue(rs,"fdevname").trim();
  %>     <%=devName%>
  <%  out.print(" | Del");
  }stmt.close();
 }catch (Exception e) {out.print(e);}%>

<%
  } //for()
 }else{
%>

   No record found!

<% } // else -- if(arrStudent.size() > 0){%>
<% }  //  if form submitted %>

In the database, I got table intAppOverview where the months (Jan, Feb, Mar,..., Dec) assigned to bit datatype.
When I try to retrieve the data by using String sql = "SELECT jan, feb.... FROM intAppOverview", its only shows 1, 0 and empty(for null values) in the virtual table on the JSP page.
My question is: how do I relate this 2 conditions to get 1 color for a cell and it work for every cells.
For example: column 'May' that laps with the Application Name 'Student Miscellaneous' have 'green' color and the value is 1/'True'. Meanwhile, other cell with white/no color will be null or 0/'False' value.
You may run the code above and click on the color indicator to see how it work so far.
Thank you for your time to read and reply this. >.<
Regards,
Eja


text:
Q: Java method that returns sum of number series and takes series array as parameter I have tried this:
public class NumberSeries {
    public static void main(String[] args) {
        // this line of code is not correct
        SumOfNumbers( int nums [{23,44,12,33}]);
    }

    public static int SumOfNumbers(int Series[]) {
        int sum = 0;
        for (int i = 0; i < Series.length; i++) {
            sum = sum + Series[i];
        }
        return sum;
    }
}

I am failing to call SumOfNumbers method correctly. What am I doing wrong?

A: What you are trying to do is declaring an  in-line inline array.
SumOfNumbers( int nums [{23,44,12,33}]);

That should be
SumOfNumbers( new int [] {23,44,12,33}); // in-line passing

or even clear
int[] nums = new int[] {23,44,12,33}; // declaring
SumOfNumbers( nums); //passing

You are not declaring it properly.

A: Not passing the array in correct way, modify code as following
int[] nums ={23,44,12,33};
SumOfNumbers( nums);

A:   int [] nums={23,44,12,33};

      SumOfNumbers( nums);

You can use this code in main method.


text:
Q: Normal vector field of $I \times_f S^n$ Let $I$ be an interval and $f \colon I \to \mathbb{R}$ is a positive function such that $M = I \times_f S^n(1)$ is the warped product Riemannian manifold, which is a hypersurface in $\mathbb{R}^{n+2}$. Here $I$ denotes an interval and $S^n(1)$ is the unit sphere, both equipped with their standard metric. I'm now asked to determine the normal vector field of $M$. The normal vector field is of course the vector field that is normal to $T_pM$. But $T_pM = T_pI \oplus T_pS^n(1)$ so I think that it is enough to find a normal vector field on $I$ and $S^n(1)$. The normal vector field on $S^n(1)$ is of course just the position vector but I'm not sure what the normal vector on the interval is, nor if my approach is correct.
EDIT: the immersion is given by
$\varphi : I \times S^n \to \mathbb{R}^{n+2} : (t, y_0,...,y_n) \mapsto \big(\alpha_1(t), \alpha_2(t)y_0,..., \alpha_2(t)y_n\big) $
where $\alpha \colon I \to \mathbb{R}^{2}$ is an arc lenght parametrised curve with $\alpha_2(t) > 0$.


text:
Q: How can I use check constraint in sql server 2005 i want to check for a particular set of values.
eg

*

*check columnname should be between 1 to 5

*check columnname should be either 1 or 2 or 4

A: There is quite a wealth of information in the SQL Server documentation on this, but the two statements to create the check constraints you ask for are:
ALTER TABLE tablename ADD CONSTRAINT constraintName CHECK (colname between 1 and 5);

ALTER TABLE tablename ADD CONSTRAINT constraintName CHECK (colname in (1,2,4));

The condition of a check constraint can include:

*

*A list of constant expressions introduced with in

*A range of constant expressions introduced with between

*A set of conditions introduced with like, which may contain wildcard characters
This allows you to have conditions like:
(colname >= 1 AND colname <= 5)

A: ALTER TABLE tablename ADD CONSTRAINT constraintName CHECK (colname in (1,2,4));


text:
Q: Two Conditions in Jmeter While Loop This is not an overlap question, My Question:
I have two condition in my Jmeter while loop.
Condition 1: Checks for response text
Condition 2: Wants to check whether there is any error on page or not and in case yes, move to next sample and mark it as failure
${__javaScript( "${EME}" != "First Pass Yield" && "${EME_ERROR}" = "Odbc driver returned an error")}

Above condition variable ${EME} check for the response text and it works fine but at the same page i want to check if in case there's an error i should be able to capture that as well.

A: For equal between string use == and not =. I checked the following and it worked
${__javaScript("${EME}" != "First Pass Yield" && "${EME_ERROR}" == "Odbc driver returned an error")}

If you hover over the condition Jmeter suggest use jexl3 for performance. so you can equally execute jexl statement:
${jexl3("${EME}" != "First Pass Yield" && "${EME_ERROR}" == "Odbc driver returned an error")}


text:
Q: Sqlite3 with cygwin How to install Sqlite3 with Cygwin? When I try to compile in Cygwin like this:
gcc -o basics basics.c

it says:
/tmp/ccpS4NGr.o:basics.c:(.text+0x67): undefined reference to _sqlite3_open' /tmp/ccpS4NGr.o:basics.c:(.text+0x10b): undefined reference to_sqlite3_exec' /tmp/ccpS4NGr.o:basics.c:(.text+0x172): undefined reference to _sqlite3_exec' /tmp/ccpS4NGr.o:basics.c:(.text+0x1d9): undefined reference to_sqlite3_exec' /tmp/ccpS4NGr.o:basics.c:(.text+0x243): undefined reference to _sqlite3_prepare
_v2' /tmp/ccpS4NGr.o:basics.c:(.text+0x279): undefined reference to_sqlite3_column_ count' /tmp/ccpS4NGr.o:basics.c:(.text+0x28f): undefined reference to _sqlite3_step' /tmp/ccpS4NGr.o:basics.c:(.text+0x2cb): undefined reference to_sqlite3_column_ text' /tmp/ccpS4NGr.o:basics.c:(.text+0x2ec): undefined reference to _sqlite3_column_ name' /tmp/ccpS4NGr.o:basics.c:(.text+0x355): undefined reference to_sqlite3_close' collect2: ld returned 1 exit status
I kept the sqlite3.h in the same directory of basics.c along with 3 other files that comes with sqlite-amalgamation package

A: While you can build SQLite yourself, your don't have to.
Re-run Cygwin's setup.exe, and on the package selection screen, select the libsqlite3-devel package from the Libs category. Then your build command becomes:
gcc -o basics basics.c -lsqlite3

A: How are you including it?
#include <sqlite.h>

or
#include "sqlite.h"

The latter form might well work; it'll check the current folder before the include path.

A: You need to build and include the sqlite amalgamation!  Add that .c file to your command line:
gcc -o basics basics.c sqlite3.c


text:
Q: How to put placeholder datetime-local I try to give default value to datetime-local. I try this code:
 <input type="datetime-local" ng-model="event.startdate" value="2016-10-09T15:38:00">

But it doesn't work. Can you help me please.

A: You should init your $scope, in that case event.startdate. You can do it with ng-init directive property or through $scope in your controller.
Look demo below :
EDIT : updated to work with angular 1.5.3

var app = angular.module('App', []);

app.controller('appCtrl', function($scope) {
  $scope.event = {
    startdatefromcontroller: new Date('2016-10-09T15:38:00')
  };
});
section {
  margin: 10px;
  padding: 10px;
}
section label {
  display: inline-block;
  width: 250px;
}

    Init from controller through $scope
    <input type="datetime-local" ng-model="event.startdatefromcontroller" id="startdatefromcontroller">


text:
Q: Crystal Report viewer always keeps asking me to login I have this problem: Crystal Report viewer always keeps asking me to login but i don't know how to change the server name and database so that I can Login. This is my code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CrystalDecisions.CrystalReports.Engine;
using System.Data.SqlClient;

namespace WindowsFormsApplication1
{
    public partial class print : Form
    {
        SqlConnection con = config.getConnection();

        ReportDocument crypt = new ReportDocument();

        public print()
        {

            InitializeComponent();
        }

        private void print_Load(object sender, EventArgs e)
        {
            con.Open();

            SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM PersonalInformation", con);

            DataSet dst = new DataSet();
            sda.Fill(dst, "employeesinformation");

            crypt.Load(@"C:\Users\ASPIRE\Documents\mao ni\WindowsFormsApplication1\WindowsFormsApplication1\CrystalReport1.rpt");
            crypt.SetDataSource(dst);
            crystalReportViewer1.ReportSource = crypt;
            crystalReportViewer1.Refresh();
            con.Close();
        }
    }
}


text:
Q: How do I update one value within an object using setAttribute? I have an element that contains an attribute called "sound". The value of this sound attribute is an object. One of the properties in this object is "volume".
In other words:
<a-entity position='0 0 0' sound='src: url; on: click; volume: 2.0;'></a-entity>

So it's like this:
{
  position: '0 0 0',
  sound: {
    src: 'url',
    on: 'click',
    volume: '2.0'
  }
}

I'm using setAttribute to update the volume attribute but I don't know if there's an effective way to only target one property while not changing the other properties in the object.
Basically this replaces the sound object and removes all the properties that are not specified (src AND on properties are removed):
element.setAttribute('sound', {
  volume: '4'
});

I don't want to replace the entire object. I only want to replace one value for one property. Is there a best way to go about this?

A: You can make use of the 3-argument version of setAttribute which is in the docs here: https://aframe.io/docs/core/entity.html#Updating-Multi-Property-Component-Data
Specifically you can do something like:
element.setAttribute("sound", "volume", "4");

A: You could get object corresponding to the attribute, and replace only the properties you need.
Something like this:
var data = element.getAttribute('sound');
data.volume = '4';
element.setAttribute('sound', data);

Edit
If you set the data in the html like a real JS object, you could do:
var newData = JSON.parse(element.getAttribute('sound'));
newData.volume = 4;
element.setAttribute('sound', JSON.stringify(newData));

Here is a fiddle


text:
Q: Need color value visible over map I need to write some text over google maps image. I try lot off combinations of colors but it is ugly. Can anybody give me a color ( hex value) which visible on that map and looks good ( I have no talent for design at all ) ?

A: Do what Google itself does: write it in black and outline with white. Look closely at words in the image: you'll see thin white outline around all words.


text:
Q: `TypeError` when calling create(). You may need to make the field read-only, or override the create() method Not sure what's going on here. I'm trying to perform create a new instance via Django-rest-framework. What am I doing wrong?
There are a few read-only fields being submitted back.
I've tried marking them as read-only via read_only_fields in the serializer, as well as specifying them as editable=False within the model's fields.
Note: I would prefer to avoid specifying my own create method if possible. This should work via standard functionality as documented here
when POSTing the following:
{
  "displayName": "New test",
  "backgroundColour": "#4d3567",
  "foregroundColour": "#FFFFFF",
  "helpText": "test",
  "description": "test",
  "comment": "test."
}

i'm getting:
TypeError at /api/v1/classifications/
Got a `TypeError` when calling `ClassificationLabel.objects.create()`. This may be because you have a writable field on the serializer class that is not a valid argument to `ClassificationLabel.objects.create()`. You may need to make the field read-only, or override the ClassificationLabelListSerializer.create() method to handle this correctly.

models.py:
class ClassificationLabel(models.Model):
    """
    this model is used to create all instances of classifications
    labels that will be displayed to a user
    """
    displayName = models.CharField('Classification label display name', max_length = 32)
    helpText = models.TextField('Explanatory text about this label', max_length = 140, blank=True)
    backgroundColour = models.CharField('Hex code for background colour including Alpha', max_length=8)
    foregroundColour = models.CharField('Hex code for foreground colour include Alpha', max_length=8)
    description = models.TextField('Description of this label', max_length = 256, blank=True)
    comment = models.TextField('Internal comments for this label', max_length = 1024, blank=True)
    lastChanged = models.DateTimeField('last changed timestamp', auto_now=True, editable=False)
    identifier = models.CharField('Classification label ID', max_length = 128, blank=True, editable=False)
    revision = models.PositiveIntegerField('Revision number for this label', default=1, editable=False)
    #placeholder for lastChangedBy

    def clean(self):
        #the following code generates a unique identifier and checks it for collisions against existing identifiers
        if not self.identifier:
            stringCheck = False
            while stringCheck is False:
                newString = str(uuid.uuid4())
                newString.replace('-', '')
                doesStringExist = ClassificationLabel.objects.filter(identifier=newString).count()
                if doesStringExist == 0:
                    stringCheck = True
            self.identifier = newString

    def __str__(self):
        return self.displayName + " - " + self.identifier

    def save(self, force_insert=False, force_update=False):
        self.revision += 1
        super(ClassificationLabel, self).save(force_insert, force_update) # Call the "real" save() method.

serializer:
class ClassificationLabelListSerializer(serializers.ModelSerializer):
    class Meta:
        model = ClassificationLabel
        fields = ('displayName', 'helpText', 'identifier', 'backgroundColour', 'foregroundColour', 'comment', 'description', 'lastChanged', 'revision')
        #read_only_fields = ('identifier', 'lastChanged', 'revision',)

views.py
class ClassificationLabelList(mixins.ListModelMixin,generics.GenericAPIView, mixins.CreateModelMixin):
queryset = ClassificationLabel.objects.all()
serializer_class = ClassificationLabelListSerializer

def get(self, request, *args, **kwargs):
    return self.list(request, *args, **kwargs)

def post(self, request, *args, **kwargs):
    return self.create(request, *args, **kwargs)

what seems to have fixed it
an updated save() method seems to have fixed this. updated code below:
    def save(self, *args, **kwargs):
        self.revision += 1
        super(ClassificationLabel, self).save() # Call the "real" save() method.

A: Maybe try something like this in your serializer,
class ClassificationLabelListSerializer(serializers.ModelSerializer):
    lastChanged = serializers.DateTimeField(read_only=True)
    identifier = serializers.CharField(read_only=True)
    revision = serializers.IntegerField(read_only=True)
    class Meta:
        model = ClassificationLabel
        fields = ('displayName', 'helpText', 'identifier', 'backgroundColour', 'foregroundColour', 'comment', 'description', 'lastChanged', 'revision')

    def create(self, validated_data):
        return ClassificationLabel.objects.create(**validated_data)

Also, edit the save method in your models.py,
def save(self, *args, **kwargs):
    self.revision += 1
    return super(ClassificationLabel, self).save(*args, **kwargs) #


text:
Q: How to maintain a session? I am working on C# technology. I need to maintain a session for each state in stand-alone application. My goal is to achieve a session for the purpose of timeout facility. Please guide me.

A: Winforms are inherently stateful. Variables or state you set should be available in memory as long as your calling code can access them. A global System Timer might be what you are looking for here.
Check out this answer
If you need to reinitialize a session you can look at this answer


text:
Q: How does bitwise information storage in (32-bit) int variables work? In this book I'm reading I'm going over bitwise operators. Its says the following in the book.

Bitwise operations can potentially store a lot of information in a small amount of memory. Many traits in the world have only two possibilities that are either this way or that way. You are either married or you're not. you are either male or female. In C++, you can store each of these traits in a single bit. This way you can pack 32 separte binary properties into a single 32-bit int.

So is what he saying is when you use bitwise operators in C++ it would only cost 1 bit of memory? I'm not sure what the 32-bit int thing is relevent to and also when he talks about "memory" is this the RAM that the program takes up? Because when I run my C++ programs they are way above 1 bits of ram being ocupied. Am I looking at this in the wrong way?

A:
What is the difference between a normal int and a 32-bit int?

As David Arno points out, you haven't said what you mean by a "normal" int.

So is what he saying is when you use bitwise operators in C++ it would only cost 1 bit of memory?

No, he's saying that if you want to treat integers as collections of bits, you can do so with bitwise operators.

when he talks about "memory" is this the RAM that the program takes up

Begin by no longer thinking of "memory" and "RAM" as the same thing. Memory is the abstract notion of active storage; RAM is just one small part of a complex strategy to reify that abstract notion. Modern memory is, in many ways, better conceived of as pages of a swap file with RAM as the cache.
Next, make your question more crisp. By "the memory that the program takes up" do you mean the memory required to load the program itself into memory, or do you mean the data memory consumed during its execution? If you mean the latter, by "memory" do you mean memory on the temporary pool or the long term storage pool?  Each has a different allocation strategy. Managing memory correctly is of vital importance in C++. If you do not understand the difference between short lived and long lived storage, you will write buggy C++ programs. Make sure you understand this difference very clearly.

Am I looking at this in the wrong way?

That seems likely, yes.

A: Your title and question body are asking two different questions.

What is the difference between a normal int and a 32-bit int?

There's no such thing as a "normal" int. The size of int in C++ is platform and compiler dependent.

So is what he saying is when you use bitwise operators in C++ it would only cost 1 bit of memory?

The first thing to note about your quote from the book is the statement "You are either married or you're not. you are either male or female." It highlights a flaw in thinking about either/or traits that can cause problems in code. Both real-world examples are false. In the UK, you could be single, cohabiting, in a civil partnership, married and living together, married and separated, a widow(er) or divorced. There is no "married/ not married"; there are many different relationship states, each with different legal ramifications. Likewise, one may not be either male or female. In addition to the standard XX and XY chromosome pairs, some people are XXX, XXY, XXXX etc and a few people have 49 chromosomes and can be XXXY etc. This leads to complications in determining if someone is eg female in sports, with tests for the Y chromosome having been abandoned as some who identify themselves as female have a Y chromosome. There are many states of maleness and femaleness; it's not a dichotomy.
Likewise in programming, if you start packing data into bits, you can run into situations where you suddenly need a third category (such as when someone in a civil partnership complains that your app only allows for married/not married). Unless you are working on very specialist solutions, memory is cheap and operating on larger data types than bits is often faster.
If you are working on a solution where memory is tight though, and you have lots of state that is truly either/or, then bitwise operations can be used to pack lots of data into a small space. Each flag does indeed only use one bit of memory. Bear in mind though that the compiler will typically allocate 32/64 bits (depending on architecture) to the the value holding your bitwise data, so unless you have a large number of flags, you won't necessarily be saving memory.
Bitwise flags are useful for situations where you have a bunch of complementary options, but their advantage is in the ease of testing them (using bitwise and and or), not in saving memory.

A: The book is talking about what is commonly known as bitfields, and their use is often more memory efficient on most platforms, and especially so in serialization or communication contexts.  A boolean requires its own address to be usable by the compiler.  This means that while, practically, we only need one bit to represent a true (1) or false (0) condition, there is no physical way to address and store one bit in memory. This often means that a boolean will take up an entire byte in memory, just like the smallest integer on that same platform.
Now lets say you had 18 boolean variables. Each one will needs its own addressed piece of memory so that we can reference it elsewhere in the software.  That means on our theoretical system we need 18 bytes.  People started to see this as a waste of memory, as only one bit out of every byte was really needed.
Enter bitfields.  If we look at an integer that matches the system's addressable memory size, we see that it takes up the same number of bits as a single boolean.  Integers use all of the bits to represent its range of values.  (Decimal value 26 is represented as 00000000 00000000 00000000 00011010 on a 32 bit system, 3572 is 00000000 00000000 00001101 11110100, etc.).
Bitwise operators allow us to play with those bits directly, rather than needing to worry about any real integer value that they were intended to represent.  This is important, because if you assign meanings ahead of time to each of those bits, you can set them to 1 and 0 explicitly and treat each bit individually as a boolean.
People love to rip apart analogies but I'm going to give it a shot anyway:
Think of it like a street of houses in a wealthy area full of bachelors.  Each home has an address on the street, and each house has 32 rooms, but only one person lives in each house. The bachelors are our booleans. Now lets say a family moves into one of the houses.  They are considered one family, but now there are many more people living in the house.  This is like our integer - while multiple people are now taking up rooms, we still see it like one house with one value (the family that lives there).  Now, another house gets converted to apartments.  While its physically still only taking up one house on the street, we assign some letters to each room (Apartment 1A, apartment 2C, etc) that don't affect the physical street address or composition of the house but let us reference each person individually - that's the bit field.
In practice, I'd consider the use of bitfields first instead of booleans as a case of pre-optimization.  There are trade-offs in usability; someone else may comment on the trade-offs of speed. Likewise, you can run into issues moving bitfield implementations to different systems if you aren't careful (how would your 32 bit value look on an 8 bit system?)  On the flip side, in a small embedded system that I worked on that transferred a ton of status boolean values over a slow serial connection, encoding them as a bitfield was basically a necessity.

A: In C++, an int is at least 16 bits. A long (which I have seen referred to as a 32-bit int) is at least 32 bits.
When you declare and initialize something, like long i = 0, you actually initialize at least 32 bits of memory. If you use bitwise operations, you can access each bit individually.
For example, if you have 32 traits that have two options (meaning they can be encoded in a single bit), you can use a bitmask rather than have 32 separate traits. Of course, this is an optimization for memory usage rather than readability. There are always tradeoffs when doing something like this.

A: So whenever you initialize a variable with a certain datatype (int, float, long, double, etc.) it preserves a certain number of bits for it in the memory. A basic difference between a 16 and 32-bit floatpoint-number is the range of possible values respectively the count of digits.
Examples:
In case of a 16 bit number it is a range from 3,1·10^−5 to 6,6·10^4.
A 32-bit number would serve a range from 1,5·10^−45 to 1,5·10−45.
To learn more about Datatypes just visit: Wikipedia: Data Type
I hope this helped a 'bit' ;-)
Mike


text:
Q: Using push() method and indexOf() method to remove/check duplicate dates from an array in AngularJS1 Iam able to pull EPOCH dates and convert them into a string successfully, however what I previously coded didnt check or remove duplicates. Anyone has an idea of what I can add to do so? In this case, the timestamp is the EPOCH date I pulled form the live data! ANGULARJS1

A: var dateMap = {};
for (i = 0; i < dbData.length; i++) {
  let tmp_date_str = "";
  let tmp_date = new Date(dbData[i].TIMESTAMP);

  tmp_date_str += tmp_date.getFullYear();
  tmp_date_str += "-";

  if ((tmp_date.getMonth()+1) < 10) {
      tmp_date_str += "0";
  }

  tmp_date_str += (tmp_date.getMonth()+1);
  tmp_date_str += "-";

  if (tmp_date.getDate() < 10) {
      tmp_date_str += "0";
  }
  tmp_date_str += tmp_date.getDate();

    // make it a map, and if value for this string already exists, do nothing
  if (!dateMap[tmp_date_str]) {
    dateMap[tmp_date_str] = true;
  }
}

If you need to get your dates as an array just do
  var dates = Object.keys(dateMap)

A: You can use set to eliminate duplication:
const mySet= new Set(["one", "two", "three", "one"]);

mySet.has("one") // true
mySet.size === 3); // true

The Set constructor can take an array of
items with which the set is initialized.

A: For check and remove duplicates you can use angular.equals:
var newArray = [];
            angular.forEach($scope.dates, function(value, key) {
                var exists = false;

                angular.forEach(newArray, function(val2, key) {
                if(angular.equals(value.date, val2.date)){ exists = true };
                });

                if(exists == false && value.dates != "") { newArray.push(value); }
            });

            $scope.dates = newArray;


text:
Q: WebView and buttons layout makes buttons invisible I've got the following layout:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical">

    <WebView xmlns:android="http://schemas.android.com/apk/res/android"
             android:id="@+id/webview"
             android:layout_width="fill_parent"
             android:layout_height="fill_parent"
    />

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"
                  android:orientation="horizontal">

        <Button android:id="@+id/back"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:text="Back" />

        <Button android:id="@+id/page_number"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:text="1 / 100" />

        <Button android:id="@+id/next"
                android:layout_width="wrap_content"
                android:layout_height="fill_parent"
                android:text="Next" />
    </LinearLayout>
</LinearLayout>

Which results in the following

How do I make the buttons fit the screen and stop the WebView pushing them off?

A: Use RelativeLayout. Wrap the RelativeLayout around the buttons like this:
   <RelativeLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true">
    <Button android:id="@+id/back"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:text="Back"
            android:layout_alignParentLeft="true"  />

    <Button android:id="@+id/page_number"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:text="1 / 100" />

    <Button android:id="@+id/next"
            android:layout_width="wrap_content"
            android:layout_height="fill_parent"
            android:text="Next" />
   </RelativeLayout>

The android:layout_alignParentBottom="true" makes sure the buttons always have enough space.
Consider using a RelativeLayout around the WebView and use:
android:layout_alignParentTop="true"`

Edit:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:orientation="vertical">
<RelativeLayout android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical"
          android:layout_alignParentTop="true">

<WebView xmlns:android="http://schemas.android.com/apk/res/android"
         android:id="@+id/webview"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
/>
</RelativeLayout>

<RelativeLayout android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:orientation="vertical"
              android:layout_alignParentBottom="true">

    <Button android:id="@+id/back"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Back"
            android:layout_alignParentLeft="true" />

    <Button android:id="@+id/page_number"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="1 / 100"
            android:layout_toRightOf="@+id/back" />

    <Button android:id="@+id/next"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:text="Next"
            android:layout_toRightOf="@+id/page_number" />
 </RelativeLayout>
</RelativeLayout>

A: I'm having exactly the same problem except I'm using a TextView below my WebView and a second WebView above the main WebView, all necessary for our chat program. The TextView keeps getting pushed off by the WebView.
I've tried the proposed switch to RelativeLayout, also tried TableLayout and nested LinearLayouts, all to the same effect. The only thing that sort of works is to fix the WebView's pixel size [which raises the hairy issue of handling onConfigurationCahnge()]  or to mess around with layout_weight. layout_weight has similar problems though, as the configuration or size of the web page changes the surrounding controls are smushed.
Looks like if I want it to work exactly the one way , a small webview at the top, a main webview and a textview I'll have to fix the webview's pixel size and handle their size change at loadtime (for different screens) and onConfigurationChange() when the screen turns.


text:
Q: Disagreement over Discrete Math Property I know I'm probably wrong, maybe someone can explain it to me. I'm doing practice problems in preparation for a test that is coming up.

*Let u and v be two vertices in a graph G. Show that if G has two simple  paths between vertices u and v, then G has a simple circuit.

  Sol: Assume that G has the following two simple paths: (u,..P1..,v)
  and (v,..P2..,u). Therefore, G has the circuit (u,..P1..,v,..P2..,u).
  If this circuit has no  repeated edges, then the proof is complete.
Otherwise, let (x,y) be the first  edge that occurs in P1 and is repeated in P2. In this case, the circuit can be  represented as
  follows: (u,..P1..,x,y,..P1..,v,..P2..,y,x,..P2..,u) This circuit can
  be reduced to become as follows: (u,..P1..,x,..P2..,u) where no edge
  in P1 is repeated in P2(because edge (x,y) was the first edge in  P1
  that is repeated in P2). Thus, the reduced circuit is simple.

I've marked the part I'm having trouble with in bold. I don't
understand how we can just strip out the y vertex and simplify the
graph. I suspect I'm not preparing the graph properly, but I've
uploaded an example image to show why the graph can't be simplified.

A: If you delete the edge that goes from $x$ to $y$, you get a simple circuit going from $u$ to $x$ and then back from $x$ to $u$ along a different path, and that's a simple circuit.  It never goes to $y$, nor to $v$.  The problem is only to show that there is at least one simple circuit.  It's not required to include any particular vertices, such as $y$ and $v$.