// Add the new slick-theme.css if you want the default styling
When building desktop apps using HTML and JS there are often times one has to
open a file and read its contents. To do so we first have to create an HTML
input element, create a javascript event handler and a js file reader object to
finally read the contents of the file. The nice part about this is that it does
not require a server to upload. Since the javascript is written in the HTML
<script>
tags, the entire code runs on the browser without needing a server.
The HTML input element will allow the user to select the file from the browser. This should be added to your page.html file.
<input type="file" class="upload" id="input" />
Event handler code consist of two parts:
Whenever a registered event occurs, the event handler code is executed.
Registering the event handler:
// Reference for the html input element
var inputElement = document.getElementById("input");
// on change run the 'handleFiles' method
inputElement.addEventListener("change", handleFiles, false);
Creating a handler function:
function handleFiles() {
var file = this.files[0]; /* now you can work with the file list */
console.log(file.name); /* logged the filename */
console.log(file.size); /* logged the filesize */
reader.readAsText(file); /* this will make sense in a bit */
}
When the handleFiles
method is fired the file
object has the path
information of the given selected in the input
element. So now the contents
of the selected file can be read using the JS FileReader
object.
Create the file reader
var reader = new FileReader();
Register + Create an event handler for when the FileReader
finishes reading
the file.
reader.onload = function (e) {
console.log(reader.result);
/* Do something with the read reader.result */
}
AID is a volunteer movement promoting sustainable, equitable and just development. AID supports grassroots organizations in India and initiates efforts in various interconnected spheres such as education, livelihoods, natural resources including land, water and energy, agriculture, health, women's empowerment and social justice.
This is a presentation for EC762 on Quantum Cryptography. It explores the Security Perspectives of Quantum Cryptography.
Cloud Scrubs aims to connect rural health centers to a central system to mine the health data and allow governments to take proactive steps to avoid, reduce medical conditions in a population.
This is an unofficial Windows Phone 7 Application for the popular online marketplace Dubizzle.
An Wii Nunchuck Library for the Arduino
This is a MEMS based Weight sensor analyzed using COMSOL.
This is the collection of Photonics Review Papers and Presentations that were made in EC770 and EC568 at BU.
This is the collection of projects done as a part of CIDAR Lab
Team Indus is the only Indian Competitor in Google Lunar XPrize Competition. It is currently one of the finalists and the winner of two milestone prizes. Team Indus aims to launch a spacecraft and a rover to the Moon by 2018.
The Cross-disciplinary Integration of Design Automation Research (CIDAR) group at Boston University develop computational and experimental tools for synthetic biology. The research facilities include both a computational workspace in the Department of Electrical and Computer Engineering as well as experimental laboratory space in the Boston University Center of Synthetic Biology (CoSBI).
Geeks was an app development startup that ran between 2010-2012 and is currently on a hiatus.