Posts

Showing posts from December, 2016

Akka Streaming File IO

Akka Streams provide simple Sources and Sinks that can work with  ByteString  instances to perform IO operations on files. Streaming data from a file is as easy as creating a  FileIO.fromPath  given a target path, and an optional  chunkSize  which determines the buffer size determined as one "element" in such stream: import akka . stream . scaladsl . _ val file = Paths . get ( "example.csv" )   val foreach : Future [ IOResult ] = FileIO . fromPath ( file ) . to ( Sink . ignore ) . run () Please note that these processing stages are backed by Actors and by default are configured to run on a pre-configured threadpool-backed dispatcher dedicated for File IO. This is very important as it isolates the blocking file IO operations from the rest of the ActorSystem allowing each dispatcher to be utilised in the most efficient way. If you want to configure a custom dispatcher for file IO operations globally, you can do so by changin...

Typechecking With PropTypes

From https://facebook.github.io/react/docs/typechecking-with-proptypes.html As your app grows, you can catch a lot of bugs with typechecking. For some applications, you can use JavaScript extensions like  Flow  or  TypeScript  to typecheck your whole application. But even if you don't use those, React has some built-in typechecking abilities. To run typechecking on the props for a component, you can assign the special  propTypes property: class Greeting extends React . Component { render () { return ( < h1 > Hello , { this . props . name } < /h1> ); } } Greeting . propTypes = { name : React . PropTypes . string }; React.PropTypes  exports a range of validators that can be used to make sure the data you receive is valid. In this example, we're using  React.PropTypes.string . When an invalid value is provided for a prop, a warning will be shown in the JavaScript console. For performance ...

Installing node-oracledb

Following the instruction on https://github.com/oracle/node-oracledb/blob/master/INSTALL.md export OCI_LIB_DIR=/opt/oracle/instantclient export OCI_INC_DIR=/opt/oracle/instantclient/sdk/include After these two commands, run an extra command: export ORACLE_HOME=/opt/oracle/ Otherwise, ORA-12154 would be given.