function

C Error Checking Function (Not really homework, but don't say I said it wasn't)

For my systems programming class we're doing a lot of programming in C and are required to error check most functions as we are currently learning to program with pthreads. The reason I say this is not really homework, is that it is far above and beyond what is expected for this class. Simply checking each function individually is more ...

How do I create a cycling function that cycles between adding and removing classes?

This currently works: $(document).ready(function() { $('body').addClass('red').delay(50).queue(function(next){ $(this).removeClass('red').delay(50).queue(function(next2){ $(this).addClass('blue'); next2(); }); next(); }); But I'd like something more efficient. And plus, the code above becomes ...

Two functions executed by setInterval() at the same time are slowing each other.

Hey, I wrote a script with two functions executed by setInterval(). One function rotateTheSun() constantly rotates an object, the other moveSlide() handles moving a sliding div onclick. Whenever the constant function is running, the div slide very slow. Is it a JS issue, or did I just wrote a bad script (as usual)? source: window.o...

deep linking from xml to open function in Acionscript

Hi, I have general text in CDATA in my xml which is pulling in content into Flash. This is working well and I am able to add images this way too. What I need though is to wrap that image in an tag which, when clicked on will fire off a function in my Actionscript 2 to launch a video. Could someone please tell me how I would go about t...

Restricting variable access

I need to have a variable that only one function can write (let's call that function a) and that only one other function can read (let's call that function b). Is that possible? ...

Something wrong with disregarding a returned value from a function in PHP

For instance: // somefile.php function doSomething() { // do lots of code, whatever... return $something; } // mainfile.php include "somefile.php" doSomething(); // ignored the return value, we don't need it here What happens when a function in PHP returns a value but we don't care about it? Is something wrong with this behav...

problem with multi statement table valued function, what am I doing wrong?

Hi guys, I having problems with this function, seems like @idUsuario and @passCorrecto aren't getting any value, so, when I use this variables in the where clause I'm not getting any result data. ALTER FUNCTION [dbo].[login](@usuario varchar(20), @password varchar(20)) RETURNS @info TABLE (nombre varchar(70) not null, tipo varchar(30) ...

Howto exit setInterval function defined in jquery

i have this javascript code: var step = 8; // How many pixels to move per step var current = -1920; // The current pixel row var imageWidth = 1920; // Background image width var headerWidth = 960; // How wide the header is. function slide_in(){ ...

SharePoint - Passing Dataview Row Arguments to a C# function from ASP.net button

I've done this with a asp.net Gridview. but does anybody have any examples on how to pass row information from an asp.net button in SharePoint Dataview rows to an inline C# function? the button Repeats as follows: <asp:Button runat="server" Text="Delete" id="Delete{@ID}" OnClick="DeleteDoc()"/> My function looks like this: void De...

How do you create a simple function to query the database? Mine isn't working!

I want to make a simple function that I can call on to query my database. I pass the "where" part of the query to it and in the code below, my $q variable is correct. However, what should I then do to be able to use the data? I'm so confused at how to do something I'm sure is extremely easy. Any help is greatly appreciated! function get...

Can someone explain the following strange function declarations?

std::thread f() { void some_function(); // <- here return std::thread(some_function); } std::thread g() { void some_other_function(int); // <- here std::thread t(some_other_function,42); return t; } ...

Getting boost::function arity at compile time?

I need to make a decision in a BOOST_PP_IF statement based on the arity (parameter count) of a boost::function object. Is this possible? boost::function_types::function_arity does what I'm looking for, but at runtime; I need it at compile time. ...

Removing new line function when enter button is pressed Java

Hi I have a text area that I would like to become blank when the enter button is pressed. I know this would normally be done with a setText method. However when I do this, the text is removed but the new line function created by the return key being pressed. My question is, is the anyway of stopping this default action from happening? ...

Jquery: is there a way to create functions in my small bit of code to make this faster/simplier/smaller?

I'm trying to find a way to make this smaller by using functions/variables in my jquery. $('.search-what-category').fadeOut('normal', function(){ $('.search-wrapper').animate({'height':40}) }) $('.search-what-category').fadeOut('normal', function(){ $('.search-wrapper').animate({'height':40}, function(){ $('.search-wra...

Generating a unique MySQL field based on the contents of other fields

Hi folks, In creating unique custom reference codes (i.e. JOB1293XYZ) for a while I have been generating custom reference/hashes in PHP then checking my database to see if it already exists and if so generating another. I'm curious if in MySQL it is possible to to generate the contents of a field based on the other fields in that row, ...

Flexible JavaScript functions (for MongoDB)

I'm working on some Map / Reduce queries for MongoDB and am trying to do the following (in a nutshell). m = function() { this.convert = function(val) { return val+1; } emit(convert(this.age), this.doesWearGlasses); } r = function(k, v) { count = 0; for(var i = 0; i < v.length; i++) { count +...

Objective-C - Best practice for writing a simple method?

In the following function which one is the best practice? To send an autoreleased object, and make the caller retain it? or send an allocated object, and make the caller release it? - (NSString*) convertDataToString :(NSData*)myData { //just an example, method might not exist NSString *str = [[NSString alloc] initWithDat...

virtual function redefinition hides other overloaded functions of same name from another base class

Ok, I'm using virtual functions, overloaded functions, and multiple inheritance. Of course this doesn't turn out well. The scenario: Class base1 has a virtual function that needs to be specified by its child. Class derived derives from two parents base1 and base2, and should use base2's existing functionality to define base1's virtual ...

templated function pointer

I have an approach to call delayed function for class: //in MyClass declaration: typedef void (MyClass::*IntFunc) (int value); void DelayedFunction (IntFunc func, int value, float time); class TFunctorInt { public: TFunctorInt (MyClass* o, IntFunc f, int v) : obj (o), func (f), value (v) {} virtual void operator()(); protected: ...

PostgreSQL: Why can't subqueries as expressions return more than one row, but functions can?

If I try to create a column whose value is a select returning more than one row, I get an error. => select (select 1 union select 2); ERROR: more than one row returned by a subquery used as an expression But if I create a function that does the same thing, I get the behavior I want. => create or replace function onetwo() returns set...