예제 #1
0
        public static ResponseObject GetAll()
        {
            ResponseObject responseObj = new ResponseObject();

            try
            {
                responseObj.Data = Convert.ToString(Utills.ReadStream(Config.JsonRepoDir));
            }
            catch (Exception ex)
            {
                Log.WriteEx(ex);
                responseObj.ErrObj = new ErrorObject()
                {
                    IsError    = true,
                    ErrMessage = "Error Occured!"
                };
            }

            return(responseObj);
        }
예제 #2
0
        private bool CheckUnaryOp(Position pos)
        {
            Position prevPos = pos - 1;

            // If <UnaryOp> is a first character
            if (prevPos.IsBegin)
            {
                return(true);
            }

            // If <UnaryOp> located after the left bracket ')'
            if (Utills.Check(pos - 1, lbracketPr) &&
                Tables.UnaryOperatorsPriorityTable.ContainsKey(pos.Current))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
 public void UpdateHolidaysTime()
 {
     foreach (EmployeeWeek week in _ActualWorldState.List)
     {
         foreach (EmployeeDay day in week.DaysList)
         {
             if (day.TimeList != null && day.TimeList.Count > 0)
             {
                 foreach (EmployeeTimeRange timerange in day.TimeList)
                 {
                     if (!timerange.IsWorkingRange)
                     {
                         if (timerange.Absence != null && timerange.Absence.AbsenceTypeID == AbsenceType.Holiday)
                         {
                             timerange.Time = Utills.GetEntityTime(timerange.Absence, timerange.Begin, timerange.End, week.ContractHoursPerWeek, StoreDays.AvgDayInWeek);
                         }
                     }
                 }
             }
         }
     }
 }
예제 #4
0
        public override IToken TakeToken(Position pos)
        {
            if (Check(pos))
            {
                Position start = new Position(pos);

                // Main part of the number
                Utills.MoveWhile(pos, digitPr);

                // Fraction part of the number
                Utills.MoveWhile(pos, numSeparatorPr);
                Utills.MoveWhile(pos, digitPr);

                return(new NumberToken(Position.CreateString(start, pos)));
            }
            else
            {
                Exception ex = new Exception("Cannot take the token");
                ex.Source = "NumberReader";

                throw ex;
            }
        }
예제 #5
0
        public static string SetEditorChoiceFromMemberProfile(int id = 0)
        {
            var currentMember = Utills.GetMember(id == 0 ? Member.CurrentMemberId() : id);

            var editorChoice = EditorChoiceRte;

            if (currentMember != null)
            {
                var markdownEditorProperty = currentMember.getProperty(UseMarkdownEditorPropertyAlias);

                if (markdownEditorProperty != null)
                {
                    if (markdownEditorProperty.Value.ToString() == "1")
                    {
                        editorChoice = EditorChoiceMarkdown;
                    }
                }
            }

            SetEditorChoiceCookie(editorChoice);

            return(editorChoice);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (umbraco.library.IsLoggedOn() && int.TryParse(Request.QueryString["id"], out pageId))
            {
                Member   mem = Member.GetCurrentMember();
                Document d   = new Document(pageId);

                if ((d.getProperty("owner") != null && d.getProperty("owner").Value.ToString() == mem.Id.ToString()) ||
                    Utills.IsProjectContributor(mem.Id, pageId))
                {
                    holder.Visible = true;
                    RebindFiles();

                    umbraco.library.RegisterJavaScriptFile("swfUpload", "/scripts/swfupload/SWFUpload.js");
                    umbraco.library.RegisterJavaScriptFile("swfUpload_cb", "/scripts/swfupload/callbacks.js");
                    umbraco.library.RegisterJavaScriptFile("swfUpload_progress", "/scripts/swfupload/fileprogress.js");

                    MemberGuid  = mem.UniqueId.ToString();
                    VersionGuid = d.Version.ToString();

                    string defaultVersion = uWiki.Businesslogic.UmbracoVersion.DefaultVersion().Version;
                    string options        = "";

                    foreach (uWiki.Businesslogic.UmbracoVersion uv in uWiki.Businesslogic.UmbracoVersion.AvailableVersions().Values)
                    {
                        string selected = "selected='true'";
                        if (uv.Version != defaultVersion)
                        {
                            selected = "";
                        }
                        options += string.Format("<option value='{0}' {2}>{1}</option>", uv.Version, uv.Name, selected);
                    }

                    lt_versions.Text = options;
                }
            }
        }
예제 #7
0
        protected void saveProject(object sender, CommandEventArgs e)
        {
            Member   m = Member.GetCurrentMember();
            Document d;

            if (e.CommandName == "save")
            {
                int pId = int.Parse(e.CommandArgument.ToString());

                d = new Document(pId);

                if ((int)d.getProperty("owner").Value == m.Id || Utills.IsProjectContributor(m.Id, d.Id))
                {
                    d.Text = tb_name.Text;
                    d.getProperty("version").Value     = tb_version.Text;
                    d.getProperty("description").Value = tb_desc.Text;

                    d.getProperty("stable").Value = cb_stable.Checked;
                    d.getProperty("status").Value = tb_status.Text;

                    d.getProperty("demoUrl").Value    = tb_demoUrl.Text;
                    d.getProperty("sourceUrl").Value  = tb_sourceUrl.Text;
                    d.getProperty("websiteUrl").Value = tb_websiteUrl.Text;

                    d.getProperty("vendorUrl").Value = tb_purchaseUrl.Text;

                    d.getProperty("licenseUrl").Value  = tb_licenseUrl.Text;
                    d.getProperty("licenseName").Value = tb_license.Text;

                    d.getProperty("file").Value = dd_package.SelectedValue;
                    d.getProperty("defaultScreenshot").Value = dd_screenshot.SelectedValue;


                    if (dd_screenshot.SelectedIndex > -1)
                    {
                        d.getProperty("defaultScreenshotPath").Value = new uWiki.Businesslogic.WikiFile(int.Parse(dd_screenshot.SelectedValue)).Path;
                    }
                    else
                    {
                        d.getProperty("defaultScreenshotPath").Value = "";
                    }

                    if (Request["projecttags[]"] != null)
                    {
                        Rest.Tagger.SetTags(d.Id.ToString(), "project", Request["projecttags[]"].ToString());
                    }


                    Node category = new Node(int.Parse(dd_category.SelectedValue));

                    //if we have a proper category, move the package
                    if (category != null && category.NodeTypeAlias == "ProductGroup")
                    {
                        ;
                    }
                    {
                        if (d.Parent.Id != category.Id)
                        {
                            d.Move(category.Id);
                        }
                    }


                    if (d.getProperty("packageGuid") == null || string.IsNullOrEmpty(d.getProperty("packageGuid").Value.ToString()))
                    {
                        d.getProperty("packageGuid").Value = Guid.NewGuid().ToString();
                    }

                    d.Save();
                    d.Publish(new umbraco.BusinessLogic.User(0));

                    umbraco.library.UpdateDocumentCache(d.Id);
                    umbraco.library.RefreshContent();
                }
            }
            else
            {
                d = Document.MakeNew(tb_name.Text, new DocumentType(TypeId), new umbraco.BusinessLogic.User(0), RootId);

                d.getProperty("version").Value     = tb_version.Text;
                d.getProperty("description").Value = tb_desc.Text;

                d.getProperty("stable").Value = cb_stable.Checked;

                d.getProperty("demoUrl").Value    = tb_demoUrl.Text;
                d.getProperty("sourceUrl").Value  = tb_sourceUrl.Text;
                d.getProperty("websiteUrl").Value = tb_websiteUrl.Text;

                d.getProperty("licenseUrl").Value  = tb_licenseUrl.Text;
                d.getProperty("licenseName").Value = tb_license.Text;

                d.getProperty("vendorUrl").Value = tb_purchaseUrl.Text;

                //d.getProperty("file").Value = dd_package.SelectedValue;
                d.getProperty("owner").Value       = m.Id;
                d.getProperty("packageGuid").Value = Guid.NewGuid().ToString();

                if (Request["projecttags[]"] != null)
                {
                    Rest.Tagger.SetTags(d.Id.ToString(), "project", Request["projecttags[]"].ToString());
                    d.getProperty("tags").Value = Request["projecttags[]"].ToString();
                }

                Node category = new Node(int.Parse(dd_category.SelectedValue));

                //if we have a proper category, move the package
                if (category != null && category.NodeTypeAlias == "ProductGroup")
                {
                    ;
                }
                {
                    if (d.Parent.Id != category.Id)
                    {
                        d.Move(category.Id);
                    }
                }

                d.Save();

                d.Publish(new umbraco.BusinessLogic.User(0));
                umbraco.library.UpdateDocumentCache(d.Id);

                umbraco.library.RefreshContent();
            }

            Response.Redirect(umbraco.library.NiceUrl(GotoOnSave));
        }
예제 #8
0
 public override bool Check(Position pos)
 {
     return(Utills.Check(pos, digitPr));
 }
예제 #9
0
 public FullApiController()
 {
     Functional = new Functional(pathToConfigs);
     Utills     = new Utills(pathToConfigs);
 }
예제 #10
0
파일: Log.cs 프로젝트: ZisoF/PublicProjects
 public static void WriteEx(Exception ex)
 {
     Utills.WriteStream(Config.LogFileDir, string.Format("date: {0}; Msg: {1}; ExMsg: {2}; Source: {3}", DateTime.Now, ex.Message, ex.InnerException, ex.Source));
 }
예제 #11
0
 public EmlpoyeeHolidaysSumDays(EmlpoyeeHolidaysSumInfo info)
 {
     EmployeeID    = info.EmployeeID;
     TimePlanning  = Utills.ToDays(info.TimePlanning);
     TimeRecording = Utills.ToDays(info.TimeRecording);
 }
예제 #12
0
 public override bool Check(Position pos)
 {
     return(Utills.Check(pos, beginVarPr));
 }
예제 #13
0
        public override void run(Function f, Parameters parameters)
        {
            // Get input parameters
            Vector startPoint      = parameters.Input.StartPoint;
            double eps             = parameters.Input.Eps;
            double stepValue       = parameters.Input.StepValue;
            double stepCoefficient = parameters.Input.StepCoefficient;
            int    iterationLimit  = parameters.Input.IterationLimit;

            // Set start step
            double startStep = stepValue;

            double norm = startPoint.Norm;

            if (norm != 0)
            {
                startStep *= norm;
            }

            // Build the system of coordinate orts
            Vector[] orts       = new Vector[f.Dimension];
            Vector   nullVector = new Vector(new double[f.Dimension]);

            for (int i = 0; i < f.Dimension; i++)
            {
                Vector ort = new Vector(nullVector);
                ort[i] = 1;

                orts[i] = ort;
            }

            Vector x1 = startPoint, x2, x3, x4;
            double currentStep = startStep;
            int    counter     = 0;

            do
            {
                // Exploratory Search - 1
                Vector point1;
                Vector point2;
                Vector minPoint;
                do
                {
                    minPoint = x1;

                    for (int i = 0; i < orts.Length; i++)
                    {
                        point1 = minPoint - currentStep * orts[i];
                        point2 = minPoint + currentStep * orts[i];

                        minPoint = Utills.MinArg(f, point1, minPoint, point2);
                    }

                    // Step division
                    if (x1 == minPoint)
                    {
                        currentStep /= stepCoefficient;
                    }
                }while (currentStep > eps && x1 == minPoint);

                x2 = minPoint;

                // Success
                if (currentStep <= eps)
                {
                    break;
                }

                do
                {
                    // Accelerated Search
                    x3 = 2 * x2 - x1;

                    // Exploratory Search - 2
                    minPoint = x2;
                    Vector basePoint = x3;

                    for (int i = 0; i < orts.Length; i++)
                    {
                        point1 = basePoint - currentStep * orts[i];
                        point2 = basePoint + currentStep * orts[i];

                        minPoint = Utills.MinArg(f, point1, minPoint, point2);

                        if (minPoint != x2)
                        {
                            basePoint = minPoint;
                        }
                    }

                    x4 = minPoint;

                    // Failure
                    if (minPoint == x2)
                    {
                        x1 = x2;
                        break;
                    }
                    // Success
                    else
                    {
                        x1 = x2;
                        x2 = x4;
                    }
                }while (true);

                counter++;
            }while (counter < iterationLimit);

            // Set output parameters
            parameters.Output.ResultPoint = x1;
            parameters.Output.Iterations  = counter;
        }
예제 #14
0
 public override bool Check(Position pos)
 {
     return(Utills.Check(pos, semicolonPr));
 }
예제 #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            umbraco.library.RegisterJavaScriptFile("tinyMce", "/scripts/tiny_mce/tiny_mce_src.js");


            if (!Page.IsPostBack)
            {
                int pId = 0;

                Member m = Member.GetCurrentMember();

                if (m.Groups.ContainsKey(MemberGroup.GetByName("Vendor").Id))
                {
                    p_purchaseUrl.Visible = true;
                    d_notice.Visible      = false;
                }


                string            taglist = string.Empty;
                XPathNodeIterator tags    = umbraco.editorControls.tags.library.getAllTagsInGroup("project").Current.Select("./tags/tag");

                while (tags.MoveNext())
                {
                    taglist += "\"" + tags.Current.Value + "\",";
                }

                bool hideHq = true;
                if (m.Groups.ContainsKey(MemberGroup.GetByName("HQ").Id))
                {
                    hideHq = false;
                }

                List <uRepo.Category> categories = uRepo.Packages.Categories(false, hideHq);
                dd_category.Items.Add(new ListItem("Please select...", ""));

                foreach (uRepo.Category c in categories)
                {
                    dd_category.Items.Add(new ListItem(c.Text, c.Id.ToString()));
                }

                ScriptManager.RegisterStartupScript(
                    this,
                    this.GetType(),
                    "inittagsuggest",
                    " $(document).ready(function() { $('#projecttagger').autocomplete([" + taglist + "],{max: 8,scroll: true,scrollHeight: 300}); enableTagger();});",
                    true);


                if (!string.IsNullOrEmpty(Request.QueryString["id"]) && int.TryParse(Request.QueryString["id"], out pId) && umbraco.library.IsLoggedOn())
                {
                    Document d = new Document(pId);

                    if ((int)d.getProperty("owner").Value == m.Id || Utills.IsProjectContributor(m.Id, d.Id))
                    {
                        lt_title.Text = "Edit project";

                        bt_submit.CommandName     = "save";
                        bt_submit.CommandArgument = d.Id.ToString();

                        tb_name.Text    = d.Text;
                        tb_version.Text = d.getProperty("version").Value.ToString();
                        tb_desc.Text    = d.getProperty("description").Value.ToString();

                        cb_stable.Checked = (d.getProperty("stable").Value.ToString() == "1");
                        tb_status.Text    = d.getProperty("status").Value.ToString();

                        tb_demoUrl.Text    = d.getProperty("demoUrl").Value.ToString();
                        tb_sourceUrl.Text  = d.getProperty("sourceUrl").Value.ToString();
                        tb_websiteUrl.Text = d.getProperty("websiteUrl").Value.ToString();

                        tb_licenseUrl.Text = d.getProperty("licenseUrl").Value.ToString();
                        tb_license.Text    = d.getProperty("licenseName").Value.ToString();

                        tb_purchaseUrl.Text = d.getProperty("vendorUrl").Value.ToString();

                        dd_category.SelectedValue = d.Parent.Id.ToString();

                        List <uWiki.Businesslogic.WikiFile> Files = uWiki.Businesslogic.WikiFile.CurrentFiles(d.Id);


                        bool hasScreenshots = false;
                        if (Files.Count > 0)
                        {
                            foreach (uWiki.Businesslogic.WikiFile f in Files)
                            {
                                if (f.FileType != "screenshot")
                                {
                                    dd_package.Items.Add(new ListItem(f.Name, f.Id.ToString()));
                                }
                                else
                                {
                                    dd_screenshot.Items.Add(new ListItem(f.Name, f.Id.ToString()));
                                    hasScreenshots = true;
                                }
                            }

                            dd_package.SelectedValue = d.getProperty("file").Value.ToString();

                            p_file.Visible = true;
                        }
                        else
                        {
                            p_file.Visible = false;
                        }

                        p_screenshot.Visible = false;

                        if (hasScreenshots)
                        {
                            p_screenshot.Visible        = true;
                            dd_screenshot.SelectedValue = d.getProperty("defaultScreenshot").Value.ToString();
                        }
                        else
                        {
                            p_screenshot.Visible = false;
                        }



                        List <ITag> projecttags = umbraco.editorControls.tags.library.GetTagsFromNodeAsITags(pId);

                        if (projecttags.Count > 0)
                        {
                            string stags = string.Empty;
                            foreach (ITag tag in projecttags)
                            {
                                stags += tag.TagCaption + ",";
                            }

                            stags = stags.Substring(0, stags.Length - 1);

                            ScriptManager.RegisterStartupScript(
                                this,
                                this.GetType(),
                                "inittags",
                                " $(document).ready(function() {$('#projecttagger').addTag('" + stags + "');});",
                                true);
                        }
                    }
                }
                else
                {
                    p_screenshot.Visible = false;
                    p_file.Visible       = false;
                    lt_title.Text        = "Create new project";
                }
            }
        }
예제 #16
0
 public override bool Check(Position pos)
 {
     return(Utills.Check(pos, rbracketPr));
 }
예제 #17
0
 public override bool Check(Position pos)
 {
     return(!(Utills.Check(pos, notErrorPr)));
 }
예제 #18
0
        private async void TrainButtonClick(object sender, EventArgs e)
        {
            if (Controller.File == null)
            {
                BrakPlikuMessageBox();
                return;
            }

            switch (KlasyfikatorComboBox.SelectedIndex)
            {
            //2plik = 0.056 4plik = 0.066 [300k points]
            case 0:
                DisableChangeButtons();
                await Task.Run(() =>
                {
                    KNNClassifier = new KnnAccordClassifier(3);
                    if (!KNNClassifier.CanClassify)
                    {
                        var pointsToTrain     = Utills.GenerateClassArray(Controller.File.LasPointDataRecords, 0.066);
                        var inputOutputArrays = KnnAccordClassifier.MakeInputOutputs(pointsToTrain, Controller.File);
                        KNNClassifier.Teach(inputOutputArrays.Item1, inputOutputArrays.Item2);
                    }
                });

                EnableChangeButtons();
                break;

            case 1:
                DisableChangeButtons();
                await Task.Run(() =>
                {
                    ENNetwork = new EncogNeuralNetwork(Controller.File);
                });

                EnableChangeButtons();
                break;

            case 2:
                DisableChangeButtons();
                await Task.Run(() =>
                {
                    KNNClassifierQuick = new KnnAccordClassifierQuick(3);
                    if (!KNNClassifierQuick.CanClassify)
                    {
                        var inputOutputArrays =
                            KnnAccordClassifierQuick.MakeInputOutputs(Utills.GroupPointsList(
                                                                          Controller.File, OpenGlController.divisionCountX, OpenGlController.divisionCountY));
                        KNNClassifierQuick.TeachGroups(inputOutputArrays.Item1, inputOutputArrays.Item2);
                    }
                });

                EnableChangeButtons();
                break;

            case 3:
                DisableChangeButtons();
                await Task.Run(() =>
                {
                    ENNetworkQ = new EncogNeuralNetworkQuick(Controller.File, OpenGlController.divisionCountX, OpenGlController.divisionCountY);
                });

                EnableChangeButtons();
                break;

            case 4:
                DisableChangeButtons();
                await Task.Run(() =>
                {
                    KNNClassifierSlow = new KnnAccordClassifierSlow(3);
                    if (!KNNClassifierSlow.CanClassify)
                    {
                        var pointsToTrain     = Utills.GenerateClassArray(Controller.File.LasPointDataRecords, 0.10);
                        var inputOutputArrays = KnnAccordClassifierSlow.MakeInputOutputs(pointsToTrain, Controller.File);
                        KNNClassifierSlow.Teach(inputOutputArrays.Item1, inputOutputArrays.Item2);
                    }
                });

                EnableChangeButtons();
                break;

            case 5:
                DisableChangeButtons();
                await Task.Run(() =>
                {
                    ENNetworkS = new EncogNeuralNetworkSlow(Controller.File);
                });

                EnableChangeButtons();
                break;
            }
            KoniecTreninguMessageBox();
        }
예제 #19
0
 public HomeController()
 {
     Functional = new Functional(pathToConfigs);
     Utills     = new Utills(pathToConfigs);
 }