Determine the controller, action, and ID of the given URLs - asp.net

Determine the controller, action, and ID of the given URLs. Recreate and complete the table on a clean sheet of a paper.This is the table that need to answer Please help for my assignment thank you.

Usually, MVC-based implementations route urls as - controller/action/id - so in your example too, you can deduce using the same pattern from the endpoints mentioned in your first column in the image. (for ex: if it says test/pre/1000, then it will be TestController, Action method is pre and id is 1000). For action the default value is Index, if you do not find anything after the controller name in the endpoint.
I suggest to do a bit more research on it online. I'm sure it will not be tough to find an answer for your question or any follow up such questions, pretty quickly. Please refer this as a first - https://www.tutorialsteacher.com/mvc/routing-in-mvc - explains clearly and it almost answers your question directly. Look at the URL Pattern and Configuring a Route sections in that link. Once you follow that in your hands-On trials and you still face issues in routing that is when stackoverflow can be an appropriate forum to find answers for your real time hurdles. Hope this helps.

Related

Is it possible to have a NPC offer items only to characters with a certain achievement?

Im looking for a way to add an NPC which sells items based on the achievements a character has. Because of my lack of other coding skills, if at all possible i would like to achieve it with SQL commands, hence modifying the db. I was looking through the conditions page on the wiki but have no idea how to use the provided information.
Also i was backtracing the db regarding the NPC Charles Worth who happens to teach tailors recipes based on achievements they have. I intended to copy this toons conditions, but couldnt find what entries to use.
Any help, clarifying db entries, or pointing to the right direction in another way, is much appreciated.
Please follow this link for the documentation:
https://www.azerothcore.org/wiki/conditions
You can use the source type: "SOURCE_TYPE_NPC_VENDOR" and the condition type: "CONDITION_ACHIEVEMENT" for what you need, how to implement this, you can find that in the link above.
Also, one way to make this easier is to use the tool developer by the azerothcore team, Keira3.
This is a very visual Database Editor and can help you understand what each column do as almost each cell is documented and you have links to the full documentation as well.
Keira3 link: https://github.com/azerothcore/keira3

HERE API Calculate Route - avoid anything changes router behavior

Problem
If you choose to use avoidArea, exclueCountries or avoidLinks (and probably some more that I wasn't able to test) in your request router enforces fastest route mode.
Given is route from Poland to Germany.
Official testing client: http://refclient.ext.here.com/
First request (no avoids, no excludes, mode:shortest) was:
https://route.api.here.com/routing/7.2/calculateroute.json?app_code=pxIXqdtgOSwQDXSDfjLQpw&app_id=cgZPrYfgRePXzXC3PbBp&jsonattributes=41&language=en-us&legattributes=le&maneuverattributes=po,ti,pt,ac,di,fj,ix&metricsystem=metric&mode=shortest;car&routeattributes=sh&waypoint0=geo!stopOver!53.49012,18.80973&waypoint1=geo!stopOver!53.61957,12.43167
This resulted in a quite straightforward route like below.
If we add now any country exclusion (e.g. GBR, CHE, CZE) the route is now routed via motorways like fastest mode was enforced.
https://route.api.here.com/routing/7.2/calculateroute.json?app_code=pxIXqdtgOSwQDXSDfjLQpw&app_id=cgZPrYfgRePXzXC3PbBp&avoidseasonalclosures=false&excludecountries=CHE,GBR,CZE&jsonattributes=41&language=pl-pl&legattributes=le&maneuverattributes=po,ti,pt,ac,di,fj,ix&metricsystem=metric&mode=shortest;car&routeattributes=sh,zo&waypoint0=geo!stopOver!53.49012,18.80973&waypoint1=geo!stopOver!53.61957,12.43167
EDIT 1 BEGIN
I checked out the new routing API and results are similar:
Without avoids:
https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey={API_KEY}=41&language=en-us&legattributes=le&maneuverattributes=po,ti,pt,ac,di,fj,ix&metricsystem=metric&mode=shortest;car&routeattributes=sh&waypoint0=geo!stopOver!53.49012,18.80973&waypoint1=geo!stopOver!53.61957,12.43167
With avoids:
https://route.ls.hereapi.com/routing/7.2/calculateroute.json?apiKey={API_KEY}&avoidseasonalclosures=false&excludecountries=CHE,GBR,CZE&jsonattributes=41&language=pl-pl&legattributes=le&maneuverattributes=po,ti,pt,ac,di,fj,ix&metricsystem=metric&mode=shortest;car&routeattributes=sh,zo&waypoint0=geo!stopOver!53.49012,18.80973&waypoint1=geo!stopOver!53.61957,12.43167
On a sidenote, http://refclient.ext.here.com/ doesn't have option to test new API
EDIT 1 END
Question
Why is it happening? Is it designed behavior? If not, when can we expect this to be fixed?
Ok, I've got an answer for you from engineering. I'm rewording a bit so any mistakes/confusion blame me, not him. :)
So yes, the API here is ignoring your request to use shortest.
Quote from developer: Specifically in this case, when using "shortest" mode and requesting additional "avoids", routes more than 300km or so are not "good". It does not fall back to "fastest" mode but another mode where "fastest" route shape has more of an influence.
You mentioned wanting to avoid tolls, be aware that you can ask for that option when calling the API, so that may be a solution for you.
I hope this helps a bit, and thank you for being patient.

Social Network API design for Like, Comment, and other Interactions?

Suppose I have a website where I showcase people's artwork, recipes, and journals (and this list is likely to grow). I want people to be able to comment, like, flag, etc. all of them.
I'm not looking for a database schema. I am using ASP.net Web API but the platform should be irrelevant. I am passing an Authorization Bearer header to identify the user who wants to like, comment on, flag, etc. another user's work.
I currently have two "schemes" but I'm not sure what the advantages/disadvantages of each one is, so I can't make a good decision.
The first looks like this:
POST api/<entity>/{id}/<action>
For example, api/journal/21793/like, or api/recipe/1005/comment. Of course, each action would have the appropriate body that includes info to store to the back end.
Implementing it this way, though, would require us to write entityCount x interactionTypeCount functions (actions), which is very tedious, though the API call is friendly.
The second API scheme looks like this:
POST api/<action>
For example, api/like, api/comment - and yes, there would be no way to depict which object type and which record of the object type in the URL. So, if we were to comment on the recipe mentioned, we would call:
POST api/comment
{"id":"1005", "objectType":"recipe", "comment":"This was excellent!"}
This way, we call only 1 API to comment on anything in our system. So, each of the POST api/ functions would require the id and objectType properties in the body, plus whatever other required data as appropriate for the action. (I'm using JSON as an example).
I see that developers would have to know beforehand what our accepted objectType values are in order to post interactions to the right record. I'm not sure if this is option is a good idea.
This question might get flagged for being off-topic or open to debate, but I'm hoping someone can tell me more pros and cons of each approach indicated above so I can make a better decision. Better yet, offer a solution that is either totally different or combines aspects of the two approaches above.

Create own customed URL shortener

I am currently trying to code out a simple asp.net URL shortener which allows me to customise the shortened url. I am also not allowed to use open source, which means I cannot use any of the url shortening services. I am required to develop on on my own.
But this is the first time I am doing this so i have no idea on how to start(excluding the UI).
I understand that there are already such questions being asked. But I've read through the posts and I couldn't understand what is it about. I've also tried to google for the solution but it doesn't seem to be working.
I would really appreciate any help given to me.
P.S I am fairly new in programming and not strong in any of the programming languages.
You would need:
A system to store pairs of shortened URLs and their full version.
A page which takes the shortened URL parameter (eg. short.aspx?q=SHORTENED), looks it up in your data store, and redirects to the full URL.
Some interface to edit your data store, add new URLs, etcetera.
That should be it really. If this is too difficult, it might be smarter to start on a basic programming course first.

Token replacement

I currently implement a replace function in the page render method which replaces commonly used strings - such as replace [cfe] with the root to the customer front end. This is because the value may be different based on the version of the site - for example the root to the image folder ([imagepath]) is /Images on development and live, but /Test/Images on test.
I have a catalogue of products for which I would like to change [productName] to a link to the catalogue page for that product. I would like to go through the entire page and replace all instances of [someValue] with the relevant link. Currently I do this by looping through all the products in the product database and replacing [productName] with the link to the catalog page for that product. However this is limited to products which exist in the database. "Links" to products which have been removed currently wont be replaced, so [someValue] will be displayed to the user. This does not look good.
So you should be able to see my problem from this. Does anyone know of a way to achieve what I would like to easily? I could use regexes, but I don't have much experience of those. If this is the easiest way, using "For Each Match As String In Regex.Matches(blah, blah)" then I am willing to look further into this.
However at some point I would like to take this further - for example setting page layouts such as 3 columns with an image top right using [layout type="3colImageTopRight" imageURL="imageURL"]Content here[/layout]. I think I could kind of do this now, but I cant figure out how to deal with this if the imageURL were, say, [Image:Product01.gif] (using regex.match("[[a-zA-Z]{0,}]") I think would match just [layout type="3colImageTopRight" imageURL="[Image:Product01.gif] (it would not get to the end of the layout tag). Obviously the above wouldn't quite work, as I haven't included double quotes in the match string or anything, but you get the general idea. You should be able to get the general idea of what I am getting at and what I am trying to do though.
Does anyone have any ideas or pointers which could help me with this? Also if this is not strictly token replacement then please point me to what it is, so I can further develop this.
Aristos - hope reexplaining this resolves the confusion.
Thanks in advance,
Regards,
Richard Clarke
#RichardClarke - I would go with Regular Expressions, they're not as terrible to learn as you might think and with a bit of careful usage will solve your problems.
I've always found this a very useful tool.
http://derekslager.com/blog/posts/2007/09/a-better-dotnet-regular-expression-tester.ashx
goes nicely with a cheat sheet ;-)
http://www.addedbytes.com/cheat-sheets/regular-expressions-cheat-sheet/
Good luck.

Resources