I have defined an action with the following two commands:
#Prompt([...]; "1");
#Command([ToolsRunMacro];"(AGENT)");
#Prompt([...]; "2");
#If(#GetProfileField("PrivateProfile";"LENGTH";#UserName))>0;#PostedCommand([Compose];"FORM");"");
#Prompt([...]; "3");
But with the #Prompt commands I found out, that first of all each of the #Promptmessages (1-3) are displayed and after that the AGENT runs. But as the AGENT manipulates the LENGTHfield, the #IF statement compares an 'obsolete' value.
Maybe each statement is executed at once? If yes: how can I prevent the agent from this behavior?
I would appreciate any help!
The [ToolsRunMacro] command will always run after all #Functions have executed first. There is no way to change this.
You can get a list of what commands will execute straight away vs after other functions that execute at the end, in the infocenter documentation.
http://publib.boulder.ibm.com/infocenter/domhelp/v8r0/topic/com.ibm.designer.domino.main.doc/H_COMMAND.html
Also something to be aware on your code is that Profile documents are cached. So you might not in all cases see any changes made to the document straight away.
Related
I have the following code with two dictionaries. I can see that when I iterate through DictForbidden even though it is empty the execution flow enters the loop so DictToAdd.remove(anInteger); is executed with
the old value of anInteger
var DictForbidden, DictToAdd : TDictionary<Integer,boolean>;
var anInteger: Integer;
DictForbidden := TDictionary<Integer,boolean>.Create;
DictToAdd := TDictionary<Integer,boolean>.Create;
anInteger := 1;
DictToAdd.Add(anInteger,true);
for anInteger in DictForbidden.Keys do
DictToAdd.remove(anInteger);
DictForbidden.Free;
DictToAdd.Free;
I am running Delphi 10.4 and I don't recall such a behavior in 10.3. I think back then if the dictionary was empty the loop was not entered. Do you know if this is something new on Delphi 10.4?, or maybe I am doing something wrong here?
regards, Carlos
In my 10.4.1 it doesn't enter the loop. But it may look like it does when you debug trace due to optimization made by the compiler. Try replacing the
DictToAdd.Remove
with a
writeln(anInteger) // if Console Application
ShowMessage(IntToStr(anInteger)) // if GUI Application
and see if anything is reported.
thank you very much for the quick help!
Actually you are right #Heartware. After the loop, DictToAdd still contains a 1. So basically there is no case here rather than putting a break point in the line DictToAdd.remove(anInteger); the execution is stopped and putting then the cursor above anInteger you see the value is 1 but stepping over the 1 is not being removed. When replacing the removal by a showmessage I observe the same thing the break point is reached but the showmessage is not executed.
Also noticed that when using a begin/end like this
for anInteger in DictForbidden.Keys do
begin
DictToAdd.remove(anInteger);
end;
the break point is not reached.
This is a little annoyance with the debugger caused by the fact that a loop of course produces some executable code - especially a for in loop that has calls to MoveNext and Current and some cleanup code for the enumerator after it completes.
This code has to go somewhere and often the line information being used by the debugger (aka "the blue dots") of that code overlap with actual code you wrote like in this case.
To illustrate this here is how the disassembly looks like when I put your code into a console application.
As you can see there are two breakpoints displayed here which belong to the same one breakpoint I placed in line 21. But the one that got hit is the one with the cleanup code which is responsible for destroying the enumerator. If you hit F7 and you compiled with debug dcus you will notice that it actually does not go into TDictionary.Remove but into TObject.Destroy.
Now the disassembly after placing the begin and end:
Again two breakpoints shown but this time I actually placed them both myself - and they are for different lines.
I need to execute a function immediately when someone purchases a course or an order gets completed successfully. The function I am trying to execute is actually called an API. I don't see an appropriate Hook from LearnPress.
It works perfectly when I use "user_register"(when someone registers this hook fire) hook but it doesn't work when I use this "learn_press_confirm_order" hook given by LearnPress.
Do you guys know is there any appropriate way that I can follow and achieve this. Thank You for your time
First off, your Lime API key should be treated as a password - don't share it on the web! Go to your LimeLM Account right now, choose 'Settings', and choose 'Generate New Key'. I'll wait :)
There's nothing obviously wrong with your code, so I would debug it like this:
Put a die('setup'); immediately after the add_action. We want to be sure that this file is actually being called. If it is, remove the die.
Wordpress and LearnPress are fantastic, because you've got the source code. Go to wp-content/plugins/learnpress and type (on Linux or something *nix)
grep -R "learn_press_confirm_order" .
This will show you all the files that reference this action. There is only one:
./templates/order/confirm.php: transaction_method, $order->get_id() ); ?>
So pull up an editor and edit wp-content/plugins/learnpress/templates/order/confirm.php. You need to determine:
Whether the file is being run at all when you order. (Use die right at the top, or error_log if you can see your webserver/php log files.)
I'm fairly certain at this point you will have found the error, but there's a chance for some reason you're getting to this page, but the action isn't being called. So you might need to work out the exact flow of control on this confirm.php page. Again, die or error_log.
You can make live changes to the code of learnpress, to help you debug it. Most people are afraid to dig into other people's code, but that's the great power of open source. You can just reinstall learnpress when you're done.
Looking forward to hearing how it goes :)
Tokenize2 is a javacsript lib to select multiple options.
It provides a very neat UI to start writing and then get a list of options to select from. Selected options will show up as "tags" that can be removed with "x" link.
So far all is fine. But Right now you need to know what your looking for and start write at least one character to see matching alternatives.
In my scenario there are very few alternatives and they are not known to the user. I would like to show ALL options when the user clicks the input box. There is a configuration option named searchMinLength but it is already set to 0.
Is there a workaround that can be used? Maybe like triggering load and dropdown manually?
I know there are a lot of similar alternatives but I picked Tokenize2 because:
It looks clean and nice
It works in mobile browsers
I don't know if there is an "official" approach, but after some investigation I have found an acceptable workaround.
After downloading the Tokenizer2 sourceode I found the following line that triggered my attention:
if(this.input.val().length > 0){
this.trigger('tokenize:search', [this.input.val()]);
}
My interpretation is that the internal search command is not triggered unless the user input has at least one character. This line in sourcecode could easily be modified. I have filed a suggestion for this here: https://github.com/zellerda/Tokenize2/issues/26
My current workaround is to add an event listener for the select event and there trigger the internal search command. That works fine for my scenario and does not force a source code rewrite.
$("#my-dropdown").on("tokenize:select", function (e: Event, routedEvent: boolean) {
$("#my-dropdown").trigger('tokenize:search', "");
});
Tokenize2
This link worked for me GitHub
$('.tokenize-sample-demo1').on('tokenize:select', function(container){
$(this).tokenize2().trigger('tokenize:search', [$(this).tokenize2().input.val()]);
});
Got an issue with keymapping commands:
https://www.youtube.com/watch?v=d5nrEO_t7Wo
As you can see in the video, when I call the commands by keyboard shortcut:
On the first attempt - the function isn't called.
On the second attempt - the function is called.
Where as, when I call the commands via the command pallet, the commands are called even on the first attempt. Not shown in the video, I can call the commands from the command pallet more than once without fail.
This leeds me to believe there is something wrong with my keymap.coffee:
'.editor:not(.mini)':
'shift-cmd-h': 'hex:view'
'alt-down':'editor:add-selection-below'
'alt-up':'editor:add-selection-above'
'.editor':
'cmd-k':'jxa:compile'
'shift-cmd-k':'jxa:compileApp'
'cmd-u':'jxa:execute'
However I can see nothing clearly wrong here... So perhaps there's something wrong with my init.js?
https://github.com/sancarn/JXA-Compile/blob/master/src/init.js
Any ideas?
This was solved by DamnedScholar here.
Okay, no. It's because cmd-k is bound to so many things. Go into Settings -> Keybindings and search for it and you'll see a lot of different things attached to it that are all bindings with multiple key presses. So when you press cmd-k, Atom waits to see what your next key press will be. You should consider using something different for jxa:compile.
I want to embed one my specific chart in dahsboard of kibana. For that I need inject my JS into Kibana source. I have followed by instructions https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md to provide test environment, but I have obtained an error after "./kibana --dev"
let _ = require('lodash');
^^^
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
SyntaxError: Unexpected strict mode reserved word
at Module._compile (module.js:429:25)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:41)
Can anybody help me with start environment, or advice. Probably, I am moving by wrong way...my general goal (inject my JS code into Kibana) can be reached by another approach.
Thanks
I have reached my general goal, and if it is right - I place here my approach. (also, as an answer for above question)
When I was seeking ways how to implement what I want (my own custom metrics in dashboard....only as training and for personal "sport interest" sake) - I had chosen next way.
First of all - you need pay attention on index.js, not small one but huge file (more than 5MB), it predominantly contains angularJS terms.
My steps was:
I put into HTML empty container for my metrics
<div class="metric_container"></div>.
HTML defines in index.js as
define('text!plugins/dashboard/index.html',[],function () { return '<div dashboard-app class="app-container dashboard-container">\n .....
you can try to search ctrl+F it over the index.js
I found variable with JSON data for charts (esResp)
I found watcher on changing it $scope.$watch('esResp', prereq(function (resp, pre Resp) {....
Put in the body of watcher my_function () call.
finished my_function() call, that contains completing HTML metric sample with renewed figures (from esResp JSON) and putting it into
metric_container
so, I can develop my own metrics, charts, and it will be renew, but ONLY based on information provided in charts.
So, If you need smth - you need firstly create appropriate chart because of data set for you own calculations and further visualization.
Something So.
I am sure, probably there is best way, but my was.
I have created a number of visualizations for Kibana 4.4.1, and once you have the right baseline, it is no big deal.
I encourage you to take a look at any of my sources, in order to know what has to be done (http://github.com/JuanCarniglia).
There are some basic files you need to have, and you have them, you just put them on the src/plugins directory, and restart kibana. If everything is fine, you get a new visualization on the list.
If you encounter any problems or need a more detailed description, send me a message or post it here and I'll try to explain with more detail.