每日一得

不求多得,只求一得 about java,hibernate,spring,design,database,Ror,ruby,快速开发
最近关心的内容:SSH,seam,flex,敏捷,TDD
本站的官方站点是:颠覆软件

  BlogJava :: 首页 :: 新随笔 :: 联系 :: 聚合  :: 管理 ::
  220 随笔 :: 9 文章 :: 421 评论 :: 0 Trackbacks

#

     摘要:   阅读全文
posted @ 2007-04-11 16:09 Alex 阅读(7768) | 评论 (8)编辑 收藏

     摘要:   阅读全文
posted @ 2007-03-30 08:34 Alex 阅读(799) | 评论 (0)编辑 收藏

key words: contentType,meta

come from here


 

在经典同时看到两个关于ContentType的问题

http://bbs.blueidea.com/thread-2729935-1-1.html

http://bbs.blueidea.com/thread-2729945-1-1.html

所以查了下资料,copy了一份详细的ContentType的列表

 

不同的ContentType 会影响客户端所看到的效果.

默认的ContentType为 text/html  也就是网页格式.

代码如:

<% response.ContentType ="text/html" %> 
<!--#i nclude virtual="/ContentType.html" -->

显示的为网页,而

<% response.ContentType ="text/plain" %> 
<!--#i nclude virtual="/sscript/ContentType.html" -->

则会显示html原代码.

以下为一些常用的 ContentType

GIF images
<% response.ContentType ="image/gif" %> 
<!--#i nclude virtual="/myimage.gif" -->
JPEG images
<% response.ContentType ="image/jpeg" %> 
<!--#i nclude virtual="/myimage.jpeg" -->
TIFF images
<% response.ContentType ="image/tiff" %> 
<!--#i nclude virtual="/myimage.tiff" -->
MICROSOFT WORD document
<% response.ContentType ="application/msword" %> 
<!--#i nclude virtual="/myfile.doc" -->
RTF document
<% response.ContentType ="application/rtf" %> 
<!--#i nclude virtual="/myfile.rtf" -->
MICROSOFT EXCEL document
<% response.ContentType ="application/x-excel" %> 
<!--#i nclude virtual="/myfile.xls" -->
MICROSOFT POWERPOINT document
<% response.ContentType ="application/ms-powerpoint" %> 
<!--#i nclude virtual="/myfile.pff" -->
PDF document
<% response.ContentType ="application/pdf" %> 
<!--#i nclude virtual="/myfile.pdf" -->
ZIP document
<% response.ContentType ="application/zip" %> 
<!--#i nclude virtual="/myfile.zip" -->

 

下面是更详细的ContentType

application/andrew-insetez
application/mac-binhex40hqx
application/mac-compactprocpt
application/mathml+xmlmathml
application/msworddoc
application/octet-streambin dms lha lzh exe class so dll
application/odaoda
application/oggogg
application/pdfpdf
application/postscriptai eps ps
application/rdf+xmlrdf
application/smilsmi smil
application/srgsgram
application/srgs+xmlgrxml
application/vnd.mifmif
application/vnd.mozilla.xul+xmlxul
application/vnd.ms-excelxls
application/vnd.ms-powerpointppt
application/vnd.wap.wbxmlwbxml
application/vnd.wap.wmlc.wmlc wmlc
application/vnd.wap.wmlscriptc.wmlsc wmlsc
application/voicexml+xmlvxml
application/x-bcpiobcpio
application/x-cdlinkvcd
application/x-chess-pgnpgn
application/x-cpiocpio
application/x-cshcsh
application/x-directordcr dir dxr
application/x-dvidvi
application/x-futuresplashspl
application/x-gtargtar
application/x-hdfhdf
application/x-httpd-php.php .php4 .php3 .phtml
application/x-httpd-php-source.phps
application/x-javascriptjs
application/x-koanskp skd skt skm
application/x-latexlatex
application/x-netcdfnc cdf
application/x-pkcs7-crl.crl
application/x-shsh
application/x-sharshar
application/x-shockwave-flashswf
application/x-stuffitsit
application/x-sv4cpiosv4cpio
application/x-sv4crcsv4crc
application/x-tar.tgz tar
application/x-tcltcl
application/x-textex
application/x-texinfotexinfo texi
application/x-trofft tr roff
application/x-troff-manman
application/x-troff-meme
application/x-troff-msms
application/x-ustarustar
application/x-wais-sourcesrc
application/x-x509-ca-cert.crt
application/xhtml+xmlxhtml xht
application/xmlxml xsl
application/xml-dtddtd
application/xslt+xmlxslt
application/zipzip
audio/basicau snd
audio/midimid midi kar
audio/mpegmpga mp2 mp3
audio/x-aiffaif aiff aifc
audio/x-mpegurlm3u
audio/x-pn-realaudioram rm
audio/x-pn-realaudio-pluginrpm
audio/x-realaudiora
audio/x-wavwav
chemical/x-pdbpdb
chemical/x-xyzxyz
image/bmpbmp
image/cgmcgm
image/gifgif
image/iefief
image/jpegjpeg jpg jpe
image/pngpng
image/svg+xmlsvg
image/tifftiff tif
image/vnd.djvudjvu djv
image/vnd.wap.wbmp.wbmp wbmp
image/x-cmu-rasterras
image/x-iconico
image/x-portable-anymappnm
image/x-portable-bitmappbm
image/x-portable-graymappgm
image/x-portable-pixmapppm
image/x-rgbrgb
image/x-xbitmapxbm
image/x-xpixmapxpm
image/x-xwindowdumpxwd
model/igesigs iges
model/meshmsh mesh silo
model/vrmlwrl vrml
text/calendarics ifb
text/csscss
text/html.shtml html htm
text/plainasc txt
text/richtextrtx
text/rtfrtf
text/sgmlsgml sgm
text/tab-separated-valuestsv
text/vnd.wap.wml.wml wml
text/vnd.wap.wmlscript.wmls wmls
text/x-setextetx
video/mpegmpeg mpg mpe
video/quicktimeqt mov
video/vnd.mpegurlmxu
video/x-msvideoavi
video/x-sgi-moviemovie
x-conference/x-cooltalkice
posted @ 2007-03-29 09:25 Alex 阅读(1937) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2007-03-28 16:55 Alex 阅读(4549) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2007-03-26 22:18 Alex 阅读(36075) | 评论 (7)编辑 收藏

     摘要:   阅读全文
posted @ 2007-03-20 16:23 Alex 阅读(3363) | 评论 (1)编辑 收藏

key words : jsp防盗链 header

最近碰到盗链的问题,即复制一个url地址,在另一个地方也能访问。

index.jsp页面
<html>
  
<head><title>Simple jsp page</title></head>
  
<body>Place your content here

  here is index jsp
    get header info
  
<href="a.jsp">a.jsp</a>
  
</body>
</html>

a.jsp页面
<html>
  
<head><title>Simple jsp page</title></head>
  
<body>Place your content here

  here is a. jsp
    get header info
  
<%=request.getHeader("Referer")%>
  
<%if(null == request.getHeader("Referer") || request.getHeader("Referer").indexOf("yourdomain.com"< 0){%>
     做人要厚道
  
<%}else{%>
  合法访问
  
<%}%>
  
</body>
</html>


即从内部访问可以,直接粘贴地址在另一个浏览器里访问禁止
posted @ 2007-03-13 10:01 Alex 阅读(5912) | 评论 (8)编辑 收藏

     摘要:   阅读全文
posted @ 2007-03-12 00:40 Alex 阅读(12373) | 评论 (18)编辑 收藏

     摘要:   阅读全文
posted @ 2007-02-25 00:20 Alex 阅读(397) | 评论 (0)编辑 收藏

     摘要:   阅读全文
posted @ 2007-02-24 23:37 Alex 阅读(1881) | 评论 (2)编辑 收藏

key words: pd, powerdesigner,外建

在PD中建立外键碰到一个问题,如: forum(id,name)表,forum_thread(id,forum_id)表,需要将forum的id设为forum_thread的外建,指向forum_id,默认的在 PD中是将主键设为外建.

需要如下设置才可以:

foreign_key.png
posted @ 2007-01-31 10:42 Alex 阅读(1296) | 评论 (0)编辑 收藏

key words: 上传文件

目里面有上传文件的需求,我想了一下不外乎下面两种处理方法:

1. 在数据库表中建立一个blob字段存放用户上传文件.
2. 在服务器上建立一个文件夹保存用户上传文件,数据库表中只存放该文件的url地址.

我本人现在比较倾向于第2种方案, 主要原因是担心方案1的效率(我用的是mysql数据库)。 但是处理过程中除了维护数据库中表的字段还要维护上传的文件,稍微麻烦一点。

大家在项目里面又是怎么做呢? 给我点建议!谢谢


讨论内容见: javaeye

robin更建议第二种方案,放在数据库中主要的问题是 AppServer吃不消,开销比较大.

上面是摘录,不过我们这里用的是Oracle9i AS,在Oracle的协作套间里一般文档或者上传的文件都是保存在数据库里,还把这个特性作为Oracle 与别的协作套件之间不同的卖点。

大家以为如何? 我直觉是Oracle的DB和oc4j的AppServer对付这个似乎没有开销上的担心,但是没有实际检测过。

换句话说,文件的管理是放在文件夹里方便还是数据库里方便? 有点为难

update (2007-5-13):
还有一种方案结合了数据库和IO,我认为比较可行,就是文件存在数据库,但是下载的时候第一次从数据库下载,然后第一次这个文件保存在一个临时文件夹下面,以后每次下载的时候总是先检查此临时文件夹,如果已经存在则直接下载,如果没有则从数据库重复这个动作。当然,保存在临时文件夹下的文件的命名需要唯一,这个应该没有问题。
posted @ 2007-01-31 09:06 Alex 阅读(1942) | 评论 (4)编辑 收藏


这个年代的偶像很多,值得学习的也很多,,如果让我说,我觉得在现在这个急功近利的所谓2.0时代,阿甘精神更值得我们学习。

什么是阿甘精神?
1。奔跑。 不停的奔跑,不要停下来
2。不断地重复,如果你做的不够好,那就说明你还重复的不够多。
3。执着。 不要相信权威,按自己的意志去做。

现在,聪明的人很多,但是小聪明似乎更多,包括我。

你认可阿甘精神么? 如果是,顶一下。

刚看到关于阿甘精神的另一个有意思的摘录:



"
阿甘就是看到一个目标就走过去了,别的人是,看见一个目标,先订一个作战计划,然后匍匐前进,往左闪,往右躲,再弄个掩体…一辈子就看他闪转腾挪活得那叫一个花哨,最后哪儿也没到达。
"

很形象哦。

祝各位在2007年工作进步。

posted @ 2007-01-30 08:59 Alex 阅读(1208) | 评论 (2)编辑 收藏

key words: js,javascript,检查上传文件大小

有时需要在客户端获得待上传得文件大小,google了一下,发现下面这个用法.

<html>  
<input type="file" name="file1" onchange="ShowSize(this.value)">  
<script language="JavaScript">  
<!--  
function ShowSize(files)  
{  
  
var fso,f;  
  fso
=new ActiveXObject("Scripting.FileSystemObject");  
  f
=fso.GetFile(files);
  
var mySize = f.size/1024;
  alert(mySize
+" K ");  
}
  
//-->  
</script>  
</html>


BTW: 奇怪,COS上传组件里怎么没有获得上传文件大小的方法?  MultipartRequest里是没有,有知道的兄弟通知下哦
posted @ 2007-01-25 17:16 Alex 阅读(10395) | 评论 (4)编辑 收藏

     摘要: key words : hibernate spring daocome from : http://lpacec.javaeye.com/blog/46220   1.  package infoweb.dao;         2.         3. import java.util.List;         4. import java.util.Iterator;         5...  阅读全文
posted @ 2007-01-25 09:24 Alex 阅读(896) | 评论 (0)编辑 收藏

仅列出标题
共15页: 上一页 1 2 3 4 5 6 7 8 9 下一页 Last