function

How to use previous count of semaphore in ReleaseSemaphore.

Looking for an example of how to read the last semaphore count from ReleaseSemaphore Having problems creating a basic local variable to store LPLONG lpPreviousCount into and print out. Looks like I need a pointer to the variable but not having much luck. If you can point me in the right direction, that would be greatly appreciated. ...

Help with creating a reusable PHP function which will 'dynamically' call other functions

Hello! This is my first time I am trying to make something seriously with relational db in MySQL and some kind of CMS created in PHP with CodeIgniter. I came to the part where I have to insert some data in few many-to-many related tables. In my code everything works fine (well, with just few minutes of testing), but I need some help with...

Haskell: Composing two error-raising functions

The problem I have been given says this: In a similar way to mapMaybe, define the function: composeMaybe :: (a->Maybe b) -> (b -> Maybe c) -> (a-> Maybe c) which composes two error-raising functions. The type Maybe a and the function mapMaybe are coded like this: data Maybe a = Nothing | Just a mapMaybe g Nothing...

Calling .click(function)() inside Facebox

Hello, I've created a Facebox on my site and want to call .click(function)() to append text to all tags. I can get it working outside the Facebox, but it won't work once I put it inside. I haven't spent much time looking through the facebox.js file because I'm tight on time...so, if someone could help me out here, that would be great...

Defining erlang functions in the shell

Is there any way to define an Erlang function from within the Erlang shell instead of from an erl file? ...

How do you call functions from inside a Facebox using jQuery???

Hello, I've created a Facebox on my site and want to call the .click(function)() to append text to all paragraphs. My code refuses to work once I put it inside the facebox...but works when on a regular html page. Is there anyone out there that could help me out? This has caused me a great deal of pain... Here's my code: **// Facebox ...

Can if statements be implemented as function calls?

One of the stylistic 'conventions' I find slightly irritating in published code, is the use of: if(condition) { instead of (my preference): if (condition) { A slight difference, and probably an unimportant one, but it occurred to me that the first style might be justified if 'if' statements were implemented as a kind of function ca...

Access Nz() function doesn't work in query

I have lots of orders in tblOrders and a few deliveries in tblDeliveries. SELECT tblOrders.SkuBestelId, Sum(tblDeliveries.delivered) AS TotalDelivered FROM tblOrders INNER JOIN tblDeliveries ON tblOrders.SkuBestelId = tblDeliveries.SkuBestelId GROUP BY tblOrders .SkuBestelId; Of course, this gives me lots of "TotalDelivered" fields wi...

Logging function calls to a file and using this log file as program code

I have an application which is written in C and logs my function calls by writing them to a file. Now I need to re-use these logged function calls in another C-application (which is also the reason for logging). This application should do - next to other things - exactly the things which were logged. example: MYLOGFILE which was writt...

Ambiguous function declaration in Javascript

I am new to Javascript and got confused by how the function declaration works. I made some test on that and got some interesting results: say(); function say() { alert("say"); } The forward-declaration worked and popup "say" On the opposite say(); say = function() { alert("say"); } did not work, although it also declared...

C++ problem in calling a function in main that prints the map.

Hi, I am trying to print the contents of the map and this is where my code fails. I have tested all my methods and I have no problem to read from file, filer the word, put it into map, and even the print function is working. However, when I am calling the printer function from main it does not print the map. I am new to polymorphism and...

Javascript Scope and local variables

I'm really not sure if this is possible in Javascript. Here's my function: var tree = function(name, callback) { if (this.name) { this.name.push(name) print(this.name) } else { this.name = [] } callback() } I'd like to use it as follows and print out the heirarchy: tree("john", function() { tree("geoff", functio...

C++ ...when all the arguments have default values

Ok, I guess that this is a very absurd/basic question, but still: class m { public: void f(int ***); /***/ } void m::f(int ***a = NULL) { /***/ } The call to f (as well as any function which has default values for all the arguments) doesn't accept 0 arguments. Why? How should I format the declaration then? Thanks already. ...

Passing multiple values to a function call (Python)

import re def strip_tags(value): "Return the given HTML with all tags stripped." return re.sub(r'<[^>]*?>', '', value) I have this function to strip HTML tags, but it seems to accept only single value, what do I need to change if I want to pass multiple (not fixed) values at once? Thanks ...

Jquery selection problem

Hi Guys, I have a bunch of elements with ids like "check1", "check2", "check3" etc. I want to loop through each of them and hide them and set onclick funcion. Here is my current code: for (i = 0; i < badgeArray.length; i++) { jQuery("a#check"+ i + "").click(function(){ jQuery("#check" + i + "info").toggle(); ...

Regex for removing whitespace

def remove_whitespaces(value): "Remove all whitespaces" p = re.compile(r'\s+') return p.sub(' ', value) The above code strips tags but doesn't remove "all" whitespaces from the value. Thanks ...

calling function inside preg_replace thats inside a function

I have some code with the a structure similar to this function bbcode($Text) { //$Text = preg_replace("/\[video\](.+?)\[\/video\]/",embed_video($1), $Text); return $Text;} function embed_video($url){ if (preg_match("/http:\/\/www.youtube.com\/watch\?v=([0-9a-zA-Z-_]*)(.*)/i", $url, $matches)) { return ...

Cannot use send() to send .exe in c programming

I am building a server-client program with c and having some problen wtih sendina a whole file with send() and recv() function. I need to send the whole file with these but all these functions can do is send a string. The main problem is with sending the exe or other binary formet data. Should I use htons or htonl func? I dunno how to u...

How to only show the first x characters of a post as a preview (PHP)?

I was wondering how you would show only the first "x" characters of a post, as a preview. Sort of like what StackOverflow does when they show there list of questions. The quick brown fox jumps over the lazy dog goes to The quick brown fox jumps... I dont want to split up a word in the middle. I was thinking the explode function sp...

Alternative for deprecated PHP function: eregi_replace

Do anyone know a good alternative for the deprecated eregi_replace function? I need it for this sniplet: $pattern = "([a-z0-9][_a-z0-9.-]+@([0-9a-z][_0-9a-z-]+\.)+[a-z]{2,6})"; $replace = "<a href=\"mailto:\\1\">\\1</a>"; $text = eregi_replace($pattern, $replace, $text); Thanks! ...