예제 #1
0
        public ActionResult Create(string yakMessage, double latitude, double longitude, double confidence, string sentiment, int?replyId)

        {
            Yak yak;

            if (replyId != null)
            {
                yak = new Yak()
                {
                    Text         = yakMessage,
                    Latitude     = latitude,
                    Longitude    = longitude,
                    Confidence   = confidence,
                    Sentiment    = sentiment,
                    ReplyToYakId = replyId.Value,
                    Timestamp    = DateTime.Now
                };
            }
            else
            {
                yak = new Yak()
                {
                    Text       = yakMessage,
                    Latitude   = latitude,
                    Longitude  = longitude,
                    Confidence = confidence,
                    Sentiment  = sentiment,
                    Timestamp  = DateTime.Now
                };
            }

            db.Yaks.Add(yak);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
        public List <Yak> GetYaks(double latitude, double longitude, string userId, string salt)
        {
            string res = GetMessages(latitude, longitude, userId, salt);

            var deserializerSettings = new JsonSerializerSettings()
            {
                DateFormatHandling   = DateFormatHandling.IsoDateFormat,
                DateParseHandling    = Newtonsoft.Json.DateParseHandling.None,
                DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc
            };

            JToken token = JsonConvert.DeserializeObject <JObject>(res, deserializerSettings);

            List <Yak> result = new List <Yak>();

            foreach (JToken messageToken in token["messages"])
            {
                Yak yak = new Yak();
                yak.MessageID = messageToken["messageID"].ToString();
                yak.Message   = messageToken["message"].ToString();
                yak.Latitude  = double.Parse(messageToken["latitude"].ToString(), CultureInfo.InvariantCulture);
                yak.Longitude = double.Parse(messageToken["longitude"].ToString(), CultureInfo.InvariantCulture);
                yak.Time      = DateTime.ParseExact((string)messageToken["time"], "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
                result.Add(yak);
            }

            return(result);
        }
예제 #3
0
    public static int Main(String[] args)
    {
        Console.WriteLine("Starting...");
        int SIZE = 2;
        Int64 sum = 0;

        Yak[,,,,,,] foo = new Yak[SIZE, SIZE, SIZE, SIZE, SIZE, SIZE, SIZE];
        int i, j, k, l, m, n, o;

        for (i = 0; i < SIZE; i++)
            for (j = 0; j < SIZE; j++)
                for (k = 0; k < SIZE; k++)
                    for (l = 0; l < SIZE; l++)
                        for (m = 0; m < SIZE; m++)
                            for (n = 0; n < SIZE; n++)
                                for (o = 0; o < SIZE; o++)
                                {
                                    foo[i, j, k, l, m, n, o].a = i * j * k * l * m * n * o;
                                    foo[i, j, k, l, m, n, o].b = i + j + k + l + m + n + o;
                                    foo[i, j, k, l, m, n, o].Do_Something();
                                }

        for (i = 0; i < SIZE; i++)
            for (j = 0; j < SIZE; j++)
                for (k = 0; k < SIZE; k++)
                    for (l = 0; l < SIZE; l++)
                        for (m = 0; m < SIZE; m++)
                            for (n = 0; n < SIZE; n++)
                                for (o = 0; o < SIZE; o++)
                                {
                                    sum += foo[i, j, k, l, m, n, o].b;
                                }

        Console.WriteLine("\nTry to get count!");

        test(foo);

        if ((foo.Length == SIZE * SIZE * SIZE * SIZE * SIZE * SIZE * SIZE) && (sum == 449))
        {
            Console.Write("Count is:" + foo.Length.ToString());
            Console.WriteLine("\nEverything Worked!");
            return 100;
        }
        else
        {
            Console.WriteLine("Count is:" + foo.Length.ToString());
            Console.WriteLine("Sum is:" + sum.ToString());
            Console.WriteLine("\nEverything Didnt Work!");
            return 1;
        }
    }
예제 #4
0
 public static void test(Yak[,,,,,,] Odd_Variable)
 {
     Console.Write(Odd_Variable.Length);
 }
예제 #5
0
    public static int Main(String[] args)
    {
        Console.WriteLine("Starting...");
        int   SIZE = 2;
        Int64 sum  = 0;

        Yak[,,,,,,] foo = new Yak[SIZE, SIZE, SIZE, SIZE, SIZE, SIZE, SIZE];
        int i, j, k, l, m, n, o;

        for (i = 0; i < SIZE; i++)
        {
            for (j = 0; j < SIZE; j++)
            {
                for (k = 0; k < SIZE; k++)
                {
                    for (l = 0; l < SIZE; l++)
                    {
                        for (m = 0; m < SIZE; m++)
                        {
                            for (n = 0; n < SIZE; n++)
                            {
                                for (o = 0; o < SIZE; o++)
                                {
                                    foo[i, j, k, l, m, n, o].a = i * j * k * l * m * n * o;
                                    foo[i, j, k, l, m, n, o].b = i + j + k + l + m + n + o;
                                    foo[i, j, k, l, m, n, o].Do_Something();
                                }
                            }
                        }
                    }
                }
            }
        }

        for (i = 0; i < SIZE; i++)
        {
            for (j = 0; j < SIZE; j++)
            {
                for (k = 0; k < SIZE; k++)
                {
                    for (l = 0; l < SIZE; l++)
                    {
                        for (m = 0; m < SIZE; m++)
                        {
                            for (n = 0; n < SIZE; n++)
                            {
                                for (o = 0; o < SIZE; o++)
                                {
                                    sum += foo[i, j, k, l, m, n, o].b;
                                }
                            }
                        }
                    }
                }
            }
        }

        Console.WriteLine("\nTry to get count!");

        test(foo);

        if ((foo.Length == SIZE * SIZE * SIZE * SIZE * SIZE * SIZE * SIZE) && (sum == 449))
        {
            Console.Write("Count is:" + foo.Length.ToString());
            Console.WriteLine("\nEverything Worked!");
            return(100);
        }
        else
        {
            Console.WriteLine("Count is:" + foo.Length.ToString());
            Console.WriteLine("Sum is:" + sum.ToString());
            Console.WriteLine("\nEverything Didnt Work!");
            return(1);
        }
    }