|
If it's tons of data I wouldn't want to hold it all in memory without good reason.
(And it doesn't look like threading.)
|
|
|
|
|
From his original post, it looks like he is trying to implement multi-threaded processing of the table, just in the wrong way.
|
|
|
|
|
I considered that, but I don't think so. Of course, the situation is unclear.
|
|
|
|
|
Here is my xml file i want to get the value of contextExpression eg.
I have tried lots of example to get the value but failed
Can anybody help to how to do using XDocument in C#
modified 15-Jan-15 11:24am.
|
|
|
|
|
|
Try this:
XDocument document = XDocument.Parse(@"<?xml version=""1.0"" encoding=""utf-8""?>
<campaign xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns=""urn:nds:dyn:campaign:version02"" handle=""4329"" campaignId=""4329"" campaignType=""EPG"" startDateTime=""2015-01-15T10:07:51"" endDateTime=""2015-01-15T12:07:51"" lastModifiedDateTime=""2014-10-25T06:24:28"" amsEnabled=""false"">
<contextExpression><![CDATA[(zoneId==176)&&((startTime==100)&&(endTime==1200))]]></contextExpression>
<adContent>
<contentInstance xsi:type=""ImageInstanceType"" language=""English"" imageType=""PNG"" height=""228"" width=""178"" epgResolution=""HD"">
<contentInstanceRef>image.png</contentInstanceRef>
</contentInstance>
</adContent>
</campaign>");
XNamespace defaultNamespace = document.Root.Name.Namespace;
XName contextExpressionNodeName = defaultNamespace + "contextExpression";
XElement contextExpressionNode = document.Root.Element(contextExpressionNodeName);
string contextExpression = (string)contextExpressionNode;
Console.WriteLine(contextExpression);
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
|
So, I have an enum and want to get the ASCII code of the numeric value of a certain enum value. For example if I have the enum value STANDARD (=1), I want to get the ASCII code for '1' (49) in a byte variable. I cant seem to figure out how to do. Anyone?
enum PackageType : byte { STANDARD=1, REQUEST=2, ANSWER=3 }
PackageType type = PackageType.STANDARD;
byte b = (byte)type;
|
|
|
|
|
|
"How about make STANDARD=49 ?"
Well, I guess it´s time to call it a night. Lol
I´ll make STANDARD=49.
|
|
|
|
|
((int)type).ToString();
Or, if you want just the first character:
((int)type).ToString()[0];
The difficult we do right away...
...the impossible takes slightly longer.
modified 14-Jan-15 15:13pm.
|
|
|
|
|
|
Well if you can change you enum you could do this:
enum PackageType
{
Standard = '1',
Request = '2',
Answer = '3'
}
And that's job done. If not, just add 48 to 'b'.
Regards,
Rob Philpott.
|
|
|
|
|
Yet another option would be a conversion function as follows:
enum PackageType : byte { STANDARD, REQUEST, ANSWER }
static readonly byte[] PackageTypeValues = { (byte)'1', (byte)'2', (byte)'3' };
byte PackageTypeToByte( PackageType packageType )
{
return PackageTypeValues[(byte)packageType];
}
This has the advantage of separating the enumeration values from their display tokens, allowing you to change one without changing the other. The disadvantage is that they can become unsynchronized...
|
|
|
|
|
Yet another possibility:
public enum ByteEnum
{
FortyNine = (byte)'1',
Fifty = (byte)'2',
FiftyOne = (byte)'3'
}
I keep thinking you want something other than an Enum here (a Struct ?), but I am not quite sure what that "other" might be.
«I'm asked why doesn't C# implement feature X all the time. The answer's always the same: because no one ever designed, specified, implemented, tested, documented, shipped that feature. All six of those things are necessary to make a feature happen. They all cost huge amounts of time, effort and money.» Eric Lippert, Microsoft, 2009
|
|
|
|
|
byte[] result = Encoding.ASCII.GetBytes(PackageType.STANDARD.ToString());
|
|
|
|
|
Is it possible to design a program that will launch explorer, wait until a dialog box appears in explorer and then activate a button in the dialog box. Wait until another dialog box appears and then automatically complete the username and password in That dialog box and finally terminate the program?
An analogy would be Explorer automatically connecting to one's banks website that does not allow saving username and passwords.
This is a program I am trying to develop for visually impaired people for easy login access to the local library. When you launch explorer in the library it automatically tries to connect to the library's website.
All constructive comments are welcome.
|
|
|
|
|
Depends where the login is. If it is on the desktop, then yes, you can get a handle to the process and all controls it creates, and manipulate them by sending messages. If it is in the login-screen, then no.
picardy wrote: This is a program I am trying to develop for visually impaired people for easy login access to the local library. Yup, but you are suggesting that the locked door opens automatically for them. In that case, it'd be easier to simply remove the lock completely.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
When one opens explorer in the library, it attempts to connect to the library wi-fi network. The dialog boxes are inside the explorer window. I cannot remove or change any library security measures. I was wondering if I had a handle to that instance of explorer if it would be possible to loop for all objects inside explorer's window and if that object was of type 'button' and label contains 'Accept' if I could select that button. Similarly, for the next dialog window.
|
|
|
|
|
There's an app called 'UISpy' (or similar) that shows the handle (and other stuff) if you hover your mouse over a control (regardless which app). It uses the same technique; sending messages to a control. IIRC, then "WM_SETTEXT" would be the message to set a certain string in a foreign edit-control.
It won't be as easy as looping all the controls; native apps do not use the .NET framework. You'd have to dive into the winapi.
Bastard Programmer from Hell
If you can't read my code, try converting it here[^]
|
|
|
|
|
I am learning MVC but just at first hurdle. Is there any logical reason why when I right click on Model to add a class (it is always a class isn't it?) - I get the default option of Add - Controller.
Now I know this isn't a big issue but it's kind of like learning to drive and the Speedometer says you are going 'nearly empty'.
Is this a mistake on Microsoft part or just something that I don't get because it's new to me.
Thanks and sorry I know this isn't a very constructive question.
|
|
|
|
|
I think, because a Model requires a Controller to fill it up with the data from the data source (such as Database) and then to pass it to the View for rendering purposes.
You might not have a Controller for your Model and so on, so that is why it is displaying the option. I have re-checked in my MVC application and same is being shown there, no that is not an error. It is asing you to create a Controller, if you need one. If you don't, you can avoid using that and instead of it just use the "Add --> New Item" menu option and it will provide you with a new Window containing all possible files.
The sh*t I complain about
It's like there ain't a cloud in the sky and it's raining out - Eminem
~! Firewall !~
|
|
|
|
|
Afzaal Ahmad Zeeshan wrote: You might not have a Controller for your Model
Also, I think the OP wants to ask why is an option for adding a Controller there at all in the Context Menu for the Models?
Afzaal Ahmad Zeeshan wrote: I think, because a Model requires a Controller to fill it up I am afraid, I have to disagree. A Model doesn't require a Controller to fill it up. The Controller merely selects an appropriate Model. It's a good practice (as I know) that the Model should have already been populated before it's returned to the Controller.
Your time will come, if you let it be right.
|
|
|
|
|
Thanks for the replies and this confirms then that Microsoft have (as usual) just not even properly tested this from a user point of view. If I right click on Model the first option should be to add a class.
It's a small thing but just irritating when I work so hard to make everything I do as obvious to the user as possible.
Anyway rant over.
Thanks for the replies.
|
|
|
|
|
In that case I would be adding a controller to the Model folder - surely that can't be right?!
|
|
|
|