Search Results

Search found 311 results on 13 pages for 'shawn mclean'.

Page 5/13 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • Fetching Strategy example in repository pattern with pure POCO Entity framework

    - by Shawn Mclean
    I'm trying to roll out a strategy pattern with entity framework and the repository pattern using a simple example such as User and Post in which a user has many posts. From this answer here, I have the following domain: public interface IUser { public Guid UserId { get; set; } public string UserName { get; set; } public IEnumerable<Post> Posts { get; set; } } Add interfaces to support the roles in which you will use the user. public interface IAddPostsToUser : IUser { public void AddPost(Post post); } Now my repository looks like this: public interface IUserRepository { User Get<TRole>(Guid userId) where TRole : IUser; } Strategy (Where I'm stuck). What do I do with this code? Can I have an example of how to implement this, where do I put this? public interface IFetchingStrategy<TRole> { TRole Fetch(Guid id, IRepository<TRole> role) } My basic problem was what was asked in this question. I'd like to be able to get Users without posts and users with posts using the strategy pattern.

    Read the article

  • How do I create a graph from this datastructure?

    - by Shawn Mclean
    I took this data structure from this A* tutorial: public interface IHasNeighbours<N> { IEnumerable<N> Neighbours { get; } } public class Path<TNode> : IEnumerable<TNode> { public TNode LastStep { get; private set; } public Path<TNode> PreviousSteps { get; private set; } public double TotalCost { get; private set; } private Path(TNode lastStep, Path<TNode> previousSteps, double totalCost) { LastStep = lastStep; PreviousSteps = previousSteps; TotalCost = totalCost; } public Path(TNode start) : this(start, null, 0) { } public Path<TNode> AddStep(TNode step, double stepCost) { return new Path<TNode>(step, this, TotalCost + stepCost); } public IEnumerator<TNode> GetEnumerator() { for (Path<TNode> p = this; p != null; p = p.PreviousSteps) yield return p.LastStep; } IEnumerator IEnumerable.GetEnumerator() { return this.GetEnumerator(); } } I have no idea how to create a simple graph with. How do I add something like the following undirected graph using C#: Basically I'd like to know how to connect nodes. I have my own datastructures that I can already determine the neighbors and the distance. I'd now like to convert that into this posted datastructure so I can run it through the AStar algorithm. I was seeking something more like: Path<EdgeNode> startGraphNode = new Path<EdgeNode>(tempStartNode); startGraphNode.AddNeighbor(someOtherNode, distance);

    Read the article

  • Should I convert overlong UTF-8 strings to their shortest normal form?

    - by Grant McLean
    I've just been reworking my Encoding::FixLatin Perl module to handle overlong UTF-8 byte sequences and convert them to the shortest normal form. My question is quite simply "is this a bad idea"? A number of sources (including this RFC) suggest that any over-long UTF-8 should be treated as an error and rejected. They caution against "naive implementations" and leave me with the impression that these things are inherently unsafe. Since the whole purpose of my module is to clean up messy data files with mixed encodings and convert them to nice clean utf8, this seems like just one more thing I can clean up so the application layer doesn't have to deal with it. My code does not concern itself with any semantic meaning the resulting characters might have, it simply converts them into a normalised form. Am I missing something. Is there a hidden danger I haven't considered?

    Read the article

  • Lexographical sorting problem

    - by Shawn Mclean
    I'm doing a problem that says concatenate the words to generate the lexicographically lowest possible string. from a competition. Take for example this string: jibw ji jp bw jibw The actual output turns out to be: bw jibw jibw ji jp When I do sorting on this, I get: bw ji jibw jibw jp. Does this mean that this is not sorting? If it is sorting, does lexicographic sorting take into consideration pushing the shorter strings to the back or something? I've been doing some reading on lexigographical order and I dont see any point or scenarios on which this is used, do you have any?

    Read the article

  • Quick start on visual studio 2010 with SVN

    - by Shawn Mclean
    The only source control I ever used was SourceGear Vault on my local machine. I need to put a new project on a svn server I got at beanstalkapp. I installed tortoiseSVN and AnkhSVN. I successfully connected everything, I see 3 folders: branches tags trunks I created my project and I want to attach it to the server, which of these folders do I select? What is the use of the these folders?

    Read the article

  • What is this event?

    - by Shawn Mclean
    Could someone explain what this C# code is doing? // launch the camera capture when the user touch the screen this.MouseLeftButtonUp += (s, e) => new CameraCaptureTask().Show(); // this static event is raised when a task completes its job ChooserListener.ChooserCompleted += (s, e) => { //some code here }; I know that CameraCaptureTask is a class and has a public method Show(). What kind of event is this? what is (s, e)?

    Read the article

  • Applying to a international programming jobs

    - by Shawn Mclean
    If this question is not suited at stackoverflow, could you tell me in comments and suggest a site that I can ask this question and I'll close this. I'm located in Jamaica and in my final semester of a bsc computer science degree. I would like to apply to programming jobs abroad. How do I go about this? What is the sequence to follow and documents needed? Thanks.

    Read the article

  • Is git suitable for one developer without server

    - by Shawn Mclean
    I am a single developer without another computer to backup my projects on. I'm looking into source controls and I came across git but all the setup tutorials are targeted to an external server. I used to use SourceGear Vault, but seeing that git is getting alot of attention, I might as well familiarize myself with it. I do not always have internet access. Is Git suitable for me? Can I be pointed in the right direction to set it up? Visual Studio 2008. Windows 7.

    Read the article

  • CMS + Blog engines for personal website

    - by Shawn Mclean
    I want to create a personal website where I show off my work, write blog posts, etc. I dont want to create my own, but I'm seeking one flexible enough for me to write my own codes for it if needed. For eg, I'd like to create a page with jquery functionality and backend code. Features I'm looking for: Blog engine similiar to wordpress OpenId login (comments, etc) Exporting content in an event I want to switch engines. I have alot of knowledge in .net and small amount in php, so any of these frameworks can work for me.

    Read the article

  • Manhattan Heuristic function for A-star (A*)

    - by Shawn Mclean
    I found this algorithm here. I have a problem, I cant seem to understand how to set up and pass my heuristic function. static public Path<TNode> AStar<TNode>(TNode start, TNode destination, Func<TNode, TNode, double> distance, Func<TNode, double> estimate) where TNode : IHasNeighbours<TNode> { var closed = new HashSet<TNode>(); var queue = new PriorityQueue<double, Path<TNode>>(); queue.Enqueue(0, new Path<TNode>(start)); while (!queue.IsEmpty) { var path = queue.Dequeue(); if (closed.Contains(path.LastStep)) continue; if (path.LastStep.Equals(destination)) return path; closed.Add(path.LastStep); foreach (TNode n in path.LastStep.Neighbours) { double d = distance(path.LastStep, n); var newPath = path.AddStep(n, d); queue.Enqueue(newPath.TotalCost + estimate(n), newPath); } } return null; } As you can see, it accepts 2 functions, a distance and a estimate function. Using the Manhattan Heuristic Distance function, I need to take 2 parameters. Do I need to modify his source and change it to accepting 2 parameters of TNode so I can pass a Manhattan estimate to it? This means the 4th param will look like this: Func<TNode, TNode, double> estimate) where TNode : IHasNeighbours<TNode> and change the estimate function to: queue.Enqueue(newPath.TotalCost + estimate(n, path.LastStep), newPath); My Manhattan function is: private float manhattanHeuristic(Vector3 newNode, Vector3 end) { return (Math.Abs(newNode.X - end.X) + Math.Abs(newNode.Y - end.Y)); }

    Read the article

  • ASP.NET MVC Response file should not download

    - by Shawn Mclean
    I am generating a .cxml file on the server and pushing it to the browser based on certain queries. If I just link to a .cxml, it does what I expected and opens it in the respective application. How can I generate a file and push it to the browser just like if it was linked to a file without it asking me to download it? The link looks something like: http://localhost/MyController/GetFile?q=TheQueryStringParam Thanks.

    Read the article

  • Stored Procedure or calculations via IQueryable?

    - by Shawn Mclean
    This is a question that is based on choosing performance over design practices. If I have a method that will be executed many times a second; public static IQueryable<IPerson> InRadius(this IQueryable<IPerson> query, Coordinate center, double radius) { return (from u in query where CallHeavyMathFormula(u, center, radius) select u); } This extension method for IQueryable generates a SQL that does some heavy maths calculation (Cosine, Sine, etc). This would mean the application sends 1-2KB of sql to the server per call. I've heard of placing all application logic, in your application. I also would like to change to a database such as azure or one of those scalable databases in the future. How do I handle something like this? Should I leave it as it is now or write stored procedures? How do applications like twitter or facebook do it?

    Read the article

  • Get records based on child condition

    - by Shawn Mclean
    In LINQ To Entities: How do I get the records (including both child and parent) based on a condition of the child in a one to many. My structure is set up as follows: GetResources() - returns a list of Resources. GetResources().ResourceNames - this is the child, which is an entity collection. GetResources().ResourceNames - a property of one record of this child is Name. I'd like to construct something like this: return (from p in repository.GetResources() where p.ResourceNames.Exist(r => r.Name.Contains(text, StringComparison.CurrentCultureIgnoreCase)) select p).ToList(); but of course, Exist doesn't exist. thanks.

    Read the article

  • NUnit Assert a list of objects in no order

    - by Shawn Mclean
    How do I Assert a collection of items in no particular order? I just want to make sure all the items are in the list. I'm heard of CollectionAssert but I do not see any method that would do what I want. My object looks like this: public class Vector2{ public float X {get; set;} public float Y {get; set;} } Assert - I want something like this: CollectionAssert.ContainsAll(mesh.GetPolygonVertices(0), aListOfVertices); mesh.GetPolygonVertices(int) returns a List<Vector2> and aListOfVertices contains all of what is returned, but not guaranteed that order.

    Read the article

  • Convert object to enum C#

    - by Shawn Mclean
    I have binded a list of enum to a combobox. Now I want to get the SelectedItem return the enum, which currently returns it as type object. How do I convert this object to my enum? My framework is silverlight on windows-phone-7

    Read the article

  • Java application on windows server possibility?

    - by Shawn Mclean
    I'd like to know if it is possible to have this application (neo4j) running on windows server 2008 alongside an asp.net mvc application. Reason for this, I need to access the graph database (neo4j) which provides a RESTful service from my mvc application. How would I go about setting up this architecture?

    Read the article

  • C# Random of cordinates is linear

    - by Shawn Mclean
    My code is to generate random cordinates of lat and long within a bound: Random lastLat = new Random(); Random lastLon = new Random(); for (int i = 0; i < 50; i++) { int lat = lastLat.Next(516400146, 630304598); //18.51640014679267 - 18.630304598192915 int lon = lastLon.Next(224464416, 341194152); //-72.34119415283203 - -72.2244644165039 SamplePostData d0 = new SamplePostData(); d0.Location = new Location(Convert.ToDouble("18." + lat), Convert.ToDouble("-72." + lon)); AddPushpin(d0); } My output looks like this: Is there something wrong with how my numbers are generated?

    Read the article

  • Structure of Astar (A*) graph search data in C#

    - by Shawn Mclean
    How do you structure you graphs/nodes in a graph search class? I'm basically creating a NavMesh and need to generate the nodes from 1 polygon to the other. The edge that joins both polygons will be the node. I'll then run A* on these Nodes to calculate the shortest path. I just need to know how to structure my classes and their properties? I know for sure I wont need to create a fully blown undirected graph with nodes and edges.

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >