Categories

## Is it bad practice to calculate within the insert query?

I am trying to do a web application for time sheets. I have three options to calculate the value of hours (AFAIK): In the form In the backend In the query Is it smart or bad practice to do this calculation in the SQL query? with list as (select code_id,code_ppu from code) insert into hr […]

Categories

## How can I make a colored Confusion Matrix (heatmap)? Or, show the full matrix?

I’m plotting a confusion matrix showing predicted vs actual of a total of 26 classes (26 letters of the alphabet). My code is as follows: y_pred = np.argmax(predictions, axis=1) # Transform predictions into 1-D array with label number pd.DataFrame(confusion_matrix(y_test, y_pred), columns=[“pA”, “pB”, “pC”, “pD”, “pE”, “pF”, “pG”, “pH”, “pI”, “pJ”, “pK”, “pL”, “pM”, “pN”, “pO”, […]

Categories

## How to set an attirbutes list when creating new object

Hope the title was not too confusing. I’ve been working on program and I have created so attribut with a default list in it. The thing is I don’t know how to do modification to that list when I create this object. Thank you def __init__(self,nm,pm,adss): self._nom = nm self._prenom = pm self._adresse = adss […]

Categories

## Why is the strontium ion smaller than the potassium ion?

The ionic radius of the $\ce{Sr^2+}$ ion is $\mathrm{132\,pm}$, while the ionic radius of the $\ce{K^+}$ ion is $\mathrm{152\,pm}$. Why is this the case? I would have thought that since $\ce{K^+}$ has one less shell of electrons than $\ce{Sr^2+}$, its radius would be significantly smaller.

Categories

## Validate integer

This is a program that allows the user to build a high school schedule. I would like to validate an integer as a high school class number in my String method. Here’s the name of my method with the parameters. public static String addClass(String name, String day, String momentOfDay, int group){ The user has to […]

Categories

## Extraction datas from forms

I’ve just start to learn Django and now I’m trying understand how to insert datas in db, how to work with datas from templates and ect. My question is about extracting datas from form(Meta class) in template. Here is my code: model class Worker(models.Model): POSITION_SHOICE = ( (‘MANAGER’, ‘MANAGER’), (‘developer’, ‘DEVELOPER’), (‘teamlead’, ‘TEAMLEAD’), (‘pm’, ‘PM’), […]

Categories

## what is the goal of the code blow in opaque_connection of siglot.h

here comes a trouble to me while I am reading a open source sigslot(http://sigslot.sourceforge.net), there a class named _opaque_connection used to save Class function pointer with Class object pointer , but I don’t understand why does it use a union_caster to convert and save function pointer instead of saving it directly here is the code […]

Categories

## ggnet grouping nodes in network (using an adjacency matrix)

In ggnet, I want to group character vectors that indicate the nodes in the network, but cannot figure out how to do it. I have an undirected adjacency matrix. Now I use the vertex attribute, and tried to set it like this: devtools::install_github(“briatte/ggnet”) library(sna) library(network) library(ggnet) adj = read.delim(“data.txt”, row.names = 1) net = network(adj, […]