Posts

Showing posts from 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.

flappy bird游戏源代码揭秘和下载

Image
作者:左文 链接:https://www.zhihu.com/question/22715390/answer/22368482 来源:知乎 著作权归作者所有,转载请联系作者获得授权。 背景: 最近火爆全球的游戏flappy bird让笔者叹为观止,于是花了一天的时间山寨了一个一模一样的游戏,现在把游戏的思路和源码分享出来,代码是基于javascript语言,cocos2d-x游戏引擎,cocos2d-x editor手游开发工具完成的,请读者轻砸; ps:运行demo必须配置好cocos2d-x editor,暂不支持其他工具; 还有demo是跨平台的,可移植运行android,ios,html5移动系统等,csdn博客里会介绍代码如何移植,请持续关注; Android Apk下载演示: 暂时先移植到android平台 下载地址: http:// share.weiyun.com/cac18d 8c58d40bf2401b3fdeeb6bcb2f 代码下载: csdn下载: http:// download.csdn.net/detai l/touchsnow/6912707 百度云盘: http:// pan.baidu.com/s/1pJnWDb 9 金山快盘 : http://www. kuaipan.cn/file/id_2534 8935635745384.htm?source=1 代码如何移植到各平台: Android: http:// blog.csdn.net/touchsnow /article/details/19176091 html5: http:// blog.makeapp.co/? p=245 效果图: &amp;lt;img src="https://pic3.zhimg.com/765282dd955615781212934f058aba5a_b.jpg" data-rawwidth="1355" data-rawheight="706" class="origin_image zh-lightbox-thumb" width="1355" data-ori...

Introducing Play 2

Since 2007, we have been working on making Java web application development easier. Play started as an internal project at Zenexity (now  Zengularity ) and was heavily influenced by our way of doing web projects: focusing on developer productivity, respecting web architecture, and using a fresh approach to packaging conventions from the start - breaking so-called JEE best practices where it made sense. In 2009, we decided to share these ideas with the community as an open source project. The immediate feedback was extremely positive and the project gained a lot of traction. Today - after two years of active development - Play has several versions, an active community of more than 10,000 people, with a growing number of applications running in production all over the globe. Opening a project to the world certainly means more feedback, but it also means discovering and learning about new use cases, requiring features and un-earthing bugs that we were not specifically considered ...