Automapper - From View to Domain - automapper

I have read that a best practice approach for going from View to Domain is not to reverse map objects, but to use a Command Processing Architecture. However, with the exception of this post - http://weblogs.asp.net/rashid/archive/2009/08/25/restify-extending-asp-net-mvc.aspx, I have not been able to dig up anything about that.
Can anyone nudge me in the right direction with regards to this.
Thanks

There's not such thing as Best Practice! Try to do reverse mapping - if it works, go for it! If you run into a lot of friction, it's because your domain is complex - and doesn't fit well with this scenario.
A simple way of providing this in your domain is simply:
Customer.UpdatePersonalInformation(personalInformationDto);
And do the work inside there.

Related

how to consider user modification in result and consider them in VRP

I am working on one VRP(Vehicle routing problem) to make plan of pickup and drop service, As VRP is NP hard problem user edits plan according to their requirement.Now I am planning to consider their modification while preparing plan. where should I start for same?
The easiest way to incorporate expert knowledge into a VRP optimiser would probably be using constraints. Have a look at JSprit documentation of constraint as a starting point, if you are using JSprit. If the available type of constraints are not enough to model the knowledge your expert has, you may need to dig deeper and play with cost function and search strategy.
Inferring the constraints automatically from the improvements the expert made to a previous route is going to be difficult. There may be many reasons for any change in a route - it's difficult to tell why the expert made a change if they don't tell you explicitly. If possible, ask the expert to define the constraints explicitly. For example, instead of just changing a route so a job from address X and a job from address Y are served by vehicle 1, the expert will tell your system "Address X and address Y always have to be served by the same vehicle".
By the way, since this is a rather general algorithmic question, you might try to post it on the Compute Science Stack Exchange.

UML Modelling Qustion

I am in the process of developing some Use Cases for a mobile mapping/gps app. Users will be able to use this app similar to google maps. I was wondering if anyone had valuable input into some possible use cases.
Here are some I came up with myself:
1) Get Current Location
2) Set Destination Location
3) Create Fastest Route
4) View Alternative Routes
5) Traffic Estimation on Routes
If someone could help me elaborate or comment on my direction that would be helpful!
My first impulse was to flag your question as "too broad", as you basically ask to help you with your requirements analysis. But I give a few hints.
Your 5 use cases don't look bad. But they appear to be just a first rough sketch of the functionality of your app, that needs to be refined. A good model, be it UML or anything else, must be helpful for its reader to gain some insight. Now these 5 use cases could be named by any child who has seen a navigation device once in her life. To be meaningful, questions like the following should be asked and will probably lead to a more detailed use case analysis:
How are destination locations selected? If there is more than one place called Jacksonville, how will the user be informed, and how will she select the right one? Does selecting the location consist of more than one step, say country - city - road - block, to assist the user?
How do map data get into the application?
What kind of alternative routes are considered and how should they be calculated?
How will traffic data get into the application?
Try to put yourself into the developer's position. Which questions will she need to have clarified to build the right application?

Which are the best tools available for an online routing application?

So here's my question. Supposing that one is about to create an online web appliation that takes as user input a current location and a location for destination, and displays as a result one of the 5-6 available routes that are stored in a database that is most suitable in terms of distance,and Open Street Map data and Open Layers are used which would be the best way to make this happen?
What I am asking for is what would I need for:
1.Storing the data in database
2.Do the routing calculations. If I would like to change a bit the algorithms for academic reasons and have more control of my final result how would I do that? Do I need any programming language? Any good tutorials?
3.What is the difference between using pgRouting and using any custom solution(like mentioned above)? Doing the all the coding again by myself would be like reinventing the wheel?
4.What would be best for a commercial website, where fast calculations would be needed?
UPDATE: What I need is a way to connect 1.user input(as geometry points) 2.Routing algorithm I have written 3.Road Network and return a result in terms of best way to go to a point
Please see the list of online routers and offline routers for OSM as well as the general wiki page about routing with OSM.
If that still doesn't answer your questions, ask a more specific one.

Can I load an XPage from another Db using the Include Page control?

Looking at xp:include control; we have the following syntax:
<
xp:include pageName="/main.xsp" id="include1">
Is there any way to compute the pageName property so it makes reference to another Db?
Designer Help
"Can you?" Yes, but it's quite complicated and I wouldn't recommend attempting it. You would have to write an extended version of the Include control that could point to a different NSF and could include that NSF as a ModuleClassLoader for your current application. While this is theoretically possible, it requires a great deal of knowledge of the internal Java workings of XPages and a willingness to test extensively.
There may be other ways to solve your problem, such as using Design inheritance to include your target page in the local application. Otherwise, you're asking a question about what's possible with a sequence of ones and zeros, so of course the answer is "yes, but..." And in this case, unless you have a desire to research the inner workings of the XSP server, or want to recruit someone who already has such knowledge, the answer to "Can I" is no.
As Nathan says - the reality is that no you can't do that. BUT you should think of WHY you're trying to do this?
Keep in mind that by not having your XPage source in the same place you won't have any kind of shared application or sessionScope available. Because of that it really is just like including a foreign web page and has nothing to do with XPages.
You'll probably be better off just using an iFrame if you want to run a foreign page inside another xpages application.

Backbone.js: form fields are not being sent in the request

Please forgive the newb question, but I am not finding answers elsewhere... probably because I'm not sure what the question should really be.
I am VERY new to Backbone.js, and I am trying to figure out why changes in the page's form fields are not being sent in POST/PUT requests. The 'change' event IS firing, and the View is catching it, but the model does not have the fields it should have from the form. I haven't been able to find anything that deals with this, so I am fairly certain we have just done something very wrong in our app... but I don't know how to figure out what that might be.
I realize this is not the most complete question, so please let me know if more info is required. I am so new to this that I am not even sure what one might need to track this down.
Any help at all would be greatly appreciated. Thank you in advance,
vegtabill
With backbone.js, there is more than one way to do something. I personally update my model with the data from the view and then json serialize that data for transmission to the server side if I'm not using the REST capabilities build into backbone collections of models (i.e. the fetch, save, etc.) You can use the model.set() method to do this. I am fairly new to backbone too so please don't slam me if you take offense to my approach. I know there are others out there that know a lot more about this topic than me. This approach works for me and it enforces my personal goal of the model not having a reference to the view. That separation is important to me personally. To be more explicit, I listen for events on my view that I then use to update my model.

Resources