How to correctly add a variable's value to parameters in Postman? - twitter-oauth

I'm learning Chrome Postman now and my issue now is:
I need to generate a new value of a parameter for each request.
So each request (I make a POST) must have a unique value of this parameter.
So far I thought to manage it with environment variables and I have done it like this:
I add a new environment variable with a unique value
I use this variable in the "value" field on a parameter
And it doesn't work - I get error 401 Authorization Required.
Seems that the error is not connected to the parameter at all but as soon as I change the parameter and manually input a unique data it works well!
So this will work for me:
Please suggest what I'm doing wrong here and advice how to do it right. Thanks!

Spent some more hours investigating I found my problem!
The problem is the value I put into a variable - it included ":" sign and this sign simply changed my URL.

Related

Uri.Parse() is adding random characters inside the uri

When I try to create a Uri object using Uri.parse, I get %0D%0A added after `_countryCode` value
This is what gets logged
http://api.geonames.org/countryInfo?country=US%0D%0A&username=medcollapp
value of _countryCode is a string like US or IN.
_countryCode is not empty I made sure of it.
I have no idea how to fix this any help would be appreciated.

Trying to use dynamic and action parameters

recently I stumbled upon one of the videos of Benjamin Schumann titled: What are dynamic and action parameters and when should you use them in your AnyLogic model.
I tried to further adjust the functions of dynamic and action based parameters for a problem of mine. Just to give a heads up, I am fairly new to Anylogic (only worked through that one book, and some minor projects and tutorials) and been decent in Java (been a few years since I've been actively working in Java but currentlystarting to get back in [still rusty]).
Regarding my actual problem, in the video Mr. Schumann has an agent with three parameters. One static, one dynamic and one action. In addition to that he has a variable (double) all set in his agent. On his main is a button to increment the value of the variable with the help of the parameters and to trace the lines in the console (= giving out a string if a certain threshold of the variable is passed).
I created a similar setting, however I happen to run into a lot of variable errors during time to time while compiling.
Here some example code snippets:
dynamic parameter p_Station of the type String
v_myFahrt < 222 ? "Wiesbaden Hbf" :
v_myFahrt < 442 ? "Wiesbaden-Biebrich Bahnhof Wiesbaden Ost" :
v_myFahrt < 663 ? "Wiesbaden-Mainz-Kastel Bahnhof" :
"Hochheim (Main) Bahnhof"
therefore my variable is called v_myFahrt, a double with the initial value of 0
action parameter p_durchFahrt with the default action:
v_myFahrt = v_myFahrt + 220;
and my Button on the main:
myAgent.p_durchFahrt();
traceln(myAgent.p_Station());
So basically it is a somewhat similar code as in the reference. I tried to than add another instance of the agent with a different set of "code" for the dynamic parameter (different Strings and values) as well as a different "code" for the action parameter (e.g. + 208 instead of + 220). To then wanting to trace the lines in the console with the button again.
I tried to add
myAgent1.p_durchFahrt(); traceln(myAgent1.p_Station());
to it.
But before I coul even run it, I keep getting the error "v_myFahrt cannot be resolved to a variable" for myAgent1. Inspecting the error it keeps referring to myAgent1 with the newly added code for p_Station and I can't seem to find a way around it.
What am I doing majorly wrong here?
it looks like you have created v_myFahrt in main, right? (that would explain your symptoms).
If yes, you should create it in MyAgent instead.

BIRT Chart API setting caption to string with equal sign in it truncates value on left

I'm attempting to use the Chart API directly and am running into a problem with an expression.
If I attempt to do the following
chart.getTitle().getLabel().getCaption().setValue("Day of Week (M=1)");
The resulting label is:
1)
If I remove the '=' from the value it works fine no problems but that '=' appears to be triggering an expression evaluation.
Note this is using the Chart Engine API, and this chart is NOT associated with a BIRT Report.
Anyone have any suggestions?
EDIT It looks like while generating the chart, it attempts to resolve the chart title as a key for an externalized message. RunTimeContext.externalizeMessage(...) because of the fact that my title contains an '=' sign. Is there a way to escape this to prevent it from attempting to render it as this?
I took a deeper look into this and was able to fake it out by implementing an externalizer and just keying it to concatenate the key & default values together with the '=' token constant.
as this is for demo purposes it worked ... granted not the most optimal solution but it got what I needed.

Get statuscode text in C#

I'm using a plugin and want to perform an action based on the records statuscode value. I've seen online that you can use entity.FormattedValues["statuscode"] to get values from option sets but when try it I get an error saying "The given key was not present in the dictionary".
I know this can happen when the plugin cant find the change for the field you're looking for, but i've already checked that this does exist using entity.Contains("statuscode") and it passes by that fine but still hits this error.
Can anyone help me figure out why its failing?
Thanks
I've not seen the entity.FormattedValues before.
I usually use the entity.Attributes, e.g. entity.Attributes["statuscode"].
MSDN
Edit
Crm wraps many of the values in objects which hold additional information, in this case statuscode uses the OptionSetValue, so to get the value you need to:
((OptionSetValue)entity.Attributes["statuscode"]).Value
This will return a number, as this is the underlying value in Crm.
If you open up the customisation options in Crm, you will usually (some system fields are locked down) be able to see the label and value for each option.
If you need the label, you could either do some hardcoding based on the information in Crm.
Or you could retrieve it from the metadata services as described here.
To avoid your error, you need to check the collection you wish to use (rather than the Attributes collection):
if (entity.FormattedValues.Contains("statuscode")){
var myStatusCode = entity.FormattedValues["statuscode"];
}
However although the SDK fails to confirm this, I suspect that FormattedValues are only ever present for numeric or currency attributes. (Part-speculation on my part though).
entity.FormattedValues work only for string display value.
For example you have an optionset with display names as 1, 2, 3,
The above statement do not recognize these values because those are integers. If You have seen the exact defintion of formatted values in the below link
http://msdn.microsoft.com/en-in/library/microsoft.xrm.sdk.formattedvaluecollection.aspx
you will find this statement is valid for only string display values. If you try to use this statement with Integer values it will throw key not found in dictionary exception.
So try to avoid this statement for retrieving integer display name optionset in your code.
Try this
string Title = (bool)entity.Attributes.Contains("title") ? entity.FormattedValues["title"].ToString() : "";
When you are talking about Option set, you have value and label. What this will give you is the label. '?' will make sure that the null value is never passed.

How do I create a manual link on a tree in Oracle APEX when Session State Protection is turned on?

Friends,
I'm facing another challenge in APEX and I hope you can help.
I have created a tree using the method described in John & Scott's superb book, "Pro Application Express" whereby the page link is stored in a table. Below is an example:
go to a page passing some parameters
f?p=&APP_ID.:3:&SESSION.::::P3_IDENTIFIER,P3_FAMILY_NAME:&P2_IDENTIFIER.,&P2_FAMILY_NAME.
When the page is run this works as expected. I can expand the tree and navigate to the page passing parameters if required.
However when I turned on session state protection these "hand crafted" links stopped working. Which I expected because the link contains no checksum.
After some investigation I see I have to use APEX_UTIL.PREPARE_URL to generate the URL with a checksum. Unfortunately this is where I run into problems. I can't seem to be able to pass the parameters values to the calling page.
The original tree query was:
select "IDENTIFIER" id,
"PARENT_IDENTIFIER" pid,
"TITLE" name,
"LINK" link,
null a1,
null a2
from <some table>
I then changed this to use APEX_UTIL.PREPARE_URL:
....
APEX_UTIL.PREPARE_URL('f?p='||:APP_ID||':3:'||:APP_SESSION||'::::P3_IDENTIFIER,P3_FAMILY_NAME:&P2_IDENTIFIER.,&P2_FAMILY_NAME.') link,
...
and this works, the page is called and I can see the values of the parameters passed. But I can't use this method as it is restricted to the one page!
Finally I tried storing the page number, parameters and parameter values in different columns of the table that the tree is based on and then bring them together:
...
APEX_UTIL.PREPARE_URL('f?p='||:APP_ID||':'||navigate_to_page||':'||:APP_SESSION||'::::'||parameters||':'||parameter_values) link,
...
Where:
navigate to page has the value of: 3
parameters has the value of: P3_IDENTIFIER,P3_FAMILY_NAME
parameter_values has the values of: &P2_IDENTIFIER.,&P2_FAMILY_NAME.
This now calls the page, but the parameter values have become literals. so where I'm expecting an identifier I see &P2_IDENTIFIER and ditto for family name.
What am I doing wrong? How can I pass values to my called page using apex_util_prepare_url?
In case of need, my environment details are: Apex 3.2.1, Oracle Application Server 10.1.2.3. Oracle Database 10.2.0.3
Thanks in advance for any help you may be able to provide.
I think you'll need to resolve those variables, using the v() function:
APEX_UTIL.PREPARE_URL('f?p='||:APP_ID
||':'||navigate_to_page
||':'||:APP_SESSION
||'::::'||parameters
||':'||v('P2_IDENTIFIER')||','||v('P2_FAMILY_NAME')) link,
On a side note, you might need to be careful about P2_FAMILY_NAME since it's being used in the url; it sounds like a plain text field which contains user-entered data?