随笔:25 文章:1 评论:8 引用:0
BlogJava 首页 发新随笔
发新文章 联系 聚合管理

2010年5月22日

for a C++ program converts true and false to 1 and 0 where integer values are expected, and it converts 0 to false and nonzero to true where bool values are expected.
posted @ 2010-05-22 00:23 ljwiie 阅读(146) | 评论 (0)编辑 收藏

2010年5月6日

用构造函数定义属性,用原型定义方法
function ClassA(sColor) {
    this.color = sColor;
}

ClassA.prototype.sayColor = function () {
    alert(this.color);
};

function ClassB(sColor, sName) {
    ClassA.call(this, sColor);
    this.name = sName;
}

ClassB.prototype = new ClassA();

ClassB.prototype.sayName = function () {
    alert(this.name);
};
在此例子中,继承机制由两行突出显示的蓝色代码实现。在第一行突出显示的代码中,在 ClassB 构造函数中,用对象冒充继承 ClassA 类的 sColor 属性。在第二行突出显示的代码中,用原型链继承 ClassA 类的方法。由于这种混合方式使用了原型链,所以 instanceof 运算符仍能正确运行。

下面的例子测试了这段代码:
var objA = new ClassA("blue");
var objB = new ClassB("red", "John");
objA.sayColor(); //输出 "blue"
objB.sayColor(); //输出 "red"
objB.sayName(); //输出 "John"

摘自http://www.w3school.com.cn/js/pro_js_inheritance_implementing.asp
posted @ 2010-05-06 23:57 ljwiie 阅读(193) | 评论 (1)编辑 收藏

2007年1月11日

做个查询,字段1值除3,如果=1,就用字段2值-20,如果=2,字段2 值-30,将差值大于0的数据选出来 

SELECT col1, col2, 
CASE 
   WHEN col1 / 3 = 1 THEN col2 - 20 
   WHEN col1 / 3 = 2 THEN col2 - 30
END AS difference
FROM price
WHERE (
CASE 
   WHEN col1 / 3 = 1 THEN col2 - 20 
   WHEN col1 / 3 = 2 THEN col2 - 30
END > 0)
posted @ 2007-01-11 10:26 ljwiie 阅读(291) | 评论 (0)编辑 收藏

2006年12月19日

...
posted @ 2006-12-19 23:00 ljwiie 阅读(219) | 评论 (1)编辑 收藏

2006年12月18日

<%@ page isThreadSafe="true|false" %>
默认值为true

isThreadSafe=false模式表示它是以Singleton模式运行。
     该模式implements了接口SingleThreadMode,
     该模式同一时刻只有一个实例,不会出现信息同步与否的概念。
     若多个用户同时访问一个这种模式的页面,
     那么先访问者完全执行完该页面后,后访问者才开始执行。

isThreadSafe=true模式表示它以多线程方式运行。
    该模式的信息同步,需访问同步方法(用synchronized标记的)来实现。
    一般格式如下:
    public synchronized void syncmethod(...){
      if(...) {
         wait();
      }
      notifyAll();
    }
posted @ 2006-12-18 17:39 ljwiie 阅读(2406) | 评论 (0)编辑 收藏

2006年12月13日

1. <iframe id="" name=""width="0" height="0" src=""></iframe>
      parent.window.location.reload();

2.  window.open( [sURL] [, sName] [, sFeatures] [, bReplace])
      window.opener.location.reload();

3. window.showModalDialog(sURL [, vArguments] [, sFeatures])
      
vArguments 用 window表示,代表该window对象
      
window.dialogArguments.location.reload();
posted @ 2006-12-13 12:28 ljwiie 阅读(399) | 评论 (0)编辑 收藏

2006年12月10日

当子类继承了父类之后,之类初始化顺序如下:

1.父类static变量,或程序块
2.子类static变量,或程序块
3.父类成员变量
4.父类构造函数
5.子类成员变量
6.子类构造函数

posted @ 2006-12-10 11:30 ljwiie 阅读(207) | 评论 (0)编辑 收藏

2006年12月3日

去年的今天我买了我的第一块滑板,boiling 2005款。
posted @ 2006-12-03 23:27 ljwiie 阅读(214) | 评论 (0)编辑 收藏

2006年10月26日

oracle里面round为四舍五入,绝对值四舍五入后加符号

java里面的
Math.round(a): (long)Math.floor(a + 0.5d)
Math.floor(a): 不大于a的最大整数

posted @ 2006-10-26 10:08 ljwiie 阅读(862) | 评论 (0)编辑 收藏

2006年10月24日

--商品价格信息表
create table GOODS(
 ID NUMBER,
 NAME VARCHAR2(10),
 PRICE NUMBER(10,2),
 AREA VARCHAR2(10)
);
--添加主键
alter table GOODS
add constraint PK_GOODS primary key (ID);
--添加注视
comment on table GOODS  is '商品信息表';
comment on column GOODS.ID is '商品编号';
comment on column GOODS.NAME is '商品名称';
comment on column GOODS.PRICE is '商品价格';
comment on column GOODS.AREA is '销售地区';

--添加数据
insert into GOODS values(11,'苹果','2.5','成都1');
insert into GOODS values(12,'苹果','3.5','成都2');
insert into GOODS values(13,'苹果','1.5','成都3');
insert into GOODS values(14,'苹果','2.0','成都4');

insert into GOODS values(21,'香蕉','1.7','成都1');
insert into GOODS values(22,'香蕉','1.5','成都2');
insert into GOODS values(23,'香蕉','1.6','成都3');
insert into GOODS values(24,'香蕉','2.0','成都4');

--查询某种商品平均价
select NAME,avg(PRICE) from GOODS group by NAME;

--将商品价格更新为同种商品(名称相同)的平均价格
update GOODS A
set A.PRICE =
(
 select avg(PRICE) from GOODS where NAME = A.NAME
);

--执行环境oracle

posted @ 2006-10-24 10:36 ljwiie 阅读(216) | 评论 (0)编辑 收藏
CALENDER
<2024年4月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

常用链接

留言簿(1)

随笔分类

随笔档案

相册

收藏夹

朋友blog

最新评论


Powered By: 博客园
模板提供沪江博客

Contact ljwiie QQ:122050271