再说实名制了

姓名,身份证
是这次qq群最少要做到的部分

至于全范围的实名制
说实在话,我也不知道韩国究竟做到什么程度

—–
实名制不是完全公开大众
只是别人知道你不会改id而已

至于身份证,是有关部门掌握的

—–
反正似乎实名制是迟早的事情
有偌大个韩国的样本来跟
不过也有人说韩国的是基本制度明显完整很多

qq群只是试刀而已

不过实名制的施行,不排除以权谋私或者根本就是个错误的方向的可能

—–
我们不能怎么反抗

Posted in Uncategorized | Leave a comment

qq群主实名制

我晕

现在我手上有三个群是我创建的
我不打算登记的了
挂了就算了,没法

还有一堆我经常泡的群
不知道他们(群主)打算怎么办

听说深圳连论坛版主都要实名制

再听说韩国已经实行上网实名制
该不会我们迟早走上这条路

最近网站备案也轰轰烈烈
不过我这个blog还没去备案
哪天也会被咔嚓?

Posted in Uncategorized | Leave a comment

产品与项目,和其他

我后来呆的公司都是做产品的

看来我也是喜欢上这种形式的东西

---
做产品就是,没有固定的需求

需求可以自己发掘

你如果等策划那边给需求的话,就会觉得像做项目,就像客户总提一些无聊的需求似的

如果把自己当成策划,那就花多点时间去思考究竟做一件什么东西出来,什么东西会受到欢迎,这样思考和收集的时间就会变多,实际代码的时间也可以减少 -_-

策划经常给一下没多大意义的需求,或者是不好实现的需求

---
这个发掘用户需求跟项目里的不同

产品面向的是一些不可直接接触的受众

自己去想想什么样的东西会受欢迎是挺有意思的事情

---
我自己的产品不只一个的

不过还未有第一个,哈

---
我现在还是在帮别人做产品的阶段

产品要涉及商业效果才长命

当然有些产品是可以纯粹兴趣,好玩就行

---
我不专指技术上的东西

现在我的想法是,技术是辅助的东西,不是根本

所有我现在对“做一个软件”这种不太感兴趣

---
技术应该是辅助的东西

不过在某些人眼里,技术是一种艺术,其实也是无可口非

只不过大多数艺术家都找不到饭吃而已

Posted in Uncategorized | Leave a comment

富爸爸

没有绝对的好书,也没有绝对的坏书(废话)

至少我能说 富爸爸 是一本可以一读的书
但是读的时候不要走火入魔
以为里面说的都是真理

书里也有不少误导的部分
一来或许是国内外环境的不同
二来,作者也承认了,这是一本畅销书,不一定是好书,这是他的目的,所以这里面下笔的时候或许用了某些手段,例如煽情一点
演讲者为了演讲的效果,说的东西是不是真理已经不是最重要的事情了
励志书总应该像一本励志书的

关键是如果一本书能引起我们的思考,那已经是一本值得一读的书了

http://forum.javaeye.com/viewtopic.php?p=85553#85553

Posted in Uncategorized | Leave a comment

带颜色的图

m$很会用颜色

rose就白痴很多

together有个color uml
可惜没有推广

后来弄了tdd就把color uml丢一边
不过together一直都支持color的

但是color uml是对颜色有一个约定的

Posted in Uncategorized | Leave a comment

不oo了

我发现,最近写的代码都是static的

我发现,宁愿写三个if也不愿意写三个类

我发现,宁愿传id进去,也不愿意写一个id prop

还好我还能将某段代码抽出来变成一个方法
每个方法的代码还不是很多
不过还是传一个id过去

ft

Posted in Uncategorized | Leave a comment

随地说 delphi

有没人喜欢,borland也没收入

delphi 6 7 是黄金事情

delphi 8不用评价了

没有新版,何来收入

这个m$醒目很多

你看windows升级多快啊

Posted in Uncategorized | Leave a comment

annotation for acegi

UPDATE: The new version of acegi has itself’s annotation implement. So you don’t need this any more.

annotation is so good that i can’t wait to use it in acegi

code sample

    import java.util.List;
    import org.gotblog.common.acegi.SecurityConfig;
    import org.springframework.transaction.annotation.Transactional;
    public interface BookManager {
	@Transactional
	@SecurityConfig( { "ROLE_USER", "ROLE_ANONYMOUS" })
	public List listBook();
    }

here’s my implementation for it

    package org.gotblog.common.acegi;
 
    import static java.lang.annotation.ElementType.METHOD;
    import static java.lang.annotation.ElementType.TYPE;
    import static java.lang.annotation.RetentionPolicy.RUNTIME;
 
    import java.lang.annotation.Retention;
    import java.lang.annotation.Target;
 
    @Target( { TYPE, METHOD })
    @Retention(RUNTIME)
    public @interface SecurityConfig {
	String[] value();
    }
    package org.gotblog.common.acegi;
 
    import java.lang.annotation.Annotation;
    import java.lang.reflect.Field;
    import java.lang.reflect.Method;
    import java.util.Collection;
    import java.util.HashSet;
    import java.util.Set;
 
    import org.springframework.metadata.Attributes;
 
    public class AcegiAnnotationAttributes implements Attributes {
	// TODO need to add cache
 
	public Collection getAttributes(Class targetClass) {
		Set<net.sf.acegisecurity.SecurityConfig> configs =
			new HashSet<net.sf.acegisecurity.SecurityConfig>();
		for (Annotation annotation : targetClass.getAnnotations()) {
			if (annotation instanceof SecurityConfig) {
				SecurityConfig config = (SecurityConfig) annotation;
				for (String value : config.value()) {
					configs.add(new net.sf.acegisecurity.SecurityConfig(value));
				}
				break;
			}
		}
		return configs;
	}
 
	public Collection getAttributes(Class targetClass, Class filter) {
		throw new IllegalArgumentException("Not support filter");
	}
 
	public Collection getAttributes(Method targetMethod) {
		Set<net.sf.acegisecurity.SecurityConfig> configs =
			new HashSet<net.sf.acegisecurity.SecurityConfig>();
		for (Annotation annotation : targetMethod.getAnnotations()) {
			if (annotation instanceof SecurityConfig) {
				SecurityConfig config = (SecurityConfig) annotation;
				for (String value : config.value()) {
					configs.add(new net.sf.acegisecurity.SecurityConfig(value));
				}
				break;
			}
		}
		return configs;
	}
 
	public Collection getAttributes(Method targetMethod, Class filter) {
		throw new IllegalArgumentException("Not support filter");
	}
 
	public Collection getAttributes(Field targetField) {
		throw new IllegalArgumentException("Not support field annotation");
	}
 
	public Collection getAttributes(Field targetField, Class filter) {
		throw new IllegalArgumentException("Not support field annotation");
	}
 
    }
    <bean id="acegiAnnotationAttributes"
	class="org.gotblog.common.acegi.AcegiAnnotationAttributes"/>
    <bean id="objectDefinitionSource"
	class="net.sf.acegisecurity.intercept.method.MethodDefinitionAttributes">
	<property name="attributes">
		<ref local="acegiAnnotationAttributes"/>
	</property>
    </bean>

it works fine and i haven’t optimized it for performance

Posted in Java | Tagged , | Leave a comment

acegi基本使用一

acegi真的超级难用,花了大量时间才调试出来

我使用的版本是acegi-security-0.8.1
目标是使用acegi通过spring aop直接对service bean的每一个method做权限

在web.xml加入


Acegi Filter Chain Proxy
net.sf.acegisecurity.util.FilterToBeanProxy

targetClass net.sf.acegisecurity.util.FilterChainProxy


Acegi Filter Chain Proxy
/*

FilterToBeanProxy是从servletfilter跳至spring bean的媒介
实际上,targetClass所接受的必须是spring bean定义了的类的类名
而且,这个类也是实现servletfilter接口的(以下称这个类为acegi filter)
FilterToBeanProxy是整个acegi的总入口,把servletfilter跟spring bean穿起来了
实现得非常好,建议参看源代码,代码也非常精练

targetClass只接受一个acegi filter,入口参数是类名
这个类名必须至少在spring定义一个bean
acegi里面有若干不同特性的预定acegi filter供选择使用

往往我们不仅仅需要一个acegi filter,所以这里我们借助FilterChainProxy
FilterChainProxy主要是通过正则表达式将特定的URI提交给若干acegi filter做处理

这样,acegi在web.xml的配置算完了
当然,acegi还有提供若干其他servletfilter
不过这次用不上

Posted in Uncategorized | Leave a comment

hibernate

session以request为边界,用spring opensessioninview filter+HibernateTemplate实现(其实就是ThreadLocal+ServletFilter)
transaction以service(不是DAO)为边界(如果一个service method里面需要有两段事务的话,就分成两个service method),用spring aop声明事务实现
另DAO可看实际情况考虑省去,代码迁移到service

你们肯定很少翻hibernate.org

http://www.hibernate.org/168.html

这里提到session和transaction的若干处理方法,介绍他们的优缺点,哪些不能用等等

我个人比较喜欢session-per-request-with-multiple-transactions
就是我上面所说的

另外还有两个application transaction做long Session的,大致就是之前断断续续讨论的detached objects、saveOrUpdate、hibernate version、httpsession保存po等等等等,用spring mvc可以实现,不过似乎这种做法目前接受度不高

http://up-u.com/?p=26

http://forum.javaeye.com/viewtopic.php?p=71858#71858

Posted in Uncategorized | Leave a comment