Here

JAVA WEB项目大文件上传下载代码

血红的双手。 提交于 2020-04-10 17:32:48
1,项目调研 因为需要研究下断点上传的问题。找了很久终于找到一个比较好的项目。 在GoogleCode上面,代码弄下来超级不方便,还是配置hosts才好,把代码重新上传到了github上面。 https://github.com/freewebsys/java-large-file-uploader-demo 效果: 上传中,显示进度,时间,百分比。 点击【Pause】暂停,点击【Resume】继续。 2,代码分析 原始项目: https://code.google.com/p/java-large-file-uploader/ 这个项目最后更新的时间是 2012 年,项目进行了封装使用最简单的方法实现了http的断点上传。 因为html5 里面有读取文件分割文件的类库,所以才可以支持断点上传,所以这个只能在html5 支持的浏览器上面展示。 同时,在js 和 java 同时使用 cr32 进行文件块的校验,保证数据上传正确。 代码在使用了最新的servlet 3.0 的api,使用了异步执行,监听等方法。 上传类UploadServlet @Component("javaLargeFileUploaderServlet") @WebServlet(name = "javaLargeFileUploaderServlet", urlPatterns = { "

文章-依赖注入:《Inversion of Control Containers and the Dependency Injection pattern》

元气小坏坏 提交于 2020-04-10 09:43:58
ylbtech-文章-依赖注入:《Inversion of Control Containers and the Dependency Injection pattern》 In the Java community there's been a rush of lightweight containers that help to assemble components from different projects into a cohesive application. Underlying these containers is a common pattern to how they perform the wiring, a concept they refer under the very generic name of "Inversion of Control". In this article I dig into how this pattern works, under the more specific name of "Dependency Injection", and contrast it with the Service Locator alternative. The choice between them is less important

django:理解urls路由

大憨熊 提交于 2020-04-10 09:34:08
最近在看django的官方文档,跟着文档敲第一个django应用,刚开始看到第一部分关于urls路由的设置时,脑子里冒出来许多问号 一时没转过弯来,它到底是咋转发路由的??如何通过我配置的路径来定位到指定视图的? 然后自己就反复试验了几次,又仔细看了文档中的描述(我的蹩脚英语不足以支撑看原版英文文档,看的英译汉,所以翻译后有些字眼确实不好理解,没内个味道了...) OK,闲话到此为止,继续往下看 首先,我的django项目层级如下 mysite/urls.py 是根 URLconf 文件 polls/urls.py 是一个应用下的 URLconf 文件 在 polls/urls.py 中添加了路由 from django.urls import path from . import views urlpatterns = [ path( '' , views.index, name= ' index ' ), ] 然后在 mysite/urls.py 文件的 urlpatterns 列表里插入一个 include() from django.contrib import admin from django.urls import include, path urlpatterns = [ path( ' polls/ ' , include( ' polls.urls ' )),

SSH的哪些keys

南笙酒味 提交于 2020-04-10 09:10:44
Known Host Keys 防止中间人攻击。 https://www.ssh.com/ssh/host-key#known-host-keys SSH clients store host keys for hosts they have ever connected to. These stored host keys are called known host keys , and the collection is often called known hosts . In OpenSSH, the collection of known host keys is stored in /etc/ssh/known_hosts and in .ssh/known_hosts in each user's home directory. Each host (i.e., computer) should have a unique host key. Sharing host keys is strongly not recommended, and can result in vulnerability to man-in-the-middle attacks . However, in computing clusters sharing hosts keys may

【HERE地图开发记录(2)】finecms高级版添加Here地图字段类别

百般思念 提交于 2020-04-09 19:24:41
由于finecms的自定义字段类别属于系统自带项,需要增加的话就要加代码了,如果是普通的控件增加就相对简单,Here地图的话就略带点坑了,废话不说马上去片! 1.增加finecms字段类别 首先在dayrui/libraries/Field文件夹中增加我们自己的字段类别文件,因为同是地图项目,所以我直接复制Baidumap.php,改名为Heremap.php 打开Heremap.php后,我们可以先看看构造函数 /** * 构造函数 */ public function __construct() { parent::__construct(); $this->name = IS_ADMIN ? lang('991') : ''; // 字段名称 $this->fieldtype = array('INT' => 10); // TRUE表全部可用字段类型,自定义格式为 array('可用字段类型名称' => '默认长度', ... ) $this->defaulttype = 'INT'; // 当用户没有选择字段类型时的缺省值 } 其中name属性就是在系统中显示的名字,这里读取的是/dayrui/language/*/admin_lang.php 里面的message信息,为了以后finecms升级不冲突,我在这里就设一个偏远山区的下标991为我的名称信息(PS

使用Pandas库分析股票

拥有回忆 提交于 2020-04-09 18:41:55
原文地址: 使用Pandas库分析股票 Introduction 用 Pandas 等三方库,根据 Financial technology 相关程序,进行股票分析, Requirement This assignment builds on Lectures 7 to 9 and on Tutorials 6 and 7. You might want to consider using some of the Python code discussed in those lectures and tutorials to answer some of the questions below. Important: It is important that you do not change the type (markdwon vs. code) of any cell, nor copy/paste/duplicate any cell! If the cell type is markdown, you are supposed to write text, not code, and vice versa. Provide your answer to each question in the allocated cell. Do not create

[ASP.NET Core MVC] 如何实现运行时动态定义Controller类型?

不问归期 提交于 2020-04-09 04:52:52
昨天有个朋友在微信上问我一个问题:他希望通过动态脚本的形式实现对ASP.NET Core MVC应用的扩展,比如在程序运行过程中上传一段C#脚本将其中定义的Controller类型注册到应用中,问我是否有好解决方案。我当时在外边,回复不太方便,所以只给他说了两个接口/类型:IActionDescriptorProvider和ApplicationPartManager。这是一个挺有意思的问题,所以回家后通过两种方案实现了这个需求。源代码从 这里 下载。 一、实现的效果 我们先来看看实现的效果。如下所示的是一个MVC应用的主页,我们可以在文本框中通过编写C#代码定义一个有效的Controller类型,然后点击“Register”按钮,定义的Controller类型将自动注册到MVC应用中 由于我们采用了针对模板为“{controller}/{action}”的约定路由,所以我们采用路径“/foo/bar”就可以访问上图中定义在FooController中的Action方法Bar,下图证实了这一点。 二、动态编译源代码 要实现如上所示的“针对Controller类型的动态注册”,首先需要解决的是针对提供源代码的动态编译问题,我们知道这个可以利用Roslyn来解决。具体来说,我们定义了如下这个ICompiler接口,它的Compile方法将会对参数sourceCode提供的源代码进行编译

无法绑定到“ ngModel”,因为它不是“ input”的已知属性

我与影子孤独终老i 提交于 2020-04-09 01:00:16
问题: I've got the following error when launching my Angular app, even if the component is not displayed. 即使未显示组件,启动我的Angular应用程序时也会出现以下错误。 I have to comment out the <input> so that my app works. 我必须注释掉 <input> 这样我的应用才能正常工作。 zone.js:461 Unhandled Promise rejection: Template parse errors: Can't bind to 'ngModel' since it isn't a known property of 'input'. (" <div> <label>Created:</label> <input type="text" [ERROR ->][(ngModel)]="test" placeholder="foo" /> </div> </div>"): InterventionDetails@4:28 ; Zone: <root> ; Task: Promise.then ; Value: I'm looking at the Hero plunker, but I don't see any

[ASP.NET Core MVC] 如何实现运行时动态定义Controller类型?

北城以北 提交于 2020-04-09 00:55:32
昨天有个朋友在微信上问我一个问题:他希望通过动态脚本的形式实现对ASP.NET Core MVC应用的扩展,比如在程序运行过程中上传一段C#脚本将其中定义的Controller类型注册到应用中,问我是否有好解决方案。我当时在外边,回复不太方便,所以只给他说了两个接口/类型:IActionDescriptorProvider和ApplicationPartManager。这是一个挺有意思的问题,所以回家后通过两种方案实现了这个需求。源代码从 这里 下载。 一、实现的效果 我们先来看看实现的效果。如下所示的是一个MVC应用的主页,我们可以在文本框中通过编写C#代码定义一个有效的Controller类型,然后点击“Register”按钮,定义的Controller类型将自动注册到MVC应用中 由于我们采用了针对模板为“{controller}/{action}”的约定路由,所以我们采用路径“/foo/bar”就可以访问上图中定义在FooController中的Action方法Bar,下图证实了这一点。 二、动态编译源代码 要实现如上所示的“针对Controller类型的动态注册”,首先需要解决的是针对提供源代码的动态编译问题,我们知道这个可以利用Roslyn来解决。具体来说,我们定义了如下这个ICompiler接口,它的Compile方法将会对参数sourceCode提供的源代码进行编译

[ASP.NET Core MVC] 如何实现运行时动态定义Controller类型?

与世无争的帅哥 提交于 2020-04-08 21:15:04
原文: [ASP.NET Core MVC] 如何实现运行时动态定义Controller类型? 昨天有个朋友在微信上问我一个问题:他希望通过动态脚本的形式实现对ASP.NET Core MVC应用的扩展,比如在程序运行过程中上传一段C#脚本将其中定义的Controller类型注册到应用中,问我是否有好解决方案。我当时在外边,回复不太方便,所以只给他说了两个接口/类型:IActionDescriptorProvider和ApplicationPartManager。这是一个挺有意思的问题,所以回家后通过两种方案实现了这个需求。源代码从 这里 下载。 一、实现的效果 我们先来看看实现的效果。如下所示的是一个MVC应用的主页,我们可以在文本框中通过编写C#代码定义一个有效的Controller类型,然后点击“Register”按钮,定义的Controller类型将自动注册到MVC应用中 由于我们采用了针对模板为“{controller}/{action}”的约定路由,所以我们采用路径“/foo/bar”就可以访问上图中定义在FooController中的Action方法Bar,下图证实了这一点。 二、动态编译源代码 要实现如上所示的“针对Controller类型的动态注册”,首先需要解决的是针对提供源代码的动态编译问题,我们知道这个可以利用Roslyn来解决。具体来说