Guide to scala.io and simple IO for Scala 2.9? - file

Does anybody have a guide to this, containing code samples, tips and an outline of the different IO approaches?
I have checked out the the API documentation. There are also some basic examples with scala.io.Source in Programming in Scala.
There are some pretty basic questions already answered here on SO.
I'm looking for something more in depth.
Alternatively, any tips on exactly which bits of the API documentation to focus on and which Java libraries? I'm familiar with System.IO in .NET land, but not so much Java.

Scala's standard library is currently pretty limited for I/O, so you'll probably want to dig into Java's libraries. Oracle's Basic I/O tutorial, covering java.nio, looks like a reasonable starting point.
A while ago there was some discussion about a community driven redesign of Scala I/O called scala-io, but I'm not sure the official status. The mailing list hasn't seen much recent activity, but the code in Github is being actively developed (incubator mailing list and Github project). In his answer, hishadow gave a link to scala-io documentation.

My tip is to look also at tools Path,File and Directory.
They have little sugar (that everyone has in their little utils library) like:
val writer = File("/my/file").bufferedWriter
File.closeQuietly(writer)
Directory("myDir").walk
Then have a look at Process like here

There is an in-development IO library with documentation available at http://jesseeichar.github.com/scala-io/. Included are examples for different usages.
The source repository is at https://github.com/jesseeichar/scala-io.

I recommend looking at java.nio.
Due to technical limitations of the underlying Java platform implementing IO in Scala wasn't a good idea.
This has changed with Java 7, which provides good Java APIs for everything related to file management.
There are some thoughts about an IO library for Scala, but no decision about that yet.

The author of scala-IO, Jesse Eichar, has recently began a series of articles about using Scala-IO on his blog: here's the 'getting started' entry.

Related

Angular-Fullstack Generator: How to create a persistent file upload using the boilerplate?

Thank you for reading this post.
As a newcomer to the programming community, I have what I believe to be a fairly easy question.
How do you implement a file upload (particularly images) using the MEAN stack (yeoman angular-fullstack generator in particular)? An explanation using the yeoman angular-fullstack boilerplate would be appreciated.
In particular, could you please make a step-by-step explanation. This is not recorded anywhere on the internet, so your help will be recognized and appreciated! :-)
While there are numerous explanations out there, those explanations always answer a particular user's question (as do many other questions/answers) and are not applicable to general use cases. Those explanations typically require one to be able to parse through numerous lines of irrelevant code, in order to absorb the information that's relevant. As such, a "noob" is not able to utilize the part of the code that is applicable to him/her. That is why I'm asking for an explanation using the boilerplate of a generator, so that myself and others may use this information -- now and in the future.
Using search engines and research, I have come across the predominate answer that ng-file-upload and multer can accomplish this task. However, there is no rudimentary explanation of how this used implemented within a MEAN stack together (particularly, angular-fullstack -- the predominate MEAN stack implementation at this time).
Today, any general non-static website requires a file-upload implementation, and it seems extremely odd that there is very little documentation on this issue. I've read numerous O'Reilly books on MongoDB, but this issue is not addressed. Images and Videos are essential to commercial-grade websites, and these topics should be documented in a way that is digestible for newcomers to MEAN programming.
Thank you for your time, and I appreciate any and all helpful answers and comments.
you can use my code which is MEAN project for image upload
https://github.com/RohitShedage/image-upload

Embedding Dart into application

I am just experimenting , but want to use Dart as a scripting language for a high performance simulation application I've been working on.(think games)
Basically use Dart in lieu of Lua
I have found old resources, but I have heard the are out of date - and haven't really found any tutorials on how to actually utilize them.
found resources:
https://github.com/google/embed-dart-vm
https://github.com/google/embed-dart-vm/tree/master/src
I couldn't find any good article on this, only this discussion thread in Dart group. However, there are working demos in the Dart's source code.
Take a look at DartHost implementation in some of these projects - this should give you some idea about how to do it.

Resources To learn IOCP On Windows

I recently was made aware of this thing called IOCP on windows and i began searching for more information on it but i couldn't find anything up to date (most of the examples were on codeproject almost 5 years old) and not too many guides or tutorials. Can anyone recommend any up to date resources about it in the form of online tutorials or example projects (that you wrote and can share or other open source projects) or even a book about it because if it's as good as it sounds i plan to use it extensively so i will invest in it.
Thank You.
If you're looking at IOCP from a Network programming point of view then you probably also want to add Network Programming for Microsoft Windows to your list of resources.
There were lots of basic IOCP tutorials on CodeProject back in 2002 when I wrote my articles on IOCP there, so I took a slightly different approach and wrote some code that was, hopefully, reusable as a simple networking framework. This has since grown into a product that I sell. The latest version of the code that's associated with the original CodeProject articles can be found here: http://www.serverframework.com/products---the-free-framework.html I've changed it considerably over the years but the original code still works fine and provides good scalability and is, perhaps, useful as a working example to learn from.
IOCP is a feature that has been in Windows since the dark ages and has changed little in years since. As such, any samples etc. from 5+ years ago should still work pretty well today.
MSDN has some documentation on IOCP:
http://msdn.microsoft.com/en-us/library/aa365198%28v=VS.85%29.aspx
Mark Russinovich also wrote up a great intro into IOCP:
http://sysinternals.d4rk4.ru/Information/IoCompletionPorts.html
Mark also wrote a more thorough description of Windows' IO infrastructure in "Windows Internals" which is essential reading.
I also strongly recommend Jeffery Richter's "Windows via C/C++" which is also essential reading for anyone embarking on lower-level Windows programming.
HTH.

Java ME tips for Java EE developer

I am used to programming in Java EE but right now I am being assigned to Java ME project. From what I am reading all those ME restrictions are quite painful. Do you have any tips on how to deal with such a crude language? Are there are any good libraries which might give a higher level of abstraction?
I am also looking for tips about developing tools or strategies e.g. tools like maven (I mean tools without which you can't imagine working). Are there are tools/approaches which you must know about in Java ME?
There are so many things to discuss here, you could write a book or two about the topic!
First of all, realize that "Java ME" is an umbrella term that encompasses a variety of Java environments, some very limited compared to Java SE, some nearly as capable. However, when most people use the term they're really referring to the limited side of things -- the CLDC (Connected Limited Device Configuration) and the MIDP (Mobile Information Device Profile). So let's assume that's where you're going.
The biggest problem you're going to face as a J2EE developer is the sheer LACK of APIs in a MIDP environment. Also missing language features -- no enums, no generics. Basically you're dealing with a subset of Java 1.3, which is a huge step back for you. The collections classes aren't there, for example, so you end up using the old-style Vector and Hashtable classes a lot. Or you end up using device-specific API extensions at the cost of portability.
The good news is that the NetBeans tools is pretty good for MIDP development, they've put in a lot of good features. You can also use Eclipse, there are some good plugins for that. The tool support is there, including ant tasks and so on.
There's lot of material on the web to get started with Java ME. Read some of my Java ME overview material (which still refers to Java ME as J2ME). Then figure out what platforms you're targeting. If you're doing BlackBerry stuff, for example, you'll want to learn and use the BlackBerry APIs and not MIDP.
There's definitely a learning curve, but you'll adapt quickly enough.

An amnesia patient's "first" functional language? (I really like Clojure...)

I was recently diagnosed with a cascading dissociative disorder that causes retrograde amnesia in addition to an existing case of possible anterograde amnesia. Many people have tried to remind me of how great a programmer I was before -- Right now I get the concepts and the idioms, but I want to teach myself whether I know or not. I think I can overcome the amnesia problems in part with it.
My question for you, stackoverflow, is this: I recently found Clojure and it... it feels good to use, even in just copying down the examples from whatever webpage I can find. My goals in learning a functional programming language are to create a simple webserver, an irc AI bot of some variety, and a couchdb-like database system, all of which lightweight and specifically for education. What flaws does Clojure have? Is there a better functional programming language to use right now for education /and/ application?
I think Clojure is a very nice language. If I should point to any defect it is that it's very new, and even though the language seems very mature and production ready, the tools and frameworks around it aren't. So if you are going to make, for instance, a web-app, don't expect to fire three commands and have a "Your first web app is running, now read this documentation to create your models"-page on your browser.
There aren't that many libraries written in Clojure yet either, but that's not a huge problem if you consider that you can use almost anything written in Java.
Haskell currently has a large following and a growing base of libraries and applications. It's also used for education and research. I find it a very nice language to use.
Haskell, Erlang and Clojure are all good choices. I would personally recommend Clojure, you might be able to do some interesting database stuff with the Software Transational Memory system that is part of Clojure.
You list CouchDB in your question, and it's written in Erlang, which is meant to be a pretty engrossing language once you get into it.
I have no personal experience with Clojure, but i really recommend F#. It's quite a powerful language in the style of OCaml. I really like it because it's debugging tools and IDE are second to none, and you can take advantage of practically every library on the (huge) .NET platform.

Resources