随时积累随手记(持续更新...)

9.java 反射获取属性值 方法

 

public static void main(String[] args) throws SecurityException, ClassNotFoundException, IllegalArgumentException, IllegalAccessException   
 {   
  TestEntity obj = new TestEntity();   
  obj.setName("name value");   
  obj.setCode("code value");   
  Field[] fds = Class.forName   
  ("com.test.impl.TestEntity").getDeclaredFields();   
     
  System.out.println(fds.length);   
  for(int i=0;i<fds.length;i++)   
  {   
   System.out.println(fds[i].get(obj));   
      
  }   
 }  

8.Maven依赖的Scope说明

<dependency>

    < groupId>javax.servlet</groupId>

    < artifactId>jsp-api</artifactId>

    < version>2.0</version>

    < scope>provided</scope>

   < /dependency>
  • compile 默认的scope,表示  dependency 都可以在生命周期中使用。而且,这些dependencies 会传递到依赖的项目中。适用于所有阶段,会随着项目一起发布 
  • provided 跟compile相似,但是表明了dependency 由JDK或者容器提供,例如Servlet  AP和一些Java EE APIs。这个scope 只能作用在编译和测试时,同时没有传递性。         
  • runtime 表示dependency不作用在编译时,但会作用在运行和测试时,如JDBC驱动,适用运行和测试阶段。 
  • test 表示dependency作用在测试时,不作用在运行时。  只在测试时使用,用于编译和运行测试代码。不会随项目发布。 
  • system 跟provided  相似,但是在系统中要以外部JAR包的形式提供,maven不会在repository查找它。

7.JS中的!=、== 、!==、===的用法和区别。

var num = 1;
 
var str = '1';
 
var test = 1;
 
test == num   //true 相同类型 相同值
 
test === num  //true 相同类型 相同值
 
test !== num  //false test与num类型相同,其值也相同, 非运算肯定是false
 
num == str   //true  把str转换为数字,检查其是否相等。
 
num != str   //false  == 的 非运算
 
num === str  //false  类型不同,直接返回false
 
num !== str  //true   num 与 str类型不同 意味着其两者不等 非运算自然是true啦

== 和 != 比较若类型不同,先偿试转换类型,再作值比较,最后返回值比较结果 。而 === 和 !== 只有在相同类型下,才会比较其值。


6.eclipse到工作空间

"D:Program Fileseclipse-jee-mars-1-win32-x86_64eclipseeclipse.exe" -data E:workspaceeclipse_mars_gayy


5.Hibernate注解方式生成序列主键

@SequenceGenerator(name="gen",sequenceName="SEQ_CODE",initialValue=1,allocationSize=1)
@Id
@GeneratedValue(strategy=GenerationType.SEQUENCE,generator="gen")
@Column(name="ID" ,nullable=false,unique=true)
private String id;


4.Hibernate注解方式生成UUID主键

@GenericGenerator(name="hibernate-uuid",strategy="uuid")

@GeneratedValue(generator="hibernate-uuid")

------------------------------------------------------------------------

@Id  

@GenericGenerator(name="hibernate-uuid", strategy="uuid")  

@GeneratedValue(generator="hibernate-uuid")  

private String id;


3.客户希望我们开发的不是一个B/S系统,而是一个客户端应用。

还有在一些需要全屏的需求的B/S系统的时候,需要隐藏所有浏览器的相关的内容,F11的全屏不能满足要求。

只需做如下操作:

"C:Program Files (x86)GoogleChromeApplicationchrome.exe" --app=http://www.baidu.com --start-maximized


2.使用sc命令创建服务,使用net start启动服务

sc create MongoDB binPath= "D:MongoDBinmongod.exe --service --dbpath D:MongoDBdata --logpath=D:MongoDBlogsmongodb.log  --logappend"
net start MongoDB

1.jdbc方式连接Oracle数据库的时候,需要使用数据库的sid_name,而不是数据库的services_name.而使用plsql连接数据库的时候,只需要数据库的services_name即可,所以修改连接字符串中的services_name 为sid_name.
查询sid_name的方法
select INSTANCE_NAME from v$instance;


原文地址:https://www.cnblogs.com/xmc0551/p/5009813.html