- 浏览: 97145 次
- 性别:
- 来自: 北京
-
最新评论
文章列表
初学PHP,闲暇写的排列组合,以十一运金为例,11,5的排列组合,可通用。(备注:初学,用字符串简单控制)。
<?php
$total = 0;
$result = array();
function test() {
combination(11,5,"",$total);
printf("Total %d", $GLOBALS['total']);
echo '<br />';
foreach ($GLOBALS['result'] as $value) {
echo implode( ...
System.nanoTime
- 博客分类:
- JAVA
System.nanoTime只能用于计算时间差,不能用于计算时间的准确度(System.out.println(new Date(System.nanoTime()));这种是绝对错误的)。
long java.lang.System.nanoTime()
Returns the current value of the most precise available system timer, in nanoseconds.
This method can only be used to measure elapsed time and is not related to any ...
分为Project和Coder
分别用于生成工程及针对数据表的ssh2各层的代码框架。
整个代码架构基于之前的一个项目。
目前来说,基本上把底层模板更换就可以生成别的架构的代码。
www.aimashe.com
Struts2拦截器获取调用方法及Action类
- 博客分类:
- JAVA
action!method.action
获取动态方法调用的Action方法
System.out.println(actionInvocation.getProxy().getMethod());
获取类名或类
System.out.println(actionInvocation.getProxy().getActionName());
actionInvocation.getAction()
dtdaedataloweiwilaldjajkpqieqonzda=java;
PHP加载mysql出错
- 博客分类:
- PHP
windows7 下配置,apache,php,mysql配置过程中,出现以下错误。在确定一切都正常,但仍然出现下面的错误时,
PHP Warning: PHP Startup: Unable to load dynamic library /ext/php_mysql.dll
通过以下方法处理:
拷贝php5\libmysql.dll 到 Apache2.2\bin目录下,即可解决。
www.aimash.com
Oracle按间隔周统计
- 博客分类:
- Oracle
按非自然月归类:
select ceil(months_between(add_months(sysdate,1),sysdate)) from dual;
按非自然周分组,左侧表,left join 右侧表
select to_char(to_date('2011-02-08', 'yyyy-mm-dd')+7*(rownum-1) ,'yyyy-mm-dd') a ,
to_char(case when to_date('2011-02-08', 'yyyy-mm-dd')+7*(rownum-1)+6>sysdate then sysdate else
to_d ...
Objectify使用
- 博客分类:
- Objectify
Objectify需要注册实体类,才能保存对象。以下是示例代码:
private static Objectify objectify = ObjectifyService.begin();
static {
ObjectifyService.register(User.class);
}
/**
* 获取持久化对象
*
* @return
*/
public static Objectify getPersistenceManager() {
return objectify;
}
Errors occurred during the build.
Errors running builder 'JavaScript Validator' on project
解决方式,去掉JavaScript Validator
工程->properties->Builders 在 JavaScript Validator上去掉选择
个人网站:爱码社
使用Google时,经常出现被重置,搜索缓慢。依照技术的强势来说,Google不能出现这种问题。那问题的本质相比也不言而喻了。解决方法如下:
在系统的C:\Windows\System32\drivers\etc目录下,往hosts文件里添加以下内容,问题解决
203.208.46.146 www.google.com
203.208.46.147 www.google.com.hk
203.208.46.132 clients1.google.com
203.208.46.149 mail.google.com
203.208.46.161 chatenabled.mail.goo ...
当hibernate出现 should be mapped with insert="false" update="false"异常时,
代表hibernate的hbm.xml中出现重复的字段
将MyEclipse的工程转成Eclipse工程,设置如下:
一:工程->properties->Project Facets选项下
添加Dynamic Web Module,将java的版本设为1.6(注意)
二:还是在工程的properties选项中,找到Deployment Assembly选项,更改WebContent为WebRoot
看了几篇关于提高JAVA在GAE上的运行速度。主要几个方面进行了实践。
第一:弃用现在的流行的框架,像Spring,Struts2等这种框架,这些在GAE上的速度堪比老牛拉车
第二:弃用JSP,改用freemarker作为视图,使用freemarker的缓存功能,缓存模板。
第三:弃用jdo,jpa等GAE默认的持久层,改用objectify等,删除app engine SDK默认添加的无用的jar包,最后精简剩下的jar包如附件
经过上面的处理后,运行速度还是上来了。
上面对jar包的精简处理可能有点过,原则是在确定不需要的时候,删除它。
删除后,部署使用appcfg update命令 ...
int a = b = 1;
上面的语句JAVA是如何分配内存的?
一次被问到上面这个问题,被整晕了。后来一想,这压根就是一句语法错误的语句,连编译都过不去,去谈内存分配有点扯。
正解:
int a =1;
int b = 1;
由于基本类型是存放在栈中的,而栈是可以数据共享的,所以上述代码在栈中存放了a,b的引用及数据1三个量。
1.插入
2.更新
3.集合删除
4.集合更新
5.集合创建
6.删除
/**
* Perform all currently queued actions.
*
* @throws HibernateException error executing queued actions.
*/
public void executeActions() throws HibernateException {
executeActions( insertions );
executeActions( updates );
executeActions ...
var select = document.getElementById("selectId");
while(select.options.length>0) {
select.options.remove(0);
}