numeric

SQLITE order by numeric and not alphabetic

孤街醉人 提交于 2020-08-08 07:15:09
问题 When I order my database SQLITE by Classement I have this : Classement | Nom 1 | clem 10 | caro 11 | flo 12 | raph 2 | prisc 3 | karim 4 | prout I would like to get : Classement | Nom 1 | clem 2 | prisc 3 | karim 4 | prout 10 | caro 11 | flo 12 | raph Here is my code : SELECT t.Classement FROM tableau t WHERE 1 = (SELECT 1 + COUNT (*) FROM tableau t2 WHERE t2.Classement < t.Classement OR ( t2.Classement == t.Classement AND t2.Nom < t.Nom )) Can anyone help me ? Thank you! 回答1: You get

When does `n` match last digits of `n^2`?

浪尽此生 提交于 2020-07-16 04:45:02
问题 I'm solving one programming problem. Find all numbers x from 1 to n that have a property that digits of x match digits at the end of x^2 . For example: 5 matches last digit of 5^2 (25) 6 matches last digit of 6^2 (36) 25 matches last digits of 25^2 (625) 76 matches last digits of 76^2 (5776) 376 matches last digits of 376^2 (141376) 625 matches last digits of 625^2 (390625) etc. Does anyone know what the numerical criteria is for a number to match itself in last digits of it squared? I'm

When does `n` match last digits of `n^2`?

不问归期 提交于 2020-07-16 04:44:42
问题 I'm solving one programming problem. Find all numbers x from 1 to n that have a property that digits of x match digits at the end of x^2 . For example: 5 matches last digit of 5^2 (25) 6 matches last digit of 6^2 (36) 25 matches last digits of 25^2 (625) 76 matches last digits of 76^2 (5776) 376 matches last digits of 376^2 (141376) 625 matches last digits of 625^2 (390625) etc. Does anyone know what the numerical criteria is for a number to match itself in last digits of it squared? I'm

Recode numeric values in R

a 夏天 提交于 2020-06-22 22:45:28
问题 I want to recode some numeric values into different numeric values and have had a go using the following code: survey$KY27PHYc <- revalue(survey$KY27PHY1, c(5=3, 4=2,3=2,2=1,1=1)) I get the following error: ## Error: unexpected '=' in "survey$KY27PHYc <- revalue(survey$KY27PHY1, c(5=" Where am I going wrong? 回答1: This function does not work on numeric vector. If you want to use it, you can do as follows: x <- 1:10 # your numeric vector as.numeric(revalue(as.character(x), c("2" = "33", "4" =

C# WPF How to use only numeric value in a textbox [duplicate]

与世无争的帅哥 提交于 2020-06-18 10:36:18
问题 This question already has answers here : How do I get a TextBox to only accept numeric input in WPF? (30 answers) Closed 3 years ago . I use a WPF application I would like to allow only numbers in a textbox. In a WindowsForm application I would know how I would have to make it. Unfortunately, there is a KeyPress not in WPF and the "code" functioned also no longer. How is it right and what is the event? Here you can see the old code that has worked in Windows Form: private void

Disable conversion of scalars to strings when deserializing with Jackson

不羁岁月 提交于 2020-06-12 05:42:06
问题 I want to identify numerical values inserted without quotation marks (as strings) in JSON sent through the request body of a POST request: For example, this would be the wrong JSON format as the age field does not contain quotation marks: { "Student":{ "Name": "John", "Age": 12 } } The correct JSON format would be: { "Student":{ "Name": "John", "Age": "12" } } In my code, I've defined the datatype of the age field as a String , hence "12" should be the correct input. However, no error message

sort numbers numerically and strings alphabetically in an array of hashes perl

北城余情 提交于 2020-05-29 09:55:45
问题 It's a very easy problem but can't get my way around it. I have an array of hashes. The data structure as follows: my @unsorted = ( { 'key_5' => '14.271 text', # ... }, { 'key_5' => 'text', # ... }, { 'key_5' => '13.271 text', # ... }, { 'key_5' => 'etext', # ... }, ); How can I sort the array based on key_5 of the hash. The string part should be sorted alphabetically. and where the key is number string (format is always like this),it should be sorted numerically (ignoring the string part

Should I use numeric or float to avoid calculaton prolems in PostgreSQL

删除回忆录丶 提交于 2020-05-14 14:29:39
问题 I have encountered a topic regarding to calculation errors on Accuracy problems . I end up with the following values in one of my queries in PostgreSQL: 1.0752688172043 (when using float) 1.07526881720430110000 (when using numeric) 1) So, for these values I think I should use numeric data type in order to obtain result more accurately. Is that right? 2) What if the following values (assume that the rest digits after the last number is 0). In that case should I still use numeric rather than

Convert factor value into numeric in a column of dataframe

寵の児 提交于 2020-03-28 07:00:09
问题 s ['64.0', '2'] a ['63.0', '2'] b ['63.0', '1'] How to convert it into data frame as follows : s 64.0 a 63.0 b 63.0 回答1: We could use parse_number library(dplyr) library(readr) df2 <- df1 %>% mutate(col2 = parse_number(as.character(col2))) df2 # col1 col2 #1 s 64 #2 a 63 #3 b 63 Or using base R with sub as.numeric( sub("\\D+([0-9.]+)[^0-9]+.*", "\\1", df1$col2)) data df1 <- structure(list(col1 = c("s", "a", "b"), col2 = structure(3:1, .Label = c("['63.0', '1']", "['63.0', '2']", "['64.0', '2'

SAS not recognizing date format

假如想象 提交于 2020-02-24 10:26:07
问题 I have the following character date format: "3/1990" "4/1990" "5/1990" ... I tried the following code: data work.temps; set indata; newdate = input(strip(Date), MMYYSw.); rename newdate = date; run; I keep on getting the following error meassage: Informat MMYYSW was not found or could not be loaded. 回答1: You may have to use a different informat to read in the character dates so that SAS can interpret them as numeric (since dates in SAS are actually numeric values), and then format them as