Hi, I need to find a goal given the following conditions -I only know my 4 surroundings (N,W,S,E): they can be empty or an obstacle -I know the goal coordinates (x,y) -I know my coordinates I know bug-2 (and bug-1) are complete algorithms (they always find the goal). But it is really bad in some maps with large obstacles. My questions are two. 1. How come there arent quick and well-known solutions to this? Ive been googling for ages and I just find theoretical papers, full of blabla and no pseudocode. 2. A* wouldnt work for this because of my first restriction, right? Thanks
Quake2Player
Posts
-
Goal finding: I just need the name of an algorithm -
Prolog simple problemwtf are you talkin about anyway the answer was to use findall(X, predicate(X), List)
-
Prolog simple problemHello, I have some facts like: asdf(a,b). asdf(b,c). asdf(c,d). etc. I'd like to do some function givemelettersinvolved(L) that instantiates in L a list that contains the constants involved in those facts for example asdf(a,b). asdf(b,c). givemelettersinvolved(L) would give L = [a, b, c] How can I make this? I was trying with ...(L) :- asdf(A,B), member(A,L), member(B,L). But its not working
-
Layouts in PHP and redirectionThanks for replying Though, I know that, that's why i'm asking for a better way of doing layouts.. so that I dont have the content's logic after heads, body, etc tags Ps. ob_start() and ob_flush() worked for me.. but its not a very elegant solution
-
Layouts in PHP and redirectionHi, I have an index.php that takes a $_GET variable, "action", like this: index.php?action=someContent And based on the value of "action" I include some php in some div in the body. The problem is that if I have some logic in those included contents, and they need to redirect the user (using header("..")), they can't because of "Warning: Cannot modify header information - headers already sent by" So.. I either need 1. A way to redirect without header 2. or a way to create a layout more efficient than that
-
Linq2Sql: Adding an object with childsLets say my Linq 2 Sql model is like this: Class Movement { Products, ... } Class Product { ... } The problem is that if I create a Movement and populate all of its properties, like:
Movement m = new Movement()
m.SomeProperty = ...
m.SomeProperty = ...
m.Products.Add ( someExistingProduct )
m.Products.Add ( someExistingProduct )
m.Products.Add ( someExistingProduct )movementsRepository.Add ( m )
movementsRepository.Save()I get an error "An attempt has been made to Attach or Add an entity that is not new" The only why i'm getting to achieve the add is like this:
Movement m = new Movement()
m.SomeProperty = ...
m.SomeProperty = ...movementsRepository.Add ( m )
movementsRepository.Save()someExistingProduct = productsRepository.GetById ( ... )
someExistingProduct.Movement = m
productsRepository.Save()someExistingProduct = productsRepository.GetById ( ... )
someExistingProduct.Movement = m
productsRepository.Save()etc..
The problem with this second approach is that if there is a problem with one of the products (which are retrieved by an id specified on a form, etc.) I would need to delete the Movement and etc. I dont find it a very elegant solution. Help please, Thanks
-
Response.Redirect problemDoesnt work either...
-
Response.Redirect problemHi, I'm using ASP.net MVC, In a certain controller ("Users") I have a "LoginNeeded()" method, this one redirects you if you are not logged in: if (CurrentUser == null) { HttpContext.Response.Redirect("/Users/Login/", true); } The problem: If a method from the Users controller calls this method.. everything works fine. If a method from another controller calls this method.. It doesnt find the action i'm redirecting (it tries to search in "Shared/Users/Login" and "ThisOtherController/Users/Login" Any help?!
-
Request.Form in MVCMVC solves the separation of concerns.. thats what it "fixes"
-
Request.Form in MVCBut with checkboxes, for example, when you use ASP.NET (not mvc) you can manage them as if their were winforms checkboxes (ie. myCheckBox.Value is bool), And with Listboxes, you can refer to the ith item in the list (because its an array), and so on..
-
Request.Form in MVCHi, I was wondering if retrieving the input in MVC is always string based? Like requesting.form a "select multiple" (aka listbox).. Is any other method than retrieving the values in a comma-separated string? Like "043,015,091" Or for example a checkbox.. is it possible to retrieve a bool instead of parsing a string? Because everything must be retrieved by using Request.Form Please notice that i'm talking about ASP.NET MVC: That means i'm retrieving the values from a controller (POST) and not in the SomeButton_Click or something. In a NOT MVC way it would be all object oriented by using asp controls and etc.
-
Protecting POST from an actionOk so I'm using sessions now instead of cookies, Can you answer my question now, which is analogue to the previous question: Should I check for the session at the beggining of the POST? Or I dont have to care about someone cloning the form with action=myformpost
-
Protecting POST from an actionUhm.. 1. Ok lets assume i'm not going to stop using cookies.. Should I check for the cookie in the POST? Yes or no? 2. In asp 3.0 I used to use Sessions, but in ASP.NET (MVC) I don't know how, the usage is similar to cookies? Do you have some link with Session's usage? Also, arent sessions based on cookies though? (Also, I definetly dont wanna use the filters that come with MVC.. like [Auth] and others)
-
Protecting POST from an actionWhat if I'm just using cookies? For example: Action /SomeForm/ (GET) 1. I check if the user has some cookie. If he does, 2. I show the form to him. Action /SomeForm/ (POST) 1. Should I check if the user has that cookie or not? 2. Process inputs, etc.
-
Protecting POST from an actionHi, I have a question about security and user access: If I protected a GET action with access only for logged users or for some type of user, should I also protect the POST action? In ASP 3.0 I used to do that because one could clon the form and set the "action=myformpost.asp", Thanks
-
Popup form notifying other form?Hi, I have a form where there is a combobox, and next to it there is a link "Other" that opens a popup and lets the user to create more options (that dont appear in the combo) How can I notify the parent form (the one with the combo) that the popup form added succesfuly the new option? With winforms is really easy using events.. but in web its confusing Help please! Thx
-
A form for creating a one to many record in a db -
A form for creating a one to many record in a dbIf I'm having a form with n textboxs (n defined by te user by pressing a "new registry" button for example), and the textboxs are named product1, product2, ...productn.. How should I retrieve the data in the POST? Should I send n thrue the form too? What is the typical way of doing this kind of forms??.. that there is a main record in a db (for example some headers) and n records within that record? is there a good practice way? The db would look like table1: mainid, headers table2: id, mainid, etc. (ie. one to many relationship)
-
Users and Cookies in ASP.NET MVCHi, The situation is this: I would like to have an static method in some class of the Models library like this static User GetCurrentUser() Which takes a cookie in the user ("currentUserId") and returns the User retrieved from the db.. The problem: I cant have access to the cookies (to the "Request" class) from the Model lib. So what other solution can I use? Should I make that method in the Controllers library? IF i dont add a view to a method of a controller class then that method wont be an action? ALSO: The method needs to be used from other controllers.. so.. is that possible?
-
Database design questionOh thats a nice solution.. Though the movements are used in other parts of the software.. so this "dummy" movements would have to have different properties.. like "from = to"