Shortcut to create a var statement in WebStorm - webstorm

Is there a shortcut to create a var statment with WebStorm? For example in the following line I wanna create var parameter when selecting parameter:
someFunctionCall(parameter);
expected result
var parameter;
someFunctionCall(parameter);

Use Refactor | Extract | Variable. Shortcut would depend on the OS and selected keymap.

Related

Localization Text in SwiftUI

I am having issues with localization text in SwiftUI. I created a file called "Localizable.string" which contains the following key and values.
"helloTitle" = "Hello!";
I use the localizedString as shown below:
var body: some View {
Text("helloTitle")
.padding()
}
Instead of display "Hello" it displays "helloTitle".
Here are my build settings:
For some reason Base has 0 Files Localized. I am not sure why?
Double check the target membership of your Localizable.strings file. It should be part of the same target as your view.
try renaming the file to Localizable.strings, note the "s"

How to pass <list_items> to a PULLDOWN DIALOG as a variable?

In a PRACTICE script, how do I pass a list of items to a pulldown dialog as a variable. I have tried the following, but it doesn't seem to work.
&myFiles="foo,bar,baz"
DIALOG
(
OptionA.SEL: PULLDOWN &myFiles ""
)
From the PRACTICE Script Language User’s Guide (practgice_user.pde):
Use (& or (&+ as opening block delimiter to switch ON macro expansion ...
The following works as expected:
&myFiles="foo,bar,baz"
DIALOG
(&+ ; <-- note this
OptionA.SEL: PULLDOWN &myFiles ""
)

Attachments moved away from Item after validation and before submit process in Apex

I have multiple File Browser Item fields on one page of Application in Oracle Apex.
What happens: When I miss any Item for which validation error fires, I want to hold that file to the browser but I usually loose it if I get that validation error. Is there a solution for the same like other Items fields hold previous value except File Browser Item field. Please see below ss:
Anshul,
APEX 4.2 is very old and no longer supported. A later (or preferably latest) version of APEX will behave differently as Dan explained above.
Can you import your application into apex.oracle.com (which is running APEX 20.1) and you will probably see better results. Based on this you can hopefully use it as justification to upgrade your environment.
Regards,
David
Go to your page-level attributes and a function like the following in the Function and Global Variable Declaration:
function validateItems(request) {
var $file1 = $('#P68_FILE_1');
var $file2 = $('#P68_FILE_2');
var errorsFound = false;
if ($file1.val() === '') {
errorsFound = true;
// Show item in error state
}
if ($file2.val() === '') {
errorsFound = true;
// Show item in error state
}
if (!errorsFound) {
// I think doSubmit was the name of the function back then. If not, try apex.submit
doSubmit(request);
} else {
// Show error message at top of page, I'll use a generic alert for now
alert('You must select a file for each file selector.');
}
}
Then, right-click the Create button and select Create a Dynamic Action. Set the name of the Dynamic Action to Create button clicked.
For the Action, set Type to Execute JavaScript Code. Enter the following JS in code:
validateItems('CREATE');
Finally, ensure that Fire on Initialization is disabled.
Repeat the process for the Save button, but change the request value passed to validateItems to SAVE.

Make a Label/Text automatically recognize links in QtQuick/QML?

I want to automatically make links (e.g. https://xmpp.org/) into the text of a Text element clickable, so the link can be opened in a browser (without manually copying the link).
I can't add e.g. manually in my code, because the input comes directly from users.
Has Qt a simple solution for this in QtQuick/QML?
You can use something like that(Regex is from this answer);
Text {
property string text2: "http://www.google.com"
text: isValidURL(text2) ? ("<a href='"+text2+"'>"+text2+"</a>") : text2
onLinkActivated:{
if (isValidURL(text2)){
Qt.openUrlExternally(text2)
}
}
function isValidURL(str) {
var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*#)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%#!\-\/]))?/
return regexp.test(str);
}
}
You can use TextArea or TextEdit components, set textFormat property to TextEdit.RichText and listen to onLinkActivated signal.
E.g.
TextArea {
id: ...
textFormat: TextEdit.RichText
onLinkActivated: Qt.openUrlExternally( link )
}
Note: in order the link in browser you need to use Qt.openUrlExternally
One hint, in order to make the component not editable (so that user can not type in), DO NOT set enabled property (inherited from Item) to false, use readOnly property instead. Setting enabled would make link unclickable.

How to use Delegate with QCalendarWidget?

I need modify the delegate in a QCalenderWidget. I want to change the background-color of cell when the user select a specific day.
I would like getting a simple example.
You could use QWidget::setStyleSheet(const QString & styleSheet) and set selection-background-color value:
auto calendar = new QCalendarWidget(this);
calendar->setStyleSheet("selection-background-color:black");