I have a model called Contact.
I have added the following method:
def all_completed_events
# for a given Contact, return all contact_events records that exist and where sugarcrm = false
return (self.contact_letters + self.contact_postalcards + self.contact_emails + self.contact_voicemails + self.contact_calls)
end
What is mis...
I am experimenting with mongodb 1.6 and this thing is new to me.
I notice that if I shard a collection, and then do a mapReduce, mapReduce doesn't accept the argument scope anymore:
// some line in some example code...
res = db.data.mapReduce(m,r,{scope: {log : log, padZero: padZero}});
And I got an error like this:
Mon Aug 09 1...
My question is related to this question.
#include<iostream>
template< typename T >
class T1 {
public:
T i;
void display()
{
std::cout<<i<<"\n"<<j<<"\n"<<k;
}
protected:
T j;
private:
T k;
friend void Test( T1 &obj);
};
template<typename T>
void Test(T1<T> &obj)
{
T a=T();
obj.i=a;
obj.j=a;
...
Hi, on a website i want to do this: (simplified)
myHandlers = new Array();
for(var i = 0; i < 7; i++) {
myHandlers.push(new Handler({
handlerName: 'myHandler'+i, // works, e.g. ->myHandler1, 2, 3 etc.
handlerFunc: function(bla) { /*...*/ alert(i); } // doesn't work,all return 7
}
}
I could set the counter as another attrib...
So, I ask this question in the context of a basic text input function I see in a C++ book:
char *getString()
{
char temp[80];
cin >> temp;
char * pn = new char[strlen(temp + 1)];
strcpy(pn, temp);
return pn;
}
So temp declares an array of 80 chars, an automatic variable whose memory will be freed once getString() r...
I just recently learned about Scope Guard C++ idiom. Unfortunately I can't find any good implementation of it.
Can anyone point me to some good and usable Scope Guard implementation in C++?
Thanks, Boda Cydo.
...
How do I access overridden members of base classes of base classes?
#include <iostream>
using namespace std;
class A {public: char x; A(){x='A';};};
class B1 : public A {public: char x; B1(){x='B';};};
class B2 : public A {public: char x; B2(){x='B';};};
class C : public B1, public B2 {public: char x; C(){x='C';};};
int main(){
C ...
If I want to give a JavaScript variable global scope I can easily do this:
var myVar;
function functionA() {
myVar = something;
}
Is there a similarly simple and clean way -- without creating an object -- to separate the "declaring" and the "defining" of a nested function? Something like:
function functionB; // declared wi...
Dear Masterminds,
I'm currently wondering if there is a better solution than passing this scope to the lambda-function via the parameter 'e' and then passing it to 'funkyFunction' using call()-method
setInterval(function(e){e.funkyFunction.call(e)}, speed, this)
(Minor question aside: I'd been reading something about memory-leaks in ...
I have been thinking a lot lately about how code gets organized in a layered way. I have been thinking of four different ways:
Instantiation -- specifically objects are instances of classes. However, in several languages (like python), classes are also objects that were instantiated from a metaclass. So you can end up with an instan...
I guess this is a really simple question and, probably, one that has been answered several times over. However, I really do suck at C++ and have searched to no avail for a solution.
I would really appreciate the help.
Basically:
#ifndef ANIMAL_H
#define ANIMAL_H
class Animal
{
public:
void execute();
void setName(char*);
Anima...
I have the following Javascript function that should return an array of groups that are in database. It uses $.getJSON() method to call get_groups.php which actually reads from the database.
function get_groups() {
var groups = [];
$.getJSON('get_groups.php', function(response) {
for (var i in response) {
gr...
Hello
I'm handling cookies using JavaScript to store some values in my asp.net web application.
I use document.cookie to save some values (converted into a lengthy string). But i want that value to be accessible across all the pages in my application.
When i try to get that value from a different page, i get the values pertaining to t...
file name myServices.php
<?php
$gender = 'MALE';
?>
in another file lets say file.php
include "myServices.php"
$name = 'SAM';
$age = '23';
?>
<!--after some more HTML code-->
<?php
$gender = 'FEMALE';
$name = 'ELENA';
//Question:
//In the above statements are there new variables crea...
Hello everyone, I would like to ask you some help in clarifying a few issues. But, before anything, some code is inbound first - it's a really simple login example I've constructed.
Container is Tomcat 5.5.27.
Let's assume correct username and pass combination is entered; questions are at the bottom.
LoginPage.jsp (entrypoint - view)...
For lift development, I sometimes need to use match–case statements like the following. (Rewritten to plain scala for easier understanding.) One note to them: These are actually different partial functions, defined in different parts of the code, so it’s important that a case statement fails in or before the guard in order to have the ot...
Hi there, can anyone explain the following to me. I have two JavaScript functions defined in global scope as follows:
var foo = function () {
var that = this;
that.toString = function () { return "foobar" };
return that;
}();
alert(foo.toString());
var foo2 = function (foo) {
var that;...
The following line works as expected, but I am a little concerned why:
getLine >>= \x-> getLine >>= \y-> return [x, y]
Consider the addition of parenthesis to scope the lambda expressions:
getLine >>= (\x-> getLine) >>= (\y-> return [x, y])
The second line is errorneous because x is not in scope when used in the return, and I am ha...
Hey guys I'm having a problem limiting the scope of a jQuery selector. I've created a slideshow widget that depends on an unordered list for a structure as follows:
<ul id="caption">
<li class="visible">
<p>
SwitchPoint Solutions is a leading provider of automated configuration solutions fo...
I want to create an object from a class that I have created. What I have been trying is to create the object (which can be testingclass) from a method of another class, which I will call classexample, but it says that testingclass is undeclared, which I assumed meant that it was out of the scope of the method, and the method couldn't ac...