Javascript functions and declaring

When working with functions in JavaScript, are variables declared as parameters in a function different from variables declared within the function itself? For example, is function functionName (var1, var2) different to Function (var1, var2) { ...
more »

2017-02-22 23:02 (1) Answers

TIMEZONE select box change to USA only

I have a bit of code that populates a selectbox with timezones however it includes Asia, Africa, etc. I would like to only have it list US timezones. Is that possible? The code I have now is... /* Get all timezone listing */ functi...
more »

2017-02-22 21:02 (1) Answers

Trim leading zeroes with char in string

I need to write a function that removes the first leading zero(s) in a string. The position of the first zero(s) can vary. Example one: 0000900 needs to become 900 Example two: A0000900 needs to become A900 Example three: ABCD00090ABC0D nee...
more »

2017-02-22 21:02 (1) Answers

Use same jQuery function in multiple instances

I have this function and it needs to work in 54 different buttons on a page, what am I missing to make it work ONLY in the corresponding FLIP? $(document).ready(function() { $(".flip").mouseenter(function() { $(".panel").slideDown("mediu...
more »

2017-02-22 18:02 (3) Answers

PHP Class and Function return

I have problem with PHP class and function. My class file is: <?php class EF_IP{ public function ip_adresa(){ // dobivanje IP adrese if (!empty($_SERVER['HTTP_CLIENT_IP'])) { $ip = $_SERVER['HTTP_CLIENT_IP']; return $ip...
more »

2017-02-22 15:02 (2) Answers

fillStyle not a function

I'm getting an unusual error "ctx_wrap.fillStyle is not a function". this line produces the error: ctx_wrap.fillStyle('#b8b8b8'); in this: ... this.paint = function() { self.path(ctx_wrap); if (!isOver) { ctx...
more »

2017-02-22 04:02 (1) Answers

Yii - Fatal error: Cannot redeclare function

I have this function called checkCentre1() and I'm unable to open my web application due to below error appearing: Fatal error: Cannot redeclare checkCentre1() (previously declared in C:\xampp\htdocs\scms2\protected\views\layouts\main.php:39) in ...
more »

2017-02-22 03:02 (0) Answers

Reading files in For-loop fashion in R

I have some files with YYYYMMDD date code in it. For example, my20150112.csv. How do you make a for-loop in R so that R will automatically process the next date after it finishes processing the previous date. Here are the scripts below: R_script -&...
more »

2017-02-21 23:02 (3) Answers

Dynamically creating functions and expressions

I am currently dealing with a problem. I am working on a package for some specific distributions where among other things I would like to create a function that will fit an mixture to some data. For this I would like to use for example the fitdistr f...
more »

2017-02-21 23:02 (1) Answers

How to use data.table within functions and loops?

While assessing the utility of data.table (vs. dplyr), a critical factor is the ability to use it within functions and loops. For this, I've modified the code snippet used in this post: data.table vs dplyr: can one do something well the other can'...
more »

2017-02-21 20:02 (1) Answers

PHP IMAP on RHEL

It seems like the package php-imap is not available for RHEL. Therefore, I am not able to retrieve emails from a gmail account using PHP. Does anyone has any suggestions on how to do it without using PHP imap functions or where to get the source code...
more »

2017-02-21 19:02 (0) Answers

Alamofire download from JSON API

I'm trying to set text on a label from api, but it seems that the function doesn't even get called. Please refer to the snippet below. Is there anything wrong with it? EDIT: typealias DownloadComplete = () -> () var date: String = "" override ...
more »

2017-02-20 20:02 (3) Answers

Need help fixing my e^x approximation c program

I have written a c program that should compute and print the approximation of e^x for all values up to n. I am using this equation to implement my program. f(x, n) = e^x = the sum of i=0 up to n= x^i/x! = x^0/0! + x^1/1! + x^2/2! +....+ x^n/n! ...
more »

2017-02-20 17:02 (2) Answers

Python - apending a function to a list

I want to create a list that contains the monomials up to degree n basis = [lambda x:x**i for i in range(0,n+1)] This however creates a list of n functions, but all the same one (of degree n) and not of degree 0,1,2,...n I tried without list comp...
more »

2017-02-20 17:02 (2) Answers

How to access argument in javascript function

This is a javascript function: String.prototype.digit = function() { console.log(this); // 'this' contain the object return false; }; How can I access the argument '14' in function while calling function like this: '14'.digit(); ...
more »

2017-02-20 13:02 (1) Answers

Javascript AddEventListener works only once

In the code below I'm trying to generate 8 random numbers between 1-80, put them into divs with clicking run button, empty numbers array and erase inside of divs with reset button. Run button works only once. It can't create new elements for numbers...
more »

2017-02-20 10:02 (1) Answers