/// <summary>
 /// Constructor.
 /// </summary>
 public MainWindow()
 {
     InitializeComponent();
     Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
     CredentialsProvider.Initialize("AkCCTWkX8-FpNuz3LXlVFG5yrQBq2R6p2Efl2TXG4vXSBu4k0OxvLwgCjO5G5TZK");
     MapDataSource.Initialize(true);
 }
Example #2
0
        public InitializeResult InitializeLocal(PluginEnvironment env, IMessageReceiver receiver)
        {
            // Data files contained in [datadrectory]/wordnet
            string          basedir = env.GetConfigDirectory("datadirectory") + Path.DirectorySeparatorChar + "wordnet" + Path.DirectorySeparatorChar;
            MemcachedClient cache   = MemcacheSource.DefaultClient();

            nounIndexSource = new BackedMemcachedSource <Index>(new IndexFile(basedir, WordNetAccess.PartOfSpeech.Noun), "WN:I:N:", cache);
            verbIndexSource = new BackedMemcachedSource <Index>(new IndexFile(basedir, WordNetAccess.PartOfSpeech.Verb), "WN:I:V:", cache);
            adjIndexSource  = new BackedMemcachedSource <Index>(new IndexFile(basedir, WordNetAccess.PartOfSpeech.Adj), "WN:I:A:", cache);
            advIndexSource  = new BackedMemcachedSource <Index>(new IndexFile(basedir, WordNetAccess.PartOfSpeech.Adv), "WN:I:R:", cache);

            if (!advIndexSource.TestMemcached(10, 10))
            {
                Console.Out.WriteLine("Loading nouns into Memcached");
                nounIndexSource.LoadIntoMemcached();
                Console.Out.WriteLine("Loading verbs into Memcached");
                verbIndexSource.LoadIntoMemcached();
                Console.Out.WriteLine("Loading adjectives into Memcached");
                adjIndexSource.LoadIntoMemcached();
                Console.Out.WriteLine("Loading adverbs into Memcached");
                advIndexSource.LoadIntoMemcached();
            }

            nounOffsetsSource = new MapDataSource <string, Index, long[]>(nounIndexSource, IndexFile.ExtractOffsets, null);
            verbOffsetsSource = new MapDataSource <string, Index, long[]>(verbIndexSource, IndexFile.ExtractOffsets, null);
            adjOffsetsSource  = new MapDataSource <string, Index, long[]>(adjIndexSource, IndexFile.ExtractOffsets, null);
            advOffsetsSource  = new MapDataSource <string, Index, long[]>(advIndexSource, IndexFile.ExtractOffsets, null);

            env.SetDataSource <string, long[]>(WordNetAccess.NounIndexSourceName, nounOffsetsSource);
            env.SetDataSource <string, long[]>(WordNetAccess.VerbIndexSourceName, verbOffsetsSource);
            env.SetDataSource <string, long[]>(WordNetAccess.AdjIndexSourceName, adjOffsetsSource);
            env.SetDataSource <string, long[]>(WordNetAccess.AdvIndexSourceName, advOffsetsSource);

            nounDefinitionSource = new DefinitionFile(basedir, WordNetAccess.PartOfSpeech.Noun);
            verbDefinitionSource = new DefinitionFile(basedir, WordNetAccess.PartOfSpeech.Verb);
            adjDefinitionSource  = new DefinitionFile(basedir, WordNetAccess.PartOfSpeech.Adv);
            advDefinitionSource  = new DefinitionFile(basedir, WordNetAccess.PartOfSpeech.Adv);

            env.SetDataSource <long, WordNetDefinition>(WordNetAccess.NounDefinitionSourceName, nounDefinitionSource);
            env.SetDataSource <long, WordNetDefinition>(WordNetAccess.VerbDefinitionSourceName, verbDefinitionSource);
            env.SetDataSource <long, WordNetDefinition>(WordNetAccess.AdjDefinitionSourceName, adjDefinitionSource);
            env.SetDataSource <long, WordNetDefinition>(WordNetAccess.AdvDefinitionSourceName, advDefinitionSource);

            fileTools = new FileWordNetTools(env.GetConfigDirectory("datadirectory") + Path.DirectorySeparatorChar + "wordnet" + Path.DirectorySeparatorChar);

            return(InitializeResult.Success());
        }
    private string createQuestion()
    {
        var    jss      = new JavaScriptSerializer();
        string url      = "http://2d73b8c2.problems.sphere-engine.com/api/v3/problems?access_token=" + token;
        string jsonData = "{\"code\":\"" + textQcode.Value + "\",\"name\":\"" + textQname.Value + "\"}";

        client.Headers.Add("Content-Type", "application/json");
        try
        {
            response = client.UploadString(url, "POST", jsonData);
            QuestionDataSource.InsertParameters.Clear();
            QuestionDataSource.InsertParameters.Add("Category", textQcategory.Value);
            QuestionDataSource.InsertParameters.Add("Question", textQcode.Value);
            QuestionDataSource.InsertParameters.Add("QuestionName", textQname.Value);
            QuestionDataSource.Insert();
            if (!checkboxCategory.Checked)
            {
                DataView dv = (DataView)MapDataSource.Select(new DataSourceSelectArguments());
                dropdownCategory.Items.Clear();
                foreach (System.Data.DataRow row in dv.Table.Rows)
                {
                    dropdownCategory.Items.Add(row["Category"].ToString());
                }
                dropdownCategory.SelectedIndex = dropdownCategory.Items.IndexOf(new ListItem(textQcategory.Value));
                checkboxCategory.Checked       = true;
                textQcategory.Disabled         = true;
                ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "DoPostBack", "__doPostBack('dropdownCategory','')", true);
            }
            ListView1.DataBind();
            return("");
        }
        catch (WebException ex)
        {
            using (WebResponse response = ex.Response)
            {
                using (Stream data = response.GetResponseStream())
                {
                    StreamReader sr        = new StreamReader(data);
                    var          resultObj = jss.Deserialize <Dictionary <string, dynamic> >(sr.ReadToEnd());
                    return(resultObj["message"]);
                }
            }
        }
    }
Example #4
0
        /// <summary>
        /// On addButton click. Adds a new point.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddButton_Click(object sender, RoutedEventArgs e)
        {
            if (this.textBoxName.Text == "")
            {
                return;
            }

            bool result = MapDataSource.AddPoint(new MapPoint
            {
                Name   = this.textBoxName.Text,
                CoordX = this.upDownX.Value == null ? 0 : (int)this.upDownX.Value,
                CoordY = this.upDownY.Value == null ? 0 : (int)this.upDownY.Value
            });

            if (!result)
            {
                this.ClearInputControls();
                return;
            }

            MapDataSource.GenerateDistanceMatrix();
            // rerender the view
            this.listViewEntries.Items.Refresh();
        }
        public InitializeResult Initialize(PluginEnvironment env, Assembly assembly, IMessageReceiver receiver)
        {
            // Data files contained in [datadrectory]/wordnet
            string basedir = (string)env.GetConfig("datadirectory") + Path.DirectorySeparatorChar + "wordnet" + Path.DirectorySeparatorChar;
            MemcachedClient cache = MemcacheSource.DefaultClient();

            nounIndexSource = new BackedMemcachedSource<Index>(new IndexFile(basedir, WordNetAccess.PartOfSpeech.Noun), "WN:I:N:", cache);
            verbIndexSource = new BackedMemcachedSource<Index>(new IndexFile(basedir, WordNetAccess.PartOfSpeech.Verb), "WN:I:V:", cache);
            adjIndexSource = new BackedMemcachedSource<Index>(new IndexFile(basedir, WordNetAccess.PartOfSpeech.Adj), "WN:I:A:", cache);
            advIndexSource = new BackedMemcachedSource<Index>(new IndexFile(basedir, WordNetAccess.PartOfSpeech.Adv), "WN:I:R:", cache);

            if (!advIndexSource.TestMemcached(10, 10)) {
                nounIndexSource.LoadIntoMemcached();
                verbIndexSource.LoadIntoMemcached();
                adjIndexSource.LoadIntoMemcached();
                advIndexSource.LoadIntoMemcached();
            }

            nounOffsetsSource = new MapDataSource<string, Index, long[]>(nounIndexSource, IndexFile.ExtractOffsets, null);
            verbOffsetsSource = new MapDataSource<string, Index, long[]>(verbIndexSource, IndexFile.ExtractOffsets, null);
            adjOffsetsSource = new MapDataSource<string, Index, long[]>(adjIndexSource, IndexFile.ExtractOffsets, null);
            advOffsetsSource = new MapDataSource<string, Index, long[]>(advIndexSource, IndexFile.ExtractOffsets, null);

            env.SetDataSource<string, long[]>(WordNetAccess.NounIndexSourceName, nounOffsetsSource);
            env.SetDataSource<string, long[]>(WordNetAccess.VerbIndexSourceName, verbOffsetsSource);
            env.SetDataSource<string, long[]>(WordNetAccess.AdjIndexSourceName, adjOffsetsSource);
            env.SetDataSource<string, long[]>(WordNetAccess.AdvIndexSourceName, advOffsetsSource);

            nounDefinitionSource = new DefinitionFile(basedir, WordNetAccess.PartOfSpeech.Noun);
            verbDefinitionSource = new DefinitionFile(basedir, WordNetAccess.PartOfSpeech.Verb);
            adjDefinitionSource = new DefinitionFile(basedir, WordNetAccess.PartOfSpeech.Adv);
            advDefinitionSource = new DefinitionFile(basedir, WordNetAccess.PartOfSpeech.Adv);

            env.SetDataSource<long, WordNetDefinition>(WordNetAccess.NounDefinitionSourceName, nounDefinitionSource);
            env.SetDataSource<long, WordNetDefinition>(WordNetAccess.VerbDefinitionSourceName, verbDefinitionSource);
            env.SetDataSource<long, WordNetDefinition>(WordNetAccess.AdjDefinitionSourceName, adjDefinitionSource);
            env.SetDataSource<long, WordNetDefinition>(WordNetAccess.AdvDefinitionSourceName, advDefinitionSource);

            return InitializeResult.Success();
        }
Example #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (string.IsNullOrEmpty(Request.QueryString["p"]))
            {
                Response.Redirect("Default.aspx");
            }

            MapDataSource.SelectParameters.Clear(); //Select
            MapDataSource.SelectParameters.Add("Question", Request.QueryString["p"]);
            DataSourceSelectArguments args = new DataSourceSelectArguments();
            DataView dv = (DataView)MapDataSource.Select(args);
            if (dv.Table.Rows[0]["Category"].ToString() != "Contest")
            {
                header.InnerHtml = "Edit Question: " + dv.Table.Rows[0]["Category"].ToString();
            }

            var    jss = new JavaScriptSerializer();
            string url = "http://2d73b8c2.problems.sphere-engine.com/api/v3/problems/" + Request.QueryString["p"] + "?access_token=" + token;
            response = client.DownloadString(url);
            var problemObj = jss.Deserialize <Dictionary <string, dynamic> >(response);
            qName.Value = problemObj["name"];
            var doc = new HtmlAgilityPack.HtmlDocument();
            doc.LoadHtml(problemObj["body"]);
            var            paragraphs = doc.DocumentNode.Descendants("p");
            HtmlTextArea[] textList   = { qText1, qText2, qText3, qText4, qText5 };
            int            index      = 0;
            foreach (var node in paragraphs)
            {
                textList[index++].Value = node.InnerHtml;
            }

            url      = "http://2d73b8c2.problems.sphere-engine.com/api/v3/problems/" + Request.QueryString["p"] + "/testcases?access_token=" + token;
            response = client.DownloadString(url);
            var testcaseObj = jss.Deserialize <Dictionary <string, dynamic> >(response);
            table.InnerHtml = "";
            foreach (var testcase in testcaseObj["testcases"])
            {
                table.InnerHtml +=
                    "<tr role=\"row\" class=\"gradeA odd\">" +
                    "<td class=\"sorting_1\">" +
                    testcase["number"] +
                    "</td>" +
                    "<td>" +
                    "<center><input type=\"checkbox\" " + (testcase["active"] == true ? "checked=\"checked\"" : "") + " runat=\"server\" onchange=\"javascript:updateActive()\"> </center> " +
                    "</td>" +
                    "<td>" +
                    testcase["limits"]["time"] + " Second" +
                    "</td>" +
                    "<td>" +
                    "<span><a class=\"btn btn-primary btn-block btn-outline\" href=\"javascript:__doPostBack('buttonTestEdit','" + testcase["number"] + "')\"><i class=\"fa fa-pencil-square-o\"></i></a></span>" +
                    "</td>" +
                    "</tr>";
            }
        }

        string ctrlName = Page.Request.Params.Get("__EVENTTARGET");

        if (!String.IsNullOrEmpty(ctrlName) && (ctrlName == "buttonUpdate" || ctrlName == "checkChange"))
        {
            var    jss  = new JavaScriptSerializer();
            string url  = "http://2d73b8c2.problems.sphere-engine.com/api/v3/problems/" + Request.QueryString["p"] + "?access_token=" + token;
            string body =
                "<p>" + qText1.Value.Replace("<p>", "").Replace("</p>", "") + "</p>" +
                "<h4>Input</h4>" +
                "<p>" + qText2.Value.Replace("<p>", "").Replace("</p>", "") + "</p>" +
                "<h4>Output</h4>" +
                "<p>" + qText3.Value.Replace("<p>", "").Replace("</p>", "") + "</p>" +
                "<h4>Example</h4>" +
                "<pre>" +
                "<strong>Input:</strong>" +
                "<p>" + qText4.Value.Replace("<p>", "").Replace("</p>", "") + "</p>" +
                "<strong>Output:</strong>" +
                "<p>" + qText5.Value.Replace("<p>", "").Replace("</p>", "") + "</p>" +
                "</pre>";

            string    activeString = "";
            string [] activeList   = Request.Cookies["activeTest"].Value.Split(',');
            foreach (string item in activeList)
            {
                activeString += item + ",";
            }
            if (activeString.Substring(activeString.Length - 1, 1) == ",")
            {
                activeString = activeString.Substring(0, activeString.Length - 1);
            }

            string jsonData = "{\"name\":\"" + qName.Value + "\" , \"activeTestcases\":\"" + activeString + "\" ,\"body\":" + jss.Serialize(body) + " }";

            client.Headers.Add("Content-Type", "application/json");
            try
            {
                response = client.UploadString(url, "PUT", jsonData);
                MapDataSource.UpdateParameters.Clear();
                MapDataSource.UpdateParameters.Add("QuestionName", qName.Value);
                MapDataSource.UpdateParameters.Add("Question", Request.QueryString["p"]);
                MapDataSource.Update();
                Response.Redirect(Request.RawUrl);
            }
            catch (WebException ex)
            {
                using (WebResponse response = ex.Response)
                {
                    using (Stream data = response.GetResponseStream())
                    {
                        StreamReader sr        = new StreamReader(data);
                        var          resultObj = jss.Deserialize <Dictionary <string, dynamic> >(sr.ReadToEnd());
                        labelResult.Visible   = true;
                        labelResult.InnerText = resultObj["message"];
                    }
                }
            }
        }
        else if (!String.IsNullOrEmpty(ctrlName) && ctrlName == "buttonCreate")
        {
            var    jss = new JavaScriptSerializer();
            string url = "http://2d73b8c2.problems.sphere-engine.com/api/v3/problems/" + Request.QueryString["p"] + "/testcases?access_token=" + token;
            client.Headers.Add("Content-Type", "application/json");
            response = client.UploadString(url, "POST");
            var numberObj = jss.Deserialize <Dictionary <string, dynamic> >(response);
            table.InnerHtml +=
                "<tr role=\"row\" class=\"gradeA odd\">" +
                "<td class=\"sorting_1\">" +
                numberObj["number"] +
                "</td>" +
                "<td>" +
                "<center><input type=\"checkbox\" runat=\"server\" checked=\"checked\" onchange=\"javascript:javascript:updateActive()\"></center>" +
                "</td>" +
                "<td>" +
                "1 Second" +
                "</td>" +
                "<td>" +
                "<span><a class=\"btn btn-primary btn-block btn-outline\" href=\"javascript:__doPostBack('buttonTestEdit','" + numberObj["number"] + "')\"><i class=\"fa fa-pencil-square-o\"></i></a></span>" +
                "</td>" +
                "</tr>";
        }
        else if (!String.IsNullOrEmpty(ctrlName) && ctrlName == "buttonTestEdit")
        {
            var    jss    = new JavaScriptSerializer();
            string testId = Page.Request.Params.Get("__EVENTARGUMENT");

            string url = "http://2d73b8c2.problems.sphere-engine.com/api/v3/problems/" + Request.QueryString["p"] + "/testcases/" + testId + "?access_token=" + token;
            response = client.DownloadString(url);
            var testcaseObj = jss.Deserialize <Dictionary <string, dynamic> >(response);
            editTime.Value = testcaseObj["limits"]["time"];

            editInput.Value  = client.DownloadString(testcaseObj["input"]["url"] + "?access_token=" + token);
            editOutput.Value = client.DownloadString(testcaseObj["output"]["url"] + "?access_token=" + token);

            labelIdTestcase.InnerText = " Test Case " + testId;
            divTestcase.Visible       = true;
        }
        else if (!String.IsNullOrEmpty(ctrlName) && ctrlName == "buttonApiUpdate")
        {
            var    jss    = new JavaScriptSerializer();
            string testId = labelIdTestcase.InnerText.Split(' ')[3];
            string url    = "http://2d73b8c2.problems.sphere-engine.com/api/v3/problems/" + Request.QueryString["p"] + "/testcases/" + testId + "?access_token=" + token;
            client.Headers.Add("Content-Type", "application/json");
            string jsonData = "{\"input\":" + jss.Serialize(editInput.InnerText) + ",\"output\":" + jss.Serialize(editOutput.InnerText) + ",\"timelimit\":" + jss.Serialize(editTime.Value) + "}";
            try
            {
                response = client.UploadString(url, "PUT", jsonData);
                Response.Redirect(Request.RawUrl);
            }
            catch (WebException ex)
            {
                using (WebResponse response = ex.Response)
                {
                    using (Stream data = response.GetResponseStream())
                    {
                        StreamReader sr        = new StreamReader(data);
                        var          resultObj = jss.Deserialize <Dictionary <string, dynamic> >(sr.ReadToEnd());
                        labelUpdate.Visible   = true;
                        labelUpdate.InnerText = resultObj["message"];
                    }
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        labelMessage.InnerText = "";
        if (!Page.IsPostBack)
        {
            checkboxCategory.Checked = true;
            DataView dv = (DataView)MapDataSource.Select(new DataSourceSelectArguments());
            foreach (System.Data.DataRow row in dv.Table.Rows)
            {
                dropdownCategory.Items.Add(row["Category"].ToString());
            }
            dropdownCategory.SelectedIndex = 0;
            textQcategory.Value            = dropdownCategory.Value;
        }

        string ctrlName = Page.Request.Params.Get("__EVENTTARGET");

        if (!String.IsNullOrEmpty(ctrlName) && ctrlName == "dropdownSize")
        {
            DataPager1.PageSize = Convert.ToInt32(dropdownSize.Value);
        }
        else if (!String.IsNullOrEmpty(ctrlName) && ctrlName == "dropdownCategory" && checkboxCategory.Checked)
        {
            textQcategory.Value = dropdownCategory.Value;
        }
        else if (!String.IsNullOrEmpty(ctrlName) && ctrlName == "checkboxCategory")
        {
            if (checkboxCategory.Checked)
            {
                textQcategory.Disabled = true;
                textQcategory.Value    = dropdownCategory.Value;
            }
            else
            {
                textQcategory.Disabled = false;
                textQcategory.Value    = "";
            }
        }
        else if (!String.IsNullOrEmpty(ctrlName) && ctrlName == "buttonCreate")
        {
            if (textQcategory.Value != "" && textQcode.Value != "" && textQname.Value != "")
            {
                labelMessage.InnerText = createQuestion();
            }
            else
            {
                labelMessage.InnerText = "Invalid or missing fields";
            }
        }
        else if (!String.IsNullOrEmpty(ctrlName) && ctrlName == "delete")
        {
            string question = Request["__EVENTARGUMENT"];
            QuestionDataSource.DeleteParameters.Clear();
            QuestionDataSource.DeleteParameters.Add("Question", question);
            QuestionDataSource.Delete();
            if (DataPager1.TotalRowCount == 1)
            {
                dropdownCategory.Items.RemoveAt(dropdownCategory.SelectedIndex);
            }
            ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "DoPostBack", "__doPostBack('dropdownCategory','')", true);
        }

        QuestionDataSource.SelectParameters.Clear();
        QuestionDataSource.SelectParameters.Add("Category", dropdownCategory.Value);
        QuestionDataSource.SelectParameters.Add("QuestionName", "%" + search.Value + "%");
        ListView1.DataSource = QuestionDataSource;
        ListView1.DataBind();

        int CurrentPage = ((DataPager1.StartRowIndex) / DataPager1.MaximumRows) + 1;

        recordCount.InnerHtml = "Showing " + (DataPager1.StartRowIndex + 1) + " to " + (DataPager1.StartRowIndex + DataPager1.PageSize) + " of " + DataPager1.TotalRowCount + " entries";
    }
Example #8
0
 private void viewMatrixButton_Click(object sender, RoutedEventArgs e)
 {
     MapDataSource.ShowDistanceMatrixDialog();
 }
Example #9
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (string.IsNullOrEmpty(Request.QueryString["p"]))
            {
                DataView dv = (DataView)MapDataSource.Select(new DataSourceSelectArguments());
                foreach (System.Data.DataRow row in dv.Table.Rows)
                {
                    dropdownCategory.Items.Add(row["Category"].ToString());
                }
                dropdownCategory.SelectedIndex = 0;
                if (!string.IsNullOrEmpty(Request.QueryString["c"]))
                {
                    dropdownCategory.SelectedIndex = dropdownCategory.Items.IndexOf(new ListItem(Request.QueryString["c"]));
                }
            }
            else
            {
                CategoryDataSource.SelectParameters.Clear();
                CategoryDataSource.SelectParameters.Add("Question", Request.QueryString["p"]);
                DataView dv = (DataView)CategoryDataSource.Select(new DataSourceSelectArguments());
                if (dv.Table.Rows.Count > 0)
                {
                    labelCategory.InnerHtml = "Category: <a href='Leaderboard.aspx?c=" + dv.Table.Rows[0]["Category"] + "'>" + dv.Table.Rows[0]["Category"] + "</a> <br />Question: " + dv.Table.Rows[0]["QuestionName"];
                }
                else
                {
                    labelCategory.InnerHtml = "Question Not Found";
                }
            }
        }

        LeaderDataSource.SelectParameters.Clear();
        if (string.IsNullOrEmpty(Request.QueryString["p"]))
        {
            LeaderDataSource.SelectParameters.Add("Category", dropdownCategory.Value);
        }
        else
        {
            LeaderDataSource.SelectCommand =
                "SELECT* FROM ( SELECT ROW_NUMBER() OVER( ORDER BY Submission.Score DESC) AS Rank, Submission.Language AS Language, Submission.Username AS Username, Submission.Score AS Score " +
                "FROM Map INNER JOIN Submission ON Map.Question = Submission.Question " +
                "WHERE (Map.Question = @Question)) a " +
                "WHERE a.Username LIKE @Username";
            LeaderDataSource.SelectParameters.Add("Question", Request.QueryString["p"]);
        }

        string ctrlName = Page.Request.Params.Get("__EVENTTARGET");

        if (!String.IsNullOrEmpty(ctrlName) && ctrlName == "dropdownSize")
        {
            DataPager1.PageSize = Convert.ToInt32(dropdownSize.Value);
        }

        LeaderDataSource.SelectParameters.Add("Username", "%" + search.Value + "%");
        ListView1.DataSource = LeaderDataSource;
        ListView1.DataBind();

        int CurrentPage = ((DataPager1.StartRowIndex) / DataPager1.MaximumRows) + 1;

        recordCount.InnerHtml = "Showing " + (DataPager1.StartRowIndex + 1) + " to " + (DataPager1.StartRowIndex + DataPager1.PageSize) + " of " + DataPager1.TotalRowCount + " entries";
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            if (string.IsNullOrEmpty(Request.QueryString["c"]))
            {
                Response.Redirect("Default.aspx");
            }

            DataSourceSelectArguments args = new DataSourceSelectArguments();
            MapDataSource.SelectParameters.Add("Category", Request.QueryString["c"]);
            DataView dvMap = (DataView)MapDataSource.Select(args);

            DataView dvSubmission;
            string   score;

            foreach (System.Data.DataRow row in dvMap.Table.Rows)
            {
                SubmissionSource.SelectParameters.Clear();
                SubmissionSource.SelectParameters.Add("Question", row["Question"].ToString());
                SubmissionSource.SelectParameters.Add("Username", Membership.GetUser().UserName);
                dvSubmission = (DataView)SubmissionSource.Select(args);
                string theme = "danger";
                score = "";
                int value = 0;
                if (dvSubmission.Table.Rows.Count > 0)
                {
                    score = "Score: " + dvSubmission.Table.Rows[0]["Score"].ToString() + "/100";
                    value = Convert.ToInt32(dvSubmission.Table.Rows[0]["Score"]);
                    if (value == 100)
                    {
                        theme = "success";
                    }
                    else if (value >= 50)
                    {
                        theme = "info";
                    }
                    else
                    {
                        theme = "warning";
                    }
                }
                populate.InnerHtml +=
                    "<div class=\"col-lg-4\">" +
                    "<div class=\"panel panel-" + theme + "\">" +
                    "<div class=\"panel-heading\"><label>" +
                    row["QuestionName"].ToString() +
                    "</label></div>" +
                    "<div class=\"panel-body\">" +
                    "<div class=\"progress progress-striped active\">" +
                    "<div class=\"progress-bar progress-bar-" + theme + "\" role=\"progressbar\" aria-valuenow=\"" + value + "\" aria-valuemin=\"0\" aria-valuemax=\"100\" style=\"width:" + value + "%\">" +
                    "<span class=\"sr-only\"><span>" + score + "</span>% Complete (success)</span>" +
                    "</div>" +
                    "</div>" +

                    "<button onclick=\"location.href=\'Challange.aspx?p=" + row["Question"].ToString() + "'\" type=\"button\" class=\"btn btn-" + theme + "\" style=\"float:right;\">Go to Question</button>" +
                    "<h5 style=\"font-weight:bold\">" + score + "</h5>" +
                    "</div>" +
                    "<div class=\"panel-footer\" style=\"overflow:hidden;\">" +
                    "<button onclick=\"location.href=\'Leaderboard.aspx?p=" + row["Question"].ToString() + "'\" type=\"button\" class=\"btn btn-outline btn-" + theme + "\">Leaderboard</button>" +
                    "</div>" +
                    "</div>" +
                    "</div>";

                /*
                 * */
            }
        }
    }