number expected string up given майнкрафт

number_format() expects parameter 1 to be float, string given #647

Comments

adi2k5 commented Dec 17, 2017 •

In raising this issue, I confirm the following:

How familiar are you with the the source code relevant to this issue?:
3

Expected behaviour:

See all data on the webpage

Actual behaviour:

‘small boxes’ are not showing any value but just ‘—‘, in php log I can see

warning. Beside this, all is working fine, all charts, statistics of top blocked domains etc. are being shown

Steps to reproduce:

install and run pi-hole webpage

Troubleshooting undertaken, and/or other relevant information:

This is a follow up of discussion from issue pi-hole/pi-hole#1832

As suggested in pi-hole/pi-hole#1832 it might be locale related issue, in Poland we’re using comma as decimal separator and thin space as thousands groups separator.

The text was updated successfully, but these errors were encountered:

DL6ER commented Dec 17, 2017

Beside this, all is working fine, all charts, statistics of top blocked domains etc. are being shown.

Okay, this is good to know. I think we can just remove number_format() altogether and send pre-formated strings from FTL to the API. Asking @pi-hole/api for their opinion.

AzureMarker commented Dec 17, 2017

It would be preferable to have the API output consistent regardless of the server’s locale. Also, changing it to output strings instead of numbers would affect anything else using it (web interface, chronometer, custom user scripts, etc).
I’m still a bit confused as to why PHP is having such a hard time, because the docs don’t mention locale affecting number_format :

The default parameters seem to indicate that it keeps the English notation as the default even through locale changes:

DL6ER commented Dec 17, 2017 •

so it doesn’t actually seem that number_format() is depending on the locale

adi2k5 commented Dec 17, 2017 •

@Mcat12 it’s the same as in repo:

I just run dev tools, and from what I can see, each second (!) following request is being called
jquery.min.js:4 XHR finished loading: GET «https://my.domain/admin/api.php?summary».
and this request generate warning above.
Checking what kind of data is under above link, I have:

DL6ER commented Dec 17, 2017 •

number_format() should not be fired for status as there is an exception for this here:
https://github.com/pi-hole/AdminLTE/blob/master/api_FTL.php#L36

However, I’m getting

in the response, so there clearly is a difference somewhere.

AzureMarker commented Dec 18, 2017

adi2k5 commented Dec 18, 2017

I’m getting different responses for different queries.
For api.php

and for api.php?status

AzureMarker commented Dec 19, 2017

What is the output of:

adi2k5 commented Jan 2, 2018

AzureMarker commented Jan 3, 2018

And you still see this issue?

adi2k5 commented Jan 3, 2018

Yep, just updated to

and it’s still there.

AzureMarker commented Jan 3, 2018

I will manually test with the data you shared, but I think at this point we will have to do some manual print debugging. (I’ll tell you where to put the debugging lines soon)

adi2k5 commented Jan 4, 2018

Still no values but ‘—‘ in blocks.
One thing I forgot to mention earlier is, that it was working normally while I was on 3.1, problem occured only after update to 3.2.

AzureMarker commented Jan 4, 2018

and share the output of those 3 API calls you shared earlier.

adi2k5 commented Jan 4, 2018 •

I’ve enabled also error reporting in php, but unfortunately it doesn’t give any useful info in api.php?summary beside already known warning

DL6ER commented Jan 4, 2018

That is very strange. With this change,

which is what is expected after adding var_dump();

DL6ER commented Jan 4, 2018 •

Anyhow, I think it makes more sense to put it in a bit later, like this:

AzureMarker commented Jan 4, 2018

@adi2k5 Do you have another SD card you can try re-installing onto? It might be an issue with your SD card.

adi2k5 commented Jan 4, 2018 •

AzureMarker commented Jan 4, 2018

Thanks for helping find the cause of the issue! It wasn’t a complete waste of time, as now we know another thing to look out for when debugging these kinds of issues.

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Number expected string up given майнкрафт

Find Maximum and Minimum Values of a List

Your task is to make two functions, max and min (maximum and minimum in PHP) that take a(n) array/vector of integers list as input and outputs, respectively, the largest and lowest number in that array/vector.

Merge two sorted arrays into one

Get Planet Name By ID

The function is not returning the correct values. Can you figure out why?

Write a function that always returns 5

Sounds easy right? Just bear in mind that you can’t use any of the following characters: 0123456789*+-/

In this kata you need to check the provided array (x) for good ideas ‘good’ and bad ideas ‘bad’. If there are one or two good ideas, return ‘Publish!’, if there are more than 2 return ‘I smell a series!’. If there are no good ideas, as is often the case, return ‘Fail!’.

Lario and Muigi Pipe Problem

Given the a list of numbers, return the list so that the values increment by 1 for each index up to the maximum value.

You’re writing code to control your town’s traffic lights. You need a function to handle each change from green, to yellow, to red, and then to green again.

Complete the function that takes a string as an argument representing the current state of the light and returns a string representing the state the light should change to.

Create a combat function that takes the player’s current health and the amount of damage recieved, and returns the player’s new health. Health can’t be less than 0.

The Wide-Mouthed frog!

Your goal in this kata is to create complete the mouth_size method this method take one argument animal which corresponds to the animal encountered by frog. If this one is an alligator (case insensitive) return small otherwise return wide.

Generate range of integers

Implement a function named generateRange(min, max, step), which takes three arguments and generates a range of integers from min to max, with the step. The first integer is the minimum value, the second is the maximum of the range and the third is the step. (min

Читайте также:  создать транспортный штрих код

Is it a palindrome?

Write function isPalindrome that checks if a given string (case insensitive) is a palindrome.

Make a function that receive age, and return what they drink.

Is the string uppercase?

Take an array and remove every second element from the array. Always keep the first element and start removing with the next element.

All Star Code Challenge #18

This Kata is intended as a small challenge for my students

All Star Code Challenge #18

Create a function called that accepts 2 string arguments and returns an integer of the count of occurrences the 2nd argument is found in the first one.

If no occurrences can be found, a count of 0 should be returned.

You will be given a vector of strings. You must sort it alphabetically (case-sensitive, and based on the ASCII values of the chars) and then return the first value.

The returned value must be a string, and have «***» between each of its letters.

You should not remove or add elements from/to the array.

Find something in an Array

Create a find function that takes a string and an array as arguments. If the string is in the array, return true.

Is he gonna survive?

A hero is on his way to the castle to complete his mission. However, he’s been told that the castle is surrounded with a couple of powerful dragons! each dragon takes 2 bullets to be defeated, our hero has no idea how many bullets he should carry.. Assuming he’s gonna grab a specific given number of bullets and move forward to fight another specific given number of dragons, will he survive?

Return True if yes, False otherwise 🙂

DNA to RNA Conversion

Create a function which translates a given DNA string into RNA.

Сalculate how many years ago the father was twice as old as his son (or in how many years he will be twice as old).

Exclamation marks series #11: Replace all vowel to exclamation mark in the sentence

The Feast of Many Beasts

Quarter of the year

Given a month as an integer from 1 to 12, return to which quarter of the year it belongs as an integer number.

When the last petal was torn there were cries of excitement, dreams, surging thoughts and emotions.

Your goal in this kata is to determine which phrase the girls would say for a flower of a given number of petals, where nb_petals > 0.

Complete the function so that it finds the mean of the three scores passed to it and returns the letter value associated with that grade.

Create a function with two arguments that will return an array of the first (n) multiples of (x).

Assume both the given number and the number of times to count will be positive numbers greater than 0.

Return the results as an array (or list in Python, Haskell or Elixir).

Your task is to create functionisDivideBy (or is_divide_by) to check if an integer number is divisible by each out of two arguments.

Given a string of digits, you should replace any digit below 5 with ‘0’ and any digit 5 and above with ‘1’. Return the resulting string.

altERnaTIng cAsE ALTerNAtiNG CaSe

Define String.prototype.toAlternatingCase (or a similar function/method such as to_alternating_case/toAlternatingCase/ToAlternatingCase in your selected language; see the initial solution for details) such that each lowercase letter becomes uppercase and each uppercase letter becomes lowercase. For example:

Find numbers which are divisible by given number

Complete the function which takes two arguments and returns all numbers which are divisible by the given divisor. First argument is an array of numbers and the second is the divisor.

A Needle in the Haystack

Can you find the needle in the haystack?

Write a function findNeedle() that takes an array full of junk but containing one «needle»

After your function finds the needle it should return a message (as a string) that says:

«found the needle at position » plus the index it found the needle.

Transportation on vacation

After a hard quarter in the office you decide to get some rest on a vacation. So you will book a flight for you and your girlfriend and try to leave all the mess behind you.

You will need a rental car in order for you to get around in your vacation. The manager of the car rental makes you some good offers.

Write a code that gives out the total amount for different days(d).

Hello, Name or World!

Define a method hello that returns «Hello, Name!» to a given name, or says Hello, World! if name is not given (or passed as an empty String).

Assuming that name is a String and it checks for user typos to return a name with a first capital letter (Xxxx).

Pre-FizzBuzz Workout #1

Your inputs: a positive integer, n, greater than or equal to one. n is provided, you have NO CONTROL over its value.

Create a function that takes a number as an argument and returns a grade based on that number.

NBA full 48 minutes average

An NBA game runs 48 minutes (Four 12 minute quarters). Players do not typically play the full game, subbing in and out as necessary. Your job is to extrapolate a player’s points per game if they played the full 48 minutes.

Write a function that takes two arguments, ppg (points per game) and mpg (minutes per game) and returns a straight extrapolation of ppg per 48 minutes rounded to the nearest tenth. Return 0 if 0.

Count of positives / sum of negatives

Given an array of integers.

Return an array, where the first element is the count of positives numbers and the second element is sum of negative numbers.

If the input array is empty or null, return an empty array.

L1: Bartender, drinks!

Write a function getDrinkByProfession/get_drink_by_profession() that receives as input parameter a string, and produces outputs according to the following table:

Abbreviate a Two Word Name

Write a function to convert a name into initials. This kata strictly takes two words with one space in between them.

The output should be two capital letters with a dot seperating them.

It should look like this:

Patrick Feeney => P.F

https://www.codewars.com/kata/5ab6538b379d20ad880000ab/train/javascript You are given the length and width of a 4-sided polygon. The polygon can either be a rectangle or a square. If it is a square, return its area. If it is a rectangle, return its perimeter.

Third Angle of a Triangle

Remove Duplicates From List

https://www.codewars.com/kata/remove-duplicates-from-list/train/javascript/5b58e4456dc79e9f7000003c Define a function that removes duplicates from an array of numbers and returns it as a result.

Читайте также:  установка кода на велосипедном замке

The order of the sequence has to stay the same.

https://www.codewars.com/kata/grasshopper-if-slash-else-syntax-debug/train/javascript/5cd62b0e385bfb002846181b If/else syntax debug While making a game, your partner, Greg, decided to create a function to check if the user is still alive called checkAlive/CheckAlive. Unfortunately, Greg made some errors while creating the function.

checkAlive/CheckAlive should return true if the player’s health is greater than 0 or false if it is 0 or below.

Complete the function which converts a binary number (given as a string) to a decimal number.

Filter out the geese

Write a function, gooseFilter/goose_filter/GooseFilter, that takes an array of strings as an argument and returns a filtered array containing the same elements but with the ‘geese’ removed.

There will only be one ‘longest’ word.

get character from ASCII Value

https://www.codewars.com/kata/get-character-from-ascii-value/train/javascript/5cc8e9c20cbae00013a01a0a Get character from ASCII Value Write a function getChar/GetChar/get_char which takes a number and returns the corresponding ASCII char for that value.

Are You Playing Banjo?

Create a function which answers the question «Are you playing banjo?». If your name starts with the letter «R» or lower case «r», you are playing banjo!

The function takes a name as its only argument, and returns one of the following strings:

name + » plays banjo» name + » does not play banjo»

Correct the mistakes of the character recognition software

Character recognition software is widely used to digitise printed texts. Thus the texts can be edited, searched and stored on a computer.

When documents (especially pretty old ones written with a typewriter), are digitised character recognition softwares often make mistakes.

Capitalization and Mutability

https://www.codewars.com/kata/capitalization-and-mutability/train/javascript/5d1a3ffd0e313ea65c52b6d0 Your coworker was supposed to write a simple helper function to capitalize a string (that contains a single word) before they went on vacation.

Unfortunately, they have now left and the code they gave you doesn’t work. Fix the helper function they wrote so that it works as intended (i.e. make the first character in the string «word» upper case).

Don’t worry about numbers, special characters, or non-string types being passed to the function. The string lengths will be from 1 character up to 10 characters, but will never be empty.

Will there be enough space?

Bob is working as a bus driver. However, he has become extremely popular amongst the city’s residents. With so many passengers wanting to get aboard his bus, he sometimes has to face the problem of not enough space left on the bus! He wants you to write a simple program telling him if he will be able to fit all the passengers.

In this simple assignment you are given a number and have to make it negative. But maybe the number is already negative?

Given an array of integers as strings and numbers, return the sum of the array values as if all were numbers.

Will there be enough space?

You have to write a function that accepts three parameters:

cap is the amount of people the bus can hold excluding the driver. on is the number of people on the bus. wait is the number of people waiting to get on to the bus. If there is enough space, return 0, and if there isn’t, return the number of passengers he can’t take.

Jenny’s secret message

Jenny has written a function that returns a greeting for a user. However, she’s in love with Johnny, and would like to greet him slightly different. She added a special case to her function, but she made a mistake.

This kata is about multiplying a given number by eight if it is an even number and by nine otherwise.

If you can’t sleep, just count sheeps!!

Given a number, 3 for example, return a string with a murmur: «1 sheep. 2 sheep. 3 sheep. «

Alex just got a new hula hoop, he loves it but feels discouraged because his little brother is better than him

Write a program where Alex can input (n) how many times the hoop goes round and it will return him an encouraging message 🙂

-If Alex gets 10 or more hoops, return the string «Great, now move on to tricks».

-If he doesn’t get 10 hoops, return the string «Keep at it until you get it».

Write a function called repeatStr which repeats the given string string exactly n times.

Remove String Spaces

Simple, remove the spaces from the string, then return the resultant string.

https://www.codewars.com/kata/calculate-bmi/train/javascript/5b606e668f47bdcbe3000035 Write function bmi that calculates body mass index (bmi = weight / height ^ 2). if bmi 30 return «Obese»

Remove First and Last Character

It’s pretty straightforward. Your goal is to create a function that removes the first and last characters of a string. You’re given one parameter, the original string. You don’t have to worry with strings with less than two characters.

Create a function that takes an integer as an argument and returns «Even» for even numbers or «Odd» for odd numbers.

The code does not execute properly. Try to figure out why.

How good are you really?

There was a test in your class and you passed it. Congratulations! But you’re an ambitious person. You want to know if you’re better than the average student in your class. You got an array with your colleges’ points. Now calculate the average to your points!

Return True if you’re better, else False!

Note: Your points are not included in the array of your classes points. For calculating the average point you may add your point to the given array!

Write function avg which calculates average of numbers in given list.

Is n divisible by x and y?

Create a function isDivisible(n, x, y) that checks if a number n is divisible by two numbers x AND y. All inputs are positive, non-zero digits.

Remove exclamation marks

Write function RemoveExclamationMarks which removes all exclamation marks from a given string.

What ways of achieving this do you know?

Very simple, given a number, find its opposite.

Reverse Words in a String

You need to write a function that reverses the words in a given string. A word can also fit an empty string. If this is not clear enough, here are some examples:

As the input may have trailing spaces, you will also need to ignore unneccesary whitespace.

reverse(‘Hello World’) === ‘World Hello’ reverse(‘Hi There.’) === ‘There. Hi’

Источник

Comments

ASchmidt1 commented Mar 20, 2018

The following code:

The text was updated successfully, but these errors were encountered:

mszabo-wikia commented May 30, 2018

cmb69 commented Jul 4, 2018

The code works as expected without uopz: https://3v4l.org/QXr3i

ASchmidt1 commented Jul 15, 2018

@mszabo-wikia Confirmed with PHP 7.2.3. Without UOPZ extension, ONLY this code (using &$this) will work and NO issue warnings:

Читайте также:  qr код сканер где найти на телефоне

So native PHP works, and ONLY works, if &$this is used in BOTH lines.

However, the moment UOPZ is active, that working PHP 7.2.3 code fails.

mszabo-wikia commented Jul 15, 2018 •

goshlanguage commented Oct 7, 2018 •

Running the code above is successful regardless of PHP version:

This issue specifically affects the greater WordPress community, would love to help, but the comments are pretty terse regarding PHP_FUNCTION(uopz_call_user_func)

Is it possible that the parameter copying in util.c (uopz_caller_init) is mutating the parameters, or when its copying the function from the hashtable, that it’s losing some bit of metadata, such as that the parameter should be a reference?

I also looked into the zpp api to see if it could be an issue with the zend data types, which I’m still not convinced couldn’t be the issue.

@krakjoe Do you have office hours to discuss?

goshlanguage commented Oct 9, 2018

I and a colleague spent a good amount of time debugging this with gdb in hopes we could spot the issue. We even tried commenting out various bits of functionality we suspected within UOPZ, such as the callers_init bits that perform the memcpy, and much more. Each time we reran the test by @ASchmidt1 above on Php7.2, it failed, but building the same code against the Zend libs in 7.0 seems to pass.

At this point, we suspect that UOPZ could be exposing a bug within Zend, but don’t have a definitive example that proves it.

We see Zend calls in the backtraces within gdb while calling the mostly commented out bits of UOPZ, which still produces failures on php7.2.

Источник

Schema mismatch expected Number but got String (Rest API) #4997

Comments

adamofsky commented Aug 20, 2018

Hi
I am trying to save number variable of one of my classes on my backend but received this error:
«schema mismatch for Coins.price; expected Number but got String»
100% I am sending a number
In the Postman the error is the same screenshot: https://drive.google.com/file/d/1pSrAMlAnW4fn-YhzlF6aJtMnshq2R7JQ/view?usp=sharing

String variables work and saved fine

Server

Database

The text was updated successfully, but these errors were encountered:

flovilmart commented Aug 20, 2018 •

adamofsky commented Aug 20, 2018 •

No man I tried also application/json and also: utf8,javascript,gzip
The utf8 does not have this error but also not saving anything
application/x-www-form-urlencoded works for strings fine

adamofsky commented Aug 20, 2018

Changed data to raw in Postman fixed the issue

flovilmart commented Aug 20, 2018

well man, I’m just pointing out that anything but application/json doesn’t make sense (unless you have your own bodyparser middleware in front of the server (bad idea btw)).

So, man, I just tested in the Dashboard:

And it just works fine. Can you provided the logs when running with VERBOSE=1 (btw as requested in the template)?

You should see something like:

However if you pass a string:

flovilmart commented Aug 20, 2018

@adamofsky so much for 100% I am sending a number

adamofsky commented Aug 20, 2018

flovilmart commented Aug 20, 2018

I’m not your man, what if I identified as non binary? Your condescending tone is not welcome and I’d appreciate you keep your communications professional next time. And also, perhaps evaluate the need to open such issue as you demonstrated a clear lack of self criticism about your own code. Next time, expect such issues to be closed without answer.

adamofsky commented Aug 21, 2018

Dear @flovilmart
I didn’t want to hurt you by calling you ‘man’, so I am sorry if I hurt you.
I can call to my friends ‘man‘ and it is ok for us. Of course, you are not my friend but you tried to help me and you really helped me. So your help it is a friendly act an I really appreciate it. So I called you like I call my friend ‘man‘, and again I am sorry if I did hurt you.

I don’t think it is not professional, because I can call my team leader ‘man‘ and it is ok, it is a friendly relationship. Part of our job with colleagues it is, first of all, be humans and friends to work in the friendly atmosphere, and not always be official like a robot.

There is no way to criticism about my own code because I asked about the request in ‘Postman’. It is not worked in ‘Postman’ and I can’t critic ‘Postman’. But I can critic that I did something wrong and I did, I told that I changed data to raw format to fix the issue, so people can understand that it is my fault.

Parse Server not only supports ‘application/json’ but also ‘urlencode’, in queries, you can see it in Rest API documentation:

Maybe this is the reason that it works for string variables in objects, so it is a little bit confusing, and there is no similar ticket with this problem so I decided to open a ticket.

All these things I told you, not because you threaten to me that you will close my issue next time without an answer, I can create a new account and still open the issue.
All these things I told you because it is important to me that you understand that I am really don’t wanted to hurt you.
And I think that to be friendly and simple with your colleagues makes our lives easier and better.

flovilmart commented Aug 21, 2018

Just because you think it’s OK to call s/o man or be familiar, doesn’t make it OK.

Your issue reports was inaccurate, and actually, untested. I responded to the best of my abilities.

I don’t threat to close automatically your issue reports, BUT, your report didn’t include the required logs, and with those logs you would have found the solution by yourself, so in the future, I may be more direct with incomplete issue reports (they are getting automated, that’s not only for you).

Also, I’m pretty sure you didn’t try curl calls with application/json (because those work).

As for url encoded, GET requests should not have bodies, that’s why we use urlencoded JSON.

Barsha96 commented Jan 18, 2019

Got the same Issue: I was trying to add new object for Product class and product rate «rate» was a Number type
I’m using JavaScript for Parse

var res = await product.save( <
product_name: document.forms[«addProduct»][«pname»].value,
measure_unit: document.forms[«addProduct»][«measureunit»].value,
rate: parseInt(document.forms[«addProduct»][«rate»].value)
>);

Источник

Компьютерный онлайн портал