180
Points
Questions
34
Answers
52
-
Asked on July 17, 2020 in XML.
XML Tag names must not start with Numbers.
- 430 views
- 1 answers
- 0 votes
-
Asked on July 17, 2020 in XML.
Does not work:
xidel -e //resource_record[host="www.mydomain.org"]/record_id
Works:
xidel -e '//resource_record[host="www.mydomain.org"]/record_id'
- 373 views
- 2 answers
- 0 votes
-
Asked on July 17, 2020 in spreadsheet.
After hours of trial and error and searching online, I finally found the answer.
After saving the spreadsheet in Excel as an XML file (2003 Spreadsheet), launch a code editor to view the source code.
Under the tag enter:
<CodeName>Sheet1</CodeName>
Replacing ‘Sheet1’ with the desired codeName.
- 449 views
- 1 answers
- 0 votes
-
Asked on July 17, 2020 in XML.
you can use camaro for this
const xml = ` <?xml version="1.0"?> <GENERATION_BY_FUEL_TYPE_TABLE> <INST AT="2020-07-04 17:50:00" TOTAL="26065"> <FUEL TYPE="CCGT" IC="N" VAL="6648" PCT="25.5"></FUEL> <FUEL TYPE="OCGT" IC="N" VAL="0" PCT="0.0"></FUEL> <FUEL TYPE="OIL" IC="N" VAL="0" PCT="0.0"></FUEL> <FUEL TYPE="COAL" IC="N" VAL="0" PCT="0.0"></FUEL> <FUEL TYPE="NUCLEAR" IC="N" VAL="5266" PCT="20.2"></FUEL> <FUEL TYPE="WIND" IC="N" VAL="7292" PCT="28.0"></FUEL> <FUEL TYPE="PS" IC="N" VAL="902" PCT="3.5"></FUEL> <FUEL TYPE="NPSHYD" IC="N" VAL="964" PCT="3.7"></FUEL> <FUEL TYPE="OTHER" IC="N" VAL="368" PCT="1.4"></FUEL> <FUEL TYPE="INTFR" IC="Y" VAL="1506" PCT="5.8"></FUEL> <FUEL TYPE="INTIRL" IC="Y" VAL="151" PCT="0.6"></FUEL> <FUEL TYPE="INTNED" IC="Y" VAL="758" PCT="2.9"></FUEL> <FUEL TYPE="INTEW" IC="Y" VAL="338" PCT="1.3"></FUEL> <FUEL TYPE="BIOMASS" IC="N" VAL="1117" PCT="4.3"></FUEL> <FUEL TYPE="INTNEM" IC="Y" VAL="755" PCT="2.9"></FUEL> </INST> <HH SD="2020-07-04" SP="39" AT="18:00-18:30" TOTAL="26416"> <FUEL TYPE="CCGT" IC="N" VAL="7692" PCT="29.1"></FUEL> <FUEL TYPE="OCGT" IC="N" VAL="0" PCT="0.0"></FUEL> <FUEL TYPE="OIL" IC="N" VAL="0" PCT="0.0"></FUEL> <FUEL TYPE="COAL" IC="N" VAL="0" PCT="0.0"></FUEL> <FUEL TYPE="NUCLEAR" IC="N" VAL="5277" PCT="20.0"></FUEL> <FUEL TYPE="WIND" IC="N" VAL="6780" PCT="25.7"></FUEL> <FUEL TYPE="PS" IC="N" VAL="732" PCT="2.8"></FUEL> <FUEL TYPE="NPSHYD" IC="N" VAL="963" PCT="3.6"></FUEL> <FUEL TYPE="OTHER" IC="N" VAL="352" PCT="1.3"></FUEL> <FUEL TYPE="INTFR" IC="Y" VAL="1506" PCT="5.7"></FUEL> <FUEL TYPE="INTIRL" IC="Y" VAL="152" PCT="0.6"></FUEL> <FUEL TYPE="INTNED" IC="Y" VAL="756" PCT="2.9"></FUEL> <FUEL TYPE="INTEW" IC="Y" VAL="338" PCT="1.3"></FUEL> <FUEL TYPE="BIOMASS" IC="N" VAL="1112" PCT="4.2"></FUEL> <FUEL TYPE="INTNEM" IC="Y" VAL="756" PCT="2.9"></FUEL> </HH> <LAST24H FROM_SD="2020-07-03" FROM_SP="40" AT="18:30-18:30" TOTAL="558144"> <FUEL TYPE="CCGT" IC="N" VAL="137632" PCT="24.7"></FUEL> <FUEL TYPE="OCGT" IC="N" VAL="4" PCT="0.0"></FUEL> <FUEL TYPE="OIL" IC="N" VAL="0" PCT="0.0"></FUEL> <FUEL TYPE="COAL" IC="N" VAL="0" PCT="0.0"></FUEL> <FUEL TYPE="NUCLEAR" IC="N" VAL="126489" PCT="22.7"></FUEL> <FUEL TYPE="WIND" IC="N" VAL="189620" PCT="34.0"></FUEL> <FUEL TYPE="PS" IC="N" VAL="6208" PCT="1.1"></FUEL> <FUEL TYPE="NPSHYD" IC="N" VAL="15214" PCT="2.7"></FUEL> <FUEL TYPE="OTHER" IC="N" VAL="4469" PCT="0.8"></FUEL> <FUEL TYPE="INTFR" IC="Y" VAL="19018" PCT="3.4"></FUEL> <FUEL TYPE="INTIRL" IC="Y" VAL="327" PCT="0.1"></FUEL> <FUEL TYPE="INTNED" IC="Y" VAL="11774" PCT="2.1"></FUEL> <FUEL TYPE="INTEW" IC="Y" VAL="2829" PCT="0.5"></FUEL> <FUEL TYPE="BIOMASS" IC="N" VAL="30752" PCT="5.5"></FUEL> <FUEL TYPE="INTNEM" IC="Y" VAL="13808" PCT="2.5"></FUEL> </LAST24H> <LAST_UPDATED AT="2020-07-04 17:50:00"></LAST_UPDATED> </GENERATION_BY_FUEL_TYPE_TABLE>` const { transform } = require('camaro') ;(async function main() { const template = { fuels: ['//FUEL[@TYPE="WIND"]', { ic: '@IC', val: '@VAL', pct: '@PCT', parentAt: '../@AT', parentName: 'name(..)', }] } console.log(await transform(xml, template), null, 4); })()
output
{ fuels: [ { ic: 'N', val: '7292', pct: '28.0', parentAt: '2020-07-04 17:50:00', parentName: 'INST' }, { ic: 'N', val: '6780', pct: '25.7', parentAt: '18:00-18:30', parentName: 'HH' }, { ic: 'N', val: '189620', pct: '34.0', parentAt: '18:30-18:30', parentName: 'LAST24H' } ] }
- 499 views
- 1 answers
- 0 votes
-
Asked on July 17, 2020 in XML.
Try this:
jsonObject.put("Manual", jsonObject.getJSONObject("users").remove("report"));
report
is nested inusers
oremployees
. So first you have to get its root object.Update
If you want to have a json as below
{"employees":{"Manual":{"sub":"eng","score":30},"user":{"name":"test1","age":20}}}
then your code should be like this:
jsonObject.getJSONObject("users") .put("Manual", jsonObject.getJSONObject("users").remove("report")); jsonObject.put("employees", jsonObject.remove("users"));
- 367 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
You can try
DataList
and set its RepeatDirection toHorizontal
.<form id="form1" runat="server"> <div style="float: left"> <asp:Label runat="server">Content Manager: </asp:Label> </div> <div style="float: left"> <asp:DataList ID="DataList1" RepeatDirection="Horizontal" RepeatLayout="Table" RepeatColumns="0" runat="server"> <ItemTemplate> <%# Eval("UserName") %> </ItemTemplate> </asp:DataList> </div> </form>
- 470 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in XML.
let namespaceAttributes = r.DescendantsAndSelf().Attributes() |> Seq.where (fun i -> i.IsNamespaceDeclaration && i.Name.LocalName <> "xsi")
where r is XElement
- 423 views
- 1 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
C# is a statically typed language, meaning that types must be known at compile-time, and the type assigned to a variable cannot change at runtime. Consider first that all of the following lines result in exactly the same thing:
int x = 123; System.Int32 x = 123; var x = 123;
int
is just an alias forSystem.Int32
- The compiler infers that
x
is of typeSystem.Int32
when usingvar
because it’s been assigned an integral number.
What you can’t do with C# that you can do in dynamically typed languages (like javaScript) is this:
var x = 123; x = "Hello world";
In C# the compiler will complain that you cannot assign a string to an int variable, but JavaScript, being a dynamic language will allow it.
- 448 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
Just add a 0 or 1 token:
^-?[0-9]\d*(.\d+)?$
- 683 views
- 14 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
I solved this with adding the code after fetchall()
con.commit()
Calling the same select query without doing a commit, won’t update the results.
- 417 views
- 5 answers
- 0 votes