Categories
Mastering Development

Modify graph (with plotly)

This is small example of my data set.This set contain weekly data about 52 weeks.You can see data with code below: # CODE #Data library(tidyverse) library(plotly) ARTIFICIALDATA<-dput(structure(list(week = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, […]

Categories
Mastering Development

jTable.setModel() doesn’t work as expected

I’ve created an internal frame that primarily holds a jlist and a jtable. What I’ve to do is when the user selects a party or a group of parties in jList, the table should include a column with the selected party name and add it to jTable.Default jTable What I have implemented will store the […]

Categories
Mastering Development

How To Make this table

I wish i can make this table Table that’s my array $column1=array(1,9,17,25,33,41,49,57); $column2=array(2,10,18,26,34,42,50,58); $column3=array(3,11,19,27,35,43,51,59); $column4=array(4,12,20,28,36,44,52,60); $column5=array(5,13,21,29,37,45,53,61); $column6=array(6,14,22,30,38,46,54,62); $column7=array(7,15,23,31,39,47,55,63); $column8=array(8,16,24,32,40,48,56,64); $totalArray=count($column1);

Categories
Mastering Development

python pulp: How do I create LpMaximize and LpMinimize problem?

How do I go about creating an optimization that LpMaximize profits and LpMinimize the variance? I tried making var negative than using LpMaximize. The code below just the max of var and not the min of var and the max of profit. prob += lpSum([profits[i]*x[i] for i in N] and [var[v]*x[v] for v in N]) […]

Categories
Ask Mathematics

same Averages ie: same mean mode and median = 5

I am stuck with this question: Charlie makes different sets of five positive whole numbers. He finds there are only $4$ sets whose mean, median and mode are all equal to $3$. $1, 2, 3, 3, 6;$ $1, 3, 3, 3, 5;$ $2, 3, 3, 3, 4;$ $3, 3, 3, 3, 3;$ How many sets […]

Categories
Mastering Development

Cox proportional hazard model

I am trying to run Cox proportional hazard model on a data of 4 groups. Here’s the data: I am using this code: time_Allo_NHL<- c(28,32,49,84,357,933,1078,1183,1560,2114,2144) censor_Allo_NHL<- c(rep(1,5), rep(0,6)) time_Auto_NHL<- c(42,53,57,63,81,140,176,210,252,476,524,1037) censor_Auto_NHL<- c(rep(1,7), rep(0,1), rep(1,1), rep(0,1), rep(1,1), rep(0,1)) time_Allo_HOD<- c(2,4,72,77,79) censor_Allo_HOD<- c(rep(1,5)) time_Auto_HOD<- c(30,36,41,52,62,108,132,180,307,406,446,484,748,1290,1345) censor_Auto_HOD<- c(rep(1,7), rep(0,8)) myData <- data.frame(time=c(time_Allo_NHL, time_Auto_NHL, time_Allo_HOD, time_Auto_HOD), censor=c(censor_Allo_NHL, censor_Auto_NHL, censor_Allo_HOD, […]

Categories
Ask Mathematics

Flatten the curve or End the Pandemic Early? : best way to make a decision?

I am trying to solve this reward/risk problem which would depend on an individual preference. I have two countries with 2 different hospitalization capabilities. Both of them wants to flatten the curve of a pandemic so they do not want to saturate their hospitals and at the same time they want to end the pandemic […]

Categories
Mastering Development

Django: Annotate two values of the most recent foreign key

I’m actually using python 3.7 and Django 3.0.4. I using in my app models.py like this for a simple system of messages. from torii.models import User class Room(models.Model): users = models.ManyToManyField(User, related_name=’rooms’, blank=True) name = models.CharField(max_length=100) class Message(models.Model): room = models.ForeignKey(Room, on_delete=models.CASCADE, related_name=’messages’) user = models.ForeignKey(User, on_delete=models.CASCADE) content = models.TextField() date = models.DateTimeField(auto_now_add=True) So when […]

Categories
Mastering Development

Encrypt with CryptoJS in JavaScript gives me different results from Java encryption

I am trying to replicate with CryptoJS an encryption done in Java using another library. The encryption’s result in Java is [111,60,-98,107,-60,5,-17,91,-52,60,-105,64,-88,31,97,-102,118,-39,-28,3,70,-12,21,-69,70,-22,-12,-91,102,-21,-88,5,82,-66,-122,34,14,-115,7,82,-55,38,-90,74,-4,62,104,104,61,-78,57,59,-51,31,84,-115,-45,-98,-87,-11,53,98,45,2,-52] and I know that this is the correct payload. So, I am replicating the same encryption with the same values but I don’t get the same array of bytes. The steps are: I […]

Categories
Mastering Development

How to upload data to the IBM IoT Platform and Cloudant Database using HTTP APIs?

I am trying to upload my sensor data to the IBM IoT Platform and Cloudant database using https API. The command I use is curl -X POST “https://{orgId}.internetofthings.ibmcloud.com:8883/api/v0002/device/types/{deviceType}/devices/{deviceId}/events/{event_name}” -H “Content-Type: application/json” -d “EventPayload” -u ‘use-token-auth:{password}’ After I execute the command I am able to upload the data but the data I saw in IBM IoT […]