Search Results

Search found 10 results on 1 pages for 'ebb'.

Page 1/1 | 1 

  • js regexp problem

    - by Alexander
    I have a searching system that splits the keyword into chunks and searches for it in a string like this: var regexp_school = new RegExp("(?=.*" + split_keywords[0] + ")(?=.*" + split_keywords[1] + ")(?=.*" + split_keywords[2] + ").*", "i"); I would like to modify this so that so that I would only search for it in the beginning of the words. For example if the string is: "Bbe be eb ebb beb" And the keyword is: "be eb" Then I want only these to hit "be ebb eb" In other words I want to combine the above regexp with this one: var regexp_school = new RegExp("^" + split_keywords[0], "i"); But I'm not sure how the syntax would look like. I'm also using the split fuction to split the keywords, but I dont want to set a length since I dont know how many words there are in the keyword string. split_keywords = school_keyword.split(" ", 3); If I leave the 3 out, will it have dynamic lenght or just lenght of 1? I tried doing a alert(split_keywords.lenght); But didnt get a desired response

    Read the article

  • The Importance of Website Content For SEO

    This article takes a look at what should be the foundation of all of your efforts to drive traffic to your website - the content. We will also look at why websites rank and show why most SEO is a poor attempt at mimicking the natural ebb and flow of world wide web.

    Read the article

  • EF Code first + Delete Child Object from Parent?

    - by ebb
    I have a one-to-many relationship between my table Case and my other table CaseReplies. I'm using EF Code First and now wants to delete a CaseReply from a Case object, however it seems impossible to do such thing because it just tries to remove the CaseId from the specific CaseReply record and not the record itself.. short: Case just removes the relationship between itself and the CaseReply.. it does not delete the CaseReply. My code: // Case.cs (Case Object) public class Case { [Key] public int Id { get; set; } public string Topic { get; set; } public string Message { get; set; } public DateTime Date { get; set; } public Guid UserId { get; set; } public virtual User User { get; set; } public virtual ICollection<CaseReply> Replies { get; set; } } // CaseReply.cs (CaseReply Object) public class CaseReply { [Key] public int Id { get; set; } public string Message { get; set; } public DateTime Date { get; set; } public int CaseId { get; set; } public Guid UserId { get; set; } public virtual User User { get; set; } public virtual Case Case { get; set; } } // RepositoryBase.cs public class RepositoryBase<T> : IRepository<T> where T : class { public IDbContext Context { get; private set; } public IDbSet<T> ObjectSet { get; private set; } public RepositoryBase(IDbContext context) { Contract.Requires(context != null); Context = context; if (context != null) { ObjectSet = Context.CreateDbSet<T>(); if (ObjectSet == null) { throw new InvalidOperationException(); } } } public IRepository<T> Remove(T entity) { ObjectSet.Remove(entity); return this; } public IRepository<T> SaveChanges() { Context.SaveChanges(); return this; } } // CaseRepository.cs public class CaseRepository : RepositoryBase<Case>, ICaseRepository { public CaseRepository(IDbContext context) : base(context) { Contract.Requires(context != null); } public bool RemoveCaseReplyFromCase(int caseId, int caseReplyId) { Case caseToRemoveReplyFrom = ObjectSet.Include(x => x.Replies).FirstOrDefault(x => x.Id == caseId); var delete = caseToRemoveReplyFrom.Replies.FirstOrDefault(x => x.Id == caseReplyId); caseToRemoveReplyFrom.Replies.Remove(delete); return Context.SaveChanges() >= 1; } } Thanks in advance.

    Read the article

  • ASP.NET MVC - Alternative to Role Provider?

    - by ebb
    Hey there, I'm trying to avoid the use of the Role Provider and Membership Provider since its way too clumsy in my opinion, and therefore I'm trying to making my own "version" which is less clumsy and more manageable/flexible. Now is my question.. is there an alternative to the Role Provider which is decent? (I know that I can do custom Role provier, membership provider etc.) By more manageable/flexible I mean that I'm limited to use the Roles static class and not implement directly into my service layer which interact with the database context, instead I'm bound to use the Roles static class which has its own database context etc, also the table names is awful.. Thanks in advance.

    Read the article

  • ASP.NET MVC3 - Bug using Javascript

    - by ebb
    Hey there, I'm trying to use Ajax.BeginForm() to POST A Json result from my controller (I'm using MVC3). When the Json result is called it should be sent to a javascript function and extract the object using "var myObject = content.get_response().get_object();", However it just throws a "Microsoft JScript runtime error: Object doesn't support this property or method" when trying to invoke the Ajax POST. My code: Controller: [HttpPost] public ActionResult Index(string message) { return Json(new { Success = true, Message = message }); } View: <!DOCTYPE html> <html> <head> <script src="@Url.Content("~/Scripts/jquery-1.4.4.min.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/jquery.unobtrusive-ajax.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/MicrosoftAjax.js")" type="text/javascript"></script> <script src="@Url.Content("~/Scripts/MicrosoftMvcAjax.js")" type="text/javascript"></script> <script type="text/javascript"> function JsonAdd_OnComplete(mycontext) { var myObject = mycontext.get_response().get_object(); alert(mycontext.Message); } </script> </head> <body> <div> @using(Ajax.BeginForm("Index", "Home", new AjaxOptions() { HttpMethod = "POST", OnComplete = "JsonAdd_OnComplete" })) { @Html.TextBox("message") <input type="submit" value="SUBMIT" /> } </div> </body> </html> The strange thing is that the exactly same code works in MVC2 - Is this a bug, or have I forgot something? Thanks in advance.

    Read the article

  • Check for child duplicates

    - by ebb
    My console app will loop through each User to get their Websites, so that it can take new screenshots of them. However, to prevent taking screenshot of the same website twice I have to check whether there already has been taken screenshot of the website, while looping through another users websites. My current solution is: Database: User |--> ID: 1 |--> FirstName: Joe |--> ID: 2 |--> FirstName: Stranger Websites |--> ID: 1 |--> UserID: 1 |--> URL: http://site.com |--> ID: 2 |--> UserID: 2 |--> URL: http://site.com Console app: static void RenewWebsiteThumbNails() { Console.WriteLine("Starting renewal process..."); using (_repository) { var websitesUpdated = new List<string>(); foreach (var user in _repository.GetAll()) { foreach (var website in user.Websites.Where(website => !websitesUpdated.Contains(website.URL))) { _repository.TakeScreenDumpAndSave(website.URL); websitesUpdated.Add(website.URL); Console.WriteLine(new string('-', 50)); Console.WriteLine("{0} has successfully been renewed", website.URL); } } } } However, it seems wrong to declare a List for such a scenario, just to check whether a specific URL already has been added... any suggestions for an alternative way?

    Read the article

  • F# - POCO Class

    - by ebb
    Hey there! I'm trying to write a POCO class in proper F#... But something is wrong.. The C# code that I want to "translate" to proper F# is: public class MyTest { [Key] public int ID { get; set; } public string Name { get; set; } } The closest I can come to the above code in F# is something like: type Mytest() = let mutable _id : int = 0; let mutable _name : string = null; [<KeyAttribute>] member x.ID with public get() : int = _id and public set(value) = _id <- value member x.Name with public get() : string = _name and public set value = _name <- value However when I try to access the properties of the F# version it just returns a compile error saying "Lookup on object of indeterminate type based on information prior to this program point. A type annotation may be needed prior to this program point to constrain the type of the object. This may allow the lookup to be resolved." The code thats trying to get the property is a part of my Repository (I'm using EF Code First). module Databasethings = let GetEntries = let ctx = new SevenContext() let mydbset = ctx.Set<MyTest>() let entries = mydbset.Select(fun item -> item.Name).ToList() // This line comes up with a compile error at "item.Name" (the compile error is written above) entries What the hell is going on? Thanks in advance!

    Read the article

  • MVC + Is validation attributes enough?

    - by ebb
    My ViewModel has validation attributes that ensure that it wont be empty etc. - Is that enough or should I let my the code contracts I have made be in the ActionResult too? Example: // CreateCaseViewModel.cs public class CreateCaseViewModel { [Required] public string Topic { get; set; } [Required] public string Message { get; set; } } // CaseController.cs [AuthWhere(AuthorizeRole.Developer)] [HttpPost] public ActionResult Create(CreateCaseViewModel model) { if(!ModelState.IsValid) { // TODO: some cool stuff? } if (string.IsNullOrWhiteSpace(model.Message)) { throw new ArgumentException("Message cannot be null or empty", model.Message); } if (string.IsNullOrWhiteSpace(model.Topic)) { throw new ArgumentException("Topic cannot be null or empty", model.Topic); } var success = false; string message; var userId = new Guid(_membershipService.GetUserByUserName(User.Identity.Name).ProviderUserKey.ToString()); if(userId == Guid.Empty) { throw new ArgumentException("UserId cannot be empty"); } Case createCase = _caseService.CreateCase(model.Topic, model.Message); if(createCase == null) { throw new ArgumentException("Case cannot be null"); } if(_caseService.AddCase(createCase, userId)) { message = ControllerResources.CaseCreateFail; } else { success = true; message = ControllerResources.CaseCreateSuccess; } return Json(new { Success = success, Message = message, Partial = RenderPartialViewToString(ListView, GetCases) }); }

    Read the article

  • C# - LINQ Including headache...

    - by ebb
    Case can have many Replies and one User, Replies can have one Case and one User, One User can have many Replies and many Cases. ObjectSet <= Case Object (IDbSet) ObjectSet.Include(x => x.User).Include(x => x.Replies).FirstOrDefault(x => x.Id == caseId); But the User Object for each Reply are not included? Only the User object for Case is Included? How would I include the User objects for the Replies too? Thanks in advance!

    Read the article

  • How to display a hierarchical skill tree in php

    - by user3587554
    If I have skill data set up in a tree format (where earlier skills are prerequisites for later ones), how would I display it as a tree, using php? The parent would be on top and have 3 children. Each of these children can then have one more child so its parent would be directly above it. I'm having trouble figuring out how to add the root element in the middle of the top div, and the child of the children below each child of the root. I'm not looking for code, but an explanation of how to do it. My data in array form is this: Data: Array ( [1] => Array ( [id] => 1 [title] => Jutsu [description] => Skill that makes you awesomer at using ninjutsu [tiers] => 1 [prereq] => [image] => images/skills/jutsu.png [children] => Array ( [2] => Array ( [id] => 2 [title] => fireball [description] => Increase your damage with fire jutsu and weapons [tiers] => 5 [prereq] => 1 [image] => images/skills/fireball.png [children] => Array ( [5] => Array ( [id] => 5 [title] => pin point [description] => Increases jutsu accuracy [tiers] => 5 [prereq] => 2 [image] => images/skills/pinpoint.png ) ) ) [3] => Array ( [id] => 3 [title] => synergy [description] => Reduce the amount of chakra needed to use ninjutsu [tiers] => 1 [prereq] => 1 [image] => images/skills/synergy.png ) [4] => Array ( [id] => 4 [title] => ebb & flow [description] => Increase the damage of water jutsu, water weapons, and reduce the damage of jutsu and weapons that use water element [tiers] => 5 [prereq] => 1 [image] => images/skills/ebbandflow.png [children] => Array ( [6] => Array ( [id] => 6 [title] => IQ [description] => Decrease the time it takes to learn a jutsu [tiers] => 5 [prereq] => 4 [image] => images/skills/iq.png ) ) ) ) ) ) An example would be this demo image minus the hover stuff.

    Read the article

1