Qt: how to apply a shortcut( Key_Comma + Key_Return) to action - ruby-on-rails

I tried to set a shortcut by the following code, but it doesn't work. If I change it to ALT + Comma or ALT + Return, it will be fine. but the request is Comma + Return. Does anyone know how to set this special shortcut on Qt?
#shotcut = Qt::Shortcut.new(Qt::KeySequence.new(Qt::Key_Comma +
Qt::Key_Return), self, SLOT('save_by_shortcut()'))
#shotcut.setEnabled(true)
Any help would be appreciated!

You can create it by using the multiple arguments constructor for QKeySequence.
like this:
auto ac = new QAction(this);
ac->setShortcut(Qt::Key_Comma + Qt::Key_Return);

Related

R-Studio error "> " signs became "+"

We have a homework on R-studio and while applying steps I've got an error, as shown below:
+ +library(simpleaffy)
+ +>hist(dat)
+ +plotAffyRNAdeg(RNAdeg, col=cols)
+ +end()
+ +options(error = expression(NULL))
+ +>hist(prostate)
+ +>hist(prostate)
+ +source('~/.active-rstudio-document')
These are just some random codes which I wrote while trying to dispose pluses
They must be > to run the steps, but I can't run because of this error.
You have to omit both > and + at the beginning of the lines. Your code has to look like this:
library(simpleaffy)
hist(dat)
plotAffyRNAdeg(RNAdeg, col=cols)
end()
options(error = expression(NULL))
hist(prostate)
hist(prostate)
source('~/.active-rstudio-document')
You probably want to ask programming questions on StackOverflow.
A line starting with + means R is expecting more input. It usually occurs because you haven't closed a parenthesis.

Append to query-string with the same key

I am trying to add some parts to a query-string with the same key.
I have a url like http://server.com/search/result?query=hello with some controls that should add a collaborator to the query-string.
This is done with this:
<g:link action="result" params="${params + ['collaborator': collaborator.id]}">${collaborator.name}</g:link>
Which returns: http://server.com/search/?query=hello&collaborator=<id>.
This is all good, but its possible to choose more collaborators. How do I append another &collaborator=<id> to the query?
I have tried various methods like ${params + [params.collaborator + collaborator.id]}, but this only puts them in one string.
Try this:
gsp:
<g:link action="result" params="${params + ['collaborator': params.list('collaborator') + [collaborator.id]]}">${collaborator.name}</g:link>
action:
List collaboratorList = params.list('collaborator')
//Your operations on this list

ZF2 + Zend\Db\Sql\Update, adding to current value

I'm trying to do something relatively simple but can't figure it out.
I just want to add to a current value in the DB is there anyway to do the equivalent of a:
UPDATE `tablename` SET fieldB = fieldB + 1 WHERE fieldA='X'
Using the Zend/db update function?
it will be something like this:
$select = $sql->update();
$select->table('basket');
$select->set(['quantity' => new Expression("quantity + ? ", [$quantity])]);
$select->where(['basket_id'=>$basket_id]);
Remember to escape/sanitize your data! (like i do with $quantity)

Sublime text 2 Plugin Development - How do I get the language of the current file

== UPDATE ===
So I realized that Sublime already has a command for adding comments. So if I have code inserted like this:
comment = " ----------------------------------------" + '\n'
comment += " " + title + '\n'
comment += " #author " + author + '\n'
comment += " #url " + url + '\n'
comment += " ---------------------------------------" + '\n'
comment = self.view.run_command('toggle_comment')
code = items['code']
layout = comment + code
self.view.replace(edit, sel[0], layout)
How do I get the command to work so that it comments out the comment variable? Thanks.
Initial Question
I am creating a plugin for Sublime Text 2 and want to make sure that when it inserts/replaces code it inserts comments as well, but to do this I need for it to insert the correct comment types for the various languages. I know that I can run the following command:
view.settings().get('syntax')
And that will return something like this:
Packages/Python/Python.tmLanguage
Is there a way to have it return just PHP, Python, C++, etc.
I'm sure I could do a substring command in Python, but since I can see an easy way of seeing all file settings I wanted to make sure there wasn't a quick easy way of doing this. Thanks for the help.
Are you looking for scope_name ?
scope_name(point) | String | Returns the syntax name assigned to the character at the given point.

context menu demo app not working crossrider

I am generating context menu when user selects some text and right click it. I tried implementing it, problem is even sample application is not working.
http://crossrider.com/apps/10565/ide
appAPI.contextMenu.add("key1", "Display data object", function (data) {
var sAlertText = 'pageUrl: ' + data.pageUrl + '\r\n' +
'linkUrl: ' + data.linkUrl + '\r\n' +
'selectedText:' + data.selectedText + '\r\n' +
'srcUrl:' + data.srcUrl;
alert(sAlertText);
}, ["all"]);
Only data.pageUrl is available rest of all are "undefined". I want selectedText.
Disclaimer: I work at Crossrider.
Indeed there was an issue with the contextMenu due to a change in the Chrome API.
We've fixed this and now the demo app works.
Thank you for reporting this and please feel free to let us know if you encounter any issues!
Amir

Resources