3 ms·
Reading and Writing a File in Javascript for Win 8 Apps
- some1else 14y agoWow. Thanks for writing it up, but that API just makes me cringe. That's what we had to deal with back in the day, but now we have abstract APIs like localStorage, Web SQL and Indexed DB [1]. At the very least, this wont gel with "Directories and System" component of the File API [2][3]. Microsoft will probably be implementing the W3C standard, but we may have to come up with a fileQuery.js library to do file-operations the same way across platforms until they see a need for it. [1] http://www.html5rocks.com/en/tutorials/offline/storage/ http://www.html5rocks.com/en/tutorials/offline/storage/ [2] http://dev.w3.org/2009/dap/file-system/file-dir-sys.html http://dev.w3.org/2009/dap/file-system/file-dir-sys.html [3] http://www.html5rocks.com/en/tutorials/file/filesystem/ http://www.html5rocks.com/en/tutorials/file/filesystem/
- PommeDeTerre 14y agoI find the whole situation quite absurd. Throughout the 1950s, 1960s, 1970s, 1980s, 1990s, and most of the 2000s, we saw real advancements being made. Things were generally getting better over time. Fortran made programming much more accessible. C and UNIX made for an effective, practical platform. Lisp, Scheme, Smalltalk and ML brought some rigor and new ideas to the table. Perl and Python allowed for rapid development of scripts and prototypes. SQL let us really push relational databases to the limit. Even C++, Java and C# allowed for the development of large, real-world systems. Then around 2007 or so, everything went completely stupid. We saw the rise of JavaScript and NoSQL, and things have only gotten worse since then. It's like we lost 50+ years of accumulated knowledge, programming language functionality, libraries and platform support. What happened to our craft? Everything that was good is being discarded, in favor of languages, databases, APIs and platforms that are rubbish. It's not even a case of "worse is better". It's "worse is much worse".
- camus 14y agoJavascript is bad because Vendors like microsoft made it bad , to promote their own RIA tech ( silverlight ). IF ecmascript 4 would have been standardised in 2007 , javascript would be closer to ActionScript and Jscript.NET. they allow the same amount of functional programming than Javascript does yet are strongly typed , with classes , interfaces , etc ...
- drivebyacct2 14y ago>Javascript is bad because Vendors like microsoft made it bad , to promote their own RIA tech ( silverlight ) What on this green Earth does that even mean? JavaScript and Silverlight could hardly be less related other than they're both available in some browsers. Timeframe, etc, don't support your [conspiracy] theory. JS is different in that it's a prototype-based language. That and the sometimes errant recent love-obsession with Node.JS has given JS an undeserved and often non-specific bad reputation.
- PommeDeTerre 14y agoJavaScript had a bad reputation far before Node.js was introduced. It was blatantly inferior to begin with, and it hasn't really improved since, but for whatever reason people don't recognize the inferiority like they used to. While its prototype-based nature may have some theoretical benefits, in practice it has obviously been disastrous. I suspect that it is the cause of more terrible code than JavaScript's numerous other serious problems. In order to make something truly usable out of JavaScript, you essentially have to discard all of its core features and syntax. At that point, one should ask why there's even any point in bothering. If JavaScript basically needs to be twisted into something resembling C++, Java, C#, Ruby or Python to be truly useful, then why not just go with those languages instead?
- drivebyacct2 14y agoEverything now is stupid and rubbish. Got it. Ignore D, Rust, Go, valid uses of NoSQL, advanced made to RDMS, etc.
- drivebyacct2 14y agoI don't see what's that wrong with the API other than they ought to have more aligned with the HTML5 APIs. The code in the blog post is poor because it's width constrained and callback soup. Use of promises and/or better JS would help the appearance of the code.
- EwanG 14y agoBut are you sure those would WORK? One of the things I had to wrap my head around early is that MS JS is not the same as ALL JS. You don't want to know what you have to do for a Global variable...
- drivebyacct2 14y agoHuh? (I wrote one of the JS WonRT API and implementations)
- kstenson 14y agoThis application is being written on the WinRT platform which is a wrapper around win32 for writing windows 8 applications using HTML and Javascript. it's not really a browser application, it just happens to use html and javascript as it's UI layer hence it doesn't use things like localstorage or web sql etc.
- bmuon 14y ago+1 for a nice library that makes it look like the HTML5 API and that uses promises for both cases. I may even end up writing it myself.