i'm Using Google Sheets with IMPORTXML to scrape a download count information from a japanese website via XPath in google sheet. I want to save the number/text inside this red box
here's the link
https://www.photo-ac.com/main/detail/4465781?title=%E3%82%A2%E3%82%B2%E3%83%8F%E8%9D%B6%E3%81%A8%E3%83%92%E3%83%A3%E3%82%AF%E3%83%8B%E3%83%81%E3%82%BD%E3%82%A6
here's my function
=IMPORTXML("https://www.photo-ac.com/main/detail/4465781?title=アゲハ蝶とヒャクニチソウ", "/html/body/div[17]/div/div/div/div[2]/div[7]/div[1]/div[1]/div/div[3]/div[2]/div[1]//text()")
the function doesn't work? why?
thank you
When I tested your formula, I confirmed that an error of Could not fetch url: occurred. But, fortunately, when Google Apps Script is used, I confirmed that the URL can be requested using UrlFetchApp. So, in this answer, I would like to propose to use Google Apps Script. The sample script is as follows.
Sample script:
Please copy and paste the following script to the script editor of Google Spreadsheet, and save it, and put a formula of =SAMPLE("URL") to a cell. If the function name is not found, please reopen the Google Spreadsheet and test it again. This script is used as the custom function.
function SAMPLE(url) {
const value = UrlFetchApp.fetch(url).getContentText().match(/ダウンロード:.+/);
if (!value) throw new Error("Value was not retrieved.");
return value;
}
Result:
When above script is used, the following result is obtained.
Note:
This sample script is for the current HTML of the URL of https://www.photo-ac.com/main/detail/4465781?title=アゲハ蝶とヒャクニチソウ. And, when the structure of HTML of the URL is changed, above script might not be able to be used. Please be careful this.
References:
Custom Functions in Google Sheets
fetch(url)
I have Google Maps polygons stored as polygons in Postgres and I read them straight from DB to output to a react Component for editing using the Google Maps API.
In my local dev environment this works fine and by inspecting the data being fed to the React component everything looks normal:
this.state = {
map: "POLYGON ((10.69332405332034 59.88086121809927, 10.77572151425784 59.84569766552776, 10.81554695371096 59.84121336506844, 10.8450727105469 59.84518027707294, 10.86910530332034 59.85397478713949, 10.91442390683596 59.88499566305687, 11.020510637793 59.9383527020427, 10.99115654233401 59.96809210273585, 10.91811462644046 59.99462872670429, 10.80250068906253 60.0067306049673, 10.58723732236331 59.97273110496651, 10.43772026303714 59.86724837030302, 10.44239803555911 59.85643166134471, 10.44501587155..."
}
But in production it seems some kind of compression/encoding is taking effect, rendering the data unusable to Google Maps:
this.state = {
map: "01030000000100000011000000004DF44CCD71164029B0493D19844D40004DF44C45AE1640E4A03B36D6814D40004DF44C75D81640139E06594D7F4D40004DF44C7532174001AC3D1CC47C4D40004DF44CAD0917404808CC83B0774D40004DF44CB5101740926DE6EDB2714D40004DF44C45081740393029BE276E4D40004DF44C8513174013D62165106C4D40004DF44C2DF31640637589D49B6A4D40004DF44CBD901640E794678CCA6B4D40004DF44C5535164080F6C4D4E16B4D40004DF44CCD17164099584C2D84724D40004DF44C553516400505C70B53784D40004DF44C1D31164037A2643EC17F4D40004DF44CC53D1640F4139BEDEA"
}
Background/environment
We recently had to take a server out of service and in its place we added two new ones to the load balancer. They were set up through Cloud 66 using the same config so they should be exaclty the same, but I guess you never know.
We use slim syntax for templates.
I should clarify: Nothing is being done explicitly by our application code to the map field on its way from Postgres to the React component. We get the database record like so: #coverage_map = CoverageMap.find(params[:id]) and then output it in the template like so: coverageMap: #coverage_map. The outputted data on display here is copied from the HTML template being rendered by Slim.
What could be happening here? Any tips on what to look for?
In your dev environment you're retrieving the geometry from the database as WKT (Well Known Text), which is not PostgreSQL's standard output. In production you're getting a WKB (Well Known Binary) representation of the geometry, which is what you normally see when firing a simple select. What you need is to use ST_AsText to get your WKT, e.g.
WITH mytable (geom) AS (
VALUES ('POINT(1 1)'::geometry)
)
SELECT geom,ST_AsText(geom) FROM mytable;
geom | st_astext
--------------------------------------------+------------
0101000000000000000000F03F000000000000F03F | POINT(1 1)
(1 Zeile)
I have a jaspersoft report (line chart built in studio), and I want the data series in the chart to be hyperlinks that drilldown to open a dashboard.
Based on this wiki page I was able to create Reference hyperlinks so that clicking on any data series in the chart opens the correct dashboard. But I cannot get the Input Control parameters to pass correctly.
The URL when I load my dashboard directly from the repository (not by clicking hyperlinks in my line chart report) is
http://ddevrpt:8080/jasperserver-pro/dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile
The URL generated when i do not include input controls in my hyperlink reference expression is the same:
http://ddevrpt:8080/jasperserver-pro/dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile
JRXML:
<itemHyperlink hyperlinkType="Reference">
<hyperlinkReferenceExpression><![CDATA["./dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile"]]></hyperlinkReferenceExpression>
</itemHyperlink>
The URL generated when i do include Input Control parameter values is different, but still loads the dashboard empty (without passing the parameter values):
http://ddevrpt:8080/jasperserver-pro/dashboard/viewer.html?hidden_WellConcatenated_0=49005478.1:%20DILTS%2044-15%20TH&hidden_OccurrenceDate_1=2015-09-28%2000:00:00.0&hidden_OccurrenceDate_2=2015-10-05%2000:00:00.0#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile
JRXML:
<itemHyperlink hyperlinkType="Reference">
<hyperlinkReferenceExpression><![CDATA["./dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile"+"&hidden_WellConcatenated_0=" + $V{WellConcatenated_0} + "&hidden_OccurrenceDate_1=" + $P{RecordDate_0_1} + "&hidden_OccurrenceDate_2=" + $P{TimeStampMinusOneWeek}]]></hyperlinkReferenceExpression>
</itemHyperlink>
I know I am naming the input controls correctly because if i change my link type to report execution and link to a simple report using those input controls the proper report opens and the input control values are passed correctly.
I would also appreciate if anyone has other references they can point me to for drilling down TO a dashboard from a report.
I'm working with 6.3 and was able to resolve the issue with a small modification to the HyperlinkReferenceExpression syntax.
Specifically, I removed the "_hidden" before the input control resource IDs:
HyperlinkReferenceExpression:
original syntax:
"./dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile"
+"&hidden_WellConcatenated_0=" + $V{WellConcatenated_0}
+"&hidden_OccurrenceDate_1=" + $P{RecordDate_0_1}
+"&hidden_OccurrenceDate_2=" + $P{TimeStampMinusOneWeek}
modified syntax:
"./dashboard/viewer.html#%2Fpublic%2FP2%2FMidcap%2FFinancial%2FDashboards%2FWell_Profile"
+"&WellConcatenated_0=" + $V{WellConcatenated_0}
+"&OccurrenceDate_1=" +$P{RecordDate_0_1}
+"&OccurrenceDate_2=" + $P{TimeStampMinusOneWeek}
I'm assuming you're running 6.4.0. I'm not sure that approach is still valid.
You will likely need to register a custom hyperlink handler in your report in order to drill-down to a Dashboard. See here for more details: http://community.jaspersoft.com/wiki/how-use-custom-hyperlink-handler-dashboard-jasperreports-server
And here: http://www.helicaltech.com/use-custom-hyperlink-handler-with-a-dashboard-in-jasperreports-server/
Let me know if that works for you on 6.4.0!
My solution is a bad solution., but it worked for me.
In my Dataset - query I used the following:
Select p.printer_name, p.display_name, $P{start_date_1} as start_date_param, ....
Then, use the start_date_param as a field in the hyperlink.
Flot documentation says that it is based on javascript timestamp.
I have tried to convert my JSON to comply this standard, and my JSON looks like this
{"label":"Activation","data": [
["1382061194000","10"],["1382061195000","9"],["1382061196000","9"],
["1382061197000","20"],["1382061198000","6"],["1382061203000","16"],
["1382061204000","12"],["1382061205000","14"],["1382061206000","22"],
["1382061207000","20"],["1382061208000","10"],["1382061209000","19"],
["1382061210000","13"],["1382061211000","9"],["1382061212000","12"],
["1382061214000","12"],["1382061215000","17"],["1382061216000","6"],
["1382061217000","14"],["1382061218000","22"],["1382061219000","43"],
["1382061220000","34"],["1382061221000","27"],["1382061222000","31"],
["1382061223000","2"],["1382061224000","1"],["1382061225000","86"],
["1382061226000","82"],["1382061227000","4"],["1382061228000","7"],
["1382061229000","6"],["1382061230000","18"],["1382061231000","17"],
["1382061232000","15"],["1382061233000","3"],["1382061234000","14"],
["1382061235000","2"],["1382061236000","8"],["1382061237000","14"],
["1382061238000","9"],["1382061239000","5"]
]}
And i setup flot options like this
xaxis: {tickSize: 1,mode: "time", timeformat: "%H:%M:%S"}
The chart never up :(
Well actually the goal is simple, I just want to show a flot chart with 08:02:30 08:02:31 as the xaxis info. Thanks for any help.
Your problem is that you're passing in your dates as strings.
> new Date("1382061194000")
Invalid Date
> new Date(1382061194000)
Thu Oct 17 2013 21:53:14 GMT-0400 (EDT)
Try removing the quotes (around your data points too) and see what that does.
I'm using highcharts-convert.js with phantomjs, and I'm having some text-overlapping issues when exporting the charts.
I believe the reason is Chrome on OSX renders fonts differently than my ubuntu server does. So when the client's browser builds the SVG the text does not overlap (I have indeed confirmed this by capturing the POST and rendering the svg in Chrome), but when phantomjs renders the text on ubuntu its slightly wider so there is overlap.
I believe that if I export the options JSON rather than SVG, ubuntu will lay out the text according to its own font rendering, and nothing will overlap.
Does that make sense? If so, how can I get highcharts to POST the options JSON rather than SVG?
I have this process that I can use to rig everything up, but it feels like there should be a better way...
var chart = graphContainer.find(".graph-body div").highcharts();
var chartOptions = chart.options;
delete chartOptions.chart["renderTo"]; // this creates a circular reference
// provide extra options to override the chart's defaults here...
$.extend(chartOptions.chart, {backgroundColor: "#FFFFFF", spacingLeft: 30, spacingRight: 30});
// wrap this up and POST it to the server...
console.log(JSON.stringify(chartOptions));