I am working on an AutoIT script to find select messages withing a chatroom type webpage, I have no problem with placing the sent text between two special characters to make them easier to find, also to filter out all of the unwanted stuff. the problem that I am having is once the _stringbetween finds what it is looking for it doesn't continue looking. For testing I have the values returning in a GUI box. If there is a way to return all text between "^","^" it would solve my problem. Here is what i have so far
$html = _StringBetween(_INetGetSource('https://dtss.campfirenow.com/room/595835'), '^','^')
MsgBox(0, "title", $html[0])
also if anyone knows of a better way to pull select messages from campfire that would also solve my problem, maybe using the star feature... If you would like to look at the source code and api's of campfire they are available on GitHub
The _stringbetween return all occurences it will find.
You can make this simple test.
#include <array.au3>
$source="^test1^blabla^test2^blabla^test3^blabla^test4^blabla^test5^blabla"
$aRes=_StringBetween($Source,"^","^")
_ArrayDisplay($aRes)
For your source I don't now what's happening but test like this :
#include <array.au3>
$Source = BinaryToString(InetRead("https://dtss.campfirenow.com/room/595835"))
$aRes=_StringBetween($Source,"^","^")
_ArrayDisplay($aRes)
If the problem persist make a paste of your source code's page and post the link.
Related
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()]);
});
An issue has been noticed on one of our old sites running 2.4 where when the user creates a link in the CMS content, selecting an existing page to link to, the link is not being converted to the actual URL on the front end and all links are coming through in the format of <a href="[sitetree_link_id=12]">
What would be causing this and how do I fix it?
The tag looks like it's being set incorrectly. It should be [sitetree_link id=12], not [sitetree_link_id=12].
We later added support to the parser for [sitetree_link,id=12] so that links didn't need to contain spaces, but I can't recall if that's in 2.4 or only 3.0+.
Can you confirm that your WYSIWYG insertion is putting in that errant _? If so, you might want to checkout the handleaction_insert function in tiny_mce_imporvements.js to confirm that it has a line like so:
case 'internal':
href = '[sitetree_link id=' + this.elements.internal.value + ']';
If the inserted links don't actually have the errant _ but they aren't being parsed, then try checking your sapphire/_config.php file for this:
ShortcodeParser::get('default')->register('sitetree_link', array('SiteTree', 'link_shortcode_handler'));
If your site makes changes to the ShortcodeParser at all you might have inadvertently turned off sitetree_link support.
If all of that looks in order, perhaps the ShortcodeParser isn't being called for some reason. In HTMLText::forTemplate(), put a debug statement (I like die("I got here!");) to confirm that HTMLText::forTemplate() is actually getting called. If it's not, you might need to manually call it in some pre-processing of your Content variable. Instead of this:
$content = $this->Content;
Do this:
$content = $this->obj('Content')->forTemplate();
I hope that one of those answers help. Either way, it would be great if you could post back, so we could isolate what caused this. It might help us make the API easier to use in SilverStripe 3.1.
I don't understand how QTable::editCell() should be used. I am trying to do some error checking based on entries made by user in a QTable as mentioned in my another question.
I would like to give user an opportunity to re-edit the cell which has error. For example, if name column entry has some special characters such as '(', the user should be prompted for the error and the control should go back to same cell in edit mode. I tried using QTable::editCell() in my code as shown below.
Table->editCell(row, 0, TRUE);
name = Table->text(row, 0);
However, this doesn't work as expected. The control doesn't stay in the cell at all and obviously the name is not correctly collected. So, my question is how to ensure from within code that a cell of QTable can be edited so that the edited contents can be accessed immediately in next statement (as shown in above code).
Note: I am working with qt 3.3.8 only.
I don't think you can do that. You'll have to go back to the event loop, and wait for one of the signals (like valueChanged(row,col)) to be fired to re-validate the data.
A blocking wait on a GUI object is often not a good approach (except for modal dialogs).
I know I'm a little late here but you should use the following connect statement with your own custom function to do your specific needs such as below. You can also use this method to disable users from entering in special characters within you custom function. That way they wont ever have to correct undesirable characters.
connect(ui->tableWidget, SIGNAL(cellChanged(int,int)), this, SLOT(customFunction(int,int)));
void updateTable
{
//remove invalid characters
}
I have a basic label that is supposed to indicate to the user that the program is searching directories for several seconds. So it goes like...
self.label.setText(QString("Searching..."))
# method to search directories goes here
self.label.setText(QString("Search Complete"))
My problem is that the label never displays "Searching...". The execution always seems to jump straight to run the method to scan directories, and then the label text is set to "Search Complete" after the method which scans directories has finished.
I'd be grateful if someone could please explain why this is happening or suggest a better way to resolve the problem.
many thanks
Your "method to search directories" is blocking the GUI hence QLabel is not able to update the text. You can make your search routine asynchronous or go the easy way and force QLabel to update itself:
self.label.setText(QString("Searching..."))
self.label.repaint()
# method to search directories goes here
self.label.setText(QString("Search Complete"))
Add include:
#include <qapplication.h>
Let Qt process events:
self.label.setText(QString("Searching..."))
qApp->processEvents();
Note: repaint() was not necessarie.
In PyQt5, you don't need to use QString :
self.label.setText("Searching...")
self.label.repaint()
self.label.setText("Search Complete")