I'm sending a SecurityListRequest and I am receiving confirmation. I am unable to get the symbol from the response. I'm getting response like this.
8=FIXT.1.1|9=795|35=y|34=3|49=TMATCH=YYYYY|52=20160804-09:39:56.534|56=zzzzz|320=0001|322=zzzz->zzzzx|393=19|560=0|893=Y|
146=2|
55=xxxxx|48=xxxxx|22=8|167=xxxx|762=PERIOD|15=xxx|423=1|20000=1W|
55=xxxx|48=xxxxx|22=8|167=xxxx|762=PERIOD|15=xxx|423=1|20000=1M|
10=234
I tried to get like this
QuickFix.FIX50.SecurityList.NoRelatedSymGroup symbolGroup
= new QuickFix.FIX50.SecurityList.NoRelatedSymGroup();
int noofsymbols = m.Get(new NoRelatedSym()).getValue();
symbolGroup.Get(new Symbol());
and
m.get(new symbol()).getvalue();
and
m.getfield(new stringfield(55));
Every time it is throwing exception saying "Field Not Found" for tag 55.
You created a new empty NoRelatedSymGroup object, but you forgot to populate it from your message.
I think you are using the C++ QF with the C# wrapper, so this is probably the code you'd want:
var sym1 = new Symbol();
var sym2 = new Symbol();
m.getGroup(1, symbolGroup); // first group
symbolGroup.get(sym1);
m.getGroup(2, symbolGroup); // second group
symbolGroup.get(sym2);
Related
Quite new to selenium, have been looking to find an answer to this question, but so far, all the times I have tried I was not able to get my desired result.
I followed other answers to access the chrome console logs but i get an exception:
ChromeOptions options = new ChromeOptions();
options.SetLoggingPreference(LogType.Browser, LogLevel.All);
var driver = new ChromeDriver(options);
driver.Manage().Window.Maximize();
driver.Url = "https://test.test";
var homePage = new HomePage(driver); //POM
homePage.SignIn().Click();
homePage.Email("email");
homePage.Password("pw");
homePage.LogIn();
var logs = driver.Manage().Logs.GetLog(LogType.Browser);
foreach (var log in logs)
{
Console.WriteLine(log.ToString());
}
the exception is thrown on : var logs = driver.Manage().Logs.GetLog(LogType.Browser);
System.NullReferenceException: 'Object reference not set to an instance of an object.'
I haven't been able to understand why it is thrown.
After that, i would like to assert the console logs to see if a specific entry is present. Is it possible?
So, this is a dirty workaround. If you get any good answer, please don't use mine.
Modify the default console.log method to store data in a newly introduced global variable:
IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
//Multiline string used for readability. Write it in single line
js.ExecuteScript("
window.oldConsoleLog = window.console.log;
window.logCalls = [];
window.console.log = function(){
oldConsoleLog.apply(window.console, arguments);
window.logCalls.push(arguments);
}
");
Now you'll be able to get all calls using the next code:
var calls = js.ExecuteScript("return window.logCalls");
If you need a cleanup:
js.ExecuteScript("delete window.logCalls;window.console.log = window.oldConsoleLog;")
Using the Google Sheets API Version v4 for .NET in C# how do the values get assigned to the ValueRange from an ADO DataReader.
The online documentation from Google typically has code that looks like this:
// TODO: Assign values to desired properties of `requestBody`. All existing
// properties will be replaced:
Data.ValueRange requestBody = new Data.ValueRange();
Clearly this is where the data values should be set. In testing, it is possible to do the following successfully:
string range = "MySheet!A2:B";
var MyDataList = new List<object>() { "My Cell Text", "More text" };
RequestBody.Values = new List<IList<object>> { MyDataList };
Previous attempts to solve this issue involved creating a class to match the data from the reader and making a List of the objects. Then a line of code like the following was used:
RequestBody.Values = new List<IList<object>> { new List<object>(MyDataAsList) } ;
This returns the following error:
Google.GoogleApiException was unhandled
HResult=-2146233088
Message=Google.Apis.Requests.RequestError
Invalid values[1][0]:
I'm open to suggestions on other solutions to get the content of a SQL query to output to a Google Sheet.
TIA,
Joshua
I'm trying to monitor system up time by using #snmp (Lextm.SharpSnmpLib.9.0.1) and C#.
Here's my code:
public int GetUptime()
{
var uptimeMessage = new GetNextRequestMessage(0, VersionCode.V1, new OctetString("public"),
new List<Variable>
{
new Variable(new ObjectIdentifier(Oids.SystemUpTime))
});
var response = uptimeMessage.GetResponse(10000, _agentEndPoint);
var ticks = response.Pdu().Variables[0].Data.ToString();
return int.Parse(ticks);
}
But i'm getting a CS0103 error when trying to get .Data property for a response of type TimeTicks.
Here's the Inspection Window of VS2015
If this is not a bug, how can i access raw ticks value using #snmp ?
By checking the source code of TimeTicks in this library you can see the ToString method in fact generates a string based in .NET TimeSpan. That's why when you try to parse it as int exceptions come.
As for this OID you already know the Data would be a TimeTicks you should cast to that type and then call ToUInt32.
I am trying to post a tweet with TweetSharp library but a StackOverflowException is thrown. I couldn't solve this problem. What should I do? The error occurs in this line:
servis.SendTweet(new SendTweetOptions { Status = textBox1.Text });
Break it down and step through in the debugger (put a break-point on the string status = ... line):
// if you don't get this far, the problem is elsewhere
// if it fails here, the problem is accessing the textbox value
string status = textBox1.Text;
// if it fails here, the problem is inside the tweetsharp library,
// and should be referred to the library authors, but indicating which
// step fails (constructor vs Status property vs Send method)
var msg = new SendTweetOptions();
msg.Status = status;
servis.SendTweet(msg);
I'm trying to send a SOAP request to a 3rd party web service. I've successfully send and received data from other interfaces in the same service, but I'm having problems with this particular one:
<SP_GoodsMovement xmlns="http://services.hnseu.com">
<GoodsMoved xmlns="http://tempuri.org/SP_GoodsMoved.xsd">
<SerialNumberedGoodsMovements>
<SerialNumbered>
<PartNumber>string</PartNumber>
<SerialNumber>string</SerialNumber>
<MovementType>string</MovementType>
<FromLocation>string</FromLocation>
<FromLocationCategory>string</FromLocationCategory>
<ToLocation>string</ToLocation>
<ToLocationCategory>string</ToLocationCategory>
<AssetMovementTimestamp>dateTime</AssetMovementTimestamp>
<GoodsInReference>string</GoodsInReference>
</SerialNumbered>
<SerialNumbered>
<PartNumber>string</PartNumber>
<SerialNumber>string</SerialNumber>
<MovementType>string</MovementType>
<FromLocation>string</FromLocation>
<FromLocationCategory>string</FromLocationCategory>
<ToLocation>string</ToLocation>
<ToLocationCategory>string</ToLocationCategory>
<AssetMovementTimestamp>dateTime</AssetMovementTimestamp>
<GoodsInReference>string</GoodsInReference>
</SerialNumbered>
</SerialNumberedGoodsMovements>
<NonSerialNumberedGoodsMovements>
<NonSerialNumbered>
<PartNumber>string</PartNumber>
<Quantity>unsignedInt</Quantity>
<MovementType>string</MovementType>
<FromLocation>string</FromLocation>
<FromLocationCategory>string</FromLocationCategory>
<ToLocation>string</ToLocation>
<ToLocationCategory>string</ToLocationCategory>
<Used>boolean</Used>
<AssetMovementTimestamp>dateTime</AssetMovementTimestamp>
<GoodsInReference>string</GoodsInReference>
</NonSerialNumbered>
<NonSerialNumbered>
<PartNumber>string</PartNumber>
<Quantity>unsignedInt</Quantity>
<MovementType>string</MovementType>
<FromLocation>string</FromLocation>
<FromLocationCategory>string</FromLocationCategory>
<ToLocation>string</ToLocation>
<ToLocationCategory>string</ToLocationCategory>
<Used>boolean</Used>
<AssetMovementTimestamp>dateTime</AssetMovementTimestamp>
<GoodsInReference>string</GoodsInReference>
</NonSerialNumbered>
</NonSerialNumberedGoodsMovements>
</GoodsMoved>
</SP_GoodsMovement>
so my code is as follows (i can expand this if necesssary):
...
if (requestType == "SP_GoodsMovement")
{
GoodsMoved SOAP_GoodsMoved = new GoodsMoved();
SOAP_GoodsMoved.SerialNumberedGoodsMovements[0].PartNumber = partNumber[0].InnerXml;
...
string SOAPMessage;
SOAPMessage = request.SP_GoodsMovement(header, SOAP_GoodsMoved).Message;
}
When I run this code I get an 'Object reference not set to an instance of an object' error.
I think i'm not referencing the PartNumber parameter properly, but i've tried a few things without success.
Any ideas?
SOAP_GoodsMoved.SerialNumberedGoodsMovements[0]
doesn't appear to be initialised.
maybe try
GoodsMoved SOAP_GoodsMoved = new GoodsMoved();
SOAP_GoodsMoved.SerialNumberedGoodsMovements = new WhateverObject[1];
SOAP_GoodsMoved.SerialNumberedGoodsMovements[0] = new WhateverObject();
SOAP_GoodsMoved.SerialNumberedGoodsMovements[0].PartNumber = partNumber[0].InnerXml;
or you could right an overload for your GoodsMoved() ctor that ensures that the SerialNumberedGoodsMovements array gets initialized with a certain size.