我的博客
daoshud1 · 共 144 篇文章
android.os.NetworkOnMainThreadException
在android 2.3上设计的下载程序,在android 4.0上运行时报android.os.NetworkOnMainThreadException异常,原来在4.0中,访问网络不能在主程序中进行,有两个方法可以解决,一个是在主程序中增加 @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); StrictMode.setThreadPolicy(new Strict…
2013-03-24 17:20 · android · 评论(0)
sql分组取最大一条
declare @Tab table (Num int, Name varchar(2), Time DATETIME) insert into @tab select 1 ,'a', '2009/05/01' insert into @tab select 1 ,'a', '2009/05/02' insert into @tab select 1 ,'a', '2009/05/03' insert into @tab select 2 ,'b', '2009/05/04' insert into @tab select 2 ,'b', '2009/05/05' insert into @…
2013-03-20 09:42 · 数据库 · 评论(0)
sql 某列当中相同的类型累加
select Sum(case when buy_status =1 then 1 else 0 end) '订购', Sum(case when buy_status =2 then 1 else 0 end) '退订',Sum(case when buy_status =6 then 1 else 0 end) '续订' from business_record GROUP BY DATE(create_time)
2013-03-19 15:23 · mysql · 评论(0)
解决:Failed to fetch URL https://dl-ssl.google.com/android/repository/addons_li
Failed to fectch URl https://dl-ssl.google.com/android/repository/addons_list.xml, reason: Connection to https://dl-ssl.google.com refused 解决办法来源于:code.google.com 用notepad打开C:\WINDOWS\system32\drivers\etc中的hosts文件 在最后一行添加74.125.237.1 dl-ssl.google.com 成功解决问题。 原文地址: http://www.cnblogs.com/xiyo/archi…
2013-03-18 14:00 · android · 评论(0)
android开发 adt无法启动
安装了完整版的adt、创建了helloworld程序,启动的时候就报错 “Please ensure that adb is correctly located at 'D:\adt-bundle-windows-x86_64\sdk\platform-tools\adb.exe' and can be executed.” 关闭任务管理器中的adt.exe 或者adb.exe 一般是由于豌豆荚或者其它安卓手机助手造成的
2013-03-15 16:30 · android · 评论(0)
js计算两个日期之间的差
var begin=beginTime; var end=endTime; if(begin!="" && end!=""){ var aDate, oDate1, oDate2, iDays ; aDate = begin.split("-") oDate1 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) //转换为12-18-2006格式 aDate = end.split("-") oDate2 = new Date(aDate[1] + '-' + aDate[2] + '-' + aDate[0]) iDays = pa…
2013-03-14 17:32 · js · 评论(0)
java根据开始时间结束时间计算中间间隔日期
DateFormat FORMATTER = new SimpleDateFormat("yyyy-MM-dd"); List<SatisticsByCustomer> list=null; try{ String beginTime="2013-01-01"; String endTime="2013-01-21"; Calendar startDay = Calendar.getInstance(); Calendar endDay = Calendar.getInstance(); startDay.setTime(FORMATTER.parse(beginTime)); endDay…
2013-03-13 16:41 · java · 评论(0)
Android 环境配置The operation cannot be completed. See the details.
试了很多次 每次都出现 The operation cannot be completed. See the details. 后来才发现Native Development Tools是其中的一个组件,Google了下这个Android Native Development Tools原来是用来运行C/C++的代码的,反正也没打算用C环境开发,既然找不到此组件,就不必安装;于是在安装前去掉此组件前的勾选,再试一次问题解决,很顺畅的安装完成。
2013-03-03 18:04 · android · 评论(0)
target is null for setProperty(null, "x", [Ljava.lang.String;@b0c40e)错误异常
在提交form表单的时候发现后台经常出现类似异常,很奇怪,因为我的前台提交的参数和设置的ognl根本没有x之类的参数 后经研究发现原来是使用图片提交按钮惹得祸 input type="image" name="Submit" value="提交" onclick="return checkpwd();" src="images/submit.gif"/> 查询资料后发现 这个错误信息主要因为webwork.devMode = true引起,因为使用struts在默认配置下对任何提交到action的参数强制需要setter方法,而我们在使用token的时候一般都没有正确的为每一个token设置…
2013-02-26 10:58 · struts2 · 评论(0)
SQL语句 按年龄段分组统计人数
create table #t(Uname varchar(10),age int) insert #t select '啊啊',19 union all select '信息',23 union all select '宝宝',31 union all select '喔喔',21 union all select '米米',6 select nnd as '年龄段',count(*) as '人数' from( select case when age>=1 and age<=10 then '1-10' when age>=11 and age<=20 then '11-20' whe…
2012-12-04 15:52 · mysql · 评论(0)
根据输入的日期 获得当前日期为周几
public static String getWeekOfDate(Date dt) { String[] weekDays = {"周日", "周一", "周二", "周三", "周四", "周五", "周六"}; Calendar cal = Calendar.getInstance(); cal.setTime(dt); int w = cal.get(Calendar.DAY_OF_WEEK) - 1; if (w < 0) w = 0; return weekDays[w]; }
2012-11-06 11:28 · java · 评论(0)
jodm解析xml
xml文件 <?xml version="1.0" encoding="UTF-8"?> <root> <person id="1"> <username>张三</username> <password>123123</password> </person> <person id="2"> <username>1111111112</username> <password>password2</password> </person> </root> Jdom解析代码 String xmlpath="test.xml"; SAXBuilder builder=new SAXBuilder(fa…
2012-10-23 16:12 · java · 评论(0)
如何读取JAR包外的properties文件及打成jar包后无法读取到jar包内的properties文件
打成jar包后无法读取到jar包内的properties文件 发现在eclipse里一切正常,但打成jar包后就无法读取到properties文件了。 之前的程序是这样获取配置文件的: Thread.currentThread().getContextClassLoader().getResource("").getPath() +filename+".properties") 来获取properties文件,但发现一运行就报错.后来将代码改成: this.getClass().getClassLoader().getResourceAsStream(filename+".propertie…
2012-09-18 15:10 · java · 评论(0)
html 中input 框 与文字不能垂直居中, 怎么解决?
<p> <input type="text" name="author" id="author" style="vertical-align:middle" /> <label for="author"><small>呢称</small></label> </p> 就是给Input加上vertical-align:middle属性。 将支持valign 特性的对象的内容与对象中部对齐 或 css添加下面两个属性 vertical-align:middle 定义line-height: 属性, 让line-height 等于height 这样应该就能兼容所有的浏览器 比如 .td { vert…
2012-09-12 15:16 · css · 评论(0)
关于textarea标签在谷歌和火狐可以拖动大小
就是这个画红框的 而在IE是不会出现这种情况的 解决的方法:我们给这个标签加个 resize: none; 就可以解决了
2012-09-04 17:10 · 浏览器 · 评论(0)