首页 文章 精选 留言 我的

精选列表

搜索[图片审核],共10000篇文章
优秀的个人博客,低调大师

javascript dom的图片最终版源代码 (重复看)

html代码: <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>Image Gallery</title> <script type="text/javascript" src="scripts/showPic.js"></script> <link rel="stylesheet" href="styles/layout.css" type="text/css" media="screen" /> </head> <body> <h1>Snapshots</h1> <ul id="imagegallery"> <li> <a href="images/fireworks.jpg" title="A fireworks display"> <img src="images/thumbnail_fireworks.jpg" alt="Fireworks" /> </a> </li> <li> <a href="images/coffee.jpg" title="A cup of black coffee" > <img src="images/thumbnail_coffee.jpg" alt="Coffee" /> </a> </li> <li> <a href="images/rose.jpg" title="A red, red rose"> <img src="images/thumbnail_rose.jpg" alt="Rose" /> </a> </li> <li> <a href="images/bigben.jpg" title="The famous clock"> <img src="images/thumbnail_bigben.jpg" alt="Big Ben" /> </a> </li> </ul> </body> </html> css: body { font-family: "Helvetica","Arial",serif; color: #333; background-color: #ccc; margin: 1em 10%; } h1 { color: #333; background-color: transparent; } a { color: #c60; background-color: transparent; font-weight: bold; text-decoration: none; } ul { padding: 0; } li { float: left; padding: 1em; list-style: none; } #imagegallery { list-style: none; } #imagegallery li { display: inline; } #imagegallery li a img { border: 0; } function addLoadEvent(func) { var oldonload = window.onload; if (typeof window.onload != 'function') { window.onload = func; } else { window.onload = function() { oldonload(); func(); } } } function insertAfter(newElement,targetElement) { var parent = targetElement.parentNode; if (parent.lastChild == targetElement) { parent.appendChild(newElement); } else { parent.insertBefore(newElement,targetElement.nextSibling); } } function preparePlaceholder() { if (!document.createElement) return false; if (!document.createTextNode) return false; if (!document.getElementById) return false; if (!document.getElementById("imagegallery")) return false; var placeholder = document.createElement("img"); placeholder.setAttribute("id","placeholder"); placeholder.setAttribute("src","images/placeholder.gif"); placeholder.setAttribute("alt","my image gallery"); var description = document.createElement("p"); description.setAttribute("id","description"); var desctext = document.createTextNode("Choose an image"); description.appendChild(desctext); var gallery = document.getElementById("imagegallery"); insertAfter(placeholder,gallery); insertAfter(description,placeholder); } function prepareGallery() { if (!document.getElementsByTagName) return false; if (!document.getElementById) return false; if (!document.getElementById("imagegallery")) return false; var gallery = document.getElementById("imagegallery"); var links = gallery.getElementsByTagName("a"); for ( var i=0; i < links.length; i++) { links[i].onclick = function() { return showPic(this); } links[i].onkeypress = links[i].onclick; } } function showPic(whichpic) { if (!document.getElementById("placeholder")) return true; var source = whichpic.getAttribute("href"); var placeholder = document.getElementById("placeholder"); placeholder.setAttribute("src",source); if (!document.getElementById("description")) return false; if (whichpic.getAttribute("title")) { var text = whichpic.getAttribute("title"); } else { var text = ""; } var description = document.getElementById("description"); if (description.firstChild.nodeType == 3) { description.firstChild.nodeValue = text; } return false; } addLoadEvent(preparePlaceholder); addLoadEvent(prepareGallery);

优秀的个人博客,低调大师

手机开发-京东360buy手机版的图片加载

JingDong:When it render the “search result” page ,(every item has the picture) ,it will buffer all the pictures in the SD card to accelerate the display. Tested from Kevin’s emulator, we can see ,that all the images that requested are downloaded intomnt/sdcard/imagefolder. We open it with image tool ,and see that the images are exactly the same that we see from the android client. So next time ,if we want to see the previous item ,we do not need to launch the REST call again ( because it is very slow for 1G /2G network) ,instead ,it only retrieved from the SDCard locally ,which leads to a faster speed. Result analysis: Advantage: obviously reduce the times to send REST request to server and reduce the network traffic. Disadvantage: we need to clear the temp contents (buffered images ,etc) regularly. 本文转自 charles_wang888 51CTO博客,原文链接:http://blog.51cto.com/supercharles888/835920,如需转载请自行联系原作者

优秀的个人博客,低调大师

用graphite把收集到的数据渲染成图片

在这里我先讲解下他和cacti nagios的区别~ 还有我们为什么要用他~ cacti 是通过snmp来进行抓数据,当然后期可以通过snmp进行exec调取脚本中的数据 nagios是用来监控服务器的各种的状态,当然通过pnp也可以实现画图 但是我为什么要用graphite,其实他就一个功能,把收到的数据展现到页面上~ 就这一个功能,我感觉就够用了~ 需求: 脚本的执行的效率 系统某个日志的分析得到的数值 在线人数 到各个网络节点的质量,延迟 公司的开发人员想看看api的调用次数 某个程序的调用的次数 每个进程延迟的时间统计 这些都可以很好的画图,比自己用rrdtool画图要方便的多~ http://graphite.readthedocs.org/en/latest/index.html 一、 Graphite 项目简介 Graphite是一个企业级的监控工具,可以在廉价机硬件上运行。 二、 Graphite 功能 Graphite是一个画图工具,将数据以图形的方式展现出来。它主要做两件事: 存储时间序列数据 根据需要呈现数据的图形 Graphite不收集数据,有一些工具知道如何发送数据给Graphite。虽然需要一点代码,但是非常简单。 三、 简单架构 Graphite由三个软件组件组成: carbon- 一个Twisted守护进程,监听时间序列数据 whisper- 一个简单的数据库库,用来存储时间序列数据,在设计上类似于RRD graphite webapp-Djangowebapp,使用Cairo来根据需要呈现图形 架构图如下: Graphite High Level 在这个图中我们可以看到Carbon先将数据写入到Whisper数据库文件中,然后Graphite Webapp去读取这个数据,然后显示出图形。但是实际上这个体系采用了缓存,数据可能先到缓存中,然后Webapp读取,显示出图形。这也是为什么在主机I/O反应不过来时Webapp的图形仍能以接近实时的方式显示。 喂数据相当简单,通常大部分的精力花在最开始收集数据时。当你发送数据点给Carbon, 他们马上可以在webapp中画图。webapp 提供几种方式创建和显示图形,包括简单的URL API,这种呈现的方式可以很方便地将图形嵌入到其它Web页面。 四、 使用效果 下图是在浏览器中的效果: shell的例子 ORT=2003 SERVER=graphite.your.org echo "local.random.diceroll 4 `date +%s`" | nc ${SERVER} ${PORT}; python的例子 #!/usr/bin/python import sys import time import os import platform import subprocess from socket import socket CARBON_SERVER='127.0.0.1' CARBON_PORT=2003 delay=60 if len(sys.argv)>1: delay=int( sys.argv[1] ) def get_loadavg(): # For more details, "man proc" and "man uptime" if platform.system() == "Linux": return open('/proc/loadavg').read().strip().split()[:3] else: command="uptime" process=subprocess.Popen(command,stdout=subprocess.PIPE,shell=True) os.waitpid(process.pid, 0) output=process.stdout.read().replace(',', ' ').strip().split() lenlength= len(output) return output[length - 3:length] sock=socket() try: sock.connect( (CARBON_SERVER,CARBON_PORT) ) except: print "Couldn't connect to %(server)s on port %(port)d, is carbon-agent.py running?" % { 'server':CARBON_SERVER, 'port':CARBON_PORT } sys.exit(1) while True: now=int( time.time() ) lines= [] #We're gonna report all three loadavg values loadavg=get_loadavg() lines.append("system.loadavg_1min %s %d" % (loadavg[0],now)) lines.append("system.loadavg_5min %s %d" % (loadavg[1],now)) lines.append("system.loadavg_15min %s %d" % (loadavg[2],now)) message='\n'.join(lines) + '\n' #all lines must end in a newline print "sending message\n" print '-' * 80 print message print sock.sendall(message) time.sleep(delay) 本文转自 rfyiamcool 51CTO博客,原文链接:http://blog.51cto.com/rfyiamcool/1184015 ,如需转载请自行联系原作者

优秀的个人博客,低调大师

Retrofit2.0+ .Net MVC4(WebApi) 上传多张图片

最近在做Android项目,使用的是MVP+Retrofit+rxjava+dagger的项目架构,RestFul 服务使用的.Net平台的WebApi。由于业务中需要有多文件上传的功能。所以在这里记载一下,便于以后查阅。 Android端Retrofit api 定义 在这次上传中,我们将实体类数据和文件数据一起上传到服务端。所以只写一个api就好 1 2 () Observable<HttpResult<String>>addEvent(()Evententity,()List<MultipartBody.Part>parts); 读取文件并将其转换成MuiltipartBody.Part 列表 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 List<MultipartBody.Part>getFilesMap(){ =ArrayList<MultipartBody.Part>(); Filefile=; { (!=&&.size()>){ (Stringpath:){ file=File(path); RequestBodyrequestBody=RequestBody.(MediaType.(),file); MultipartBody.Partpart=MultipartBody.Part.(,file.getName(),requestBody); .add(part); } } }(Exceptione){ e.printStackTrace(); } ; } 调用Retrofit 进行网络请求,并将实体类数据和文件数据一并发送到 服务端 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 addEvent(){ Evententity=.getEntity(); List<MultipartBody.Part>fileMap=.getFilesMap(); .clear(); { Subscriptionsubscription=.getRetrofitInstance() .create(EventInterface.) .addEvent(entity,fileMap) .subscribeOn(.io()).observeOn(.ui()).subscribe(Subscriber<HttpResult<String>>(){ onCompleted(){ } onError(Throwablee){ .setLoadingIndicator(); e.printStackTrace(); } onNext(HttpResult<String>httpResult){ (httpResult.getResultCode()!=ConstData.HttpResult.){ .setLoadingIndicator(); }{ .setLoadingIndicator(); } } }); .add(subscription); }(Exceptione){ e.printStackTrace(); } } 在webapi 端对文件以及数据进行接收。由上面转化MultipartBody 那一个环节我们可以看到,传到服务端的数据是以HTTP形式传送的。数据类型都是multipart/form-data类型的。所以我们在服务端要使用http相关协议来进行接收。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 [HttpPost] public HttpResult<string>AddEvent() { //获取EventET的属性 HttpRequestrequest=HttpContext.Current.Request; stringentity=request.Form[ 0 ]; BaseBNbaseBN= new BaseBN(); EventETet=baseBN.CTJsonSerializer<EventET>(entity); SystemBNbn= new SystemBN(); et.EVENT_ID=bn.CreateID( "EVENT" ,HaiQu.N, "EVENT_ID" , "EVENT" ,EventType.YiYou); List<string>addr= new List<string>(); //获取上传的文件 HttpFileCollectioncoll=request.Files; for ( int i= 0 ;i<coll.Count;i++) { HttpPostedFilefile=coll.Get(i); Stringfilename=file.FileName.Substring(file.FileName.LastIndexOf( "\\" )+ 1 ); if (!Directory.Exists(System.Web.HttpContext.Current.Server.MapPath( "~/Upload/" +et.EVENT_ID))) //如果不存在就创建file文件夹 { Directory.CreateDirectory(System.Web.HttpContext.Current.Server.MapPath( "~/Upload/" +et.EVENT_ID)); } stringfileSavePath=string.Format( "~/Upload/" +et.EVENT_ID+ "/{0}" ,filename); file.SaveAs(System.Web.HttpContext.Current.Server.MapPath(fileSavePath)); addr.Add(fileSavePath); } EventBNeventBN= new EventBN(); HttpResult<string>result=eventBN.AddEvent(et,addr,HaiQu.N); return result; } 这里有几点需要注意,实体类的数据,传输到服务端的时候,会以JSON字符串的形式传输到后台。这样的话,在后台使用的时候,需要对其进行反序列化。 另外,上传的文件,在HTTP中是以集合的形式存在,直接取出来,存储到本地就好。有一点需要注意的是,由于IIS对上传文件的限制,需要提前修改一下允许上传文件的上限。要不然,会上传不成功(这些都是已经踩过的坑)。 说在最后,其实上传文件很简单,网上有很多的大神已经讲解的非常详细。之所又自己啰嗦了一下,是因为,在做的过程中,踩了很多的坑,而且网上大多数人都只写了Android端,没有写服务端。再加上,.NET WebApi 用的人比较小众,所以就记录了一下。以后有时间会补上Spring 作为服务端的写法。以及Struts作为服务端的写法。 今天就到这里吧。 本文转自Eumenides_s 51CTO博客,原文链接:http://blog.51cto.com/xiaoshuaigege/1878634 ,如需转载请自行联系原作者

资源下载

更多资源
Mario

Mario

马里奥是站在游戏界顶峰的超人气多面角色。马里奥靠吃蘑菇成长,特征是大鼻子、头戴帽子、身穿背带裤,还留着胡子。与他的双胞胎兄弟路易基一起,长年担任任天堂的招牌角色。

腾讯云软件源

腾讯云软件源

为解决软件依赖安装时官方源访问速度慢的问题,腾讯云为一些软件搭建了缓存服务。您可以通过使用腾讯云软件源站来提升依赖包的安装速度。为了方便用户自由搭建服务架构,目前腾讯云软件源站支持公网访问和内网访问。

Sublime Text

Sublime Text

Sublime Text具有漂亮的用户界面和强大的功能,例如代码缩略图,Python的插件,代码段等。还可自定义键绑定,菜单和工具栏。Sublime Text 的主要功能包括:拼写检查,书签,完整的 Python API , Goto 功能,即时项目切换,多选择,多窗口等等。Sublime Text 是一个跨平台的编辑器,同时支持Windows、Linux、Mac OS X等操作系统。

WebStorm

WebStorm

WebStorm 是jetbrains公司旗下一款JavaScript 开发工具。目前已经被广大中国JS开发者誉为“Web前端开发神器”、“最强大的HTML5编辑器”、“最智能的JavaScript IDE”等。与IntelliJ IDEA同源,继承了IntelliJ IDEA强大的JS部分的功能。

用户登录
用户注册