filereader

Work around for Html5 Local File Access

天涯浪子 提交于 2019-11-30 23:30:58
We are currently looking at porting a enterprise silverlight application over to html5. The major roadblock that we have hit is the ability to open files from the user's local disk. Currently they have a document library which just links to files on their computer that they can open from within the app and view or print out. All that I read is that you can only access the local sandbox of the web app with the html5 file api's. We want to load these files from code. Does anyone know of any workarounds to this? Thanks There is no way for html5 to access local file without user selection. But FSO

java - I/O - FileReader, FileWriter

梦想与她 提交于 2019-11-30 21:14:59
字节流: FileInputStream FileOutputStream 字节流每次读取一个字节,好处是什么类型文件都可以读取,坏处是处理纯文本时可能出现问题(中文每个字占2个字节,可能导致读取错误出现乱码)。 字符流: FileReader, FileWriter 只能操作纯文本文件(右键记事本可以打开而且不影响内容),txt,html等。 字节流用byte接收数据,byte是8位 字符流用char接受数据,char是16位 汉字占用两个字节,也就是16位 所以字节流有可能乱码,而字符流不会。 两者用房上基本相同,只是参数一个是byte一个是char FileReader: package io; import java.io.FileInputStream; import java.io.FileReader; import java.io.IOException; public class FileReaderTest { public static void main(String[] args){ FileReader fr = null; FileInputStream fis = null; try { fr = new FileReader("C:\\Users\\Administrator\\Desktop\\test\\filereadertest.txt")

Detecting a file's content-type when using JavaScript's FileReader interface

本秂侑毒 提交于 2019-11-30 20:06:01
I've been setting up an import script for plain-text files in a web application. My script is as follows: function dataImport(files) { confirm("Are you sure you want to import the selected file? This will overwrite any data that is currently saved in the application workspace."); for (i = 0; i < files.length; i++) { file = files[i] console.log(file) var reader = new FileReader() ret = [] reader.onload = function(e) { window.localStorage.setItem("ApplicationData", e.target.result); } reader.onerror = function(stuff) { console.log("error", stuff) console.log (stuff.getMessage()) } reader

HTML5 FIle API: Security Error while reading a file

我是研究僧i 提交于 2019-11-30 17:49:02
Problem solved, read comment The third problem I have with the HTML5 File API: I still use Chrome 12 on Mac OS X Snow Leopard and I'm still trying to read files with the HTML5 File API, but FileHandler.error() get called because a "SECURITY_ERR" occurres. The file I try to read is a regular .txt file from my desktop, but it neither works with other files although I can open them with regular applications. function FileHandler(files, action) { console.log('FileHandler called.'); this.files = files; this.reader = new FileReader(); this.action = action; this.handle = function() { console.log(

html5 fileReader — how to only read the first N characters of a file?

假如想象 提交于 2019-11-30 17:35:34
Currently I use a pattern like the following to read the first 3 characters of a series of files: var files = e.dataTransfer.files; for (var i = 0, f; f = files[i]; i++) { var fr = new FileReader(); fr.onload = function(e) { var first_three_chars = e.target.result.substr(0,3); } fr.readAsText(f); } The trouble is that I'm only interested in the first 3 characters of the file, whereas this method reads the entire file, wasting lots of memory and time. How can I quickly iterate over the files, simply taking quick peeks at the first characters? Edit: slice() was the answer, thanks sshen. Here's

AngularJS - upload and display image using FileReader API (multiple files) [duplicate]

会有一股神秘感。 提交于 2019-11-30 15:26:44
问题 This question already has answers here : Directive to get files input with ng-model [duplicate] (1 answer) ng-model for `<input type=“file”/>` (with directive DEMO) (12 answers) Closed 2 years ago . I use the following example, it works perfectly , but I'd like to upload multiple images simultaneously. http://jsfiddle.net/kkhxsgLu/2/ <div ng-controller="MyCtrl"> <div ng-repeat="step in stepsModel"> <img class="thumb" ng-src="{{step}}" /> </div> <input type='file' ng-model-instant onchange=

结对编程项目总结

烈酒焚心 提交于 2019-11-30 15:01:27
项目需求 结对编程项目:带UI的小初高数学学习软件 用户: 小学、初中和高中学生。 功能: 1、用户注册功能。用户提供手机号码,点击注册将收到一个注册码,用户可使用该注册码完成注册; 2、用户完成注册后,界面提示设置密码,用户输入两次密码匹配后设置密码成功。密码6-10位,必须含大小写字母和数字。用户在登录状态下可修改密码,输入正确的原密码,再输入两次相同的新密码后修改密码成功; 3、密码设置成功后,跳转到选择界面,界面显示小学、初中和高中三个选项,用户点击其中之一后,提示用户输入需要生成的题目数量; 4、用户输入题目数量后,生成一张试卷(同一张卷子不能有相同题目,题目全部为选择题),界面显示第一题的题干和四个选项,用户选择四个选项中的一个后提交,界面显示第二题,...,直至最后一题; 5、最后一题提交后,界面显示分数,分数根据答对的百分比计算; 6、用户在分数界面可选择退出或继续做题; 7、小初高数学题目要求见个人项目。 个人项目复用   经分析,这次结对编程项目由于题目形式改为选择而不是个人项目中的填空,这也就意味着若是沿用个人项目中的随机出题逻辑,我们需要算出随机生成的算式的正确结果,加减乘除还好说,根式运算、三角函数运算一头包, 而且若要以根式的形式表示结果极为麻烦,最终我们决定舍弃个人项目中的随机出题,以题库抽题的方式实现出题。   短信验证码我们选择了阿里云

AngularJS - upload and display image using FileReader API (multiple files) [duplicate]

空扰寡人 提交于 2019-11-30 14:08:50
This question already has an answer here: Directive to get files input with ng-model [duplicate] 1 answer ng-model for `<input type=“file”/>` (with directive DEMO) 12 answers I use the following example, it works perfectly , but I'd like to upload multiple images simultaneously. http://jsfiddle.net/kkhxsgLu/2/ <div ng-controller="MyCtrl"> <div ng-repeat="step in stepsModel"> <img class="thumb" ng-src="{{step}}" /> </div> <input type='file' ng-model-instant onchange="angular.element(this).scope().imageUpload(this)" /> $scope.stepsModel = []; $scope.imageUpload = function(element){ var reader =

Is it possible to dispatch events on regular objects (not DOM ones)? [duplicate]

懵懂的女人 提交于 2019-11-30 12:51:57
问题 This question already has answers here : Can plain Javascript objects have events? (8 answers) Closed 2 years ago . I just found out that FileReader dispatches events just as if it was a DOM element. Is it? I wonder if it's possible to create an object similar to FileReader, which doesn't have a representation in HTML/XML structure, but can dispatch events? 回答1: FileReader has methods like addEventHandler because it is defined to implement the EventTarget interface. EventTarget is defined by

WC个人项目(JAVA实现)

别等时光非礼了梦想. 提交于 2019-11-30 12:44:18
一、Github地址:https://github.com/l67t/wc 二、PSP表格 PSP2.1 Personal Software Process Stages 预估耗时(分钟) 实际耗时(分钟) Planning 计划 30 40 · Estimate · 估计这个任务需要多少时间 30 40 Development 开发 1155 1220 · Analysis · 需求分析 50 60 · Design Spec · 生成设计文档 30 40 · Design Review · 设计复审 20 20 · Coding Standard · 代码规范 15 30 · Design · 具体设计 80 60 · Coding · 具体编码 750 800 · Code Review · 代码复审 30 30 · Test · 测试(自我测试,修改代码,提交修改) 180 180 Reporting 报告 110 130 · Test Report · 测试报告 60 60 · Size Measurement · 计算工作量 20 30 · Postmortem & Process Improvement Plan · 事后总结, 并提出过程改进计划 30 40 合计 1295 1390 三、解题思路 由于之前的JAVA课设有跟这次项目相似的功能