adb shell 操作sqlite3 databases

D:\android\adt-bundle-windows-x86_64-20140702\sdk\platform-tools>adb shell
/data/edu.xatu.news/databases/n < news.db news.db-journal ta/data/edu.xatu.news/databases/ < root@vbox86p:/data/data/edu.xatu.news/databases # sqlite3 ne news.db news.db-journal lite3 news.db < SQLite version 3.7.11 2012-03-20 11:35:50 Enter ".help" for instructions Enter SQL statements terminated with a ";" sqlite> .table
android_metadata stutb
sqlite> .schema stutb
CREATE TABLE stutb(_id integer primary key autoincrement,name text not null,sex text not null,age integer not null);
sqlite>

	

JavaScript & jQuery 交互式web前端开发(2)

变量的应用

 

numeric-variable.js

 

var price;

var quantity;

var total;

 

price=5;

quantity=14;

total=quantity*price;

 

var el=document.getElementById(‘cost’);

el.textContent=’$’+total;

 

F:\html\02\numeric-variable.html

<!DOCTYPE html>
<html>
    <head>
        <title>Construtive &amp;Co.</title>
        <link rel=”stylesheet” href=”css/c02.css”>
    </head>
    <body>
       <h1>ElderFlower</h1>
<div id=”content”>
    <h2>Constom Signage </h2>
    <div id=”cost”>Cost:$5 per tile</div>
    <img src=”images\preview.jpg” alt=”Sign”/>
</div>
<script src=”js/numeric-variable.js”></script>
        </body>
</html>
实现一个小例子
example.js
var greeting=’Howdy’;
var name=’Molly’;
var message=’,please check your order:’;
var welcome=greeting+name+message;
var sign=’Montague House’;
var tiles=sign.length;
var subTotal=tiles*5;
var shipping =7;
var grandTotal=subTotal+shipping;
var elName=document.getElementById(“greeting”);
elName.textContent=welcome;
var elSign=document.getElementById(“userSign”);
elSign.textContent=sign;
var elTiles=document.getElementById(“tiles”);
elTiles.textContent=tiles;
var elSubtotal=document.getElementById(“subTotal”);
elSubtotal.textContent=subTotal;
var elShipping=document.getElementById(“shipping”);
elShipping.textContent=shipping;
var elgrandTotal=document.getElementById(“grandTotal”);
elgrandTotal.textContent=grandTotal;
F:\html\02\boolean-variable.1.html
<!DOCTYPE html>
<html>
    <head>
        <title>JavaScript &amp;jQuery-Chapter 2:Basic JavaScript Instructions – Example</title>
        <link rel=”stylesheet” href=”css/c02.css”>
    </head>
    <body>
       <h1>ElderFlower</h1>
        <div id=”content”>
            <div id=”greeting” class=”message” >Hello!</div>
            <table>
                <tr>
                    <td>Custom sign:</td>
                    <td id=”userSign”></td>
                </tr>
                <tr>
                    <td>Total tiles:</td>
                    <td id=”tiles”></td>
                </tr>
                <tr>
                    <td>SubTotal:</td>
                    <td id=”subTotal”>$</td>
                </tr>
                <tr>
                    <td>Shipping:</td>
                    <td id=”shipping”>$</td>
                </tr>
                <tr>
                    <td>Grand Total:</td>
                    <td id=”grandTotal”>$</td>
                </tr>
            </table>
               
         <a href=”#” class=”action” >Pay Now</a>
        </div>
<script src=”js/example.js”></script>
        </body>
</html>

JavaScript & jQuery 交互式web前端开发(1)

第一个js.实现按不同时间问候 

add-content.js

var today=new Date();

var nowHour=today.getHours();

var greeting;

 

if(nowHour>18){

greeting=’good evening!’;

}else if(nowHour>12){

greeting=’good afternoon!’;

}else if(nowHour>6){

greeting=’good morning!’;

}else{

greeting=’good deep!’

}

document.write(‘<h3>’+greeting+'</h3>’);

对应html
<!DOCTYPE html>
<html>
    <head>
        <title>Construtive &amp;Co.</title>
        <link rel=”stylesheet” href=”css/c01.css”>
    </head>
    <body>
        <h1>Construtive &amp;Co</h1>
        <script src=”js/add-content.js”></script>
        <p>For all orders and Inquires please call
            <em>555-33445</em></p>
        </body>
</html>

include指令与动作

1.include 语法是<%@ include file=”data.jsp”%>

新建date.jsp

<%@page import=”java.text.SimpleDateFormat,java.util.*”%>

<%@ page language=”java” contentType=”text/html; charset=UTF-8″

pageEncoding=”UTF-8″%>

<%

Date date = new Date();

SimpleDateFormat sdf = new SimpleDateFormat(“yy年MM月-dd日”);

String s=sdf.format(date);

%>

<%=s  %>

在index.jsp 包含date.jsp

<%@ include file=”data.jsp”%>

执行结果是将生成一个class类

如果用include动作 语法是<jsp:include page=”data.jap”></jsp:include>

将生成两个  class

2.forward 动作

相当于转发

语法是 <jsp:forward page=”users.jsp”>

还可以添加参数  

<jsp:forward page=”users.jsp”>

<jsp:param value=”1111@qq.com” name=”email”/>

</jsp:forward>

这就是param 动作<jsp:param value=”1111@qq.com” name=”email”/>

 

 

javabean(2) 四种作用范围scope

1.Session

login_do.jsp

<jsp:useBean id=”user” class=”com.po.User” scope=”session”></jsp:useBean>

<!– 与表单把有关  初始化User所有属性   name 实例名称 property=”*” *表示所有属性–>

<jsp:setProperty name=”user” property=”*” />

<h1>jsp:getProperty</h1>

<br> 姓名:<jsp:getProperty property=”username” name=”user” />

<br>密码:<jsp:getProperty property=”password” name=”user” />

<br>

<a href=”session.jsp”>session</a>

session.jsp

<%@ page language=”java” contentType=”text/html; charset=UTF-8″

pageEncoding=”UTF-8″%>

<%@ page import=”com.po.User”%>

<!DOCTYPE html PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”>

<html>

<head>

<meta http-equiv=”Content-Type” content=”text/html; charset=UTF-8″>

<title>Session</title>

</head>

<body>

 

<%

User user = null;

if (session.getAttribute(“user”) != null) {

user = (User) session.getAttribute(“user”);

}

;

%>

<h1>

session读取

<hr>

<%=user.getUsername()%>

<br>

<%=user.getPassword()%>

</h1>

 

</body>

</html>

session可以起作用

2.application

login_do.jsp

<jsp:useBean id=”user” class=”com.po.User” scope=”application” />

<hr>

<h1>jsp:getProperty</h1>

<br> 姓名:<jsp:getProperty property=”username” name=”user” />

<br>密码:<jsp:getProperty property=”password” name=”user” />

<br>

<hr>

<a href=”applicaton.jsp”>application</a>


application.jsp

<jsp:useBean id=”user” class=”com.po.User” scope=”application” />

<hr>

<h1>jsp:getProperty</h1>

<br> 姓名:<jsp:getProperty property=”username” name=”user” />

<br>密码:<jsp:getProperty property=”password” name=”user” />

<br>

application可以起作用

3.request  page  不起作用

javabean 使用及jsp 动作元素

1.创建User类 User.java

public class User {

private String username;

private String password;

 

public User() {

}

 

public String getUsername() {

return username;

}

 

public void setUsername(String username) {

this.username = username;

}

 

public String getPassword() {

return password;

}

 

public void setPassword(String password) {

this.password = password;

}

 

}

2.创建提交表单给login.jsp

<form name=”loginForm” action=”login_do.jsp” method=”post”  >

 

<table>

<tr>

<td>姓名:</td>

</tr>

<tr>

<td><input name=”username” type=”text”></td>

</tr>

<tr>

<td>密码:</td>

</tr>

<tr>

<td><input name=”password” type=”password”></td>

 

</tr>

 

<tr>

<td colspan=”2″ align=”center”><input name=”submit” type=”submit”></td>

</tr>

</table>

</form>

3.创建处理表单

<!– id为实例化的类  class 类的路径  scope是作用范围   –>

<jsp:useBean id=”user” class=”com.po.User” scope=”page” ></jsp:useBean>

<!– 与表单把有关  初始化User所有属性   name 实例名称 property=”*” *表示所有属性–>

<jsp:setProperty name=”user” property=”*” /> 

 

<%– 于表单有关,部分属性匹配 –%>

<%– <jsp:setProperty property=”password” name=”user”/>  –%>

<%– 手动设置属性 –%>

<%– <jsp:setProperty property=”password” name=”user” value=”1111111″ />

<jsp:setProperty property=”username” name=”user” value=”2222222″ /> –%>

<!– 使用参数赋值 param –>

<jsp:setProperty property=”username” name=”user” param=”name”/>

<hr>

<h1>jsp:getProperty</h1>

<jsp:getProperty property=”username” name=”user”/>

Jsp登陆案例

1.登陆页面

表单:

<form name=”loginForm” action=”/jsp/login/login_do.jsp” method=”post”>

 

<table>

<tr>

<td><input name=”username” type=”text”></td>

</tr>

<tr>

 

</tr>

<tr>

<td><input name=”password” type=”password”></td>

 

</tr>

 

<tr>

<td><input name=”submit” type=”submit”></td>

</tr>

<tr>

<td><input type=”radio” name=”usertype” value=”js”>老师

<input type=”radio” name=”usertype” value=”xs”>学生</td>

</tr>

</table>

</form>

2.登陆处理 用转发 和重定向

login_do.jsp

<%@ page language=”java” contentType=”text/html; charset=UTF-8″

pageEncoding=”UTF-8″%>

<%

String username = “”;

String password = “”;

String usertype = “”;

 

username = request.getParameter(“username”);

usertype = request.getParameter(“usertype”);

password = request.getParameter(“password”);

 

//也可以用session保存用户信息

session.setAttribute(“username”, username);

if (“admin”.equals(username) && “admin”.equals(password)) {

request.getRequestDispatcher(“login.jsp”).forward(request, response);

                

 

} else {

response.sendRedirect(“login_error.jsp”);

}

%>

3.登陆成功 页面

login.jsp

<h1>Login Success!</h1>

<%

String name = “”;

 

String username = “”;

String password = “”;

String usertype = “”;

 

username = request.getParameter(“username”);

usertype = request.getParameter(“usertype”);

password = request.getParameter(“password”);

%>

username:<%=username%>

<br> password:

<%=password%>

<br> usertype:<%=usertype%>

4.登陆失败页面

<h1>Login error!</h1>

 

application 对象

application对象创建于服务器启动   结束于服务器关闭

application 存入对象

<%

application.setAttribute(“city”, “西安”);

application.setAttribute(“postcode”, “713200”);

%>

取出对象
城市:<%=application.getAttribute(“city”)%>
<br>邮编:<%=application.getAttribute(“postcode”)%>