public CategoricalTweets GetTweetsByCategoryAndDate(string category, string date = "")
        {
            const string Positive = "Positive";
            const string Negative = "Negative";

            string key = string.IsNullOrEmpty(date) ? category + "-*" : category + "-" + date;
            string url = "http://" + HBaseIp + "/categories/" + key;

            WriteToFile("GetTweetsByCategoryAndDate", "Start", "categories", key);

            var data = ConnectToHBaseService(url);

            CategoricalTweets categoricalTweets = new CategoricalTweets();

            categoricalTweets.date       = date;
            categoricalTweets.category   = category;
            categoricalTweets.moodTweets = new MoodsTweets();
            categoricalTweets.moodTweets.negativeComments = new List <TweetExtended>();
            categoricalTweets.moodTweets.positiveComments = new List <TweetExtended>();

            foreach (Row row in data.Row)
            {
                foreach (Cell cell in row.Cell)
                {
                    try
                    {
                        TweetExtended tweetExtended = JsonConvert.DeserializeObject <TweetExtended>(this.DecodeBase64(cell.dollar));
                        if (tweetExtended.sentiment == Positive)
                        {
                            categoricalTweets.moodTweets.positiveComments.Add(tweetExtended);
                        }
                        else if (tweetExtended.sentiment == Negative)
                        {
                            categoricalTweets.moodTweets.negativeComments.Add(tweetExtended);
                        }
                    }
                    catch (Exception ex)
                    {
                        WriteToFile("GetTweetsByCategoryAndDate", "Exception: " + ex.ToString(), "categories", key);
                    }
                }
            }

            categoricalTweets.moodTweets.positiveComments = categoricalTweets.moodTweets.positiveComments.OrderBy(nc => nc.posScore).Take(10).ToList();
            categoricalTweets.moodTweets.negativeComments = categoricalTweets.moodTweets.negativeComments.OrderBy(nc => nc.negScore).Take(10).ToList();

            WriteToFile("GetTweetsByCategoryAndDate", "End", "categories", key);

            return(categoricalTweets);
        }
        public MoodsTweets GetTop10PositiveNegativeTweets(string key)
        {
            WriteToFile("GetTop10PositiveNegativeTweets", "Start", "mood", key);

            const string Positive = "Positive";
            const string Negative = "Negative";

            string url  = "http://" + HBaseIp + "/mood/" + key;
            var    data = ConnectToHBaseService(url);

            MoodsTweets moodsTweets = new MoodsTweets();

            moodsTweets.negativeComments = new List <TweetExtended>();
            moodsTweets.positiveComments = new List <TweetExtended>();

            foreach (Row row in data.Row)
            {
                foreach (Cell cell in row.Cell)
                {
                    try
                    {
                        TweetExtended tweetExtended = JsonConvert.DeserializeObject <TweetExtended>(this.DecodeBase64(cell.dollar));
                        if (tweetExtended.sentiment == Positive)
                        {
                            moodsTweets.positiveComments.Add(tweetExtended);
                        }
                        else if (tweetExtended.sentiment == Negative)
                        {
                            moodsTweets.negativeComments.Add(tweetExtended);
                        }
                    }
                    catch (Exception ex)
                    {
                        WriteToFile("GetTop10PositiveNegativeTweets", "Exception: " + ex.ToString(), "mood", key);
                    }
                }
            }

            moodsTweets.positiveComments = moodsTweets.positiveComments.OrderBy(nc => nc.posScore).Take(10).ToList();
            moodsTweets.negativeComments = moodsTweets.negativeComments.OrderBy(nc => nc.negScore).Take(10).ToList();

            WriteToFile("GetTop10PositiveNegativeTweets", "End", "mood", key);

            return(moodsTweets);
        }