SiteD | noear : :SiteD,数据转换插件引擎(例:转换网站,接入WEB API) | REST library
kandi X-RAY | SiteD Summary
kandi X-RAY | SiteD Summary
noear::SiteD,数据转换插件引擎(例:转换网站,接入WEB API)
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of SiteD
SiteD Key Features
SiteD Examples and Code Snippets
Community Discussions
Trending Discussions on SiteD
QUESTION
I hope you guys are having a wonderful day.
I have set up a webhook in my woocommerce that sends JSON data to Google sheets. The webhook has been working great for months now, just today, I am having some trouble with it. I have tracked the issue to be in google sheets receiving the JSON data, but I don't know why this is happening.
Let me explain.
https://docs.google.com/spreadsheets/d/18G-yVDjYeccl6kznpZgSuRTysRMAu57pwY2oGf6-KWI/edit?usp=sharing
This is the google sheet, when it gets Woocommerce JSON data, it populates a new row.
The problem
Sometimes google sheets doesn't populate the row upon receiving a new order. The problem doesn't lie with woocommerce, because I have checked woocommerce with reqbin and the webhook fires with every order.
Furthermore, when I send requests from reqbin.com to my sheet, the sheet performs the operation successfully 5-6 out of 10 times. Other times it shows an error.
The Error
The error is due to google sheets not being able to parse JSON data, because the JSON data it receives 5 out of 10 times is not proper JSON data. Other 5 times, it is just as it should be. I have put a catch statement if the sheet is unable to parse JSON. Instead of appending new row with the parsed data, it appends the raw received data to the sheet.
It is clear now that there is some issue with google sheets handling that JSON data because when the same data is sent from reqbin.com to webhook.site, it is perfectly as it should be 10/10 times.
How to reproduce the issue
- Open this google sheet. https://docs.google.com/spreadsheets/d/18G-yVDjYeccl6kznpZgSuRTysRMAu57pwY2oGf6-KWI/edit?usp=sharing
- Open reqbin.com and webhook.site, and send the following JSON from reqbin.com to webhook.site 10 times to see if any kind of error occurs.
{ "id": 47222, "parent_id": 0, "status": "processing", "currency": "PKR", "version": "5.1.0","prices_include_tax": false, "date_created": "2021-06-10T01:23:46", "date_modified": "2021-06-10T01:23:46", "discount_total": "0", "discount_tax": "0", "shipping_total": "150", "shipping_tax": "0", "cart_tax": "0", "total": "1850", "total_tax": "0", "customer_id": 0, "order_key": "wc_order_7gIuR7px6MX9C", "billing": { "first_name": "Name", "last_name": "", "company": "", "address_1": "Address", "address_2": "", "city": "City", "state": "", "postcode": "", "country": "PK", "email": "email@email.com", "phone": "1234" }, "shipping": { "first_name": "Name", "last_name": "", "company": "", "address_1": "Address", "address_2": "", "city": "City", "state": "", "postcode": "", "country": "Country" }, "payment_method": "cod", "payment_method_title": "Cash on delivery", "transaction_id": "", "customer_ip_address": "8.8.8.8", "customer_user_agent": "Mozilla/5.0 (Linux; Android 11; M2102J20SG) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.88 Mobile Safari/537.36", "created_via": "checkout", "customer_note": "", "date_completed": null, "date_paid": null, "cart_hash": "64d834c72eecc8e32b9d83fd67d10d9c", "number": "47222", "meta_data": [ { "id": 869388, "key": "_shipping_calculator", "value": "" }, { "id": 869389, "key": "is_vat_exempt", "value": "no" }, { "id": 869391, "key": "_wfacp_report_data", "value": { "wfacp_total": "0.00" } }, { "id": 869392, "key": "_woofunnel_cid", "value": "4" }, { "id": 869393, "key": "_wfacp_post_id", "value": "24852" }, { "id": 869394, "key": "_wfacp_source", "value": "https://website.com/checkouts/checkout-page/" }, { "id": 869395, "key": "_wfacp_timezone", "value": "Asia/Karachi" }, { "id": 869396, "key": "order_comments", "value": "" }, { "id": 869412, "key": "_new_order_email_sent", "value": "true" }, { "id": 869424, "key": "_woofunnel_custid", "value": "4" }, { "id": 869425, "key": "_pys_purchase_event_fired", "value": "1" }, { "id": 869426, "key": "_wfob_stats_ids", "value": [] }, { "id": 869427, "key": "_wfocu_thankyou_visited", "value": "yes" } ], "line_items": [ { "id": 35114, "name": "MTECH Ultra Resilient Knife", "product_id": 11074, "variation_id": 0, "quantity": 1, "tax_class": "", "subtotal": "1700", "subtotal_tax": "0", "total": "1700", "total_tax": "0", "taxes": [], "meta_data": [], "sku": "", "price": 1700, "parent_name": null } ], "tax_lines": [], "shipping_lines": [ { "id": 35115, "method_title": "Fast Shipping (2-4 Days)", "method_id": "flat_rate", "instance_id": "1", "total": "150", "total_tax": "0", "taxes": [], "meta_data": [ { "id": 275053, "key": "Items", "value": "MTECH Ultra Resilient Knife × 1", "display_key": "Items", "display_value": "MTECH Ultra Resilient Knife × 1" } ] } ], "fee_lines": [], "coupon_lines": [], "refunds": [], "date_created_gmt": "2021-06-09T20:23:46", "date_modified_gmt":"2021-06-09T20:23:46", "date_completed_gmt": null, "date_paid_gmt": null, "currency_symbol": "₨","_links": { "self": [ { "href": "https://website.com/wp-json/wc/v3/orders/47222" } ],"collection": [ { "href": "https://website.com/wp-json/wc/v3/orders" } ] } }
- Now send the same data to the following google sheet to see if it appends the row correctly each time.
https://script.google.com/macros/s/AKfycbxupm9bje86F4PQQkyys_LWtXs_kj279R0ipgnZ-cLd7aiEADf1AN_prhk28vOPW9JsRQ/exec
How do I solve the issue? Please let me know if you need any more information. Thanks.
Edit:
Instead of getting a full JSON body like mentioned above, the google sheets seems to be getting the following JSON.
...ANSWER
Answered 2021-Jun-10 at 05:19I managed to solve the issue with some trial and error. For anyone facing the same issue in the future, here is what worked for me.
I was using e.postData.contents to get the JSON body but this seems to have stopped working, which was causing the JSON body to be empty. I tried e.postData.getDataAsString(); which seems to be working just fine and the issue has been resolved.
QUESTION
I have the following query which works just fine (inasmuch as it generates the proper SQL command):
...ANSWER
Answered 2021-Jun-08 at 21:11You need to add select new { s, sd, p, r, o, u }
after your last join
QUESTION
I am running a small site and as every web-developer I use Javascript to interact with the client-side.
Currently I have all of my buttons the attribute, onclick=()
that means, when somebody visits my site and inspects the HTML code will find those onclick=()
calls.
I have visited other popular websites, such as StackOverflow, and it seems like they don't use the onclick=()
property for all the buttons.
Is this a securiry flaw? Should I rechange my JS code to just listen
when some button is clicked?
Thanks in advance
...ANSWER
Answered 2021-Jun-06 at 19:30While there are plenty of reasons to avoid using onclick
attributes (notably a lack of separation of concerns, lower reusability of code, and some unintuitive scoping rules) security is not one of them.
Any code you ask the browser to run is completely under the control of the owner of the browser. It is designed for their convenience, not that of the website it is visiting.
If exposing the logic of the JS to the user is a security problem then you need to solve it by moving the logic to server-side code.
QUESTION
I'm trying to create something like a combo box in excel. Selecting the Site will automatically select the JobNum and Manager. Site, JobNum, and Manager are from a separate table called master. Currently in the create form that I am trying to do, they are all dropdown list that pulls from the db master table.
Edit - Forgot to mention master table has a simple ID, just an incremental from 1. Added an image for how it looks from the DB
This is how it currently looks
How I want it to be - selecting site, autofills the bottom two
Master Table from DB showing all columns
Code for select list:
...ANSWER
Answered 2021-Jun-01 at 08:48In the .cshtml.cs
page, you could create a handler method to retrieve data based on the select Site. Then, in the .cshtml
page, you can attach the DropDownList onchange
event, in this event, get the DropDownList selected value and use JQuery.Ajax
to call the Handler method and get the related JobNum and Manager, then, sets the text box value.
More detail information, please refer the following sample:
Create the following models:
QUESTION
I have application which uses Sqlite database and i have three tables in my database. Now i want to Switch to Room Library , i can successfully create tables in room but i can't figure out a way to Define relationships between objects. I visited android developers site but i don't know how this applies to me . Here are the Queries i am using to create database in sqlite
...ANSWER
Answered 2021-May-23 at 15:57I hope you have created entity classes for your tables.
You can create an additional class for representing the relationship between these two tables.
QUESTION
I've been trying to use PyInstaller for some time as it can turn a Python script into a single .exe
file, instead of having a lib file and DLLs like cx_freeze
does for example. So it's easier for my users to update the program when I push as it's "less" stuff to download.
However, when I run "pyinstaller CLI.py", I get the following error:
...ANSWER
Answered 2021-May-17 at 14:04Something is amiss with your Python installation. The "site-specific configuration hook" site.py
is normally found in the Lib
folder just underneath the Python install directory. But according to your error log, PyInstaller finds it in Lib/site-packages
.
See also this answer from 2014:
If you have a
site.py
insite-packages
then that is an error, there should be no such file there.
It's referring to Python 2.7, but explains well what site.py
does and still applies to newer Python versions, such as Python 3.9 here.
Furthermore, the code line
QUESTION
I have a Next.js project, where I want to use Google Analytics Ecommerce, but I am getting Missing Ecommerce Data, View is configured for Ecommerce, but no data is flowing.
warning message and I don't how to fix this.
E-commerce is enabled in GA
I used this blog post to add GA into Next.js
./lib/gtag.js
...ANSWER
Answered 2021-May-15 at 16:49I installed Google Analytics Debugger which told me the parameters are not correct. I fixed that in my code by removing braces in function parameters:
QUESTION
I do have at least two wordpress sites which very inconsistently throw a varying number of net::ERR_HTTP2_SERVER_REFUSED_STREAM
errors. When these errors occur the number of errors thrown highly varies from page-load to page-load (or reload) from say 4 requests with that error to about 60 and sometimes even more (if the page has some many requests). The actually affected ressources/requests seem completly random and therefore don't leave any clue where this is coming from.
If these errors occur their occurrence mostly persists (when doing a simple page refresh or hard refresh) until the browser is restarted. Seldomly they even stay after a restart as well.
When this hiccup does happen and the browser/system gets in this faulty state, these errors also happen in the wordpress backend loading basic files like .../wp-includes/js/wp-lists.min.js?ver=5.7
and similar.
At least two users have experienced this behaviour in Chrome, Opera and Edge while being logged-in to and -out of wordpress. In Opera and Edge we do not have any browser extensions installed. As far as we know other users never had this issue even though some of them visited the site many times.
What might be the reasons for this and/or what might be a way to solve it?
List of Plugins installed on both sites:
- Image Map Pro
- Kadence Blocks - PRO Extension
- Kadence Blocks – Gutenberg Blocks for Page Builder Features
- Kadence Galleries
- Kadence Pro
- Lessify Wordpress
- Password Protect WordPress Lite
- Presto Player
- Presto Player Pro
- Slider Revolution
- WP Google Maps
- WP Google Maps - Pro Add-on
- WPvivid Backup Plugin
- WPvivid Backup Pro
ANSWER
Answered 2021-May-14 at 11:40This is not related to WordPress. It's related to either Apache or Nginx using the HTTP/2 standard.
REFUSED_STREAM (0x7): The endpoint refused the stream prior to performing any application processing (see Section 8.1.4 for details).
It can either come from too many concurrent streams:
Endpoints MUST NOT exceed the limit set by their peer. An endpoint that receives a HEADERS frame that causes its advertised concurrent stream limit to be exceeded MUST treat this as a stream error (Section 5.4.2) of type PROTOCOL_ERROR or REFUSED_STREAM. The choice of error code determines whether the endpoint wishes to enable automatic retry (see Section 8.1.4) for details).
It can also be sent during a Push Response operation:
If the client determines, for any reason, that it does not wish to receive the pushed response from the server or if the server takes too long to begin sending the promised response, the client can send a RST_STREAM frame, using either the CANCEL or REFUSED_STREAM code and referencing the pushed stream's identifier.
Or if the client is trying to connect using HTTP/1.1:
Servers that don’t wish to process the HTTP/1.1 response should reject stream 1 with a REFUSED_STREAM error code immediately after sending the connection preface to encourage the client to retry the request over the upgraded HTTP/2 connection.
There is no way for me to pinpoint what is happening during those requests, as it can have multiple reasons, as stated above.
So I suggest you a couple of options:
- Pass your site's traffic throughugh Cloudflare, so they act as a middle-man for these connections and normalize the requests sent to your server
- You can increase the
SETTINGS_MAX_CONCURRENT_STREAMS
to minimize the risk of sending aREFUSED_STREAM
. If you use Nginx, you can see how to do this here: http://nginx.org/en/docs/http/ngx_http_v2_module.html#http2_max_concurrent_streams - If you don't know how to do the above, contact your hosting company and ask them to do it for you and upgrade your Nginx version, as some older versions are known to have issues.
- Disable HTTP/2 in Nginx. How to disable http2 in nginx
- As a last resource, you can migrate to another hosting company.
If you use Apache, everything I said above applies to it as well.
QUESTION
Hello I have working code like this:
...ANSWER
Answered 2021-May-07 at 03:56please remove the below line from your code
QUESTION
I have very little experience in administration, so my question may seem silly. Sorry in advance.
My site uses Geolocation in Route 53. That is, I specify the IP address of the server for each user region. For example, users from Japan log in to server1, users from the US log in to server2, and users from Europe log in to server3.
Everything is fine at the moment, but I'm worried about the risks if something goes wrong with different servers. As far as I know, DNS records are cached from the user. Out of concern about this, I have a few questions:
What happens if server1 or server2 goes down? Will Route 53 forward to server3? Or will it not do this automatically and I need to somehow configure Route 53 additionally?
What happens if the IP address of server1 changes? In DNS, of course, I will specify a new IP for Geolocation with the region Japan, but if DNS is cached, then a user who visited the site a week ago from Japan will not be able to get to the site today. Right? That is, I believe that the old IP address of my server will be saved on his computer (cached), and that is where the request will go from the user's computer. That is, it will not know that the IP address has changed. Do I understand correctly? And if that's the case, how do I fix it?
ANSWER
Answered 2021-May-04 at 03:10What happens if server1 or server2 goes down? Will Route 53 forward to server3? Or will it not do this automatically and I need to somehow configure Route 53 additionally?
You need to select a health check. Please read this in detail.
What happens if the IP address of server1 changes? In DNS, of course, I will specify a new IP for Geolocation with the region Japan, but if DNS is cached, then a user who visited the site a week ago from Japan will not be able to get to the site today. Right?
Yes
That is, I believe that the old IP address of my server will be saved on his computer (cached), and that is where the request will go from the user's computer. That is, it will not know that the IP address has changed. Do I understand correctly?
Yes, your understanding is correct. The solution is to set a relatively low TTL.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install SiteD
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page