function

Xslt newbee abs function ??

I am not a programmer, but am trying to transform some data. The data contained in my xml field "Source/End/Edgecode" looks like -000016 I want to remove the leading dash. I thought I could use abs or right, but I don't know the correct syntax. Thanks for any help... ...

Why does this setTimeout callback give me an error?

I am attempting to collapse a div on request, but my setTimeout function will does not successfully call its callback function. Here is the code below: function newsFeed() { this.delete = function(listingID) { var listing = document.getElementById(listingID); var currHeight = listing.offsetHeight; var confirmDelet...

How to detect when one function is complete from another function?

I have a javascript function that is being built to animate the collapse of a div, and then proceed with other jobs. The code is as follows: function newsFeed() { var self = this; this.collapse = function(listingID,orig_height,curr_height,opacity) { var listing = document.getElementById(listingID); var reduceBy = 5;...

Load external Javascript on function call

Hi all, I would like to know how to load an external Javascript into my document from a function. Thanks in advance all! ...

call() of function with arguments

I have a component that I hand over a function public var func : Function; Now the function is a function that has parameters in its signature public function myFunction(s : String) : void { doSomething(s); } from my component I can call the function with func.call(); Can someone tell me how to invoke the function with its p...

Is wrapping code into a function that doesn't need to be, bad in PHP?

Many many times on a page I will have to set post and get values in PHP like this I just want to know if it is better to just continue doing it the way I have above or if performance would not be touched by adding it into a function like in the code below? This would make it much easiar to write code but at the expense of making extr...

How can I create a numpy array holding values of a multi-variable function?

I want to create an array holding a function f(x,y,z). If it were a function of one variable I'd do, for instance: sinx = numpy.sin(numpy.linspace(-5,5,100)) to get sin(x) for x in [-5,5] How can I do the same to get, for instance sin(x+y+z)? ...

PHP: how to avoid redeclaring functions?

I tend to get errors such as: Fatal error: Cannot redeclare get_raw_data_list() (previously declared in /var/www/codes/handlers/make_a_thread/get_raw_data_list.php:7) in /var/www/codes/handlers/make_a_thread/get_raw_data_list.php on line 19 how can I avoid the error? Is it possible to create a IF-clause to check whether a function is ...

PHP echo vs PHP short tags

Are they equal in safeness? I was informed that using <?=$function_here?> was less safe, and that it slows down page load. So I am now strictly biased to using echo. I just wanted to know the advantages/disadvantages, or are they pretty much the same. ...

Cleaning up PHP.

Is there anyway I can clean up if($class == 2 AND $posts >=1){$showpost ="1";} else {$showpost ="$posts"; if($class == 3 AND $posts >=2){$showpost ="2";} else {$showpost ="$posts"; if($class == 4 AND $posts >=3){$showpost ="3";} else {$showpost ="$posts"; if($class == 5 AND $posts >=4){$showpost ="4";} else {$showpost ="$posts"; if($cla...

Cleaning up PHP, and cleaning up unnecessary code.

I'm still new to certain PHP functions. Is there any way I can clean up the following code, because I know all of this is just unnecessary, and it's giving me a headache. Everything after the if statement is the same for each set of code. if($class == "2"){if ($posts >= 1){ $sql = "UPDATE users SET posts=posts+1,tposts=tposts+1,poin...

What is the problem in this JavaScript code?

var urlname= '/a/b.php?company_name='+company_name+'&series='+series; document.getElementById('frame2').innerHTML='<IFRAME HEIGHT="600px" WIDTH="100%" NORESIZE="NORESIZE" SRC="'+urlname+'" NAME="aol" FRAMEBORDER="0" ALIGN="ABSBOTTOM" scrolling="no" id="a1" name="a1" onload="Javascript:heights('a1')"></IFRAME>'; I'm using this code but ...

Assembly Function to C Program without Parameter Passing or Return Value

I need to create an assembly function that adds two positive numbers together, called by a C program. The C program would look like this: #include <stdio.h> int main(void){ int a = 0; int b = 0; int c = 0; printf( "Enter first number: " ); scanf( "%d", &a ); printf( "Enter second number: " ); scanf( "%d", &b ); sum(); printf( "Answer ...

Javascript toFixed function

Hello, I have a question regarding toFixed() function. If I have a float e.g. - 3.123123423 and 0. How can I output it to input box with toFixed(2) so the inputbox values would be 3.12 and 0. I mean if the value is integer I want output it without trailing .00 :) ...

python: combine sort-key-functions itemgetter and str.lower

Hi, I want to sort a list of dictionaries by dictionary key, where I don't want to distinguish between upper and lower case characters. dict1 = {'name':'peter','phone':'12355'} dict2 = {'name':'Paul','phone':'545435'} dict3 = {'name':'klaus','phone':'55345'} dict4 = {'name':'Krishna','phone':'12345'} dict5 = {'name':'Ali','phone':'5345...

How to make an R function return multiple columns and append them to a data frame?

Starting with this data frame myDF = structure(list(Value = c(-2, -1, 0, 1, 2)), .Names = "Value", row.names = c(NA, 5L), class = "data.frame") Suppose I want to run this function on every row of myDF$Value getNumberInfo <- function(x) { if(x %% 2 ==0) evenness = "Even" else evenness="Odd" if(x > 0) positivity = "Positive" else posi...

PHP: Caching ordered integer partition algorithm

Hello! First: The problem's name in Wikipedia is "ordered partition of a set". I have an algorithm which counts possible partitions. To speed it up, I use a cache: function partition($intervalSize, $pieces) { // special case of integer partitions: ordered integer partitions // in Wikipedia it is: ordered partition of a set global $...

How to tag text in emacs

I'm developing a text annotation system in emacs, where the format of the annotation is something like this. If this is the text: Lorem ipsem por favor I need to annotate it like this: {latin}Lorem imsem{/latin} {spanish}por favor{/spanish} So what I want to do is select a region and then run a function or a macro that will prompt...

how do I make this function a class?

hi everybody, i've been creating functions for too long without taking my code to 'classes'. I learn well through example and I just wanted to convert this simple function into a class so I can compare something I know with something I don't... Take the following function: function affiliateName($affiliateID) { $sql = 'SELECT * FROM ...

Call a function that is an attribute

Hi guys, Is it possible to call a method that is an attribute? I mean, I have this input (this is created dynamically using jQuery as well when retrieving a list of companies using .get() ): <input type="checkbox" onclick="javascript:onWorksiteChecked(this,'Virtus Västerås AB, STOCKHOLM','1:201334661','5566109426');" value="1:20133466...