Is it possible to show all options in Tokenize2? - tokenize2

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()]);
});

Related

Programmatically add key mappings in Atom

I'm creating several commands programmatically and want to avoid having to add key mappings for them explicitly in keymap.cson.
The Flight Manual page for Keymap Manager shows an add method. It doesn't give an example of how to actually use this method, so my guess is that this should work:
atom.keymaps.add('atom-text-editor',{'alt-1':'custom:my-command'});
However, this does not appear to work. When I run this in the developer console, I get this message:
Encountered an invalid key binding when adding key bindings from 'atom-text-editor' 'custom:my-command'.
I got this message even if I changed alt to ctrl.
What does the correct method call on atom.keymaps look like.
I agree, the docs are not detailed enough. However, through trial and error, I managed to figure it out:
atom.keymaps.add('foo', {
'atom-text-editor' : {
'alt-1': 'custom:my-command',
'#': 'application:about'
// etc
}
});
Explanation:
atom.keymaps.add(source, bindings, priority);
The source argument is not the same as what is referred to as the selector in Atom speak. Instead, it's an identifier that can be used to remove the keybindings, should you wish to (except it seems they haven't actually implemented a remove method!).
Instead, the selector should go inside the bindings argument, as shown above.

Filter at event viewer by data

I want to get event entries by their description (data).
I know how to get the event entry with a certain description, however I want to get an entry whith a description which contains a string (not equals to it).
That, I don't know how to do.
Please help :)
According to my answer here: https://stackoverflow.com/a/34119006/5089204 you should be able to retrieve EventRecords.
Dealing with these events is a quite complex issue... Each event has its own internal structure. The common properties are bundled in EventRecord, but the specific data must be taken from the internal details. Use the ToXml() method of an EventRecord...
In order to get the right events you must define an EventLogQuery. You must know the Provider's name and specify the filter.
Try the following: Open eventvwr and there the Windows-System queue. Right click one event, open the "Details" and choose the "XML-View". Look over different events and you will find, that they are quite differing.
But: You'll find everything you need there: First the "Provider Name" and the "EventId", these two are most important for the `EventLogQuery'.
Now go to the "define a user filter on the current protocoll"-action and type in some values. Then switch to the filter's XML and you'll learn how to define the correct query.
I'm sorry, there is no "easy and general" approach :-)

How to format Alfresco'API parameter activityFilter in servce user activities feed ?

I need to use that api : http://docs.alfresco.com/4.0/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Freferences%2FRESTful-FeedUserfeedGet.html
What I don't know is how to format activityFilter parameter ? What kind of things can I filter ? I'd like to set a max number of results, is it possible ?
I don't know where to find the documentation.
Thank you.
Mathieu.
I don't know where/if the list is documented, but it isn't hard to find out the values you are looking for...
The first place to go is the Web Script Index, which is:
http://localhost:8080/alfresco/service/index
From there you can find that web script, click on its ID, and see its declaration, any accompanying documentation, and, often, the code of the web script controller.
In this case, the controller is Java-based, so you can get its class and go look at that in the source.
Often, that's not convenient. So the next thing to do is to realize that Alfresco Share makes use of the same web script. If you turn on Firebug and go to the Alfresco Share Global Dashboard you can see the activity feed dashlet. As you change the second dropdown (the one that defaults to "all items") you will see your browser doing GETs against that web script. By choosing the various choices available in the dashlet, you'll see that the values it uses to filter activities are:
org.alfresco.comments.comment-created
org.alfresco.comments.comment-updated
org.alfresco.documentlibrary.file-added
org.alfresco.documentlibrary.file-deleted
org.alfresco.documentlibrary.file-updated
org.alfresco.documentlibrary.files-added
org.alfresco.documentlibrary.files-deleted
org.alfresco.documentlibrary.files-updated
org.alfresco.profile.status-changed
org.alfresco.site.user-joined
org.alfresco.site.user-left
org.alfresco.site.user-role-changed
You can pass more than one of these at-a-time to the web script by separating each with an escaped comma (%2C).
There may be more filters available, but those are the ones used by the activity feed dashlet on the global dashboard.

Xcode4 target labelled as missing, but cannot delete it

I want to delete this red-marked target, but am unable to.
The "minus" button in the dialogue remains greyed-out, it doesn't respond to backspace or delete keys and right-clicking just brings up help options. I can drag the missing-red-marked target above or below the working black target, but it doesn't let me delete it.
This missing red target only seems to appear in this edit schemes dialogue.
In my main project/target window, I just have the one good target there.
Any ideas how to clean this up and delete this missing target?
What worked for me was to designate another executable (or none) in the existing scheme's various actions (run, test, etc.). It's the fact it's in use in the scheme's actions that prevents its deletion. I discovered this during my research for Mastering Xcode 4 (yes, shameless plug). :-)
Try creating a brand new scheme (via "New Scheme" or "Manage Schemes...") and start using that.
Once your new scheme is building properly and is set as a default, you should be able to delete the old scheme with the bogus "missing" target.
The real issue here is explained by Joar Wingfors in the Xcode-users mailing list (emphasis mine):
In the scheme sheet you cannot delete things from one tab that some
other tab depend on. In this case you probably have to delete the
target from the test tab before you can delete it from the build tab.
Or something along those lines.
I had the exact same problem. Solved by closing the xCode and externally editing the schema file to delete the bundlableResource section for the missing library. Not the safest of all methods but it works.
First delete all schemes and then generate the schemes again. Work for me .
What Joshua said, a bit tailored. Go through all various actions and change the missing executable to an existing one.
In your case, go to 'Profile' and switch to the new app. Same if you encounter this in 'Test' tab.

how to use QTable::editCell()

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
}

Resources