Is it possible to adapt a method like this function "F"
class C {
public void F(int i);
}
to a delegate like Action<C,int>?
I have this vague recollection that Microsoft was working on supporting this kind of adaptation. But maybe I misremembered!
I have a STL container full of billions of the following objects
pair
I need some function of the following form
/*returns items sorted biggest first */
bool sortPredicate (SomeClass *two, SomeClass *one)
{
return ???;
}
Is there some trick I can use to very quickly compare pairs of pointers?
Right now I am using an extension to linq to provide me with the functionality of Contains. I call the WhereIn like this:
Answers = Answers.WhereIn(x => x.category.catid, catSTRarray);
Is there a built in function within entity framework to use?
In some library I'm using (written in C) its
StorePGM(image, width, height, filename)
char *image;
int width, height;
char *filename;
{
// something something
}
All functions are defined this way. I never seen such function definitions in my life. They seem to be valid to MSVC but when I compile it as C++ it gives errors.
What is it? some kind of old version C?
Hello,
typedef enum testCaseId
{
"TC-HIW-0019" = 0,
"TC-HIW-0020",
"TC-HIW-0021"
} testCaseId;
I need my test cases to be represented in enum. In my test function, I need to switch between the test cases like:
void testfunc(uint8_t no)
{
switch(no)
{
case 0:
case 1:
default:
}
}
So can anyone help on how to use enum to declare strings.
Is there any efficient way in python to count the times an array of numbers is between certain intervals? the number of intervals i will be using may get quite large
like:
mylist = [4,4,1,18,2,15,6,14,2,16,2,17,12,3,12,4,15,5,17]
some function(mylist, startpoints):
# startpoints = [0,10,20]
count values in range [0,9]
count values in range [10-19]
output = [9,10]
I want to cut the svn/cvs recods in pieces and then put in to database. After that i can make use of those data easily.
Any java function can get out the record? and How?
If possible, please provide a example. Thank you.
I've read that it's important to call setContentView() early in an activity since it builds the view objects that may be manipulated by subsequent code in onCreate().
In terms of lifecycle, does the view get drawn to screen as soon as setContentView() is called, or does it allow the onCreate() function to build/populate the information in the view objects, and wait to actually draw it after onCreate() completes?
Thanks!
Every object in .NET inherits (directly or indirectly) from the common root base "Object". Is there such a common object root in C++? How do I pass any object to a function?
public void DoSomeStuff(object o) { ... }
Does the Visual Studio 2008 debugger implicitly cast all smaller data types to int? I have a function with the following signature:
public int DoSomething(sbyte value) { ... }
When pass in -127 and I look at the value argument the Visual Studio debugger (e.g. Watch window) shows me that it has the value 0xFFFFFF81. This is correct except for the fact that sbyte is only 8 bits wide; I would expect the debugger to show me that it is 0x81.
I am traversing checkboxes like this:
$('.day').each(function() {
// here I need to get the following 4 text inputs in the HTML
// and set some attributes on them
});
After every checkbox there are four text input fields (there are also some div, span tags for CSS around them). So inside the loop above I need to get four text input fields that follow the checkbox in the HTML source so I can set some attributes on them.
How would I go about that?
My question is simple.
Is there an equivalent of PHP's pack() and unpack() function in C++?
If no, is there an alternative to achieve the same goal?
http://us.php.net/pack
Thanks.
Ahh i'm stuck again. helpp
why do i encounter this
"can't find variable: $j"
when i use this method
function myMethod(htmlObject)
{
var buttonTags = $j("button",htmlObject);
...
}
Sorry for askin silly questions again. running outta time =\
THANKS FOR THEHELP!
<asp:TextBox ID="txtDate" runat="server" AutoPostBack="true" OnTextChanged="txtDate_TextChanged"></asp:TextBox>
how can with Jquery add default date. I do not know where and when to call this code:
function addDefaultDate() {
if ($('#txtDate').val().length == 0) {
var now = new Date();
$('#txtDate').text(now.getDate() + '.' + now.getMonth() + '.' + now.getYear());
}
}
I have a handful of users on a server. After updating the site, they don't see the new pages. Is there a way to globally force their browsers and providers to display the new page? Maybe from settings.py? I see there are decorators that look like they do this on a function level.
I have an add form inside a div which has 3-5 textboxes.. I submit the form via ajax and hide the div in the success function of it... Now i want to clear all the values of textboxes within the adddiv using jquery?
I want to remove all non-alphanumeric and space characters from a string. So I do want spaces to remain. What do I put for a space in the below function within the [ ] brackets:
ereg_replace("[^A-Za-z0-9]", "", $title);
In other words, what symbol represents space, I know \n represents a new line, is there any such symbol for a single space.
I've got the pointer to the control with function
CWnd* CWnd::GetDlgItem(int ITEM_ID)
so i've got CWnd* pointer which points to the control,
but simply can't find any method within CWnd class that will
retrieve the size and location of a given control.
Any help?
Given an object like this:
var obj = {
first:{
second:{
third:'hi there'
}
}
};
And a key like this "first.second.third"
How can I get the value of the nested object "hi there"?
I think maybe the Array.reduce function could help, but not sure.
I want to generate some dynamic data and feed these data in to test cases. But I found that Django will initial the test class every time to do the test. So the data will get generated every time django test framework calls the function.
Is there anyway to use something like the singleton or static variable to solve the problem? What should be the solution?
Thanks!
Are they stored in the heap or there is separate area where they are stored?
Similarly where are static variables stored in memory. They can't be stored in frames as they will get destroyed when the function returns.
PS - Can someone suggest a good book that talks about memory mapping for C/C++.
In Javascript, I have a variable that is set to a block of text from a WYSIWYG editor.
I want to use JQUERY's EACH() to find span's with the class XXXX.
$( "span.foods" ).each( function() {});
But I want it to search in the variable I have, lets call if lookHere
Is this possible?
hi folks,
i got a webpage with some "cards" (divs) layin on it.
they are positioned in a star-like order, flowing to the background.
i want to bring cards from the background to the middle-foreground bei clicking on it (to focus the card "contact" for instance).
how can i realize this? is there any script which is already containing a function like this?
I am new to programming and this might be an obvious question, though i cannot for life of me figure out why my program is not returning as a double.
I am suppose to write a stocks program that takes in shares of stock, whole dollar portion of price and the fraction portion. And the fraction portion is to be inputted as two int values, and include a function definition with 3 int values.The function returns the price as a double.
#include <iostream>
using namespace std;
int price(int, int, int);
int main()
{
int dollars, numerator, denominator, price1, shares;
char ans;
do
{
cout<<"Enter the stock price and the number of shares.\n";
cout<<"Enter the price and integers: Dollars, numerator, denominator\n";
cin>>dollars>>numerator>>denominator;
cout<<"Enter the number of shares held\n";
cin>>shares;
cout<<shares;
price1 = price(dollars,numerator,denominator);
cout<<" shares of stock with market price of ";
cout<< dollars << " " << numerator<<'/'<<denominator<<endl;
cout<<"have a value of " << shares * price1<<endl;
cout<<"Enter either Y/y to continue";
cin>>ans;
}while (ans == 'Y' || ans == 'y');
system("pause");
return 0;
}
int price(int dollars, int numerator, int denominator)
{
return dollars + numerator/static_cast<double>(denominator);
}