我写了一个Android应用程序.现在,我想让设备在某个动作发生时振动.我怎样才能做到这一点?
我完成了我的学期项目,现在我需要向讲师展示.
这个项目是一个MVC服务器..
它包含Java Servlet(Contoller),JSP用于视图.
我在模型(DAO)层使用Hibernate 3.6.4,在数据库使用MySQL.
当然还有Tomcat服务器7.
有免费托管服务,我可以托管我的项目吗?
我有一个Java EE Hibernate项目,我使用MySQL作为数据库.
我希望当我第一次运行项目时,它会自动创建数据库.
这是我的hibernate.cnf.xml:
<?xml version='1.0' encoding='utf-8' ?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd" >
<hibernate-configuration>
<session-factory>
<property name="connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="connection.url">jdbc:mysql://localhost/InternetProject</property>
<property name="connection.username">root</property>
<property name="connection.password"></property>
<property name="connection.pool_size">10</property>
<property name="dialect">org.hibernate.dialect.MySQLDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<property name="show_sql">true</property>
<mapping class="entities.Business" />
<mapping class="entities.Coupon" />
<mapping class="entities.User" />
<mapping class="entities.LastLogin" />
</session-factory>
</hibernate-configuration>
Run Code Online (Sandbox Code Playgroud)
当我第一次在另一台计算机上运行该项目时,如何InternetProject创建数据库?
根据配置文件,它可能已经做到了,我不知道它.
提前致谢.
我创建了一个生成宾果板的功能,我想要返回宾果板.
正如我没想到的那样,它不起作用.
这是功能:
int** generateBoard() {
int board[N][M], i, j , fillNum;
Boolean exists = True;
// initilize seed
srand(time(NULL));
// fill up..
for(i = 0; i < N; ++i) {
for(j = 0; j < M; ++j) {
exists = True;
while(exists) {
fillNum = rand()%MAX_RANGE + 1; // limit up to MAX_RANGE
if(beenAdded(board, fillNum) == Exist) {
continue;
} else {
board[i][j] = fillNum;
exists = False;
}
}
}
}
return board;
}
Run Code Online (Sandbox Code Playgroud)
我在"返回板"行有一个compilcation错误(红色子行).
有没有使用结构\动态分配返回2D数组的方法? …
我使用C#windows窗体,我有richtextbox,我想用红色标记一些文本,一些用绿色,一些用黑色.
怎么办?附图.

我有以下代码:
#include <iostream>
using namespace std;
class CForward;
void func(CForward* frw) { delete frw; }
class CForward
{
public:
~CForward() { cout << "Forward" << endl; }
};
int main()
{
func(new CForward);
cin.get();
}
Run Code Online (Sandbox Code Playgroud)
我运行程序,它什么都没打印.
为什么?
在main中,我创建了new CFoward,并在func我删除它并将其称为析构函数.
似乎没有调用析构函数.为什么?无论如何这与前瞻性相关有关吗?
作为自我锻炼,我写了这个简单的代码:
#include <iostream>
int gIndex = 3;
template <class T> class Array
{
public:
explicit Array(int size);
T& operator[](int i) { return m_data[i]; }
T operator[](int i) const { return m_data[i]; }
T getAnchorPoint() const { return m_data[m_anchor]; }
private:
T* m_data;
int m_size;
int& m_anchor;
};
template <class T> Array<T>::Array(int size) : m_size(size), m_data(new T[size])
{
memset(m_data, 0, size*sizeof(T));
m_anchor = gIndex;
}
int main()
{
Array<double> a(10);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我收到了编译错误,其中说:
error C2758: 'Array<T>::m_anchor' : must be initialized …
没有参数的模板类是什么意思?例如,让我们拿一个计算阶乘的模板类,其模板参数在N - 中N!.
基本上,这是班级:
template <int N> class Factorial
{
public:
enum {fact = N * Factorial<N-1>::fact};
};
Run Code Online (Sandbox Code Playgroud)
但是,我发现这个班有一个"扩展课",
template<> class Factorial<1>
{
public:
enum {fact = 1};
};
Run Code Online (Sandbox Code Playgroud)
在这里我的问题是:没有参数的模板是什么template<>意思?
提前致谢.
没什么好说的
<html>
<body>
<script>
var x = document.getElementById('btn1');
alert(x);
</script>
<input type="button" id="btn1" value="Clickme" onclick="alert('1')" />
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
警报消息null而不是包含对象详细信息或类似内容的消息.
问题是什么?