public void GlobalsBeforeLocals() { string text = "x = 1 x = x + 1 local x x = 2"; Classification[] expectedClassifications = new Classification[5] { Classification.Global, Classification.Global, Classification.Global, Classification.Local, Classification.Local }; string[] expectedStrings = new string[5] { "x", "x", "x", "x", "x" }; ClassificationAndOrderTest(text, expectedClassifications, expectedStrings); }
public void ParamsBeforeLocals() { string text = "foo = function(x) x = 2 local x x = 2 end"; Classification[] expectedClassifications = new Classification[5] { Classification.Global, Classification.ParameterReference, Classification.ParameterReference, Classification.Local, Classification.Local }; string[] expectedStrings = new string[5] { "foo", "x", "x", "x", "x" }; ClassificationAndOrderTest(text, expectedClassifications, expectedStrings); }
static void Main(string[] args) { TrimApplication.Initialize(); using(Database db = new Database()) { for (int i = 0; i < 94; i++) { if (i == 98) { var sdsds = "ewrwer"; } //Classification cl = new Classification(db, 9144); Classification par = new Classification(db, 9144); Classification c = new Classification(db); c = par.NewLowerLevel(); c.Name = "EPL Test " + Guid.NewGuid().ToString(); c.RecordPattern = "/gggg"; c.LevelNumber = "/" + nextnumber().ToString().PadLeft(4, '0'); c.Save(); } } //List<int> test = new List<int>(); //for (int i = 1; i < 105; i++) //{ // int ibla = i * 10; // test.Add(ibla); // Console.WriteLine("Max test: " + test.Max().ToString() + " Last test: " + test.Last().ToString()); //} }
protected virtual void CollapseClassificationTypes() { Classification c = new Classification(dataSet, visibleTables); c.CalculateHierarquies(); List<List<string>> maximal = c.MaximalStringHierarchies; foreach (List<string> hierarchy in maximal) { foreach (string table in hierarchy) { string newTable = table; if (table.IndexOf("(") != -1) newTable = table.Substring(0, table.IndexOf("(")); if (entityTypes[newTable] > EntityTypes.ClassificationEntity) continue; if (dataSet.Tables.Contains(newTable)) { Collapse cp = new Collapse(dataSet, newTable, new List<string>(), VisibleTables); dataSet = cp.GetResult(); } } } }
{ public enum Classification { Freshman, Sophomore } private Classification classification; private string guardianFirstName; private string guardianLastName; private string guardianAddress;
public override DataSet DeriveModel() { Classification c = new Classification(dataSet, visibleTables); c.CalculateHierarquies(); List<List<string>> maximal = c.MaximalStringHierarchies; foreach (List<string> hierarchy in maximal) { foreach (string table in hierarchy) { string newTable = table; if (table.IndexOf("(") != -1) newTable = table.Substring(0, table.IndexOf("(")); if (entityTypes[newTable] == EntityTypes.TransactionEntity) continue; if (dataSet.Tables.Contains(newTable)) { Collapse cp = new Collapse(dataSet, newTable, new List<string>(), visibleTables); dataSet = cp.GetResult(); visibleTables = cp.VisibleTables; } } } return dataSet; }
public void RefreshHierarquies(string dataset, Classification c) { c.CalculateHierarquies(); treeView1.Nodes[0].Nodes[0].Nodes.Clear(); TreeNode minimal = treeView1.Nodes[0].Nodes[0].Nodes.Add("Minimal Entities"); foreach (string str in c.MinimalStringEntities) minimal.Nodes.Add(str); TreeNode maximal = treeView1.Nodes[0].Nodes[0].Nodes.Add("Maximal Entities"); foreach (string str in c.MaximalStringEntities) maximal.Nodes.Add(str); List<List<string>> maximalHierarchies = c.MaximalStringHierarchies; int count = 1; TreeNode maxNode = treeView1.Nodes[0].Nodes[0].Nodes.Add("Maximal Hierarchies"); foreach (List<string> hierarchy in maximalHierarchies) { TreeNode node = maxNode.Nodes.Add("Maximal Hierarchy #" + count++); foreach (string table in hierarchy) node.Nodes.Add(table); } treeView1.ExpandAll(); maxNode.Collapse(); }
internal DialogResult ShowDialog(out Classification classification, out Importance importance, out bool infobox, out bool attention, out bool needsPhoto, string title) { Text += ": " + title; var ret = ShowDialog(); if (ClassCheckedListBox.SelectedIndices.Count == 0) { classification = Classification.Unassessed; } else { classification = (Classification) ClassCheckedListBox.SelectedIndex; } if (ImportanceCheckedListBox.SelectedIndices.Count == 0) { importance = Importance.Unassessed; } else { importance = (Importance) ImportanceCheckedListBox.SelectedIndex; } infobox = (SettingsCheckedListBox.GetItemCheckState(0) == CheckState.Checked); attention = (SettingsCheckedListBox.GetItemCheckState(1) == CheckState.Checked); needsPhoto = (SettingsCheckedListBox.GetItemCheckState(2) == CheckState.Checked); return ret; }
public void BasicParams() { string text = "function foo(x) x = 1 end"; Classification[] expectedClassifications = new Classification[3] { Classification.Global, Classification.ParameterReference, Classification.ParameterReference }; string[] expectedStrings = new string[3] { "foo", "x", "x" }; ClassificationAndOrderTest(text, expectedClassifications, expectedStrings); }
public void BasicFields() { string text = "t = { hello = world, something, [here] = there }"; Classification[] expectedClassifications = new Classification[6] { Classification.Global, Classification.Field, Classification.Global, Classification.Global, Classification.Global, Classification.Global }; string[] expectedString = new string[6] { "t", "hello", "world", "something", "here", "there" }; ClassificationAndOrderTest(text, expectedClassifications, expectedString); }
public TimeToken(int minutes) { if (minutes < 10) classification = Classification.Quick; else if (minutes < 30) classification = Classification.Medium; else if (minutes <= 60) classification = Classification.Long; else classification = Classification.SuperLong; }
public void BasicGlobals() { string text = "foo = 1"; Classification[] expectedClassifications = new Classification[1] { Classification.Global }; string[] expectedStrings = new string[1] { "foo" }; ClassificationAndOrderTest(text, expectedClassifications, expectedStrings); }
public void BasicLocals() { string text = @"local x x = 1"; Classification[] expectedClassifications = new Classification[2] { Classification.Local, Classification.Local }; string[] expectedStrings = new string[2] { "x", "x" }; ClassificationAndOrderTest(text, expectedClassifications, expectedStrings); }
public bool CheckDataAndCodeIfExist(Classification entity) { if (CheckDataIfExists(entity) || CheckDataIfExists(entity.Code)) { return true; } return false; }
public static IList<string> GetDomains(this IEnumerable<MailBounced> target, Classification classificatioType) { return target .Where(x => x.Classification.Type == classificatioType) .Where(x => x.Domain.HasValue()) .Select(x => x.Domain) .ToList(); }
protected internal bool ProcessTalkPage(Article A, Classification Classification, Importance Importance, bool ForceNeedsInfobox, bool ForceNeedsAttention, bool RemoveAutoStub, ProcessTalkPageMode ProcessTalkPageMode, bool AddReqPhotoParm) { bool BadTemplate = false; bool res = false; article = A; if (SkipIfContains()) { A.PluginIHaveFinished(SkipResults.SkipRegex, PluginShortName); } else { // MAIN string OriginalArticleText = A.AlteredArticleText; Template = new Templating(); A.AlteredArticleText = MainRegex.Replace(A.AlteredArticleText, MatchEvaluator); if (Template.BadTemplate) { BadTemplate = true; } else if (Template.FoundTemplate) { // Even if we've found a good template bizarrely the page could still contain a bad template too if (SecondChanceRegex.IsMatch(A.AlteredArticleText) || TemplateFound()) { BadTemplate = true; } } else { if (SecondChanceRegex.IsMatch(OriginalArticleText)) { BadTemplate = true; } else if (ForceAddition) { TemplateNotFound(); } } // OK, we're in business: res = true; if (HasReqPhotoParam && AddReqPhotoParm) { ReqPhoto(); } ProcessArticleFinish(); if (ProcessTalkPageMode != ProcessTalkPageMode.Normal) { ProcessArticleFinishNonStandardMode(Classification, Importance, ForceNeedsInfobox, ForceNeedsAttention, RemoveAutoStub, ProcessTalkPageMode); } if (article.ProcessIt) { TemplateWritingAndPlacement(); } else { A.AlteredArticleText = OriginalArticleText; A.PluginIHaveFinished(SkipResults.SkipNoChange, PluginShortName); } } if (BadTemplate) { A.PluginIHaveFinished(SkipResults.SkipBadTag, PluginShortName); // TODO: We could get the template placeholder here } article = null; return res; }
public static Classification ClassifyTriangle(Vector3[] points, Plane plane, out Classification[] classes, float e) { if (points == null) { classes = null; return Classification.UNDEFINED; } return ClassifyPoints(points, plane, out classes, e); }
public TourPlace(string name, CameraParameters camParams, Classification classification, string constellation, ImageSetType type, SolarSystemObjects target) { this.constellation = constellation; this.name = name; Classification = classification; this.camParams = camParams; Type = type; Target = target; }
public ActionResult classification(Classification classification) { ViewBag.ClassificationID = new SelectList(DBentities.Lookups.Where(m => m.LookUpType == 1), "ID", "Description"); if (Session["userID"] == null) { FillDropListForParticipent(); return(View("participantInfo")); } else { if (Request.QueryString["skip"] == "1") { GetValidComment(); } else { if (ModelState.IsValid) { DBentities.Classification.Add(classification); DBentities.SaveChanges(); GetValidComment(); ModelState.Clear(); } else { // If submit without select from list int Participentid = Int32.Parse(Session["userID"].ToString()); int NumberOfCommentsByParticipant = DBentities.Classification.Where(a => a.ParticipantID == Participentid).Count(); ViewBag.NoOfComments = NumberOfCommentsByParticipant; ViewBag.ParticipantEmail = DBentities.participant.Where(a => a.ID == Participentid).Select(a => a.Email).FirstOrDefault(); var GetComment = (from i in DBentities.Comments where i.ID == classification.CommentsID select i).FirstOrDefault(); if (GetComment != null) { ViewBag.Desc = GetComment.CommentsText; ViewBag.CommentsID = GetComment.ID; ViewBag.ParticipantID = Participentid; } else { GetValidComment(); } } } return(View()); } }
protected override void Context() { base.Context(); _addedNodes = new List <ITreeNode>(); _classifiable = _project.AllClassifiables.FindById(_simulation.Id); _classification = new Classification(); _classifiable.Parent = _classification; _project.AddClassification(_classification); _classificationNode = new ClassificationNode(_classification); A.CallTo(() => _view.TreeView.NodeById(_classification.Id)).Returns(_classificationNode); A.CallTo(() => _view.AddNode(A <ITreeNode> ._)).Invokes(x => _addedNodes.Add(x.GetArgument <ITreeNode>(0))); _project.AddObservedData(new DataRepository(_usedObservedData.Id)); }
public bool CheckDataIfExists(Classification entity) { Dictionary<string, object> parameter = new Dictionary<string, object>(); parameter.Add("Name", entity.Name); parameter.Add("SubProcess", entity.SubProcess); parameter.Add("Description", entity.Description); parameter.Add("Active", entity.Active); List<Classification> classification = this.classificationRepository.CheckIfDataExists(parameter); if (classification.Count() > 0 ) { return true; } return false; }
public IHttpActionResult GetClassificationWithID([FromUri] int ClassificationID, [FromUri] string lang = "en", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { ClassificationService classificationService = new ClassificationService(new Query() { Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en) }, db, ContactID); classificationService.Query = classificationService.FillQuery(typeof(Classification), lang, 0, 1, "", "", extra); if (classificationService.Query.Extra == "A") { ClassificationExtraA classificationExtraA = new ClassificationExtraA(); classificationExtraA = classificationService.GetClassificationExtraAWithClassificationID(ClassificationID); if (classificationExtraA == null) { return(NotFound()); } return(Ok(classificationExtraA)); } else if (classificationService.Query.Extra == "B") { ClassificationExtraB classificationExtraB = new ClassificationExtraB(); classificationExtraB = classificationService.GetClassificationExtraBWithClassificationID(ClassificationID); if (classificationExtraB == null) { return(NotFound()); } return(Ok(classificationExtraB)); } else { Classification classification = new Classification(); classification = classificationService.GetClassificationWithClassificationID(ClassificationID); if (classification == null) { return(NotFound()); } return(Ok(classification)); } } }
protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master) { XElement subEle; ele.TryPathTo("WindSpeed", true, out subEle); subEle.Value = WindSpeed.ToString(); ele.TryPathTo("CloudSpeed/Lower", true, out subEle); subEle.Value = CloudSpeedLower.ToString(); ele.TryPathTo("CloudSpeed/Upper", true, out subEle); subEle.Value = CloudSpeedUpper.ToString(); ele.TryPathTo("TransitionDelta", true, out subEle); subEle.Value = TransitionDelta.ToString(); ele.TryPathTo("SunGlare", true, out subEle); subEle.Value = SunGlare.ToString(); ele.TryPathTo("SunDamage", true, out subEle); subEle.Value = SunDamage.ToString(); ele.TryPathTo("Precipitation/BeginFadeIn", true, out subEle); subEle.Value = PrecipitationBeginFadeIn.ToString(); ele.TryPathTo("Precipitation/EndFadeOut", true, out subEle); subEle.Value = PrecipitationEndFadeOut.ToString(); ele.TryPathTo("Thunder_Lightning/BeginFadeIn", true, out subEle); subEle.Value = Thunder_LightningBeginFadeIn.ToString(); ele.TryPathTo("Thunder_Lightning/EndFadeOut", true, out subEle); subEle.Value = Thunder_LightningEndFadeOut.ToString(); ele.TryPathTo("Thunder_Lightning/Frequency", true, out subEle); subEle.Value = Thunder_LightningFrequency.ToString(); ele.TryPathTo("Classification", true, out subEle); subEle.Value = Classification.ToString(); ele.TryPathTo("LightningColor/Red", true, out subEle); subEle.Value = LightningColorRed.ToString(); ele.TryPathTo("LightningColor/Green", true, out subEle); subEle.Value = LightningColorGreen.ToString(); ele.TryPathTo("LightningColor/Blue", true, out subEle); subEle.Value = LightningColorBlue.ToString(); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Id != null) { hashCode = hashCode * 59 + Id.GetHashCode(); } if (Rev != null) { hashCode = hashCode * 59 + Rev.GetHashCode(); } if (Type != null) { hashCode = hashCode * 59 + Type.GetHashCode(); } if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Source != null) { hashCode = hashCode * 59 + Source.GetHashCode(); } if (Start != null) { hashCode = hashCode * 59 + Start.GetHashCode(); } if (End != null) { hashCode = hashCode * 59 + End.GetHashCode(); } if (Classification != null) { hashCode = hashCode * 59 + Classification.GetHashCode(); } hashCode = hashCode * 59 + IsCrash.GetHashCode(); hashCode = hashCode * 59 + IsAutoAssigned.GetHashCode(); if (Properties != null) { hashCode = hashCode * 59 + Properties.GetHashCode(); } return(hashCode); } }
/// <summary> /// Fire a missile from the given shooter's position at the target position. /// </summary> /// <param name="shooter"></param> /// <param name="targetPos"></param> /// <param name="color"></param> /// <param name="verbPayload"></param> /// <returns></returns> public bool Fire(GameActor shooter, GameActor target, Vector3 targetPos, Classification.Colors color) { if (numActiveBeams < kMaxBeams) { float speed = shooter.BeamSpeed; float time2Live = shooter.BeamDist / speed; Beam Beam = new Beam(); Beam.Position = shooter.WorldCollisionCenter; Beam.StartHeight = shooter.WorldCollisionCenter.Z; Beam.Position.Z = shooter.WorldCollisionCenter.Z; // Save out the actor Beam.TargetActor = target; // Raise the height of the target pos slightly to avoid terrain hits targetPos.Z += heightOffSet; Beam.Velocity = Vector3.Normalize(targetPos - Beam.Position) * speed; float vdotv = Vector3.Dot(Beam.Velocity, shooter.Movement.Velocity); if (vdotv > 0) { /// If the bullet is moving the same direction as the shooter, /// add in the shooter's speed in the bullet's direction. /// This will only speed up the bullet, not change it's firing /// direction. vdotv /= Beam.Velocity.LengthSquared(); Beam.Velocity += Beam.Velocity * vdotv; } Beam.Life = Beam.TTL = time2Live; Vector4 color4 = Classification.ColorVector4(color); /// Brighten up the color a bit. color4.X = MyMath.SmoothStep(0.0f, 1.0f, color4.X); color4.Y = MyMath.SmoothStep(0.0f, 1.0f, color4.Y); color4.Z = MyMath.SmoothStep(0.0f, 1.0f, color4.Z); Beam.Color = new Color(color4); Beam.TTTerraHit = CheckTerrainHit(Beam, speed); if (shooter.ActiveBeams.Beams.Count == 0) { Shooters.Add(shooter); } shooter.ActiveBeams.Beams.Add(Beam); return(true); } return(false); }
public ActionResult GetClassificatedGroup(Classification classification) { Guard.ArgumentNotNull(classification, nameof(classification)); var groups = this.Data.Group.All() .Where(group => group.Classification == classification) .OrderByDescending(group => group.CreatedTime) .Select(ViewModelsHelper.AsGroupViewModel) .Where(models => models.IsDisplay) .ToList(); ViewData["Classification"] = classification; return(PartialView(groups)); }
public ActionResult editBook(string isbn) { viewModel _viewModel = new viewModel(); if (Account.testConn()) { _viewModel.book = Books.getBook(isbn); _viewModel.authorList = Author.getAuthorList(); _viewModel.classificationList = Classification.getClassificationList(); return(View("editBook", _viewModel)); } ViewBag.serverError = "No connection to database"; return(View("books", _viewModel)); }
public void TestSingleValue0Steps() { _classifier = new CLAClassifier(new[] { 0 }, 0.001, 0.3, 0); // Enough times to perform Inference and learn associations Classification <double> retVal = null; for (int recordNum = 0; recordNum < 10; recordNum++) { retVal = Compute <double>(_classifier, recordNum, new[] { 1, 5 }, 0, 10); } Assert.AreEqual(10.0, retVal.GetActualValue(0), .00001); Assert.AreEqual(1.0, retVal.GetStat(0, 0), .00001); }
public static ClassificationRoot SageTaxCodeToMTClassification(TaxCode taxcode) { ClassificationRoot classificationroot = new ClassificationRoot(); Classification classification = new Classification(); classification.id = ""; classification.externalId = taxcode.PrimaryKey.DbValue.ToString(); classification.name = string.Format("{0}-{1} ({2})", taxcode.Code, taxcode.Name, taxcode.TaxRate); classification.active = true; classificationroot.classification = classification; return(classificationroot); }
public void TestCompute2() { _classifier = new CLAClassifier(new[] { 1 }, 0.1, 0.1, 0); Dictionary <string, object> classification = new Dictionary <string, object>(); classification.Add("bucketIdx", 4); classification.Add("actValue", 34.7); _classifier.Compute <double>(0, classification, new[] { 1, 5, 9 }, true, true); Classification <double> result = _classifier.Compute <double>(1, classification, new[] { 1, 5, 9 }, true, true); Assert.IsTrue(Arrays.AreEqual(new[] { 1 }, result.StepSet())); Assert.AreEqual(5, result.GetActualValueCount()); Assert.AreEqual(34.7, result.GetActualValue(4), 0.01); }
public override DataSet DeriveModel() { Classification c = new Classification(dataSet, visibleTables); c.CalculateHierarquies(); List<string> minimal = c.MinimalStringEntities; foreach (string table in minimal) { Collapse cp = new Collapse(dataSet, table, new List<string>(), VisibleTables); dataSet = cp.GetResult(); visibleTables = cp.VisibleTables; } return dataSet; }
/// <summary> /// Gets the Classification from a target string /// </summary> /// <param name="data">A target string</param> /// <returns>The Classification of the target string</returns> public static Classification GetClassification(string data) { Target t = new Target(data); Classification clas = new Classification(); foreach (KeyValuePair <Classification, ClassificationState> pair in t.ClassificData.Data) { if (pair.Value == ClassificationState.Yes) { clas |= pair.Key; } } return(clas); }
// Constructor with full info public Movie(string title, string starring, string director, int duration, DateTime releaseDate, int quantity, int borrow, Genre genre, Classification Class) { this.title = title; this.starring = starring; this.director = director; this.duration = duration; this.releaseDate = releaseDate; this.quantity = quantity; this.borrowTimes = borrow; this.Class = Class; this.genre = genre; this.currentCopies = this.quantity; }
private UploadResult UploadOne(int appId, string contentType, Guid guid, string field, string subFolder, bool usePortalRoot) { // wrap all of it in try/catch, to reformat error in better way for js to tell the user try { // Check if the request contains multipart/form-data. if (!Request.Content.IsMimeMultipartContent()) { throw Http.NotAllowedFileType("unknown", "doesn't look like a file-upload"); } var filesCollection = HttpContext.Current.Request.Files; if (filesCollection.Count > 0) { var originalFile = filesCollection[0]; var file = new AdamUploader(BlockBuilder, appId, Log) .UploadOne(originalFile.InputStream, originalFile.FileName, contentType, guid, field, subFolder, usePortalRoot, false); return(new UploadResult { Success = true, Error = "", Name = Path.GetFileName(file.FullName), Id = file.Id, Path = file.Url, Type = Classification.TypeName(file.Extension) }); } Log.Add("upload one complete"); return(new UploadResult { Success = false, Error = "No image was uploaded." }); } catch (HttpResponseException he) { return(new UploadResult { Success = false, Error = he.Response.ReasonPhrase }); } catch (Exception e) { return(new UploadResult { Success = false, Error = e.Message }); } }
/// <summary> /// Apply <see cref="Typeface"/> that build from <paramref name="classification"/> using /// <paramref name="defaultFormatting"/> as fallback values /// </summary> private static TextFormattingRunProperties ApplyTypeFace( TextFormattingRunProperties formatting, Classification classification, TextFormattingRunProperties defaultFormatting) { TextFormattingRunProperties ApplyTypeFace(TypeFaces mask, Typeface fallbackFace) { if (mask.Is(TypeFaces.Style) && !formatting.ItalicEmpty) { formatting = formatting.ClearItalic(); } return(formatting.SetTypeface(new Typeface( mask.Is(TypeFaces.Family) ? FontFamilyService.SupportedFamilies[classification.FontFamily] : fallbackFace.FontFamily, mask.Is(TypeFaces.Style) ? FontStyleService.SupportedStyleByNames[classification.FontStyle] : fallbackFace.Style, fallbackFace.Weight, mask.Is(TypeFaces.Stretch) ? FontStretchService.SupportedStretches[classification.FontStretch] : fallbackFace.Stretch))); } if (formatting.TypefaceEmpty) { var faces = TypeFaces.Family | TypeFaces.Stretch; switch (classification.FontStyle) { case FontStyleService.Italic when !formatting.Italic: formatting = formatting.SetItalic(true); break; case FontStyleService.Normal when formatting.Italic: formatting = formatting.SetItalic(false); break; default: faces |= TypeFaces.Style; break; } formatting = ApplyTypeFace(faces, defaultFormatting.Typeface); } else { var typeFace = formatting.Typeface; if (!typeFace.Style.Equals(FontStyleService.SupportedStyleByNames[classification.FontStyle]) || !typeFace.FontFamily.Source.Equals(classification.FontFamily) || typeFace.Stretch.ToOpenTypeStretch() != classification.FontStretch) { formatting = ApplyTypeFace(TypeFaces.All, typeFace); } } return(formatting); }
public async Task <ActionResult> Create(ContentItemViewModels model, HttpPostedFileBase Default_files) { try { if (ModelState.IsValid) { Classification _objcata = cms_db.GetObjClasscifiById(model.CategoryId.Value); ContentItem MainModel = model._MainObj; MainModel.CommentCount = 0; MainModel.CrtdDT = DateTime.Now; MainModel.CrtdUserId = long.Parse(User.Identity.GetUserId()); MainModel.CrtdUserName = User.Identity.Name; MainModel.ObjTypeId = (int)EnumCore.ObjTypeId.tin_tuc; MainModel.CategoryName = _objcata.ClassificationNM; MainModel.ViewCount = 0; MainModel.StateId = (int)EnumCore.StateType.cho_phep; MainModel.StateName = this.StateName_Enable; int rs = await cms_db.CreateContentItem(MainModel); if (Default_files != null) { MediaContentViewModels rsdf = await this.SaveDefaultImageForContentItem(Default_files, MainModel.ContentItemId); int rsup = await this.UpdateImageUrlForContentItem(rsdf, MainModel); } int SaveTickerPackage = this.SaveContentItemPackage(model.lstTickerPackage, MainModel); int rs2 = await cms_db.CreateUserHistory(long.Parse(User.Identity.GetUserId()), Request.ServerVariables["REMOTE_ADDR"], (int)EnumCore.ActionType.Create, "Create", MainModel.ContentItemId, MainModel.ContentTitle, "ContentItem", (int)EnumCore.ObjTypeId.tin_tuc); //int SaveRelatedContent = await this.SaveRelateContent(MainModel.ContentItemId, model.related_content);//lưu noi dung liên quan cho tin tức này //int SaveRelatedTag = await this.SaveRelateTag(MainModel.ContentItemId, model.related_tag);//lưu tag liên quan cho tin tức này //int UpdateDefaultMedia = await this.UpdateContentObjForMedia(_objmedia, MainModel.ContentItemId);//cập nhật id tin tức này cho hình ảnh bên bảng mediacontent var context = GlobalHost.ConnectionManager.GetHubContext <NotifiHub>(); context.Clients.All.notificationNewPost(); return(RedirectToAction("Index")); } model.lstPackage = cms_db.GetObjSelectListPackage(); model.CatalogryList = new SelectList(cms_db.Getnewcatagory(), "ClassificationId", "ClassificationNM"); return(View(model)); } catch (Exception e) { cms_db.AddToExceptionLog("Create", "ContentItem", e.ToString(), long.Parse(User.Identity.GetUserId())); return(RedirectToAction("Index")); } }
internal static void Factory(string line, bool reverseOrder = false, bool save = false, string savefolder = null) { //Default order is ES~EN if (line.IndexOf("~") < 1) { throw new ArgumentException("ArgumentException in Word.Factory"); } string[] parts = line.Split('~'); string es = reverseOrder ? parts[1] : parts[0]; string en = reverseOrder ? parts[0] : parts[1]; //Scan for classification. Can appear in either side but not both string cleanstr = null; Classification c = ParseForClassification(es, out cleanstr); if (c != Classification.Unknown) { if (cleanstr != null) { es = cleanstr; } } else { //try english side c = ParseForClassification(en, out cleanstr); if (c != Classification.Unknown) { if (cleanstr != null) { en = cleanstr; } } } var w = new Word(es.Trim(), en.Trim(), c); SpanishDict[es] = w; if (save) { Save(w, savefolder); } }
// Telecom?? public Classification ToClassification(string scheme, string parent) { var authorAttribute = new Classification { ClassificationScheme = scheme, ClassifiedObject = parent, ObjectType = ObjectType.Classification }; if (Person != null) { authorAttribute.Slots.Add(new Slot { Name = "authorPerson", Values = new List <string> { Person.Hl7Person.Encode() } }); } if (Institution != null && Institution.Any()) { authorAttribute.Slots.Add(new Slot { Name = "authorInstitution", Values = Institution.Select(i => i.Hl7Organization.Encode()).ToList() }); } if (Role != null && Role.Any(r => !string.IsNullOrEmpty(r))) { authorAttribute.Slots.Add(new Slot { Name = "authorRole", Values = Role.Where(r => !string.IsNullOrEmpty(r)).ToList() }); } if (Specialty != null && Specialty.Any(s => !string.IsNullOrEmpty(s))) { authorAttribute.Slots.Add(new Slot { Name = "authorSpecialty", Values = Specialty.Where(s => !string.IsNullOrEmpty(s)).ToList() }); } return(authorAttribute); }
/// <summary> /// Writes a csv file containing fish species and frame numbers. /// </summary> /// <param name="count_path">Path to model file.</param> /// <param name="out_path">Path to output csv file.</param> /// <param name="roi">Region of interest, needed for image dims.</param> /// <param name="detections">Detections for each frame.</param> /// <param name="scores">Cover and species scores for each detection.</param> static void WriteCounts( string count_path, string out_path, Rect roi, VectorVectorDetection detections, VectorVectorClassification scores) { // Create and initialize keyframe finder. KeyframeFinder finder = new KeyframeFinder(); ErrorCode status = finder.Init(count_path, roi[2], roi[3]); if (status != ErrorCode.kSuccess) { throw new Exception("Failed to initialize keyframe finder!"); } // Process keyframe finder. VectorInt keyframes = new VectorInt(); status = finder.Process(scores, detections, keyframes); if (status != ErrorCode.kSuccess) { throw new Exception("Failed to process keyframe finder!"); } // Write the keyframes out. using (var csv = new System.IO.StreamWriter(out_path)) { csv.WriteLine("id,frame,species_index"); int id = 0; foreach (var i in keyframes) { Classification c = scores[i][0]; float max_score = 0.0F; int species_index = 0; for (int j = 0; j < c.species.Count; ++j) { if (c.species[j] > max_score) { max_score = c.species[j]; species_index = j; } } var line = string.Format("{0},{1},{2}", id, i, species_index); csv.WriteLine(line); id++; } } }
public void TestClassifiers_Success() { var listClassifiersResult = ListClassifiers(); string classifierId = null; if (listClassifiersResult.Classifiers.Count > 0) { classifierId = listClassifiersResult.Classifiers[0].ClassifierId; } Classification classifyResult = null; if (!string.IsNullOrEmpty(classifierId)) { ClassifyInput classifyInput = new ClassifyInput { Text = _textToClassify }; classifyResult = Classify(classifierId, classifyInput); } Classifier createClassifierResult = null; using (FileStream classifierData = File.OpenRead(_classifierDataFilePath), metadata = File.OpenRead(_metadataDataFilePath)) { createClassifierResult = _service.CreateClassifier(metadata, classifierData); } var createdClassifierId = createClassifierResult.ClassifierId; var getClassifierResult = GetClassifier(createdClassifierId); if (!string.IsNullOrEmpty(classifierId) && !string.IsNullOrEmpty(createdClassifierId)) { DeleteClassifier(createdClassifierId); } if (!string.IsNullOrEmpty(classifierId)) { Assert.IsNotNull(classifyResult); } Assert.IsNotNull(getClassifierResult); Assert.IsTrue(createdClassifierId == getClassifierResult.ClassifierId); Assert.IsNotNull(createClassifierResult); Assert.IsNotNull(listClassifiersResult); }
public override string ToString() { var sb = new StringBuilder("BuddyList("); bool __first = true; if (Classification != null && __isset.classification) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("Classification: "); Classification.ToString(sb); } if (DisplayName != null && __isset.displayName) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("DisplayName: "); DisplayName.ToString(sb); } if (__isset.totalBuddyCount) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("TotalBuddyCount: "); TotalBuddyCount.ToString(sb); } if (PopularContacts != null && __isset.popularContacts) { if (!__first) { sb.Append(", "); } __first = false; sb.Append("PopularContacts: "); PopularContacts.ToString(sb); } sb.Append(")"); return(sb.ToString()); }
internal void SaveToXml(System.Xml.XmlTextWriter xmlWriter, string elementName) { xmlWriter.WriteStartElement(elementName); xmlWriter.WriteAttributeString("Name", name); xmlWriter.WriteAttributeString("DataSetType", this.Type.ToString()); if (this.Type == ImageSetType.Sky) { xmlWriter.WriteAttributeString("RA", camParams.RA.ToString()); xmlWriter.WriteAttributeString("Dec", camParams.Dec.ToString()); } else { xmlWriter.WriteAttributeString("Lat", Lat.ToString()); xmlWriter.WriteAttributeString("Lng", Lng.ToString()); } xmlWriter.WriteAttributeString("Constellation", constellation); xmlWriter.WriteAttributeString("Classification", Classification.ToString()); xmlWriter.WriteAttributeString("Magnitude", magnitude.ToString()); xmlWriter.WriteAttributeString("Distance", distnace.ToString()); xmlWriter.WriteAttributeString("AngularSize", AngularSize.ToString()); xmlWriter.WriteAttributeString("ZoomLevel", ZoomLevel.ToString()); xmlWriter.WriteAttributeString("Rotation", camParams.Rotation.ToString()); xmlWriter.WriteAttributeString("Angle", camParams.Angle.ToString()); xmlWriter.WriteAttributeString("Opacity", camParams.Opacity.ToString()); xmlWriter.WriteAttributeString("Target", Target.ToString()); xmlWriter.WriteAttributeString("ViewTarget", camParams.ViewTarget.ToString()); xmlWriter.WriteAttributeString("TargetReferenceFrame", camParams.TargetReferenceFrame); xmlWriter.WriteAttributeString("DomeAlt", camParams.DomeAlt.ToString()); xmlWriter.WriteAttributeString("DomeAz", camParams.DomeAz.ToString()); xmlWriter.WriteStartElement("Description"); xmlWriter.WriteCData(HtmlDescription); xmlWriter.WriteEndElement(); if (backgroundImageSet != null) { xmlWriter.WriteStartElement("BackgroundImageSet"); ImageSetHelper.SaveToXml(xmlWriter, backgroundImageSet, ""); xmlWriter.WriteEndElement(); } if (studyImageset != null) { ImageSetHelper.SaveToXml(xmlWriter, studyImageset, ""); } xmlWriter.WriteEndElement(); }
public void LoadFromFile(string fileName) { if (!File.Exists(fileName)) { throw new FileNotFoundException("Parameter file not found", fileName); } XElement docRoot = XElement.Load(fileName); ApplicationTitle = docRoot.Element("Version").Value; MergeResult = Convert.ToBoolean(docRoot.Element("MergeResult").Value); ConflictType = ResolveSearchEngineConflictTypeFactory.Find(docRoot.GetChildValue("ConflictType", ResolveSearchEngineConflictTypeFactory.DiscardAll.Name)); if (docRoot.Element("MinimumEngineAgreeCount") != null) { MinimumEngineAgreeCount = int.Parse(docRoot.Element("MinimumEngineAgreeCount").Value); } if (docRoot.Element("MergeResultFromSameEngineButDifferentSearchParameters") != null) { KeepTopPeptideFromSameEngineButDifferentSearchParameters = bool.Parse(docRoot.Element("MergeResultFromSameEngineButDifferentSearchParameters").Value); } if (docRoot.Element("PeptideRetrieval") != null) { PeptideRetrieval = bool.Parse(docRoot.Element("PeptideRetrieval").Value); } Database.Load(docRoot); FalseDiscoveryRate.Load(docRoot); Classification.Load(docRoot); PeptideFilter.Load(docRoot); try { DatasetList.Load(docRoot); DatasetList.ForEach(m => m.Parent = this); } catch (Exception ex) { MessageBox.Show("Load dataset error :" + ex.Message); } }
// GET: Classifications/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Classification classification = db.Classifications.Find(id); if (classification == null) { return(HttpNotFound()); } ViewBag.ArtWorkID = new SelectList(db.ArtWorks, "ArtWorkID", "Title", classification.ArtWorkID); ViewBag.GenreID = new SelectList(db.Genres, "GenreID", "GenreName", classification.GenreID); return(View(classification)); }
/// <summary> /// 添加分类 /// 在传入相同分类名是会抛运行时异常 /// return 0 添加文章失败 1 添加文章成功 /// </summary> /// <param name="classification"></param> public string AddClassification(Classification classification) { //判断添加的分类是否存在 var check = _classificationContext.Classification.Where(c => c.ClassificationName == classification.ClassificationName && c.UserId == classification.UserId).FirstOrDefault(); if (check != null) { return("添加的分类已经存在"); } _classificationContext.Add(classification); if (_classificationContext.SaveChanges() == 1) { return("添加分类成功"); } return("添加分类失败"); }
private void ChangeClassification(Application app, Record record, string classificationPath, string ancestorName="MonkeysCast") { if (string.IsNullOrEmpty(classificationPath)) return; var classification = new Classification(app); string searchExpression = string.Format("Ancestor.Name = '{0}' AND Name='{1}'", ancestorName, classificationPath.Trim()); if (classification.TryLoad(new SearchExpression(searchExpression)) == TryLoadResult.Success) { record.Classifications.RemoveAll(); record.Classifications.Add(classification.Id); record.Save(); } }
// // SmallStoneBuilding // public SmallStoneBuilding() : base(SmallStoneBuildingSRO.GetInstance) { classification = new Classification("smallstonebuilding", Classification.Colors.Red, Classification.Shapes.NotApplicable, Classification.Tastes.Sweet, Classification.Smells.Pleasant, Classification.Physicalities.Collectable); StaticPropChassis staticChassis = new StaticPropChassis(); Chassis = staticChassis; staticChassis.Mass = 5000.0f; staticChassis.DefaultEditHeight = 0.0f; } // end of SmallStoneBuilding c'tor
// GET: BackOffice/Classifications/Edit/5 public async Task <ActionResult> Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Classification classification = await db.GetByIdAsync(id); if (classification == null) { return(HttpNotFound()); } return(View(classification)); }
// GET: BackOffice/Classifications/Delete/5 public async Task <ActionResult> Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Classification classification = await db.GetByIdAsync(id); if (classification == null) { return(HttpNotFound()); } classification.Translations = classification.Translations.ToList(); return(View(classification)); }
public async Task <int> Classifi(Classification ObjClass) { try { if (!string.IsNullOrEmpty(ObjClass.ClassificationNM)) { db.Classifications.Add(ObjClass); return(await db.SaveChangesAsync()); } return(0); } catch (Exception e) { return((int)EnumCore.Result.action_false); } }
public override string ToString() { string str = "\n"; str += string.Format("{0} \t{1} \t{2} \n", StringExtensions.SpaceUppercaseLetters(Classification.ToString()), StringExtensions.SpaceUppercaseLetters(Age.ToString()), StringExtensions.SpaceUppercaseLetters(Radiation.ToString())); foreach (var body in CelestialBodies) { str += string.Format("{0}\n", body); } return(str); }
static void Main(string[] args) { Application app = new Application(); LogOnStatus status = app.LogOn("LUXDAM", "Eduard_Pasmetukhau", "P2ssw0rd!"); if (status == LogOnStatus.LoggedOn) { Console.WriteLine("Ok"); } else Console.WriteLine(status); Classification c = new Classification(app); ClassificationHelper ch = new ClassificationHelper(app); Guid? rootGuid= ch.GetId(new SearchExpression("name = 'Luxottica Content*'")); Console.WriteLine("List of classification with parent Luxottica Content"); //Console.ReadKey(); if (rootGuid != null) { ClassificationCollection classCollections = new ClassificationCollection(app); classCollections.Load(new SearchExpression(String.Format("parent = '{0}'", rootGuid))); foreach (Classification classification in classCollections) { Console.WriteLine(classification.Label + " Guid: "+classification.Id); } } Console.WriteLine(); Console.ReadKey(); Console.WriteLine("First 10 Guids of Records in classification Luxottica Content"); RecordCollection rc = new RecordCollection(app); rc.Load(new SearchExpression(String.Format("classification = '{0}'", rootGuid))); foreach (Record r in rc.Take<Record>(10)) { Console.WriteLine(r.Id); } Console.ReadKey(); }
private static void ClassificationAndOrderTest(string text, Classification[] classifications, string[] tokenTexts) { var featureContainer = new LuaFeatureContainer(); SourceText sourceText = new SourceText(text); List<Classification> actualClassifications = new List<Classification>(); List<string> actualTokenTexts = new List<string>(); foreach (TagInfo tagInfo in featureContainer.Colourizer.ColorizeParserTokens(sourceText)) { actualClassifications.Add(tagInfo.Classification); actualTokenTexts.Add(text.Substring(tagInfo.Start, tagInfo.Length)); } Assert.Equal(classifications, actualClassifications); Assert.Equal(tokenTexts, actualTokenTexts); }
public void AddFieldToClassification() { var clHelper = new ClassificationHelper(app); var classificationId = clHelper.GetId(new SearchExpression("AlexanderChechet")); Classification cl = new Classification(app); if (classificationId == null) throw new Exception("Can't find classification"); cl.Load(classificationId.Value); var fieldHelper = new FieldDefinitionHelper(app); var fieldId = fieldHelper.GetId(new SearchExpression("Name=AlexanderChechet_multi")); if (fieldId == null) throw new Exception("Can't find field"); cl.RegisteredFields.Add(fieldId.Value); cl.Save(); }
public void AddFilesToClassification() { var clHelper = new ClassificationHelper(app); var clId = clHelper.GetId(new SearchExpression("AlexanderChechet")); Classification cl = new Classification(app); if (clId == null) throw new Exception("Can't find classification"); var descriptions = new Dictionary<string, string>() { {"English", "123"}, {"Russian", "456"}, {"German", "789"}, }; AddRecord(@"D:\Films\Pictures\2Ax0212.jpg", clId.Value, descriptions); AddRecord(@"D:\Films\Pictures\1079.jpg",clId.Value, descriptions); AddRecord(@"D:\Films\Pictures\2006-000.jpg",clId.Value, descriptions); AddRecord(@"D:\Films\Pictures\entry.jpg",clId.Value, descriptions); }
protected override void CollapseClassificationTypes() { Classification c = new Classification(dataSet, visibleTables); c.CalculateHierarquies(); List<List<string>> maximal = c.MaximalStringHierarchies; foreach (List<string> hierarchy in maximal) { foreach (string table in hierarchy) { string newTable = table; if (table.IndexOf("(") != -1) newTable = table.Substring(0, table.IndexOf("(")); bool doNotCollapse = false; if (entityTypes[newTable].Equals(EntityTypes.ClassificationEntity)) { List<DataRelation> relations = DataHelper.GetRelations(dataSet, newTable); if (relations.Count > 1) { foreach (DataRelation dr in relations) { if (entityTypes[dr.ChildTable.TableName].Equals(EntityTypes.ComponentEntity)) doNotCollapse = true; } } } if (doNotCollapse) continue; if (entityTypes[newTable] > EntityTypes.ClassificationEntity) continue; if (dataSet.Tables.Contains(newTable)) { Collapse cp = new Collapse(dataSet, newTable, new List<string>(), VisibleTables); dataSet = cp.GetResult(); } } } }
/// <summary> /// Generates a new sudoku board with given classification. /// </summary> /// <param name="classification">Classification. Support only for easy and medium.</param> /// <returns></returns> public Board Generate(Classification classification) { var random = new Random(Guid.NewGuid().GetHashCode()); //1. Pick a solution and transform it randomly. var solutionIndex = random.Next(0, 2); //Initial transformation: var transformations = Enum.GetValues(typeof(Transformations)); var randomTransformation = (Transformations)transformations.GetValue(random.Next(transformations.Length)); var transformedSolution = Transform(_boardSolutions[solutionIndex], randomTransformation); // 10 additional transformations: for (var i = 0; i < 10; i++) { randomTransformation = (Transformations)transformations.GetValue(random.Next(transformations.Length)); transformedSolution = Transform(transformedSolution, randomTransformation); } //2. Empty some squares var nbrToRemove = 0; switch (classification) { case Classification.Easy: nbrToRemove = 50; break; case Classification.Medium: nbrToRemove = 55; break; } var usedIndex = new List<int>(); for (var i = 0; i < nbrToRemove; i++) { var indexToRemove = random.Next(0, 81); while (usedIndex.Contains(indexToRemove)) indexToRemove = random.Next(0, 81); usedIndex.Add(indexToRemove); transformedSolution[indexToRemove] = 0; } //3. Create a Board object from the transformed int array return new Board(string.Join(string.Empty, transformedSolution)); }
public TimeToken(int minutes) { if (minutes < 10) { this.classification = Classification.Quick; } else if (minutes < 30) { this.classification = Classification.Medium; } else if (minutes <= 60) { this.classification = Classification.Long; } else { this.classification = Classification.SuperLong; } }