How do I answer this or print it via google colab? - boolean

I tried printing both the score and the bool_test but am getting an error. I am thinking it's because bool is a reserved keyword but I could be wrong.

Related

I'm trying to create a blog page with hugo it gives some annoying errors

This is the config file
baseURL = "https://.github.io/"
languageCode = "en-us"
title = "Title"
theme="hugo-PaperMod"
[[params=]]
[[homeInfoParams=]]
Title= "Hi there wave"
Content= "Can be Info, links, about..."
[[socialIcons=]]
- name= "github"
url= "<link>"
- name= "<platform 2>"
url= "<link2>"
This is the error on the powershell
ERROR 2021/08/15 17:40:30 "C:\Users\user\Desktop\blog\webapp\config.toml:5:9": unmarshal failed: toml: expected character U+005D
Rebuilt in 1 ms
I'm a total beginner in this area its most likely a basic thing but i can't figure it out.
TLDR; Take the equals signs out of your config's toml.
P.s. Their are no equals signs in the [[]] statements.
Some advice:
If your code doesn't work, verify your code (validate)-
https://www.toml-lint.com/
If you don't understand the language syntax when the validator gives you errors, check your specific misunderstanding in that language (that linter will give you more data).
https://github.com/toml-lang/toml
As it's hugo and they have pre-built config files for you to review, review what other people have done that does work:
https://gohugo.io/getting-started/configuration/#readout
https://themes.gohugo.io/
Additional, when looking at your question and the wider sphere:
Why do you say annoying error? English isn't my first language. But it's telling you that your toml is miswritten so it can't parse it. The more accurate information you give the more accurate information you will get back from others in the field.
So, a better example would be (and this is an idea):
"HUGO Config.toml errors, uncertain of correct syntax"

Alpha Vantage error when symbol has digits

I'm trying to get quotes for an Australian stock with ticker A200.AX (aka A200.AUS) from Alpha Vantage.
I have no issues getting other symbols from the AX market, e.g.:
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=ETHI.AUS&apikey=demo
...returns data as expected
However when a symbol has digit(s) in it, it seems to return an error:
https://www.alphavantage.co/query?function=TIME_SERIES_DAILY&symbol=A200.AUS&apikey=demo
Invalid API call. Please retry or visit the documentation (https://www.alphavantage.co/documentation/) for TIME_SERIES_INTRADAY.
Same result for F100.AUS
I checked to make sure the ticker was valid: A200.AUS shows up if I search for it:
https://www.alphavantage.co/query?function=SYMBOL_SEARCH&keywords=A200.AUS&apikey=demo
I'm aware of some questions related to URL encoding, but I can't see any URL special characters in A200.AUS . Besides, using the search endpoint works with the ticker passed on literally.
Does anyone know how to download this stock's information or what I'm doing wrong?
Your use of the search endpoint is great, however A200.AUS is an ETF. Alpha Vantage has some ETFs, but currently, only 100% supports stocks.

Using "is null" when retrieving prices doesn't work

I am trying to get the price items for performance block storage that are generic (not specific to a certain datacenter). I can see that these have the locationGroupId set to blank or null, but I can't seem to get the objectFilter to work with that, the query returns nothing. If I omit the locationGroupId filter I get a result that contain both location-specific and non-location specific prices.
GET /rest/v3.1/SoftLayer_Product_Package/759/getItemPrices.json?objectMask=mask[locationGroupId,id,categories,item]&objectFilter={"itemPrices":{"categories":{"categoryCode":{"operation":"performance_storage_space"}},"item":{"keyName":{"operation":"$=GBs"}},"locationGroupId":{"operation":"is null"}}}
I am guessing there is something wrong with the object filter, any ideas?
If I filter on locationGroupId 509 it works:
/rest/v3.1/SoftLayer_Product_Package/759/getItemPrices.json?objectMask=mask[locationGroupId,id,categories,item]&objectFilter={"itemPrices":{"categories":{"categoryCode":{"operation":"performance_storage_space"}},"item":{"keyName":{"operation":"$=GBs"}},"locationGroupId":{"operation":509}}}
The reason it the first query didn't work while the second did was that I used the command "curl -sg" to do the request. While that eliminates the need to escape the {}[] characters - it also turns off escaping other characters correctly in the URL - like the space in "is null". Changing that to "is%20null" solves the issue.
I am posting this as the answer as I find it likely for others to encounter this problem.

Exim getting random credential in exim.conf

I have been trying to get perl subroutine value and substitution to get the required part of string from randomips subroutine in exim.conf. However when i use string substitution i get error as follow:
Here is what I am trying to achieve
I am trying to split string by colon and get first occurrence as "interface". I'll be using second occurrence as the "helo_data.
exim.pl
sub randomhosts {
#inet = ("x.x.x.1:hostname1.domain.com","x.x.x.2:hostname2.domain.com","x.x.x.3:hostname3.domain.com"
);
return $inet[int rand($#inet+1)];
}
exim.conf
dkim_remote_smtp:
driver = smtp
interface = "${perl{randomhosts}%:*}"
helo_data = "${sender_address_domain}"
Error I get is as follow:
"failed to expand "interface" option for dkim_remote_smtp transport: missing '}' after 'perl'".
Probably the syntax.
Any help?
The code that you are trying to copy was written by someone who doesn't know much about Perl. It includes this line:
return $inet[int rand($#inet+1)];
A Perl programmer would write this as
return $inet[rand #inet];
I think there are a couple of issues here - one with your Exim syntax and one with your Perl syntax.
Exim is giving you this error:
failed to expand "interface" option for dkim_remote_smtp transport: missing '}' after 'perl'
I don't know anything about calling Perl from Exim, but this page mentions a syntax like ${perl{foo}} (which is similar to the one used in the page you are copying from) and one like ${perl{foo}{argument}} for calling a subroutine and passing it an argument. Nowhere does it mention syntax like yours:
${perl{randomhosts}%:*}
I'm not sure where you have got that syntax from, but it seems likely that this is what is causing your first error.
In a comment, you say
I am stying to get first part of string before colon for each random array value for "interface" and part after colon for "helo_data"
It seems to me that Exim doesn't support this requirement. You would need to call the function twice to get the two pieces of information that you require. You might be able to do this in the Perl using something like state variables - but it would be far more complex than the code you currently have there.
Secondly, your Perl code has a syntax error, so even if Exim was able to call your code, it wouldn't work.
The code you're copying sets up #inet like this:
#inet = ("x.x.x.1", "x.x.x.2", "x.x.x.3", "x.x.x.4");
Your equivalent code is this:
#inet = (
"x.x.x.1:hostname1.domain.com",
"x.x.x.2:hostname2.domain.com,
x.x.x.3:hostname3.domain.com
);
I've reformatted it, to make the problems more obvious. You are missing a number of quote marks around the elements of the array. (Note: I see that while I have been writing this answer, you have fixed that.)
Update: Ok, here is some code to put into exim.pl that does what you want.
use feature qw[state];
sub randomhosts {
state $current;
my #inet = (
"x.x.x.1:hostname1.domain.com",
"x.x.x.2:hostname2.domain.com",
"x.x.x.3:hostname3.domain.com"
);
if ($_[0] eq 'generate') {
shift;
#{$current}{qw[ip host]} = split /:/, $inet[rand #inet];
}
return $current->{$_[0]};
}
It generates a new ip/host pair if its first argument is 'generate'. It will then return either the hostname or the ip address from the generated pair. I think you can probably call it from your Exim config file like this:
dkim_remote_smtp:
driver = smtp
interface = "${perl{randomhosts}{generate}{ip}}"
helo_data = "${perl{randomhosts}{host}}"
But I'm no expert in Exim, so that syntax might need tweaking.
First I would like to note I have not worked with exim so I cannot say what exactly you are trying to do and why you have done things exactly so.
In the link you posted, a method called 'randinet' is added to exim.pl and the interface line in exim.conf is replaced by
interface = "${perl{randinet}}"
You have implemented a 'randomhosts' method and replaced the interface line with
interface = "${perl{randomhosts}%:*}"
Now the parser complains about not finding the closing bracket. That is likely due to the symbols you felt free to add but the parser does not have the freedom to ignore.
I suggest you try
interface = "${perl{randomhosts}}"

wordcloud package: get "Error in strwidth(...) : invalid 'cex' value"

I am using the tm and wordcloud packages in R 2.15.1.
I am trying to make a word cloud from a DTM. Here is the code:
library(wordcloud)
thedtmsparse = inspect(sparse)
trymatrix = t(thedtmsparse)
colnames(trymatrix) = c()
comparison.cloud(trymatrix, max.words=15, random.order=FALSE)
I get the following error from the last command:
Error in strwidth(words[i], cex = size[i], ...) : invalid 'cex' value
I have used the same code on another DTM where it worked fine and I got the word cloud.
Can somebody tell me a fix for the error?
Ravi
You haven't provided reproducible code (probably a big reason no one answered your question), so I can only venture to guess what the problem might be.
I faced this same error, so I'll share my experience. The problem was I had NA's instead of 0's in my term document matrix. Simply fixing that fixed that problem.