Google visualisation load failed - error - google-visualization

I have some complex google visualisation code and sometimes table show perfectly and sometimes I get this screen:
What mean that error? I look on google search but I cant get any answer? What that mean?
How sometimes google visualisation table load fine and sometimes not?
Maybe problem can be my database data, becouse I have an cell with words separated by (,) comma ... I get this like string...
UPDATE: this is my js code for google visualisation:
http://jsbin.com/binuvawi/1/edit
UPDATE 2:
sample of getzadaci.php :
{"cols":[{"label":"ID","type":"number"},{"label":"Naziv","type":"string"},{"label":"Vrsta","type":"string"},{"label":"Status","type":"string"},{"label":"Opis","type":"string"},{"label":"Pocetak","type":"date"},{"label":"Zavrsetak","type":"date"},{"label":"Odgovoran","type":"string"},{"label":"Parcela","type":"string"},{"label":"Usluzno?","type":"string"},{"label":"id_parcele","type":"string"}],"rows":[{"c":[{"v":1},{"v":"Priprema"},{"v":"navodnjavanje"},{"v":"U pripremi"},{"v":"Da se izrzi nadovdnjavanje"},{"v":"Date(2014, 02, 25)"},{"v":"Date(2014, 02, 28)"},{"v":"Laza Lazic"},{"v":"Njiva 5"},{"v":"NE"},{"v":"0"}]},{"c":[{"v":2},{"v":"Djubrenje"},{"v":"djubrenje"},{"v":"U toku"},{"v":"Vrsi se djubrenje parcele na temp. od oko 12C"},{"v":"Date(2014, 02, 28)"},{"v":"Date(2014, 03, 05)"},{"v":"Pera Peric"},{"v":"vocnjak 3"},{"v":"DA"},{"v":"0"}]},{"c":[{"v":22},{"v":"Novo zemljiste"},{"v":"obrada tla, zastita, berba\/zetva "},{"v":"Zavrseno"},{"v":"jeeeeeeeeeeeeeeeeeeeeeee"},{"v":"Date(2013, 04, 30)"},{"v":"Date(2013, 05, 11)"},{"v":""},{"v":"S4"},{"v":"787"},{"v":"0"}]},{"c":[{"v":25},{"v":"sklas"},{"v":"obrada tla, zastita, skladistenje"},{"v":"U planu"},{"v":"testiranje"},{"v":"Date(2013, 04, 17)"},{"v":"Date(2013, 04, 30)"},{"v":""},{"v":"Vocnjak N, S4, Moja parcela N, Parcela 3n "},{"v":""},{"v":"3, 19, 11, 13"}]}]}
LOAD:
<script type="text/javascript">
google.load('visualization', '1.1', {packages: ['controls']});
</script>

Related

In Coldfusion a certain date June 01, 2008 is not getting casted/parsed to datetime object while using “CreateODBCDateTime” method

<cfoutput>
<cfset mydate = 'June 01, 2008'>
<cfset JobStartDate=CreateODBCDateTime(mydate)>
</cfoutput>
Error:
Date value passed to date function createDateTime is unspecified or invalid.
Specify a valid date in createDateTime function.
Even isdate(mydate) // isdate('June 01, 2008') throws the exception.
Even *DateDiff // DateDiff('m', 'June 01, 2008', 'October 14, 2010') also gives exception.
It works okay with other dates for example: 'August 01, 2008', 'May 14, 2012' etc
I am using ColdFusion 2021 Update 3. Any help would be highly appreciated?
Adding a few more details in response to the comments:
Under JVM details Java Default Locale is en_US. Also by running GetLocale() gives me English (US).
The issue does'nt reproduce on cftry or cffiddle. But it can be reproduced if you install Coldfusion via Commandbox and try running the code.
Just do a lsParseDateTime to fix this. You are declaring that as a string so CF wont consider that as a date
<cfset JobStartDate = CreateODBCDateTime(lsParseDateTime(mydate, "en_US"))>

Django Window annotation using combined with distinct clause

I have a Django model stored in a Postgres DB comprised of values of counts at irregular intervals:
WidgetCount
- Time
- Count
I'm trying to use a window function with Lag to give me a previous row's values as an annotation. My problem is when I try to combine it with some distinct date truncation the window function uses the source rows rather than the distinctly grouped ones.
For example if I have the following rows:
time count
2020-01-20 05:00 15
2020-01-20 06:00 20
2020-01-20 09:00 30
2020-01-21 06:00 35
2020-01-21 07:00 40
2020-01-22 04:00 50
2020-01-22 06:00 54
2020-01-22 09:00 58
And I want to return a queryset showing the first reading per day, I can use:
from django.db.models.functions import Trunc
WidgetCount.objects.distinct("date").annotate(date=Trunc("time", "day"))
Which gives me:
date count
01/01/20 15
01/01/21 35
01/01/22 50
I would like to add an annotation which gives me yesterday's value (so I can show the change per day).
date count yesterday_count
01/01/20 15
01/01/21 35 15
01/01/22 50 35
If I do:
from django.db.models.functions import Trunc, Lag
from django.db.models import Window
WidgetCount.objects.distinct("date").annotate(date=Trunc("time", "day"), yesterday_count=Window(expression=Lag("count")))
The second row return gives me 30 for yesterday_count - ie, its showing me the previous row before applying the distinct clause.
If I add a partiion clause like this:
WidgetCount.objects.distinct("date").annotate(date=Trunc("time", "day"), yesterday_count=Window(expression=Lag("count"), partition_by=F("date")))
Then yesterday_count is None for all rows.
I can do this calculation in Python if I need to but it's driving me a bit mad and I'd like to find out if what I'm trying to do is possible.
Thanks!
I think the main problem is that you're mixing operations that used in annotation generates a grouped query set such as sum with a operation that simples create a new field for each record in the given query set such as yesterday_count=Window(expression=Lag("count")).
So Ordering really matters here. So when you try:
WidgetCount.objects.distinct("date").annotate(date=Trunc("time", "day"), yesterday_count=Window(expression=Lag("count")))
The result queryset is simply the WidgetCount.objects.distinct("date") annotated, no grouping is perfomed.
I would suggest decoupling your operations so it becomes easier to understand what is happening, and notice you're iterating over the python object so don't need to make any new queries!
Note in using SUM operation as example because I am getting an unexpected error with the FirstValue operator. So I'm posting with Sum to demonstrate the idea which remains the same. The idea should be the same for first value just by changing acc_count=Sum("count") to first_count=FirstValue("count")
for truncDate_groups in Row.objects.annotate(trunc_date=Trunc('time','day')).values("trunc_date")\
.annotate(acc_count=Sum("count")).values("acc_count","trunc_date")\
.order_by('trunc_date')\
.annotate(y_count=Window(Lag("acc_count")))\
.values("trunc_date","acc_count","y_count"):
print(truncDate_groups)
OUTPUT:
{'trunc_date': datetime.datetime(2020, 1, 20, 0, 0, tzinfo=<UTC>), 'acc_count': 65, 'y_count': None}
{'trunc_date': datetime.datetime(2020, 1, 21, 0, 0, tzinfo=<UTC>), 'acc_count': 75, 'y_count': 162}
{'trunc_date': datetime.datetime(2020, 1, 22, 0, 0, tzinfo=<UTC>), 'acc_count': 162, 'y_count': 65}
It turns out FirstValue operator requires to use a Windows function so you can't nest FirtValue and then calculate Lag, so in this scenario I'm not exactly sure if you can do it. The question becomes how to access the First_Value column without nesting windows.
I haven't tested it out locally but I think you want to GROUP BY instead of using DISTINCT here.
WidgetCount.objects.values(
date=Trunc('time', 'day'),
).order_by('date').annotate(
date_count=Sum('count'), # Will trigger a GROUP BY date
).annotate(
yesterday_count=Window(Lag('date_count')),
)

How can I grab the XML data using Google Sheets

Google sheet has a function importxml() to grab data from a webpage, I want to grab the table from https://rss.weather.gov.hk/rss/CurrentWeather.xml, it is an XML with XSL when I view the page source, I find the <td> tag, I try to input
=IMPORTXML("https://rss.weather.gov.hk/rss/CurrentWeather.xml", "//td")
in the cell but it returns #N/A, what is the syntax error I made? Or the content format not acceptable to Google Sheets?
=ARRAYFORMULA({IFERROR(REGEXEXTRACT(TRANSPOSE(SPLIT(INDEX(IMPORTXML(
"https://rss.weather.gov.hk/rss/CurrentWeather.xml", "//*"), 21, 1),
CHAR(10))), "(.*) \d+ degrees ;"), TRANSPOSE(SPLIT(INDEX(IMPORTXML(
"https://rss.weather.gov.hk/rss/CurrentWeather.xml", "//*"), 21, 1),
CHAR(10)))), IFERROR(REGEXEXTRACT(TRANSPOSE(SPLIT(INDEX(IMPORTXML(
"https://rss.weather.gov.hk/rss/CurrentWeather.xml", "//*"), 21, 1),
CHAR(10))), "\d+ degrees ;"))})

Aggregating using regex in Google Sheets

I have the following cell in my spreadsheet. It is a string that has the structure of a JSON object.
D2 = {color: white, quantity: 23, size: small}, {color: black, size: medium, Quantity: 40}
For the cell D3, I want the output to be 63, which is the total of the quantities found in D2. Moreover, the following things should be noted:
If something goes wrong, for example, if a quantity is given as a string, then D3 is simply kept empty.
Anytime D2 is updated, D3 is updated as well.
If D3 is updated manually, that result is kept instead of the formula. This will happen for rows where D2 is empty.
Is there any way to do this using Google Sheets? I tried using REGEXEXTRACT, however, it did not produce any result. Any help is greatly appreciated.
Edits:
The order of the attributes is not important. For example, the quantity can appear before or after the size.
The case is also not important.
=SUMPRODUCT(IFERROR(REGEXREPLACE(SPLIT(D22, ":"), "}.*", "")))
=SUMPRODUCT(IFERROR(REGEXREPLACE(SPLIT(SUBSTITUTE(D21, "quantity:", "♦"), "♦"), "}.*", "")))

react-intl FormattedDate Shows Prior Date for YYYY-MM-DD value

Please note I'm new to react-intl. I have the following date I want to display:
d1_date: "2012-03-26" //goal to display March 26, 2012
I use react-intl's
FormattedDate
to display the date:
<FormattedDate value={d1_date} year='numeric' month='long' day='2-digit' />
and I get the following result:
March 25, 2012
I know the d1_date doesn't have time information. Do I need to manipulate d1_date so that a bogus time appears allowing the true date to reflect "March 26, 2012"?
<FormattedDate value={new Date('2012-03-26')} year='numeric' month='long' day='2-digit' />
I think it requires Date instance.