`
文章列表
1)优化for循环,其他语言同样适用   var result=someFunction(arg);//someFunction复杂且result的值大,效果越明显 for(var i=0;i<result;i++){ //some code }  2)尽量减少点操作符的使用 //比如有一段代码 links[i].style.color = "#111111&q ...

html5 小技巧

1) Doctype声明就这么简单  <!DOCTYPE html>2)在HTML5中,<script>和<link>不再需要type属性了,去掉之后可以让代码更为简洁 <script src="../js/file.js"></script> <link rel="stylesheet" href="../css/file.css" /> 3)这有点让人纠结,HTML5并不是XTHML,你可以省去标签中的双引号。但是有空格什么的话还是得加上引号。4)通常 ...

mysql 的 触发器

建了3个触发器 1 create trigger t before insert on books for each row  set new.name = 'aaaddd'     2 create trigger t3 after delete on books for each row delete from a_student where sid=old.id      3 create trigger t2 before insert on a_student for each row  begin insert into books ...
(转过来收藏的) 步骤:1.在eclipse中建立一个名为"Chapter11"的新项目,在项目里创建一个名为DataBaseTest的类,向类中输入代码.2.下载JDBC驱动程序.我的驱动程序在G:/mysql-connector-java-3.1.143.将驱动程序包加入到java构件路径中.否则应用程序找不到相应的JDBC驱动.右击chapter11,选中属性,再选择"Java构件路径",点[库]选项卡4.点击右边的"添加外部JAR"按钮,找到mysql-connector-java-3.1.14-bin.jar,选中驱动程序 ...

1111111111111111

5、switch语句能否作用在byte上,能否作用在long上,能否作用在String上?在switch(expr1)中,expr1只能是一个整数表达式或者枚举常量(更大字体),整数表达式可以是int基本类型或Integer包装类型,由于,byte,short,char都可以隐含转换为int,所以,这些类型以及这些类型的包装类型也是可以的。显然,long和String类型都不符合switch的语法规定,并且不能被隐式转换成int类型,所以,它们不能作用于swtich语句中。 6、short s1 = 1; s1 = s1 + 1;有什么错? short s1 = 1; s1 += 1;有什么错 ...
//某个Activity某个按钮里发出broadcast Intent intent = new Intent("test_broadcast"); sendBroadcast(intent); <!-- manifest的application里 --> <receiver android:name=".MyBroadcastReceicer"> <intent-filter> <action android:name="test_broadca ...
  //发送 Intent intent = new Intent(); intent.setClass(Send.this, Recieve.class); // if have something to send, use Bundle Bundle bundle = new Bundle(); bundle.putString("KEY_AGE", text); //不用Bundle intent.putExtras(bundle); intent.putExtra("age", 55); start ...
//比如Tab键,默认会focus到下一个组件, //重写event方法,然后在相应的按键那return false //如果不行用return true  bool MyButton::event(QEvent *e){ if (e->type() == QEvent::KeyPress) { QKeyEvent *ke = static_cast<QKeyEvent *>(e); // QKeyEvent *ke = (QKeyEvent *)(e); if ( ...
connect(ui.exitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(ui.aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));     //ui.editStyleAction产生triggered信号,触发this的editStyleSheet()方法     connect(ui.editStyleAction,SIGNAL(triggered()),this,SLOT(editStyleSheet()));   void ...
我的目的是点"导入"按钮,执行名为"test.do"的action,但就算action里return null;他还是会跳转,其实要执行action只要把action的地址传给服务器就OK了。 用jQuery的jQuery.ajax 方法,能完全不跳转, 不加Math.random()没反应,在action拿filePath的地方再去掉那个随即数就可以了, 没参数也加上随机   $.ajax({url:"temp.do?rnd="+Math.random()}); jsp <script> function ...
  Calendar ctemp=Calendar.getInstance(); Calendar ccheckDate=Calendar.getInstance(); Calendar ccheckInEnd=Calendar.getInstance(); ccheckDate.setTime(checkDate);//Date 转 Calendar ccheckInEnd.setTime(checkInEnd);     //calendar的set 和 get ctemp.set(Calendar.YEAR, cc ...
#include<iostream>#include <vector>#include<map> using std::vector;using std::cin;using std::cout;using std::endl;using std::string;using std::pair;using std::map; typedef pair<int, string> Author;int playPair() {  Author a1(1, "david");  cout << a1.first & ...
   在action中,  request.getSession().setAttribute("name", "a name");//用这个 ActionContext.getContext().getSession().put("name", "a name"); 都是在session中设了一个name值  执行过这个action后,jsp中取session的name值 <%String sname=(String)request.getSession().getAttribute("name&q ...
editText.addTextChangedListener(new TextWatcher() {    @Override   public void afterTextChanged(Editable arg0) {    // TODO Auto-generated method stub    Integer leftLength = 30 - editText.length();     if (leftLength >= 20) {     textCount.setTextColor(Color.GREEN);     textCount.setText(leftLe ...
public class Play2Activity extends Activity { /** Called when the activity is first created. */ private TextView result; private Button insert; private Button show; private Helper db; private EditText et_title; // private EditText et_show;  //android API8         chec ...
Global site tag (gtag.js) - Google Analytics