What does ":" in URL mean? - ajax

some requirement in my school project asks to send some AJAX request to the server to the url :
http://localhost:8000/messages/:id
where I should set the value of the id as a unique number. I know that ? means a query search and # as mentioned here but what does : mean?
and if I set id value to be equal to 123,how it is shown ,like this : http://localhost:8000/messages/:123
or like this:http://localhost:8000/messages/123
I appreciate any help

There are two ':' in your url. The first one separates the host from the port e.g. host:port - in your case the host is localhost, the port is 8000.
Second case, ':id', specifies that the id is a variable. It can be replaced by any value such as '123'. The notation is there so you can differentiate a string in the url (../messages/id) from the usage of variables (../messages/:id).
All in all you have to drop the : in usage as you insert a value for the variable.

The third : in the URL you presented is just a placeholder indicating that id is a variable name.
Therefore, :id must be replaced by a value, for example 123.
Your second attempt answer is correct.

Related

My flow fails for no reason: Invalid Template Language? This is what I do

Team,
Occasionally my flow fails and its enough test it manually to running again. However, I want to avoid that this error ocurrs again to stay in calm.
The error that appears is this:
Unable to process template language expressions in action 'Periodo' inputs at line '0' and column '0': 'The template language function 'split' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#split for usage details.'.
And it appears in 2 of the 4 variables that I create:
Client and Periodo
The variable Clientlooks this:
The same scenario to "Periodo".
The variables are build in the same way:
His formula:
trim(first(split(first(skip(split(outputs('Compos'),'client = '),1)),'indicator')))
His formula:
trim(first(split(first(skip(split(outputs('Compos'),'period = '),1)),'DATA_REPORT_DELIVERY')))
The same scenario to the 4 variables. 4 of them strings (numbers).
Also I attached email example where I extract the info:
CO NIV ICE REFRESCOS DE SOYA has finished successfully.CO NIV ICE REFRESCOS DE SOYA
User
binary.struggle#mail.com
Parameters
output = 7
country = 170
period = 202204012
DATA_REPORT_DELIVERY = NO
read_persistance = YES
write_persistance = YES
client = 18277
indicator_group = SALES
Could you give some help? I reach some attepmpts succeded but it fails for no apparent reason:
Thank you.
I'm not sure if you're interested but I'd do it a slightly different way. It's a little more verbose but it will work and it makes your expressions a lot simpler.
I've just taken two of your desired outputs and provided a solution for those, one being client and the other being country. You can apply the other two as need be given it's the same pattern.
If I take client for example, this is the concept.
Initialize Data
This is your string that you provided in your question.
Initialize Split Lines
This will split up your string for each new line. The expression for this step is ...
split(variables('Data'), '\n')
However, you can't just enter that expression into the editor, you need to do it and then edit in in code view and change it from \\n to \n.
Filter For 'client'
This will filter the array created from the split line step and find the item that contains the word client.
`contains(item(), 'client')`
On the other parallel branches, you'd change out the word to whatever you're searching for, e.g. country.
This should give us a single item array with a string.
Initialize 'client'
Finally, we want to extract the value on the right hand side of the equals sign. The expression for this is ...
trim(split(body('Filter_For_''client''')[0], '=')[1])
Again, just change out the body name for the other action in each case.
I need to put body('Filter_For_''client''')[0] and specify the first item in an array because the filter step returns an array. We're going to assume the length is always 1.
Result
You can see from all of that, you have the value as need be. Like I said, it's a little more verbose but (I think) easier to follow and troubleshoot if something goes wrong.

OR condition not working in Dialogflow CX

I have an intent that contains several parameters. I established a route that should be activated when the first parameter OR the second one is not empty:
$intent.params.tipo3.resolved : "" OR $intent.params.valutarapporti.resolved : ""
If either one of the parameter is not empty, then the agent should transit to another page.
The problem is that is only works when the first parameter is not empty; if the first one is empty but the second one is not, the transition does not happen. It seems like the condition "OR" is misfunctioning.
Note that the parameter is correctly recognized: the user says something that matches the correct intent, the parameter "valutarapporti" is recognized but then no transition happens.
If I separate the two conditions in two different routes, obviously it works, but I'd like to have a single route for such a simple thing. I tried setting them as session parameters, but the results does not change (and that's not really the issue: like I said, the parameter is recognized, the problem is with the transition).
To define a condition when only one intent parameter is set, but not both, you can use the following:
$intent.params.tipo3.resolved = null OR $intent.params.valutarapporti.resolved = null
In this case, you may need to define a separate condition for a situation when both parameters are set.
To define a condition when either one of the two intent parameters is set or both parameters are set, you can use the following:
$intent.params.tipo3.resolved != null OR $intent.params.valutarapporti.resolved != null
The answer posted by Svetlana solved my problem; I'll add that I also tried to define the condition as
$intent.params.tipo3.resolved != "" OR
$intent.params.valutarapporti.resolved != ""
and that solved my immediate problem. However, it meant that the route with this condition was always valid and the other routes were never even evaluated.

JMeter retrieve value of value

I am using jmeter to test ldap.
As part of my test, I want to search for a random uid on each iteration. I did not find a straight forward answer to this. So my idea was to first select a random number 1-200 and saving that number as a variable named uid, that number would correspond to a UDV name.
For example
uid = 2 and 2 = A123456
in my udv list. However when trying to reference this variable in my ldap search filter.I am trying to use
(uid=${${uid}})
in hopes to get the value of the value of uid. However the search results just show this as a string.
<searchfilter>(uid=${${uid}})</searchfilter>
Is there another way to achieve what I am looking for?
Use __V function
${__V(${uid})}
The V (variable) function returns the result of evaluating a variable name expression. This can be used to evaluate nested variable references
${__V(A${N})} - works OK. A${N} becomes A1, and the __V function returns the value of A1
Perhaps the easiest would be going for __RandomFromMultipleVars() function?
Another option is using __V() function, it can combine and evaluate JMeter Variables

When setting Mapping Variables do you have to wire them all the way to the target?

I have a confusion on mapping variables in Informatica.
I set the variables using setVariable() and sometimes setCountVariable() but they are still at zero when I try to pass them back to the calling workflow using the postsession-success_variable_assignment.
My question: Can you set a variable anywhere in the mapping and stop there, for example in a expression, or do you have to wire it all the way to the target to get Infa to recognize it?
Can the port be an output only port, or must it be a variable port first and then moved to an output port secondly.
Just output it to next transformation... It will get assigned

validating ip address in datastage

I have a source file that contains two fields: IP_ADDRESS and USER_NAME. I want to check whether the IP address is correct or not before loading it to the datawarehouse using DATASTAGE. How do I do this?
I was browsing Stack Overflow and think I might have a solution to your question. If you create a job to grab all of the IP_ADDRESS's from the file and send them to a BASIC transformer (search for BASIC transformer in DataStage. It is NOT the one that is normally on the palette). From there, set the Stage Variables as 'SetUserStatus() and write out the column name to a peek stage (You don't need the output at all. The SetUserStatus is the important part). This will now allow you to pass up the Command Output (list of IP Addresses) to a Sequence. From the Sequence, start with the job you just created (BASIC transformer job) and link that to a User Variables Activity. In the User Variables Activity stage, Set the name to something like 'IP Address' and Expression as IP_ADDRESS.$UserStatus. You can then use a Loop to take that output that is now a List and send each individual IP Address to an Execute Stage with a Ping command to see if it returns a valid IP Address. If it does return a valid IP then have your job that writes the USER_NAME and IP_ADDRESS to do a 'Select' statement where the IP_ADDRESS = the valid IP_ADDRESS. For the ones that aren't valid, you can send them down a different path and have them write out to '.txt' file somewhere so you know which ones weren't valid. I'm sure you will need a few more steps in there but that should be the gist of it.
Hope my quick stab at your issue helps.
Yes, you can use a transformer or a transformer and a filter to do that, depending on the version of Datastage you're using. If you're using PX, just encode the validation logic in a transformer stage, and then, on the output link set up a filter that doesn't allow the rows to pass forward if they didn't pass the validation logic.

Resources