function

PHP functions wont work with String object, but works with it typed manually

Hi, I'm trying to strip tags from a text output coming from an object. The problem is, that I can't. If I type it manually like "<p>http://www.mylink.com&lt;/p&gt;", it works fine! When doing echo $item->text; it gives me the same string "<p>http://www.mylink.com&lt;/p&gt;"; Doing var_dump or even gettype, gives me a string(). So, I'm s...

jQuery - stop function

Hi, what im wanting to achieve is if a error appears ( one which I have come up with ) and contains the word 'error' then the function stops in its tracks. What the function basically consists of is 5 ajax requests, when one is successful the other kicks in.. like so.. function thing() { $.ajax({ ... ... su...

How to execute a function asynchronously every 60 seconds in Python?

Hello, I want to execute a function every 60 seconds on Python but I don't want to be blocked meanwhile. How can I do it asynchronously? import threading import time def f(): print("hello world") threading.Timer(3, f).start() if __name__ == '__main__': f() time.sleep(20) With this code, the function f is execut...

how to override functions in emacs lisp for specific mode?

hi How can I override emacs function with my own implementation for a specific mode? example/reference would be great Thanks ...

Does F# have free functions?

Does every function has to be inside a type like in C#? Or does F# has free functions? Also what about functions I have seen all over some F# code like, cos, sin, etc. Are they calls to Math.Cos, Math.Sin? Also why did they provide cos, sin, etc like that instead of Math.Cos, Math.Sin? ...

PHP default function argument as a T_VARIABLE?

Got an error today that I thought was interesting. Must be a way to do this, perhaps I just have the wrong syntax. class test{ private $test = ''; __construct(){ $this->test = "whatever"; } function getTest($var = $this->test){ echo $var; } } This throws an error basically saying that $this->test as a function ar...

Matlab: convert function to simulink block

How do I convert from a function that I have written as an m-file into a block in Simulink model? I couldn't find anything on Google that tells me how to do that easily, so it would be much appreciated if any of the readers here can help point me in the right direction. ...

What is the color format to use with imagerotate() in PHP?

In PHP; what format is used for the background color option in the function imagerotate(). $color = "???????"; imagerotate($image, $degrees, $color); I have tried: $color = "#FFFFFF"; $color = "255255255"; ...

In C++ how is function overloading typically implemented?

If there is no function overloading, the function name serves as the address of the function code, and when a function is being called, its address is easy to find using its name. However with function overloading, how exactly can the program find the correct function address? Is there a hidden table similar to virtual tables that stores...

Strange behavior on function calling.

When calling a Javascript function, it seems like JS gives priority to functions without parameters first, even if I have the same function name with parameters. The strange behavior only happens in the following scenario: I have a an HTML page with embedded Javascript, like this: //Javascript in the page function testAbc(){ ...

tr1::function WINAPI

How can I use tr1::function with WINAPI calling convention ? (at least in windows). I can use visual c++ 9 SP1 TR1 or BOOST's one... typedef void (WINAPI *GetNativeSystemInfoPtr)(LPSYSTEM_INFO); HMODULE h = LoadLibrary (_T("Kernel32.dll")); GetNativeSystemInfoPtr fp = (GetNativeSystemInfoPtr) GetProcAddress (h,"GetNativeSystemInfo"); SY...

Fastest hash function(ASP.NET) for hashing filenames

I'm trying to optimize my ASP.NET thumbnailing script, so it doesn't resize all the images all the time, and one part of the problem is choosing the hash function for the thumbnail naming/checking procedure. Is crc32 up to the task - I'm asking cause the input data is small(only relative path, size and date)? ...

Passing Javascript parameters between functions

Hi all, Is the following possible: function one(parameterOne) { document.write('P1 = '+parameterOne+'); } function two(parameterTwo) { document.write('P2 = '+parameterTwo+'); } function three(parameterOne,parameterTwo) { this.parameterOne=parameterOne; this.parameterTwo=parameterTwo; x=parameterOne+parameterTwo; document.write(x); }...

Rails/jquery passing a variable(IDs) collected in jQuery to a rails controller/action

Hi everybody, I am new to AJAX and jQuery so please excuse me if this is kind of basic: I implemented the great jgrid by 2dconcepts (http://www.2dconcept.com/jquery-grid-rails-plugin). Now I would like to select the data in my table with the checkbox, - get the product ids (that works fine I see the alert from the 'handleSelection') ...

send database info to email

Hi guy, I was wondering if sanyone could help me with the following: I have some info inserted into mysql database on a couple of pages. After this is done I retrieve these info (in a new page) from the database and want to send them via email to various emails including one from the info from database. I have built the email() functio...

Can I change a function reference of a class in ActionScript-3?

Ok, I have a class like this: public class Foo extends Sprite { public function Foo(x:Number, y:Number):void { this.x = x; this.y = y; } public function bar():void { trace("I'm a happy class."); } } And I want to do something like this: var foo:Foo = new Foo(); foo.bar = function():void { ...

JavaScript passing varibles between functions and processing them....

Hello, I'm working on a JavaScript based page that returns the cost of delivery, depending on what the user selects(Region, service(pre 12, etc) and weight). I have muddled my way through as I just dont know JS. My questions are: Can I pass the varible between functions - as detailed in the script below? Once the above has been achie...

Lisp, a couple of questions about lists and recursion

Hey guys, sorry to overflow with so many questions. I have the following: (defun recursive-function (string) "returns list of strings" ;I am trying to return flat list ; create list L (append (mapcar 'recursive-function L))) But since recursive-function returns a list, I end up with a list of a list of a list..., whereas I want just ...

can if be a proper function rather than a special form

hello I finally started learning functional languages (emacs lisp) and it makes explicit distinction between functions and special forms such as flow control , for example if. Is there a fundamental/theoretical reason why special forms are distinct from functions? do any languages provide functional if? Thanks ...

Overloading Java function with List<> parameter

I have 2 classes public class Customer{ ... public String getCustomerNumber(); ... } public class Applicant{ .... private Customer c; public Customer getCustomer(){ return c; } ... } When presented with a list of customers or applicants I want a function which iterates the list and does something with the CustomerNu...