modular

设置IntelliJ IDEA支持lambda表达式

≡放荡痞女 提交于 2019-11-30 02:34:37
使用IntelliJ IDEA做为开发工具,对基于maven的java工程,如果要编写lambda表达式,<font color="red">先确保安装并使用了jdk1.8或者更高版本</font>,然后再要做一些设置才能正常编译和执行,具体表现在maven支持和intellij idea工具支持两个方面,配置如下: ##maven支持## 在pom.xml中增加一个插件,使得maven支持jdk1.8语法: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.2</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> </plugins> </build> 修改intellij idea配置之一:修改intellij的全局设置## 接下来是intellij的全局设置,选择菜单中的全局设置,如下图红框: 在弹出的菜单中,设置Java compiler的level为1.8,具体的设置如下图红框所示: 修改intellij idea配置之二

Compile multiple C files with make

坚强是说给别人听的谎言 提交于 2019-11-29 20:41:23
(I am running Linux Ubuntu 9.10, so the extension for an executable is executablefile.out) I am just getting into modular programming (programming with multiple files) in C and I want to know how to compile multiple files in a single makefile. For example, what would be the makefile to compile these files: main.c, dbAdapter.c, dbAdapter.h? (By the way, If you haven't figured it out yet, the main function is in main.c) Also could someone post a link to the documentation of a makefile? The links posted are all good. For you particular case you can try this. Essentially all Makefiles follow this

Android组件化方案及组件消息总线modular-event实战

蓝咒 提交于 2019-11-29 13:09:45
背景 组件化作为Android客户端技术的一个重要分支,近年来一直是业界积极探索和实践的方向。美团内部各个Android开发团队也在尝试和实践不同的组件化方案,并且在组件化通信框架上也有很多高质量的产出。最近,我们团队对美团零售收银和美团轻收银两款Android App进行了组件化改造。本文主要介绍我们的组件化方案,希望对从事Android组件化开发的同学能有所启发。 为什么要组件化 近年来,为什么这么多团队要进行组件化实践呢?组件化究竟能给我们的工程、代码带来什么好处?我们认为组件化能够带来两个最大的好处: 提高组件复用性 可能有些人会觉得,提高复用性很简单,直接把需要复用的代码做成Android Module,打包AAR并上传代码仓库,那么这部分功能就能被方便地引入和使用。但是我们觉得仅仅这样是不够的,上传仓库的AAR库是否方便被复用,需要组件化的规则来约束,这样才能提高复用的便捷性。 降低组件间的耦合 我们需要通过组件化的规则把代码拆分成不同的模块,模块要做到高内聚、低耦合。模块间也不能直接调用,这需要组件化通信框架的支持。降低了组件间的耦合性可以带来两点直接的好处:第一,代码更便于维护;第二,降低了模块的Bug率。 组件化之前的状态 我们的目标是要对团队的两款App(美团零售收银、美团轻收银)进行组件化重构,那么这里先简单地介绍一下这两款应用的架构。总的来说

Compile multiple C files with make

混江龙づ霸主 提交于 2019-11-28 16:47:09
问题 (I am running Linux Ubuntu 9.10, so the extension for an executable is executablefile.out) I am just getting into modular programming (programming with multiple files) in C and I want to know how to compile multiple files in a single makefile. For example, what would be the makefile to compile these files: main.c, dbAdapter.c, dbAdapter.h? (By the way, If you haven't figured it out yet, the main function is in main.c) Also could someone post a link to the documentation of a makefile? 回答1: The

补码原理——负数为什么要用补码表示

…衆ロ難τιáo~ 提交于 2019-11-28 16:17:46
文首 我们都知道负数在计算机中是以补码(忘了补码定义的戳这里)表示的,那为什么呢?本文尝试了解补码的原理,而要想理解它,首先得理解算术中“模”的概念。所以首先看一下什么是模,然后通过一个小例子来理解补码。 1 模(Modulo) 1.1 什么是模数 In mathematics, modular arithmetic is a system of arithmetic for integers, where numbers “wrap around” upon reaching a certain value—the modulus (plural moduli). 1.1.1 理解 模是指一个计量系统的计数范围。如时钟等。计算机也是一个计算器,它也是有一个计量范围,即都存在一个“模”。 如时钟的计量范围是0~11,模 = 12。 32位计算机的计量范围是2^32,模 = 2^32。 “模”是计量器产生“溢出”的量,它的值在计量器上表示不出来,计量器上只能表示出模的余数,如12的余数有0,1,2,3,4,5,6,7,8,9,10,11。 1.2 补数 假设当前时针指向11点,而准确时间是8点,调整时间可有以下两种拨法: 一种是倒拨3小时,即:11-3=8 另一种是顺拨9小时:11+9=12+8=8 在以模为12的系统中,加9和减3效果是一样的,因此凡是减3运算,都可以用加9来代替

How can I create C header files [closed]

余生长醉 提交于 2019-11-27 10:03:36
I want to be able to create a collection of functions in a header file that I could #include in one of my C Programs. Pablo Santa Cruz Open your favorite text editor Create a new file named whatever.h Put your function prototypes in it DONE. Example whatever.h #ifndef WHATEVER_H_INCLUDED #define WHATEVER_H_INCLUDED int f(int a); #endif Note: include guards (preprocessor commands) added thanks to luke. They avoid including the same header file twice in the same compilation. Another possibility (also mentioned on the comments) is to add #pragma once but it is not guaranteed to be supported on

Why is −1 > sizeof(int)?

∥☆過路亽.° 提交于 2019-11-27 05:34:05
Consider the following code: template<bool> class StaticAssert; template<> class StaticAssert<true> {}; StaticAssert< (-1 < sizeof(int)) > xyz1; // Compile error StaticAssert< (-1 > sizeof(int)) > xyz2; // OK Why is -1 > sizeof(int) true? Is it true that -1 is promoted to unsigned(-1) and then unsigned(-1) > sizeof(int) . Is it true that -1 > sizeof(int) is equivalent to -1 > size_t(4) if sizeof(int) is 4. If this is so why -1 > size_t(4) is false? Is this C++ standard comformant? The following is how standard (ISO 14882) explains abort -1 > sizeof(int) Relational operator `>' is defined in 5

Fast n choose k mod p for large n?

删除回忆录丶 提交于 2019-11-26 21:41:04
What I mean by "large n" is something in the millions. p is prime. I've tried http://apps.topcoder.com/wiki/display/tc/SRM+467 But the function seems to be incorrect (I tested it with 144 choose 6 mod 5 and it gives me 0 when it should give me 2) I've tried http://online-judge.uva.es/board/viewtopic.php?f=22&t=42690 But I don't understand it fully I've also made a memoized recursive function that uses the logic (combinations(n-1, k-1, p)%p + combinations(n-1, k, p)%p) but it gives me stack overflow problems because n is large I've tried Lucas Theorem but it appears to be either slow or

How to create a modular JSF 2.0 application?

試著忘記壹切 提交于 2019-11-26 17:05:23
I have an application with a well defined interface. It uses CDI for resolution of the modules, (Specifically it uses Instance<> injection points on API interfaces to resolve modules) and passes various data back and fourth via the interfaces without issue. I've intentionally kept the API and implementation separate, and the modules only inherit from the API to avoid tight coupling, and the application only knows of the modules through runtime dependancies, and data passing accomplished via the APIs. The application runs fine without the modules, which can be added simply by dropping the jar

How can I create C header files [closed]

雨燕双飞 提交于 2019-11-26 14:59:56
问题 I want to be able to create a collection of functions in a header file that I could #include in one of my C Programs. 回答1: Open your favorite text editor Create a new file named whatever.h Put your function prototypes in it DONE. Example whatever.h #ifndef WHATEVER_H_INCLUDED #define WHATEVER_H_INCLUDED int f(int a); #endif Note: include guards (preprocessor commands) added thanks to luke. They avoid including the same header file twice in the same compilation. Another possibility (also