apply

Apply style reference at runtime in Mobile web application

Hi All, I'm new to mobile web development. I'm creting a website for mobiles in ASP.NET 2.0. I want to apply different style reference to the Objectlist control data according to the prfit/loss (Green if profit and red if loss) at runtime. Please help. Thanks & Regards Khushi ...

How do I wrap a function in Javascript?

I'm writing a global error handling "module" for one of my applications. One of the features I want to have is to be able to easily wrap a function with a Try{} Catch{} block, so that all calls to that function will automatically have the error handling code that'll call my global logging method. (To avoid polluting the code everywhere ...

How do I apply a diff patch on windows?

There are plenty of programs out there that can create a diff patch, but I'm having a heck of a time trying to apply one. I'm trying to distribute a patch, and I got a question from a user about how to apply it. So I tried to figure it out on my own and found out that I have no clue, and most of the tools I can find are command-line. ...

Relative Efficiency of JOIN vs APPLY in Microsoft SQL Server 2008

We're just starting to look at moving to SQL 2008 from SQL 2000 and are noting the new CROSS APPLY and INNER APPLY syntax that allows a form of 'joining' against either table-valued parametrized UDFs or correlated subqueries. Obviously it would be nice to be able to encapsulate logic in a UDF and be able to reuse it in different queries...

Java collection/map apply method equivalent?

Hi, I would like to apply a function to a Java collection, in this particular case a map. Is there a nice way to do this? I have a map and would like to just run trim() on all the values in the map and have the map reflect the updates. ...

How can I construct an object using an array of values for parameters, rather than listing them out, in JavaScript?

Is this possible? I am creating a single base factory function to drive factories of different types (but have some similarities) and I want to be able to pass arguments as an array to the base factory which then possibly creates an instance of a new object populating the arguments of the constructor of the relevant class via an array. ...

Is there a way to invoke a Python function with the wrong number of arguments without invoking a TypeError?

When you invoke a function with the wrong number of arguments, or with a keyword argument that isn't in its definition, you get a TypeError. I'd like a piece of code to take a callback and invoke it with variable arguments, based on what the callback supports. One way of doing it would be to, for a callback cb, use cb.__code__.cb_argcoun...

Why doesn't function.apply() work across document boundaries in IE?

I'm seeing some strange behavior in IE trying to call functions in another page via function.apply(). Here's a simple test case: test1.html: <HTML> <HEAD> <script language="javascript" type="text/javascript"> var opened = null; function applyNone() { opened.testFunc.apply(opened); } function applyArgs() { opened.test...

R: Using the apply function on a data frame. Help me get my vector, Victor.

I'm trying to normalize some data which I have in a data frame. I want to take each value and run it through the pnorm function along with the mean and standard deviation of the column the value lives in. Using loops, here's how I would write out what I want to do: #example data hist_data<-data.frame(matrix(rnorm(200,mean=5,sd=.5),nrow=...

JavaScript: Problem with a ActiveX-Object and the apply()-Function

Hi, i have an ActiveX Object (Master) and would like to invoke functions dynamically on it. To do this i use the apply() Function. But sadly the InternetExplorer tells me something along the lines of: "This Object doesn't support this Method". Can someone give me a hint what i could do? (To test this you also could use a small flash obj...

How to do apply in Tcl 8.4?

Hi, In Tcl 8.5 I can do something like this: apply llength { 1 2 3 } But that apply is not defined in v8.4. How would I define apply using Tcl in v8.4? I need this because I am converting some lisp code to Tcl. The lisp code has some constructs that I would like to port like this: array set levels { TRACE 0 DEBUG 1 INFO ...

lag in apply statement doesn't work in R

I'm trying to "apply" a function that does "lag"s on zoo objects in R. The function works correctly if I pass a single zoo vector - it applys the lag and everything works. However, if I "apply( data, 1, function )" then the lag doesn't work. There is no error, just the equivalent of a zero lag. This is also the case with a simple "ap...

Help me replace a for loop with an "apply" function

...if that is possible My task is to find the longest streak of continuous days a user participated in a game. Instead of writing an sql function, I chose to use the R's rle function, to get the longest streaks and then update my db table with the results. The (attached) dataframe is something like this: day user_id 2008/11/...

C: how to apply a sequence of variables to a function?

In C, is there a way to call a function with arguments stored in some array? I'm a C newbie, I'm not even sure if this is right but e.g.: void f0(int a) { ... }; void f1(int a, int b) { ... }; void f2(int a, int b, int c) { ... }; int array[5][2][?] = [ [&f0, [5]], [&f1, [-23, 5]], [&f2, [0, 1, 2]], [&f2, [1235, 111, 42...

How to write a JS function that accepts and "forwards" variable number of parameters?

How do I write a Javascript function that accepts a variable number of parameters, and forwards all of those parameters to other anonymous functions? For example, consider the scenario of a method that fires an event: function fireStartedEvent(a,b,c,d,e,f,g,...) { for(var i = 0; i < startedListeners.length; i++) { started...

How to 'apply' Visual Effects script?

Hi guys, Thanks to all for the help in the past. I have another query for you guys. I'm hoping someone can solve my problem. I have a .vbs script here. That changes the 'Visual Effects' in Windows. I've tested it on XP/Vista and it changes the settings, but doesn't 'apply' it. I've tried logout/login to no avail. What I mean by 'apply' ...

jQuery: inherit functions to several objects

hi, i made several table-based-widgets (listview-kind-of) which all have the same characteristics: styling odd/even rows, hover on/off, set color onClick, deleting a row when clicking on trash-icon. so it's always the same (prototype-)code for each widget. is there a way to have the code only once then simply apply/inherit it to all wi...

How to make a list of arrays, not their symbols, in Lisp?

I'm trying to make a function to get a delta between arrays, but right now just want to make a subset: get Nth element. (defvar p1 #(1 2)) (defvar p2 #(3 4)) (mapcar '(lambda (x) (aref x 0)) '(p1 p2)) debugger invoked on a TYPE-ERROR in ... The value P1 is not of type ARRAY. The same error if I make it with make-array. How do...

PickUp/Apply Paragraph Formatting in PowerPoint 2007

In PowerPoint 2007, PickUp/Apply does not capture some paragraph formatting, such as bullet formatting, when used programmatically (VBA). Adding the PickUp and Apply buttons to the Quick Access Toolbar (QAT) and trying this manually confirms this. However, if you triple-click on a bulleted paragraph and select PickUp from the QAT, then...

Handling NA values in apply and unique

I have a 114 row by 16 column data frame where the rows are individuals, and the columns are either their names or NA. For example, the first 3 rows looks like this: name name.1 name.2 name.3 name.4 name.5 name.6 name.7 name.8 name.9 name.10 name.11 name.12 name.13 name.14 name.15 1 ...