我得到了需要在CakePHP中重新编码的应用程序.
我通过子选择得到了以下选择:
SELECT COUNT(*) AS item1,
(SELECT COUNT(*) FROM portal_members) AS item3,
(SELECT COUNT(*) FROM portal_reviews) AS item3,
(SELECT COUNT(*) FROM portal_downloads) AS item4
FROM portal_articles
WHERE 1 = 1
Run Code Online (Sandbox Code Playgroud)
任何人都知道如何使用CakePHP find($ type,$ params)创建该查询?
我正在尝试用两个类实现一个树状结构:Tree和Node.问题是,从每个类我想调用另一个类的函数,所以简单的前向声明是不够的.
我们来看一个例子:
tree.h中:
#ifndef TREE_20100118
#define TREE_20100118
#include <vector>
#include "Node.h"
class Tree
{
int counter_;
std::vector<Node> nodes_;
public:
Tree() : counter_(0) {}
void start() {
for (int i=0; i<3; ++i) {
Node node(this, i);
this->nodes_.push_back(node);
}
nodes_[0].hi(); // calling a function of Node
}
void incCnt() {
++counter_;
}
void decCnt() {
--counter_;
}
};
#endif /* TREE_20100118 */
Run Code Online (Sandbox Code Playgroud)
Node.h:
#ifndef NODE_20100118
#define NODE_20100118
#include <iostream>
//#include "Tree.h"
class Tree; // compile error without this …Run Code Online (Sandbox Code Playgroud) 我写了一个像这样的array_length函数:
int array_length(int a[]){
return sizeof(a)/sizeof(int);
}
Run Code Online (Sandbox Code Playgroud)
然而,当我这样做时它会返回2
unsigned int len = array_length(arr);
printf ("%i" , len);
Run Code Online (Sandbox Code Playgroud)
我在哪里
int arr[] = {3,4,5,6,1,7,2};
int * parr = arr;
Run Code Online (Sandbox Code Playgroud)
但是当我这么做的时候
int k = sizeof(arr)/sizeof(int);
printf("%i", k);
Run Code Online (Sandbox Code Playgroud)
在main函数中,它返回7.
编写array_length函数的正确方法是什么?如何使用它?
我的基本理解是没有纯虚函数的实现,但是,有人告诉我可能有纯虚函数的实现.
class A {
public:
virtual void f() = 0;
};
void A::f() {
cout<<"Test"<<endl;
}
Run Code Online (Sandbox Code Playgroud)
代码是否正常?
使其成为具有实现的纯虚函数的目的是什么?
有没有办法在JSTL中将变量指定为参数名称,即:
<c:set var='myVar' value='dynamicParameterName' />
<c:out value='${param.(dynamicParameterName)}' />
Run Code Online (Sandbox Code Playgroud) 我有这个:
<div class="selection">
<a class="current" href="#">1</a>
<div class="class">text</div>
<a href="#">2</a>
<div class="class">text</div>
<a href="#">4</a>
<div class="class">text</div>
<a href="#">5</a>
</div>
Run Code Online (Sandbox Code Playgroud)
我想在a.current之后选择下一个元素.我做到了这一点,但它做得很好.
...
$(".selection a.current").next("a").hide();
Run Code Online (Sandbox Code Playgroud)
我也试过了
$(".selection").children("a.current").next("a").hide();
Run Code Online (Sandbox Code Playgroud)
...不是所有的内部.selection兄弟姐妹,因此可以使用next()选择器访问?我想知道,因为当我删除它们之间的div元素时它会起作用.
如果有人知道为什么这不起作用会很好;).
使用GUI应用程序我的意思不仅仅是一个Unix命令行应用程序,而是整个.app包和一个完整的Cocoa或Carbon应用程序.
谢谢!
PS:我对GUI应用程序并不完全准确.
我的意思是一个带有窗口和菜单的应用程序,而不是Unix命令行应用程序.
实际上,我得到了一个关于在MacOSX上使用SDL和OpenGL进行编程的教程,它甚至还有用于设置菜单所需的ObjC的XCode模板,这几乎就是我想要的.
谢谢!