function

*Subtle* Differences between VB functions and Convert.To* functions?

While converting types, I have found myself using both VB functions and BCL Convert.To* methods. E.g.) Cstr() vs. Convert.ToString() CInt() vs. Convert.ToInt32() CDbl() vs. Convert.ToInt64() etc... Are there any subtle differences that should be noted? ...

Passing and storing pointers to immutable types and strings in C#

Is there a way to store a pointer to immutable types like strings in C#? How can execute: Instance1.SomeFunction(out MyString); ,and store a pointer to MyString inside of Instance1? ...

What's the reason of providing some of the default methods in the global scope in Python?

What's the reason of providing some of the default methods in the global scope, like the len function, instead of providing them on an instance level, like: list.len() instead of: len (list) I find methods like len to be harder to discover than instance methods. Is there any reason behind this? ...

In what scenarios should one declare a member function a friend?

In what kind of scenarios would we declare a member function as a 'friend function' ?..What exact purpose does 'friend function' which defies one of central concept of 'Encapsulation' of OOP serve? ...

javascript pointer function

Hi, if I have: function init(t,y,u) { alert(t + " " + y + " " + u); } // String.prototype.add = init(5, 6, 7); // 1) // window.onload = init(5,6,7); // 2) in the 1) init will be executed and then it pointer assegned to String.prototype.add but in the 2) the function is only executed one time... but why not two times also whe...

Call C++ library in C#

I'm a newbie for C#, i have a lot of libraries are wrote with C++, when I want to call these libraries in C#, i met many problems. I want to know if there is a book or guideline to tell me how to do that. ...

Use of return keyword in code block

What is the difference between saying: if (abc == "a") { // do something here... return; } and the same as above, but without the return keyword? I am a C# coder and I know that the return keyword followed by a type or variable returns that item, but in the above context, return seems to be just to exit the code block but does it mak...

Javascript calling C# function under SliverLight

I have a SilverLight application using C#, with 2 main functions that I want to make accessible from JavaScript functions. I have done the RegisterScriptableObject() in the class and set-up the [ScriptableMember] for the functions I want access to. This the SilverLight object: <div id="silverlightControlHost"> <object id="silverlight...

Looking for a radial coordinates description of gear teeth.

I don't need a physically accurate function, but something that hints at the involute curves, etc. I was just using r = 2 + sin^2, which gets the idea across, but it looks like - ahem. Googling around, you can find plenty of information on how to draft a 'correct' gear, but nothing in the way of a bare-bones approximation. EDIT: The ...

calling a callback from a thread using function pointers

Hello, c program compiler gcc I have 3 files. main.c stop_watch.h and stop_watch.c This program does work. I call start_stopwatch. And it will callback in main.c timeout_cb() after the time has expired. I also run this in a seperate thread, as I don't want to block in main, as I will have other code I need to run. 1) The seconds in g...

How can I conditionally define a Perl subroutine?

I want to define a Perl function (call it "difference") which depends on a command-line argument. The following code doesn't work: if ("square" eq $ARGV[0]) {sub difference {return ($_[0] - $_[1]) ** 2}} elsif ("constant" eq $ARGV[0]) {sub difference {return 1}} It appears that the condition is ignored, and therefore the "difference" ...

calling jquery function from out side

hi, can we call jquery $(document).ready(function(){ } from normal javascript funtion .like i have a button .button on click function i have to call the jquery ready funtion.is it possible. Thanks Usman.sk ...

Correct way to reset or clear a Javascript object?

I have a Javascript class that contains a few functions and member objects: function MyUtils() { // Member Variables (Constructor) var x = GetComplexData(); var y = DoSomeInitialization(); // Objects this.ParamHash = function() { // Member variables this.length = 0; this.items = new Array(); // Constructor ...

triggering functions with facebook connect

I'm trying to do what is supposed to be fairly simple with facebook connect, but having no luck. When a user logs in, I want to show that users details (refreshed without reloading the page), and when the user logs out, I need to go back to a logged in state. The code I have is function update_user_box(){ jQuery('span#logge...

pygame function appears to be being ignored

I'm building a relatively simple programme to test collision detection, it's all working fine at the moment except one thing, I'm trying to make the background colour change randomly, the only issue is that it appears to be completely skipping the function to do this; import pygame from pygame.locals import * import random, math, time, ...

In c# is it possible for a function to only be called from within another function?

In c# is it possible to create a function that can only be called from within another function? eg can you do something like this? private void a() { b(); c(); ...do something else private void b() { ..do something but can only be called from a() } private void c() { ..do something but can only be called from a() } } The reaso...

Run PHP class from JavaScript

I need to fire a php class from a javascript function. code: <input type="button" name="Submit" value="Submit" class="opinionbox" onclick="verifyControl('<?=$control_no?>')"/> function verifyControl(rNo) { Cont_no=document.getElementById("ContNo").value; if(rNo==Cont_no) { frames['frame1'].print(); showPage('payment'); }...

How do I compare unix time stamps (numbers) inside a function in PHP?

Ok, I fear that this is just me having forgotten some small stupid thing about PHP, but I just can't seem to figure out what is going on here. Test code: <?php header('Content-Type: text/plain'); $closingDate = mktime(23, 59, 59, 3, 27, 2009); function f1() { return time() > $closingDate; } function f2() { return time() <...

Explain about linkages(external/internal) in c++?

Explain about linkages(external/internal) in c++? How does linkage differ for a function,constant,inline function,template function ,class and template class ...

Is it legal to use the increment operator in a C++ function call?

There's been some debate going on in this question about whether the following code is legal C++: std::list<item*>::iterator i = items.begin(); while (i != items.end()) { bool isActive = (*i)->update(); if (!isActive) { items.erase(i++); // *** Is this undefined behavior? *** } else { other_code_...