190
Points
Questions
35
Answers
41
-
Asked on July 17, 2020 in XML.
You can use this function to extract. You can only do it for 1 node. With the loop, you can get the value between two tags as you wish.
function Parse(Text, Sol, Sag: string): String; begin Delete(Text, 1, Pos(Sol, Text) + Length(Sol) - 1); Result := Copy(Text, 1, Pos(Sag, Text) - 1); end;
Use of: XML:
<test>Stackoverflow</test>
Delphi:
Parse(XML, '<test>', '</test>') //result: Stackoverflow
- 470 views
- 2 answers
- 0 votes
-
Asked on July 17, 2020 in Python.
You should take a look at the Python docs for ElementTree: https://docs.python.org/3.8/library/xml.etree.elementtree.html
Basically, you can do this:
import xml.etree.ElementTree as ET # Read the input tree = ET.parse('input.xml') # Create new output file tree.write('output.xml')
- 422 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
You may find the
"AAAA"
index first (with escaped double quotes), then useSubstring
methodvar index = str.IndexOf("\"AAAA\"", StringComparison.Ordinal); var result = str.Substring(0, index - 1);
It gives you the following result
#MASTERPOSA,COM1,0,21.5,FINESTEERING,1544,340322.000,02000008,5009,4655; SOL_COMPUTED,NARROW_INT,51.11604599076,-114.03855412002,1055.7756,16.9000, WGS84,0.0090,0.0086,0.0143
- 382 views
- 3 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
As you login using the Authorization code flow (options.ResponseType = "code";) then that means that there must be a user involved, and the roles is a IdentityResource scope, meaning that it will only be included when the user with the claim role is added to IdentityServer.
Do add a User to IdentityServer to get it to work.
- 444 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
I want to get all contacts with where a.removed = 0 and tx.removed = 0 (a=contacts, tx = transactions)
Is this what you want?
select c.*, t.* from contacts c join transactions t on t.contactid = c.id where c.removed = 0 and t.removed = 0;
This returns all contact/transaction pairs where this occurs.
- 0 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
You could group by the
PersonName
and usegroup_concat
to concatenate thePurchaseItem
s:SELECT t1.PersonId, PersonName, GROUP_CONCAT(PurchaseItem, ', ') FROM t1 JOIN t2 ON t1.PersonId = t2.PersonId GROUP BY t1.PersonId, PersonName
- 427 views
- 3 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
You have not mentioned the word "VPC" in your question so I’m assuming you don’t use it.
Cloud Run cannot directly connect to a private IP of a Cloud SQL instance. You need to configure a Serverless VPC Access Connector and specify it while deploying your Cloud Run app.
Cloud Run containers are not part of a VPC by default, so unless you do this, they will not have access to the private networks.
- 442 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in Python.
I’m sure someone else will come up with a better way, but one quick and dirty solution is you convert the timestamp to a string date, and set the time to 00:00:00 on the string and convert it back to a UNIX timestamp
- 429 views
- 4 answers
- 0 votes
-
Asked on July 16, 2020 in Python.
You can use AWS Command Line Interface (CLI), specifically the
aws s3 cp
command to copy files to your local directory.- 449 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in php.
Your function name should be unique this will throw cann’t redeclare function error so you need to change your function name
function load_js_assets() { if( is_page( A53 ) ) { wp_enqueue_script('a53wx2.js', 'http://peakweathereye.co.uk/a53wx2.js', array('jquery'), '', false); } } add_action('wp_enqueue_scripts', 'load_js_assets'); function load_js_assets1() { if( is_page( A5004 ) ) { wp_enqueue_script('a5004wx2.js', 'http://peakweathereye.co.uk/a5004wx2.js', array('jquery'), '', false); } } add_action('wp_enqueue_scripts', 'load_js_assets1');
- 322 views
- 2 answers
- 0 votes