210
Points
Questions
40
Answers
54
-
Asked on July 17, 2020 in XML.
The problem: your XML puts its elements in a namespace.
Solution: declare the same namespace in your stylesheet, assign it a prefix and use that prefix to address the elements in the source XML:
XSLT 1.0
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:met="www.metoffice.gov.uk/xml/metoRegionalFcst" exclude-result-prefixes="met"> <xsl:template match="/"> <html> <body> <xsl:value-of select="met:RegionalFcst/met:FcstPeriods/met:Period/met:Paragraph[@title='Headline:']"/> </body> </html> </xsl:template> </xsl:stylesheet>
- 451 views
- 3 answers
- 0 votes
-
Asked on July 17, 2020 in XML.
Try something like this : You would get a handle to the textview from the sdk and then change it since they don’t expose it publicly.
int id = searchView.getContext().getResources().getIdentifier("android:id/search_src_text", null, null); TextView textView = (TextView) searchView.findViewById(id); textView.setTextColor(Color.WHITE);
- 1205 views
- 30 answers
- 0 votes
-
Asked on July 17, 2020 in XML.
- 0 views
- 3 answers
- 0 votes
-
Asked on July 17, 2020 in XML.
As you mentioned, the row height of GridView depends on the first item, if you want to show the Variable height in GridView, you can try to use WrapPanel from Windows Community Toolkit. Before using it, you need to add Microsoft.Toolkit.Uwp.UI.Controls nuget package and then override the ItemsPanel of GridView, for example:
.xaml:
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls" <GridView x:Name="ImagesGridView" Grid.Row="5" Margin="12,0,2,0" Padding="10,10,0,0" Width="{Binding MainGridViewWidth}" ItemsSource="{Binding ImageList, Mode=OneWay}" ItemTemplate="{StaticResource ImageTemplate}"> <GridView.ItemsPanel> <ItemsPanelTemplate> <controls:WrapPanel Name="VerticalWrapPanel" Orientation="Vertical" /> </ItemsPanelTemplate> </GridView.ItemsPanel> </GridView>
- 394 views
- 1 answers
- 0 votes
-
Asked on July 17, 2020 in XML.
You are not closing the stream,
useUsing
statement in order to dispose and close theFileStream
:using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read)) { //load the file xmlDoc.Load(fs); //get all the nodes from the file xmlNode = xmlDoc.GetElementsByTagName("Drop"); }
- 410 views
- 3 answers
- 0 votes
-
Asked on July 17, 2020 in XML.
Like @Miller answer, Linq to Xml is simple, but if you want to use
XmlDocument
, you could modify the code like :1 –
sXml
for test :string sXml = @" <kazaliste> <predstave> <predstava id='2110' naziv='Vaclav Havel AUDIJENCIJA'> <glumci> <glumac>140</glumac> <glumac>200</glumac> </glumci> </predstava> <predstava id='2111' naziv='Vaclav Havel AUDIJENCIJA1'> <glumci> <glumac>141</glumac> <glumac>201</glumac> </glumci> </predstava> </predstave> </kazaliste>";
2 – Predstave class, change the little the constructor:
public struct Predstave { public int ID; public string Naziv; public List<int> gID; public Predstave(int id, string naziv, List<int> gid) { ID = id; Naziv = naziv; //asign gid to gID gID = gid; } }
3 – DohvatiPredstave method, you could loop on glumac for each predstava node, like :
XmlDocument oXml = new XmlDocument(); oXml.LoadXml(sXml); XmlNodeList oNodes = oXml.SelectNodes("//kazaliste/predstave/predstava"); foreach (XmlNode oNode in oNodes) { int id = Convert.ToInt32(oNode.Attributes["id"].Value); string naziv = oNode.Attributes["naziv"].Value; List<int> gid = new List<int>(); foreach (XmlNode gNode in oNode.SelectNodes("./glumci/glumac")) { gid.Add(Convert.ToInt32(gNode.InnerText)); } Predstave oPredstava = new Predstave(id, naziv, gid); predstava.Add(oPredstava); }
4 – Linq to Xml
XDcoument
:XDocument xDocument = XDocument.Parse(sXml); List<Predstave> result = xDocument.Descendants("predstava") .Select(x => new Predstave { ID = int.Parse(x.Attribute("id").Value), Naziv = x.Attribute("naziv").Value, gID = x.Descendants("glumac") .Select(y => int.Parse(y.Value)) .ToList() }).ToList();
I hope you find this helpful.
- 327 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
Unfortunately, there is no way to use such a
.dll
from an older compiler that doesn’t understand Anonymous Records. This is because the feature added to the F# metadata format, which has an unfortunate consequence of breaking forwards-compatibility whenever that new (relative to the old compiler) metadata is written to the metadata blob by using the feature. From a support standpoint, forwards-compatibility is preferred but not guaranteed.This is what is supported:
- Newer compiler can consume a binary produced by older compiler
- Newer compiler can depend on older FSharp.Core
- Newer compiler can re-bind with older FSharp.Core without recompiling
- Older compiler can depend on newer FSharp.Core
- Older compiler can re-bind with newer FSharp.Core without recompiling
This is what will often work, but is not guaranteed to work:
- Older compiler can consume binary produced by newer compiler
- Older compiler can consume all constructs in newer FSharp.Core
Note: This assumes F# post-.NET Framework 3.5. There are special considerations for using F# with old versions of the .NET Framework.
The reason why these last two points aren’t guaranteed to work is that there may be a new concept that is fundamentally impossible for an older compiler to understand. One such example would be the
voidptr
type in FSharp.Core 4.5.2 or higher. This is a new primitive that an older compiler cannot possibly interpret correctly.Unfortunately, this gets confusing whenever the use of a feature involves writing to the metadata format in a way that an older compiler cannot understand. The compiler error should probably be improved.
- 402 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in .NET.
Literally the easiest way to fix a NullReferenceExeption has two ways. If you have a GameObject for example with a script attached and a variable named rb (rigidbody) this variable will start null when you start your game.
This is why you get a NullReferenceExeption because the computer does not have data stored in that variable.I’ll be using a RigidBody variable as an example.
We can add data really easily actually in a few ways:- Add a RigidBody to your object with AddComponent > Physics > Rigidbody
Then go into your script and typerb = GetComponent<Rigidbody>();
This line of code works best under yourStart()
orAwake()
functions. - You can add a component programmatically and assign the variable at the same time with one line of code:
rb = AddComponent<RigidBody>();
Further Notes: If you want unity to add a component to your object and you might have forgotten to add one, you can type
[RequireComponent(typeof(RigidBody))]
above your class declaration (the space below all of your usings).
Enjoy and have fun making games!- 1189 views
- 28 answers
- 0 votes
- Add a RigidBody to your object with AddComponent > Physics > Rigidbody
-
Asked on July 16, 2020 in .NET.
Something like this should do the trick:
{ ... if (!Lines[i].TrimEnd().EndsWith(" and")) if (!Lines[i].TrimEnd().EndsWith(" of")) if (!Lines[i].TrimEnd().EndsWith(" for")) if (!Lines[i].TrimEnd().EndsWith(" at")) if (!Lines[i].TrimEnd().EndsWith(" the")) if (i > 0) Builder.AppendLine(); Builder.Append(" ").Append(Lines[i + 1]); } return Builder.ToString();
- 376 views
- 2 answers
- 0 votes
-
Asked on July 16, 2020 in Mysql.
you can set the default schema by below query first
use ctrData2;
And run below query
select TagId, Name from Tag, CallDetail where CallDetail.ContactId = 'f9d4787a-f1ac-41af-97d8-ea324daad018' and LOCATE(Tag.TagId, CallDetail.Tag) > 0;
- 323 views
- 1 answers
- 0 votes