Sign Up to our social questions and Answers to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers to ask questions, answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
This promise is immense; every day and every night, we are trying our best to fulfill it by helping others, leaving something worthwhile behind us, and living for a purpose that is "Enrich & Spread knowledge everywhere".
How to set a checkbox to be “checked” and “uncheck” with JQuery 1.5 & 1.6 ?
jQuery 1.6+ Use the new .prop() method: [code]$('.myCheckbox').prop('checked', true); $('.myCheckbox').prop('checked', false);[/code] jQuery 1.5.x and below The .prop() method is not available, so you need to use .attr(). [code]$('.myCheckbox').attr('checked', true); $('.myCheckbox').attr('checked',Read more
jQuery 1.6+
Use the new .prop() method:
[code]$(‘.myCheckbox’).prop(‘checked’, true);
$(‘.myCheckbox’).prop(‘checked’, false);[/code]
jQuery 1.5.x and below
The .prop() method is not available, so you need to use .attr().
[code]$(‘.myCheckbox’).attr(‘checked’, true);
$(‘.myCheckbox’).attr(‘checked’, false);[/code]
Note that this is the approach used by jQuery’s unit tests prior to version 1.6 and is preferable to using
[code]$(‘.myCheckbox’).removeAttr(‘checked’);[/code]
since the latter will, if the box was initially checked, change the behaviour of a call to .reset() on any form that contains it – a subtle but probably unwelcome behaviour change.
For more context, some incomplete discussion of the changes to the handling of the checked attribute/property in the transition from 1.5.x to 1.6 can be found in the version 1.6 release notes and the Attributes vs. Properties section of the .prop() documentation.
See lessCan i INSERT or UPDATE a table through a view ?
Hello Beter, Views in Oracle may be updateable under specific conditions. It can be tricky, and usually is not advisable. From the Oracle 10g SQL Reference: Notes on Updatable Views An updatable view is one you can use to insert, update, or delete base table rows. You can create a view to be inherenRead more
Hello Beter,
Views in Oracle may be updateable under specific conditions. It can be tricky, and usually is not advisable.
From the Oracle 10g SQL Reference:
Notes on Updatable Views
An updatable view is one you can use to insert, update, or delete base table rows. You can create a view to be inherently updatable, or you can create an INSTEAD OF trigger on any view to make it updatable.
To learn whether and in what ways the columns of an inherently updatable view can be modified, query the USER_UPDATABLE_COLUMNS data dictionary view. The information displayed by this view is meaningful only for inherently updatable views. For a view to be inherently updatable, the following conditions must be met:
In addition, if an inherently updatable view contains pseudocolumns or expressions, then you cannot update base table rows with an UPDATE statement that refers to any of these pseudocolumns or expressions.
If you want a join view to be updatable, then all of the following conditions must be true:
How to validate email address in JavaScript?
Using regular expressions is probably the best way. You can see a bunch of tests here (taken from chromium) [code]function validateEmail(email) { var re = /^(([^<>()[]\.,;:s@"]+(.[^<>()[]\.,;:s@"]+)*)|(".+"))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}Read more
Using regular expressions is probably the best way. You can see a bunch of tests here (taken from chromium)
[code]function validateEmail(email) {
var re = /^(([^<>()[]\.,;:s@”]+(.[^<>()[]\.,;:s@”]+)*)|(“.+”))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
return re.test(String(email).toLowerCase());[/code]
}
Here’s the example of regular expresion that accepts unicode:
[code]var re = /^(([^<>()[].,;:s@”]+(.[^<>()[].,;:s@”]+)*)|(“.+”))@(([^<>()[].,;:s@”]+.)+[^<>()[].,;:s@”]{2,})$/i;[/code]
But keep in mind that one should not rely only upon JavaScript validation. JavaScript can easily be disabled. This should be validated on the server side as well.
[code]function validateEmail(email) {
var re = /^(([^<>()[]\.,;:s@”]+(.[^<>()[]\.,;:s@”]+)*)|(“.+”))@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}])|(([a-zA-Z-0-9]+.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}[/code]
[code]
function validate() {
var $result = $(“#result”);
var email = $(“#email”).val();
$result.text(“”);
if (validateEmail(email)) {
$result.text(email + ” is valid :)”);
$result.css(“color”, “green”);
} else {
$result.text(email + ” is not valid :(“);
$result.css(“color”, “red”);
}
return false;
}
$(“#validate”).bind(“click”, validate);[/code]
[code]<script src=”https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js”></script>
<form>
<p>Enter an email address:</p>
<input id=’email’>
<button type=’submit’ id=’validate’>Validate!</button>
</form>
<h2 id=’result’></h2>[/code]
See lessCan I use If statement inside Where clause in oracle SQL?
hello oracle user, you can use CASE statement same like IF ex: [code] WHERE e.status = (CASE WHEN status_flag = STATUS_ACTIVE THEN 'A' WHEN status_flag = STATUS_INACTIVE THEN 'T' ELSE null END) AND e.business_unit = (CASE WHEN source_flag = SOURCE_FUNCTION THEN 'production' WHEN source_flag = SOURCERead more
hello oracle user,
you can use CASE statement same like IF ex:
[code]
See lessWHERE e.status = (CASE WHEN status_flag = STATUS_ACTIVE THEN ‘A’
WHEN status_flag = STATUS_INACTIVE THEN ‘T’
ELSE null END)
AND e.business_unit = (CASE WHEN source_flag = SOURCE_FUNCTION THEN ‘production’
WHEN source_flag = SOURCE_USER THEN ‘users’
ELSE null END)
[/code]
How to handle a unique constraint exceptions in PL/SQL code?
hello, you can use exception : [code] EXCEPTION WHEN DUP_VAL_ON_INDEX [/code]
hello,
you can use exception :
[code]
See lessEXCEPTION
WHEN DUP_VAL_ON_INDEX
[/code]
How to rollback oracle sequence value ?
There is no way to rollback the generated sequence. To restart the sequence at a different number, you must drop and re-create it. See http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_2011.htm. If you change the INCREMENT BY value before the first invocation of NEXTVAL, some sequenceRead more
There is no way to rollback the generated sequence.
To restart the sequence at a different number, you must drop and re-create it. See http://docs.oracle.com/cd/B19306_01/server.102/b14200/statements_2011.htm.
If you change the INCREMENT BY value before the first invocation of NEXTVAL, some sequence numbers will be skipped. Therefore, if you want to retain the original START WITH value, you must drop the sequence and re-create it with the original START WITH value and the new INCREMENT BY value.
See lessHow to convert milliseconds to mins, seconds in java ?
you can use java.util.concurrent.TimeUnit class Read more [code] String.format("%d mins, %d secs", TimeUnit.MILLISECONDS.toMinutes(milli), TimeUnit.MILLISECONDS.toSeconds(milli) - TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(milli)) ); [/code] If TimeUnit or toMinutes are unsupported (Read more
you can use java.util.concurrent.TimeUnit class Read more
[code]
String.format(“%d mins, %d secs”,
TimeUnit.MILLISECONDS.toMinutes(milli),
TimeUnit.MILLISECONDS.toSeconds(milli) –
TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS.toMinutes(milli))
);
[/code]
If TimeUnit or toMinutes are unsupported (such as on Android before API version 9), use the following equations:
[code]
See lessint seconds = (int) (milliseconds / 1000) % 60 ;
int minutes = (int) ((milliseconds / (1000*60)) % 60);
int hours = (int) ((milliseconds / (1000*60*60)) % 24);
[/code]
How to avoid != null statements in java ?
If you use (or planning to use) JetBrains IntelliJ IDEA, a Java IDE, you can use some particular annotations developed by them. Basically, you've got @Nullable and @NotNull. You can use in method and parameters, like this: [code] @NotNull public static String helloWorld() { return "Hello World"; } [Read more
If you use (or planning to use) JetBrains IntelliJ IDEA, a Java IDE, you can use some particular annotations developed by them.
Basically, you’ve got @Nullable and @NotNull.
You can use in method and parameters, like this:
[code]
@NotNull public static String helloWorld() {
return “Hello World”;
}
[/code]
or
[code]
@Nullable public static String helloWorld() {
return “Hello World”;
}
[/code]
The second example won’t compile (in IntelliJ IDEA).
When you use the first helloWorld() function in another piece of code:
[code]
public static void main(String[] args)
{
String result = helloWorld();
if(result != null) {
System.out.println(result);
}
}
[/code]
Now the IntelliJ IDEA compiler will tell you that the check is useless, since the helloWorld() function won’t return null, ever.
Using parameter
[code]
void someMethod(@NotNull someParameter) { }
[/code]
if you write something like:
[code]
someMethod(null);
[/code]
This won’t compile.
Last example using @Nullable
[code]
@Nullable iWantToDestroyEverything() { return null; }
[/code]
Doing this
[code]
iWantToDestroyEverything().something();
[/code]
And you can be sure that this won’t happen. 🙂
It’s a nice way to let the compiler check something more than it usually does and to enforce your contracts to be stronger. Unfortunately, it’s not supported by all the compilers.
In IntelliJ IDEA 10.5 and on, they added support for any other @Nullable @NotNull implementations.
See blog post More flexible and configurable @Nullable/@NotNull annotations.
See lessHow to open a PDF output directly when click of a SubmitButton in OAF ?
Hi Waqas, it's applicable by using Standard API [code]fnd_webfile.get_url (file_type => fnd_webfile.request_out, -- for output file. Use request_log to view log file ID => l_request_id, gwyuid => l_gwyuid, two_task => l_two_task, expire_time => 500 -- minutes, security!. );[/code] notRead more
Hi Waqas,
it’s applicable by using Standard API
[code]fnd_webfile.get_url
(file_type => fnd_webfile.request_out,
— for output file. Use request_log to view log file
ID => l_request_id,
gwyuid => l_gwyuid,
two_task => l_two_task,
expire_time => 500 — minutes, security!.
);[/code]
note : there are two profile options this API must take as following
l_gwyuid : Gateway User ID
[code]oadbtransactionimpl.getAppsContext().getEnvStore().getEnv(“GWYUID”)[/code]
l_two_task: Two Task(TWO_TASK)
[code]oadbtransactionimpl.getAppsContext().getEnvStore().getEnv(“TWO_TASK”)[/code]
you can register out parameter of calling this API to String variable then use
[code]pageContext.sendRedirect[/code]
Hope this helpful 🙂
How to to prevent other event handlers from executing after a certain event is fired ?
return false from within a jQuery event handler is effectively the same as calling both e.preventDefault and e.stopPropagation on the passed jQuery.Event object.e.preventDefault() will prevent the default event from occuring, e.stopPropagation() will prevent the event from bubbling up and return falRead more
return false from within a jQuery event handler is effectively the same as calling both e.preventDefault and e.stopPropagation on the passed jQuery.Event object.
e.preventDefault() will prevent the default event from occuring, e.stopPropagation() will prevent the event from bubbling up and return false will do both. Note that this behaviour differs from normal (non-jQuery) event handlers, in which, notably, return false does not stop the event from bubbling up
Source: John Resig
See less