« first day (3147 days earlier)      last day (1803 days later) » 

mr5
2:13 AM
Huawei is rolling out their new OS but I doubt it could compete its own Huawei AppStore against PlayStore
 
 
1 hour later…
3:13 AM
hola
 
3:33 AM
nobody is ever here
windows devs sleep at like 8:30
 
yeaaa a hoooman
do you code
 
And wake up on the other side of the world at 8 AM
Little bit, still an Intern, but maybe I can help
 
mr5
I think most of time zones here are ranging between +0100 to +0400
 
are you a c# expert
 
3:38 AM
I don't think even jon skeet will claim to be a C# expert
 
who's jon skeet
 
And I am a mere mortal
 
are you good c#
 
Jon Skeet, Reading, United Kingdom
1108k 705 8061 8516
@ChristianMatthew Bring the question, maybe I can help
Else we have @mr5 and he is a C# dinosaur so he can help
 
jesus god he has a 1.1 million rep
 
mr5
3:41 AM
@anand_v.singh I am new to C# actually. Just started 2 years ago
@ChristianMatthew squirrels here are the C# experts
 
so first let me go get that book hahahaha
but i am doing a deep dive into this luis ai bot example
now im just complaining a bit as I am trying to work through this
but the absense of json type output for everything still gets me a little
 
@mr5 I am completing 2 months in C# , so Imma call you a dinosaur
@ChristianMatthew Sample Json
{
   "query": "Book me a flight to Cairo",
   "topScoringIntent": {
       "intent": "BookFlight",
       "score": 0.9887482
   },
   "intents": [
       {
           "intent": "BookFlight",
           "score": 0.9887482
       },
       {
           "intent": "None",
           "score": 0.04272597
       },
       {
           "intent": "LocationFinder",
           "score": 0.0125702191
       },
       {
           "intent": "Reminder",
           "score": 0.00375502417
       },
       {
           "intent": "FoodOrder",
The classes you will need
 
ahhh yes
 
public class TopScoringIntent
{
public string intent { get; set; }
public double score { get; set; }
}

public class Intent
{
public string intent { get; set; }
public double score { get; set; }
}

public class Entity
{
public string entity { get; set; }
public string type { get; set; }
public int startIndex { get; set; }
public int endIndex { get; set; }
public double score { get; set; }
}

public class AccuWeather
{
public string query { get; set; }
public TopScoringIntent topScoringIntent { get; set; }
 
so i want to lock into the entities.
bookingDetails.Destination = recognizerResult.Entities["To"]?.FirstOrDefault()?["Airport"]?.FirstOrDefault()?.FirstOrDefault()?.ToString();
 
3:47 AM
Don't name the class accuwweather, that is because I kept that in Json utlis so sorry about that
 
i am looking at the first one
i want entity and score from entities
var (intent, score) = recognizerResult.GetTopScoringIntent();
hold on brb going to br
 
Okay so I would assume you are using a deserializer and have that as an Object in your C#
And now you are looking to find the destination?
So you would go to the list of entity and find the types that are location
 
mr5
@anand_v.singh nooo. I feel so old
@ChristianMatthew hey, is that DialogFlow?
 
mr5
Oh. It's similar to DialogFlow actually
We have made a sample Food Ordering prototype before using DialogFlow
 
3:57 AM
@ChristianMatthew I think the example they are showing on the homepage is way too easy and might not give the answer you are looking for, can you show what response you are getting and maybe I might be able to help a bit better
 
ok
i am trying to refactor it
 
@mr5 Read this news today, I don't think the media is reporting it with all the sides and trying to show duterrete as bad, how bad is the drug problem and what is actually happening thesun.co.uk/news/6535427/…
And I hope you don't take this as an offense, I am genuinely curious that's it
 
I want to get the entity
 
The only slightly pro Duterete point that they make is that people were afraid to even report on the crime, but I think there would be more nuance to this
 
i want something that will return this type of object
 "entities": [
       {
           "entity": "cairo",
           "type": "Location",
           "startIndex": 20,
           "endIndex": 24,
           "score": 0.956781447
       }
   ]
 
4:05 AM
Oh just this, are you using NewtonSoft Json parser
 
but instead this is returning this.
recognizerResult.Entities = {{
  "$instance": {
    "To": [
      {
        "startIndex": 10,
        "endIndex": 15,
        "text": "paris",
        "type": "To",
        "score": 0.987954
      }
    ]
  },
  "To": [
    {
      "$instance": {
        "Airport": [
 ...
 
if yes then just in the class definition that I gave you drop the things you don't need and then parse it
the rest gets taken care of automatically
 
is text what i should be focused on
in this case
 
I don't understand your last two sentences
 
{{
  "$instance": {
    "To": [
      {
        "startIndex": 10,
        "endIndex": 15,
        "text": "paris",
        "type": "To",
        "score": 0.987954
      }
    ]
  },
  "To": [
    {
      "$instance": {
        "Airport": [
          {
            "startIndex": 10,
            "endIndex": 15,
            "text": "paris",
            "type": "Airport"
          }
        ]
      },
      "Airport": [
        [
          "Paris"
        ]
      ]
    }
  ]
}}
i care about paris
that entity that has a parent of To so this is a composite type entity
i know what the intent is
 
4:08 AM
Just extract the list elements….
 
ok let me explain where the confusing is coming from
I am in the debugger now
 
boo yah.
 
when i click down on the arrow for recognizerResult.Entities
it gives me Childrentokens, count an object for First, HasValues, object for Last, New, Parent, Path Previous
what is all of that stuff
 
:o
 
when i hover over it I get the above pattern
 
4:11 AM
Okay give me a complete json response masking things that are confidential and I will "TRY" to code something up that gives you those objects, when I get free, hope you have some time, focus on try no promises
 
{{
  "$instance": {
    "To": [
      {
        "startIndex": 10,
        "endIndex": 15,
        "text": "paris",
        "type": "To",
        "score": 0.987954
      }
    ]
  },
  "To": [
    {
      "$instance": {
        "Airport": [
          {
            "startIndex": 10,
            "endIndex": 15,
            "text": "paris",
            "type": "Airport"
          }
        ]
      },
      "Airport": [
        [
          "Paris"
        ]
      ]
    }
  ]
}}
that's it
that's the hover and capture what I am assuming is the json result
 
This is an invalid json paste it in jsonutils.com and you will see
 
"assume"
 
ok this here
recognizerResult.Entities["To"]?.FirstOrDefault()?["Airport"]?.FirstOrDefault()?.FirstOrDefault()?.ToString();
is producing that above json\
however this is being set to this
bookingDetails.Destination
= paris
 
4:16 AM
and?
 
so the firstordefault value is i.e. paris vs Airport
is that how I should read that
 
let me check the golden book
 
again, how is this code getting me to paris
bookingDetails.Destination = recognizerResult.Entities["To"]?.FirstOrDefault()?["Airport"]?.FirstOrDefault()?.FirstOrDefault()?.ToString();
from the above json
 
mr5
@anand_v.singh this may sound bias coming from me but, that news site is outright misinformed, ignorant, or just another paid news outlet by yellow cults. I haven't read any news from our local news regarding about giving free guns yet. It seems they are trying very hard to portray him as a communist with no regards to human rights.
@anand_v.singh no. It's the actual opposite of it. Those who abides the law here feels more empowered because our government now is actually listening to its people unlike before
 
@mr5 Surprisingly that does not sound biased I have seen left wing media misrepresent other leaders especially Indian politicians as well and that is why I asked you.
 
4:26 AM
ok you help me and I will talk politics
 
@ChristianMatthew I think we are suffering from the xy problem
 
i have a lot of political opinions
 
lol
no i think question is fair. i am trying to understand not really solve for something just yet
 
4:28 AM
@ChristianMatthew I am trying to help, it's just that I am a bit inexperienced and from my point of view you have created something that makes getting to your result harder
Since it is giving that the Json format is invalid the only answer I have is a custom string parser
And that is not an approach I would suggest
 
ok but this question i am asking is almost a syntatical question
 
I would suggest rather fixing what you have done till now
 
i have done anyting
this code works
as intended it is from a sample
my question is how is it working
 
@ChristianMatthew Your question is what this query should rather be? and for that I need the Json/Object that came before this
@ChristianMatthew Ohh...
 
-		Entities	{{
  "$instance": {
    "To": [
      {
        "startIndex": 10,
        "endIndex": 15,
        "text": "paris",
        "type": "To",
        "score": 0.987954
      }
    ]
  },
  "To": [
    {
      "$instance": {
        "Airport": [
          {
            "startIndex": 10,
            "endIndex": 15,
            "text": "paris",
            "type": "Airport"
          }
        ]
      },
      "Airport": [
        [
          "Paris"
        ]
      ]
    }
  ]
}}	Newtonsoft.Json.Linq.JObject
all that stuff under entities is what
 
4:33 AM
Which tutorial are you following?
 
the one from azure let me get it
 
This ChildrenToken/Root/Previos these ones?
 
Shit can't code it here and check
Okay this would be difficult than I though
 
you dont' have access to azure
i know it's newtonsoft that is making this into json
i geet that
i kind of see the firstordefaults are stepping through the code
but why you do that
is it text they are ultimately looking for
which = paris
cant' i just say .text
lol you see what i mean
 
4:39 AM
No firstOrDefault is linq syntax it is just assuming that it has your current location and is looking for the first entity in which the type is location might be where you are trying to go
 
and the picture i just posted... stepping into that objects seems like yea right
 
And the root and everything is just because it is a deferred streaming execution so it keeps track of where it came from and where it is going to next that is in the list of objects
Read about each manners and that should solve why we need those extra information
@ChristianMatthew I have access to azure, just my organization enables access for certain services after an email, and I cannot really say I want to use LuisAI to help someone on a chat forum
@ChristianMatthew And I don't have a personal Azure account since they require Credit cards and being a student I only have debit cards
But back to this, did you understand it
 
yes reading through it
when you say looking for first entity do you mean entity in luis.ai sense?
or entity like collection
 
FirstOrDefault works on any class that Inherits from IEnumerable
So in this case bookingDetails.TravelDate = recognizerResult.Entities["datetime"]?.FirstOrDefault()?["timex"]?.FirstOrDefault()?.ToString().Split('T')[0]
Looks like there is a custom List in which they are looking for the first occurrence of dateTime, then in that first occurrence of Timex format and then splitting at T to get the travel date value
 
 var (intent, score) = recognizerResult.GetTopScoringIntent();
                if (intent == "Book_flight")
                {
                    // We need to get the result from the LUIS JSON which at every level returns an array.
                    bookingDetails.Destination = recognizerResult.Entities["To"]?.FirstOrDefault()?["Airport"]?.FirstOrDefault()?.FirstOrDefault()?.ToString();
                    bookingDetails.Origin = recognizerResult.Entities["From"]?.FirstOrDefault()?["Airport"]?.FirstOrDefault()?.FirstOrDefault()?.ToString();
for now i am focused on the first one .destination
 
4:51 AM
This looks like a class implementing the IDicitonary Interface which in turn Implemetns IEnumerable, or I collection which enumerates IEnumerable
 
{{
  "$instance": {
    "To": [
      {
        "startIndex": 10,
        "endIndex": 15,
        "text": "paris",
        "type": "To",
        "score": 0.987954
      }
    ]
  },
  "To": [
    {
      "$instance": {
        "Airport": [
          {
            "startIndex": 10,
            "endIndex": 15,
            "text": "paris",
            "type": "Airport"
          }
        ]
      },
      "Airport": [
        [
          "Paris"
        ]
      ]
    }
  ]
}}
ok i think i get it
 
It's an array of arrays
Jagged arrays
Jagged arrays of dictionaries
Go from left to right and that's it
 
so it's saying give me the from the entities with to and airport
the array and array first or default value
thats a shit ton of magic
ok so what I want is the score
how would I get that
 
Yes basically saying give me the first value that has to, and then give me the first value that has airport
 
and then the array of arrays
which is right here
  "Airport": [
        [
          "Paris"
        ]
i.e. paris
 
4:58 AM
To get score can you post the debugger variable watches of what is in the bookingDetails.Destination
 
what is if I wanted score
what is this $instance
 
mr5
@ChristianMatthewI suggest not to decode the response in a key-value manner rather deserizalize it so that you're working against a solid plain C# object
 
yes I totally agree
lol
i am hating this right now
 
mr5
@anand_v.singh sorry I can't keep up with the discussion. pretty busy right now at work
 
I think it comes form Newtonsoft as I have also seen that while parsing other API's but don't quote me on that
 
5:00 AM
now for sure it's 100% newtonsoft
its cringy to me
 
mr5
^ yes. Newtonsoft.Json is what I have in mind
 
@mr5 No worries working is more important that talking politics with someone on the internet
 
@ChristianMatthew I hope that clears your doubts to some extent, if not wait a few hours and Squirrles will be online here and maybe they can help... All hands meeting
gtg
 
5:03 AM
no dont' leave one more question
 
5:37 AM
Hi
Can someone maybe tell me why this is giving me a System.ArgumentOutOfRangeException: 'Index was out of range exception.
https://pastebin.com/SixX8zTD
I know what the exception is, but I somehow don't understand..
I've changed int i = 0; i < model.ColumnsFilter.Count; to int i = 0; i <= model.ColumnsFilter.Count;
 
remove that line
do you get the same error on the following line
did you do it?
 
on it sec
Same error on line model.FilteringValue[i].Value = item.Value;
 
so out of range means that the value for model.FilteringValue is not set to the right numeric posibility
what does your model for filterValue have
double long decimal
 
it's a list of this class:
public class FilterValues
    {
       public string Key { get; set; }
       public string Value { get; set; }
    }
 
that's your problem
you're passing a number into a string
 
5:48 AM
a number?
 
what is the model for columns
or class
 
    public Dictionary<string, string> ColumnsFilter { get; set; }
 
good morning
@Катерина You're looping incorrectly.
 
ok what are the values
 
for (int i = 0; i < model.ColumnsFilter.Count; i++)
this loop does one iteration per column you have
foreach(var item in model.ColumnsFilter)
this loop does the same
 
5:52 AM
yes but I need the for loop to get the index. in order to add items to list. right? model.FilteringValue1[i].Value = item.Value;
can't do this in a foreach.
 
so you're effectively performing model.ColumnsFilter.Count² operations
but why do you still use the foreach?
 
@ChristianMatthew just a few strings like "OrdNr", "" and "FreightNr", "test"
 
If you are trying to get all column keys and values you can remove the foreach loop
 
are they all key value paired?
i.e.
var dict = new Dictionary<string, string>() {
		{ "one", "two" },
		{ "three", "four" }
	};
 
because you can't do it like this @HéctorÁlvarez
   for (int i = 0; i < model.ColumnsFilter.Count; i++)
            {
                model.FilteringValue1[i].Key = item[i].Key; //Exception here ;/
            }
@ChristianMatthew Some values*are empty strings.
 
5:55 AM
also, you don't need this
 for (int i = 0; i < model.ColumnsFilter.Count; i++)
        {
 
for (int i = 0; i < model.RowsFilter.Count; i++)
{
            for (int j = 0; j < model.ColumnsFilter.Count; j++)
            {
                model.FilteringValue1[i][j].Key = item[i][j].Key;
            }
}
 
How so?
 
first you loop rows, then you loop columns
IDK what your data model is, so adapt the operation as needed
 
That doesn't seems right
 
you're trying to loop through all elements in columnsfilter correct?
 
5:58 AM
Yes I want to store all columnsfilter into the list
 
ok so the foreach statement does this
 
basically this: stackoverflow.com/questions/3968543/… but then not only key, but also value.
 
it is going to loop through all of the objects in columnsfilter
do you understand what i am saying
you're looping through a dictionary right
 
yes
correct
 
each object has a key and a value
it already knows the number of those items
so there is no need to nest a loop of a for statement
 
6:02 AM
Also
I think I understand
what you mean
 
Show us your FilteringValue
@Катерина Also you did it wrong, you're looping on the same values again
Check my example again
 
void Main()
{
	var dict = new Dictionary<string, string>() {
		{ "one", "two" },
		{ "three", "four" }
	};

	FilterValues blue = new FilterValues();

	foreach( var item in dict) {

		blue.Key = item.Key;
		blue.Value = item.Value;
		Console.Write(blue);
	}
}


public class FilterValues
    {
       public string Key { get; set; }
       public string Value { get; set; }
    }
is this what you want
i think that is what you want
 
Buenos dias
 
Buongiorno Marcello
 
@Squirrelkiller i have been looking for you
they say you are the chosen 1
 
6:11 AM
Marcello is in the next room, we're not in the same team anymore
....me?
Who claims that
 
Squirrelino what did I tell you about joining sects?
WHO IS CALIM!?
 
Oh calim isn't here anymore
 
@Squirrelkiller do you have a moment to help with something regarding luis ai
and bots
 
Who is luis
 
luis.ai
congnitive services
cognitive
 
6:15 AM
Never heard of it
Maybe another squirrel?
 
it's c#
for all intents and purposes
 
Except the subvertive python that's hiding below
 
Guess you're in the right room then
We do a bit C# and a lot of interop with XY
 
bookingDetails.Destination = recognizerResult.Entities["$instance"]?.FirstOrDefault()?["To"]?.ToString();
 
Which is fortunately language-agnostic, because people are dumb regardless of language.
 
6:20 AM
Wow so many nullables there
You should add some reverse question marks
¿
 
my issue is I keep error
 
Often, the error describes the problem and therefore leads you to your solution. Helpful insight tips #871
 
{"Cannot access child value on Newtonsoft.Json.Linq.JProperty."}
i keep getting this error
@RoelvanUden insightful
this is the expression before I altered it...
bookingDetails.Destination = recognizerResult.Entities["To"]?.FirstOrDefault()?["Airport"]?.FirstOrDefault()?.FirstOrDefault()?.ToString();
this works fine and produces this json object
+		Entities	{{
  "$instance": {
    "To": [
      {
        "startIndex": 10,
        "endIndex": 15,
        "text": "paris",
        "type": "To",
        "score": 0.987954
      }
    ]
  },
  "To": [
    {
      "$instance": {
        "Airport": [
          {
            "startIndex": 10,
            "endIndex": 15,
            "text": "paris",
            "type": "Airport"
          }
        ]
      },
      "Airport": [
        [
          "Paris"
        ]
      ]
    }
  ]
}}	Newtonsoft.Json.Linq.JObject
 
So why did you change it?
 
i want to access the score
that's why I changed it
 
6:26 AM
To is an array
you'll have to go to Tos first element
 
well hmmmm
 
^
 
there are 2 To's
 
Yes?
 
bookingDetails.Destination = recognizerResult.Entities["$instance"]?.FirstOrDefault()?.FirstOrDefault()?["To"]?.ToString();
 
6:29 AM
bookingDetails.Destination = recognizerResult.Entities["$instance"]?.FirstOrDefault()?["To"].FirstOrDefault()?.ToString();
 
No
 
+		$exception	{"Accessed JArray values with invalid key value: \"To\". Int32 array index expected."}	System.ArgumentException
 
That's taking the first element of whatever is above "To" and accessing the property "To" on it
 
So the real problem here is....to access a json property?
 
pretty much
 
6:31 AM
That is not very difficult
 
in javascript i's not
this is blowing my mind right now
 
Works prety much the same is JS and C#
Is that always the same structure? Then make a C# class and deserialize into it, the nwork with that.
 
this is in the documentation of properties for RecognizeAsync
+ $exception {"Cannot access child value on Newtonsoft.Json.Linq.JProperty."} System.InvalidOperationException
@Squirrelkiller that is with your example
why can't i access it
 
Have you considered just deserializing it into a c# object?
 
can you give me an example not sure how to do that
 
6:39 AM
Is there...a second "instance" object iwthin the second To
Hey can you paste the plain json into a gist or something?
And put it through json lint first
 
I don't think .FirstOrDefault makes sense on $instance because it isn't a collection
Although I think for an object that may consider its properties a collection, not sure
Ok yes it does it's a JContainer
Heyyy what's this double braces thing
Entities {{
That's not valid JSON is it?
 
That's why asked him to put it through jsonlint ;)
@ChristianMatthew Have you worked with json before?
 
I miss actually working with C#
All I do with it, I do at home
Guess it's time to tell the boss?
 
	{
		"$instance": {
			"To": [{
				"startIndex": 10,
				"endIndex": 15,
				"text": "paris",
				"type": "To",
				"score": 0.987954
			}]
		},
		"To": [{
			"$instance": {
				"Airport": [{
					"startIndex": 10,
					"endIndex": 15,
					"text": "paris",
					"type": "Airport"
				}]
			},
			"Airport": [
				[
					"Paris"
				]
			]
		}]

	}
 
6:47 AM
Damn I've barely been around for 2 months and I'm bored already.
 
this is valid json but from the debugger that was not what it is giving me
 
@ChristianMatthew I have to say the naming convention is really bad.
Why did you choose to name a property To which is an array of properties?
 
what do you mean
this is from luis.ai
 
@ChristianMatthew How come there is another instance within the second to?
 
dude i think you are understaiding what is going on
i didn't create this code
 
6:49 AM
Oh is it made by someone else?
 
yes lol it's a luis.ai example
 
Might be a little early to call it "someone"
 
Well, there might be an explanation, but I definitely wouldn't have picked those names
 
> gist.github.com - For Easy Code Pasting
 
this is machine learning
it's what it is
 
6:50 AM
this is understanding json
 
i understand json
 
ML is a whole other rabbit whole
 
there is no issue there
 
Well it sounds like it's going to be a hell of a trouble to maintain in the future if there are such intricacies on day 1.
 
namespace Microsoft.BotBuilderSamples
{
    public static class LuisHelper
    {
        public static async Task<BookingDetails> ExecuteLuisQuery(IConfiguration configuration, ILogger logger, ITurnContext turnContext, CancellationToken cancellationToken)
        {
            var bookingDetails = new BookingDetails();

            try
            {
                // Create the LUIS settings from configuration.
                var luisApplication = new LuisApplication(
                    configuration["LuisAppId"],
for context
 
this is the entity property for the recognizer class
 
Ya it's a JObject
its just json
 
oh this data is very dynamic
well the i see what you're saying
those parts don't have to be
let me ask you this
 
See that's why I went
21 mins ago, by Squirrelkiller
Is that always the same structure? Then make a C# class and deserialize into it, the nwork with that.
 
lol yes
it is and it isn't
for a list entity that would be a pretty accurate statement
it wouldn't have the parent To
which is a composite entity
i.e. To somewhere i.e. To Paris
and From i.e. From Chicago
so score could be anything
for a list entity they don't have parents. so it would just be instance and propertie / values
all I want it to do an entity checker
so when you give a response to the bot and you don't use an official entity the bot says repeat or can you answer the question so they give a proper response
once they do the bot goes goes on to the next question
What can I help you with today?
Say something like “Book a flight from Paris to Berlin on March 22, 2020”

4 minutes ago
travel to paris

hi

3 minutes ago
What can I help you with today?
Say something like “Book a flight from Paris to Berlin on March 22, 2020”

4 minutes ago
travel to paris

A minute ago
the issue is for this example is you can say anything and it will record it.
 

« first day (3147 days earlier)      last day (1803 days later) »