Just been re-introduced to the Perl '||=' operator from the classic Orcish Maneuver example:
keys my %or_cache = @in;
@out = sort {
($or_cache{$a} ||= KEY($a))
cmp
($or_cache{$b} ||= KEY($b))
} @in;
Is this operator available in PHP and Javascript?
And if not, do these two languages allow user defined operators?
Hi, i need to check the type of a variable in javascript, i know 3 ways to do it:
instanceof operator: if(a instanceof Function)
typeof operator: if(typeof a=="function"
toString method (jQuery uses this): Object.prototype.toString.call(a) == "[object Function]"
Which is the most secure way to do type checking beetween these solutions? and why? Please don't tell me that the last solution is better only because jQuery uses that.
Hello guys,
I am currently using the below IDE's. They serve their purposes but am wondering if there are better ones out there that i can switch to.
phpDesigner v6.2.5 (For PHP)
Navicat 8.0.29 (For MySql)
Dreamweaver CS3 (For HTML & CSS)
Spket IDE (For JavaScript)
Thats my collection of production tools. Wondering if there is anyone of them i can switch to a better one.
Thanks
I want to create a javascript class/object that allow me to have various method:
Model class
Model.all() » static method
Model.find() » static method
Model delete() » instance method
Model save() » instance method
Model.create() » static that returns a new Model instance
For static method I can define them using:
Model.staticMethod(){ method }
while for instance method is better to use:
function Model(){
this.instanceMethod = function(){}
}
and then create a new instance
or using prototype?
var m = function Model(){
}
m.prototype.method() = function(){
}
Now let's say that I want to create a new class based on Model, how to inherit not only its prototypes but also its static methods?
In c# and ruby and many other languages you can denote a string as to not need escaping.
in c# its like this
string s = @"\whatever\this\is";
the results are when printed
\whatever\this\is
my question is, is this supported in any form in javascript?
In JavaScript, how could you create a new function with the same name as an existing function, while also preserving the original function so it could be called from within the new one?
By using document.referrer we will get all the reference of url in javascript.ie,may be output like follows
http://localhost/testwordpress/wp-admin/admin.php?page=thesis-options&upgraded=true.From this output how can we differentiate the query string part only ( ie,?page=thesis-options&upgraded=true).Is there any method in javacript?Please help anybody knows........
Is it possible to handle such events as:
"ctrl" + mouse left button click;
"shift" + mouse left button click;
"alt" + mouse left button click
by using JavaScript/jquery(or other framework).
If it is possible, please give a code example for it.
Hi,
I would like to put a clock on my webpage which should show time and a timer for a particular interval.
Could you please suggest me some open source javascript to do that??
I tried unsuccessfully searching web for flash one's.
Please help.
Thanks,
Mahesh
When a user triggers a Javascript action, I want the JW FLV to seek back 5 seconds from the current location. I know how to send events using player.sendEvent('SEEK',seconds). But I dont know how many seconds to pass as JS does not know the current location. Can someone please help?
http://developer.longtailvideo.com/trac/wiki/FlashEvents#Viewevents.
Hey all. Newbie JavaScript question here. I have an array: {r=1, g=4, b=6} How do i go about getting the value of each (r,g,b) into a separate variable?
Javascript needed to prevent form submit if any of field is empty. all my form fields start names start with name=add[FieldName] those are the fields that need checking.
PHP, backend check before submiting to database double check to make sure all $POST are not empty
I'm looking at the Google Maps API tutorial, and I see this:
<script type="text/javascript"
src="http://www.google.com/jsapi?autoload={'modules':[{name:'maps', version:3, other_params:'sensor=false'}]}"></script>
Why is modules wrapped in single quotes?
Hello,
The error message that gets added to the validation summary when the form is invalid I need to get access to in client-side JavaScript. How do you access the actual message? My page doesn't have a ValidationSummary present, and Page_Validators[0].errormessage is *. Where is the message?
Thanks.
I am producing a javascript-based widget. Nothing complex just a few document.writes...
When I place it inline in the page it renders fine in all browsers. When I place it externally and load it via it fails to render in Firefox and IE but not Chrome.
Anyone know why and a possible workaround?
Hi,
I need a random object generator in JavaScript that generates a variety of objects with different fields and values. Any ideas where I can find such tool?
Thanks,
Gjorgji.
Hi, i need to check the type of a variable in javascript, i know 3 ways to do it:
instanceof operator: if(a instanceof Function)
typeof operator: if(typeof a=="function"
toString method (jQuery uses this): Object.prototype.toString.call(a) == "[object Function]"
Which is the most accurate way to do type checking beetween these solutions? and why? Please don't tell me that the last solution is better only because jQuery uses that.
Title pretty much sums it up.
The external style sheet has the following code:
td.EvenRow a{
display: none !important;
}
I have tried using:
element.style.display = "inline";
and
element.style.display = "inline !important";
but neither works. Is it possible to override an !important style using javascript.
This is for a greasemonkey extension, if that makes a difference.
Much appreciated,
Enrico
How would you sort a multidimensional array in JavaScript?
I have an array full of arrays that contain two dates and a string. I need the main array sorted by one of the date arrays, is this possible?
I'm developing an web app with jsp,servlet in server side and javascript in client side.
How can a i upload multiple files(images) to the server(and save them to the db)?
I'm using the following regexp to validate numbers in my javascript file:
var valid = (val.match(/^\d+$/));
It works fine for whole numbers like 100, 200, etc, however for things like 1.44, 4.11, etc, it returns false. How can I change it so numbers with a decimal are also accepted?
What are expando objects in javascripts?
For what purpose we need this ? Any complete example will be appreciated
I found 1 article here Javascript: The red-headed stepchild of web development
Thanks