本人學習JAVA差不多3年了吧,回想過去的3年,突然發現自己在技術上沒有特別自豪的東西,JAVA編程思想也改了好幾編,說不上精通但也很熟悉,各個流行框架差不多都用過,說不上精通但也可以熟練用.
性能優化上,也就建索引,用緩存,頁面做靜態化,分庫,讀寫分離.最近學習了一下python,語言特性不是很了解,但也能寫出小功能塊.
JAVA牛人,告訴我,怎么才能讓自己強大起來,回首3年沒有自豪的技術,極度郁悶中
不在沉默中爆發,就在沉默中死亡!!!!!1
關于IBatis緩存使用的一個BUG |
關于IBatis.Net 版本1.321里面的cacheModel有一個BUG,好大的。當你使用CacheModel 而同時查詢出來的結果是NULL的話,IBatis緩存就會有問題。在IBatis.Net 版本1.32里面一共有3處。 MappedStatements 400行處, 527 行 778行 應該改為 ? obj = RunQueryForObject(request, session, parameterObject, resultObject); ?????????????????????????????????? if(obj!=null) ?????????????????????????????????? { ????????????????????????????????????????? _statement.CacheModel[key] = obj; ?????????????????????????????????? } 每一個緩存前,判斷是否為空。 |
package com.xiewei.soft.text;
import java.util.TimerTask;
public class HelloWorldTask extends TimerTask{
? public? void? run (){
?? System.out.print("Hello world");
? }
}
package com.xiewei.soft.text;
import java.io.IOException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class Fixed {
? public static void main(String[] arg) throws IOException{
?? ApplicationContext ctx=new FileSystemXmlApplicationContext("JavaSource/conf/timetask.xml");
?? System.in.read();
? }
}
然后在spring配置文件中插入
<beans>
? <bean id ="helloWordTask"? class="com.xiewei.soft.text.HelloWorldTask" />
? <bean id="timerTask" class="org.springframework.scheduling.timer.ScheduledTimerTask">
??? <property name="delay">
????? <value>1000</value>
??? </property>
??? <property name="period">
????? <value>3000</value>
??? </property>
??? <property name="timerTask">
????? <ref local="helloWordTask"/>
??? </property>
? </bean>
? <bean id="timerFactory" class="org.springframework.scheduling.timer.TimerFactoryBean">
?? <property name="scheduledTimerTasks">
????? <list>
????? <ref local="timerTask"/>
????? </list>
??? </property>
? </bean>
</beans>
測試成功!!!!!!!
/**
?? *
?? * 解析文件,取出URL地址
?? *
?? */
?public static void regexStr(){
??String input="飛機但是??Pattern p = Pattern.compile("http://[*[a-zA-Z]|w{3}].*[a-zA-Z]");
??Matcher m = p.matcher(input);
??m.find();
??String str=m.group();
??????? System.out.print(str);
??
??
?}
/**
?* 根據URL,把網頁保存到本地
?* @param urlStr
?* @param filename
?* @return
?*/?
?public? static? boolean? getUrlToFileInputStream(String urlStr, String filename){
? ?
? ?DataInputStream dataInputStream=null;
? ?try{
? ??? URL url = new URL(urlStr);
?????????? URLConnection conn = url.openConnection();
?????????? dataInputStream = new DataInputStream(conn.getInputStream());
??????????
???? }catch(Exception e){
???? ?e.getMessage();
???
???? }
???? DataOutputStream dataoutputstream = null;
? ?if(dataInputStream !=null){
??? ???? try {
????dataoutputstream = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(filename)));
???
???byte b[] = new byte[1024*10];
???int len = 0;
???while ((len = dataInputStream.read(b, 0, 1024)) != -1) {
????dataoutputstream.write(b, 0, len);
???}
???dataoutputstream.flush();
??? ???? } catch (Exception e) {
????// TODO Auto-generated catch block
????e.printStackTrace();
???}
??????????? return true;
? ?}else{
? ??return false;
? ?}
????
????
? }