精华内容
参与话题
问答
  • Library

    2014-12-03 23:39:14
    将一个应用打包为Library 设置工程A,右键->Properties->Android,将Is library项选中,然后Apply。 另外一个应用实现 设置工程B,右键->Properties->Android,在Library中,点击Add按 钮,将A工程加入,...

    将一个应用打包为Library  

    设置工程A,右键->Properties->Android,将Is library项选中,然后Apply。

    另外一个应用实现

    设置工程B,右键->Properties->Android,在Library中,点击Add按 钮,将A工程加入,然后Apply。此时在B中就引入了A中的资源和代码,这些资源和代码都可以直接调用。需要注意的是,因为A已经不再是一个完整的 Android应用,而是一个类库工程,所以有一些内容还需要在B中配置一下。比如A中有lib库引用,则B中也要加入该lib库;比如A中的 AndroidManifest.xml文件的内容,在B的AndroidManifest.xml文件中也要相应加上。。。



    二、引用Library库项目:
     
    右键项目文件夹,点击Properties,选择Android,然后点击Add,选择你的库项目,然后Apply,OK。
     
    需要注意的是,在你的项目AndroidManifest.xml中仍然需要声明库项目中需要用到的activity、service、receiver等组件。












    展开全文
  • R语言中library()和require()的区别

    千次阅读 2017-08-06 15:59:20
    While I was sitting in a conference room at UseR! 2014, I started counting the number of times that require() was used in the presentations, and would rant about it after I counted to ten....

    While I was sitting in a conference room at UseR! 2014, I started counting the number of times that require() was used in the presentations, and would rant about it after I counted to ten. With drums rolling, David won this little award (sorry, I did not really mean this to you).

    After I tweeted about it, some useRs seemed to be unhappy and asked me why. Both require() and library() can load (strictly speaking, attach) an R package. Why should not one use require()? The answer is pretty simple. If you take a look at the source code of require (use the source, Luke, as Martin Mächler mentioned in his invited talk), you will see that require() basically means “try to load the package using library() and return a logical value indicating the success or failure”. In other words, library() loads a package, and require() tries to load a package. So when you want to load a package, do you load a package or try to load a package? It should be crystal clear.

    One bad consequence of require() is that if you require('foo') in the beginning of an R script, and use a function bar() in the foo package on line 175, R will throw an error object “bar” not found if foo was not installed. That is too late and sometimes difficult for other people to understand if they use your script but are not familiar with the foopackage – they may ask, what is the bar object, and where is it from? When your code is going to fail, fail loudly, early, and with a relevant error message. require() does not signal an error, and library() does.

    Sometimes you do need require() to use a package conditionally (e.g. the sun is not going to explode without this package), in which case you may use an if statement, e.g.

    if (require('foo')) {
      awesome_foo_function()
    } else {
      warning('You missed an awesome function')
    }
    

    That should be what require() was designed for, but it is common to see R code like this as well:

    if (!require('foo')) {
      stop('The package foo was not installed')
    }
    

    Sigh.

    • library('foo') stops when foo was not installed
    • require() is basically try(library())

    Then if (!require('foo')) stop() is basically “if you failed to try to load this package, please fail”. I do not quite understand why it is worth the circle, except when one wants a different error message with the one from library(), otherwise one can simply load and fail.

    There is one legitimate reason to use require(), though, and that is, “require is a verb and library is a noun!” I completely agree. require should have been a very nice name to choose for the purpose of loading a package, but unfortunately… you know.

    If you take a look at the StackOverflow question on this, you will see a comment on “package vs library” was up-voted a lot of times. It used to make a lot of sense to me, but now I do not care as much as I did. There have been useRs (including me up to a certain point) desperately explaining the difference between the two terms package and library, but somehow I think R’s definition of a library is indeed unusual, and the function library()makes the situation worse. Now I’m totally fine if anyone calls my packages “libraries”, because I know what you mean.

    Karthik Ram suggested this GIF to express “Ah a new library, but requireNoooooo“:

    Since you have read the source code, Luke, you may have found that you can abuse require() a bit, for example:

    > (require(c('MASS', 'nnet')))
    c("Loading required package: c", "Loading required package: MASS",
      "Loading required package: nnet")
    Failed with error:  ‘'package' must be of length 1’
    In addition: Warning message:
    In if (!loaded) { :
      the condition has length > 1 and only the first element will be used
    [1] FALSE
    
    > (require(c('MASS', 'nnet'), character.only = TRUE))
    c("Loading required package: MASS", "Loading required package: nnet")
    Failed with error:  ‘'package' must be of length 1’
    In addition: Warning message:
    In if (!loaded) { :
      the condition has length > 1 and only the first element will be used
    [1] FALSE
    
    > library(c('MASS', 'nnet'), character.only = TRUE)
    Error in library(c("MASS", "nnet"), character.only = TRUE) : 
      'package' must be of length 1
    

    So require() failed not because MASS and nnet did not exist, but because of a different error. As long as there is an error (no matter what it is), require() returns FALSE.

    One thing off-topic while I’m talking about these two functions: the argument character.only = FALSE for library() and require() is a design mistake in my eyes. It seems the original author(s) wanted to be lazy to avoid typing the quotes around the package name, so library(foo) works like library("foo"). Once you show people they can be lazy, you can never pull them back. Apparently, the editors of JSS (Journal of Statistical Software) have been trying to promote the form library("foo")and discourage library(foo), but I do not think it makes much sense now or it will change anything. If it were in the 90’s, I’d wholeheartedly support it. It is simply way too late now. Yes, two extra quotation marks will kill many kittens on this planet. If you are familiar with *nix commands, this idea is not new – just think about tar -z -x -ftar -zxf, and tar zxf.

    One last mildly annoying issue with require() is that it is noisy by default, because of the default quietly = FALSE, e.g.

    > require('nnet')
    Loading required package: nnet
    > require('MASS', quietly = TRUE)
    

    So when I tell you to load a package, you tell me you are loading a package, as if you had heard me. Oh thank you!






    转载自:https://yihui.name/en/2014/07/library-vs-require/


    相关链接:http://www.cnblogs.com/todoit/archive/2012/10/24/2736514.html


    展开全文
  • 什么是库(library)

    千次阅读 2010-06-24 14:30:00
    什么叫程序库 所谓程序库,一般是软件作者为了发布方便、替换方便或二次开发目的,而发布的一组可以单独与应用程序进行compile time或runtime链接的二进制可重定位目标码文件。通俗一点说,所谓一个库,就是一...

    什么叫程序库

    所谓程序库,一般是软件作者为了发布方便、替换方便或二次开发目的,而发布的一组可以单独与应用程序进行compile time或runtime链接的二进制可重定位目标码文件。通俗一点说,所谓一个库,就是一个文件,这个文件可以在编译时由编译器直接链接到可执行程序中,也可以在运行时由操作系统的runtime enviroment根据需要动态加载到内存中。一组库,就形成了一个发布包,当然,具体发布多少个库,完全由库提供商自己决定。

    什么是lib,什么是dll,什么是.a,什么是.so,什么是静态库,什么是动态库

    所谓静态库,就是在静态编译时由编译器到指定目录寻找并且进行链接,一旦链接完成,最终的可执行程序中就包含了该库文件中的所有有用信息,包括代码段、数据段等。所谓动态库,就是在应用程序运行时,由操作系统根据应用程序的请求,动态到指定目录下寻找并装载入内存中,同时需要进行地址重定向。 win32平台下,静态库通常后缀为.lib,动态库为.dll linux平台下,静态库通常后缀为.a,动态库为.so 从本质上来说,由同一段程序编译出来的静态库和动态库,在功能上是没有区别的。不同之处仅仅在于其名字上,也就是“静态”和“动态”。由上面的介绍不难看出,相对于动态库,静态库的优点在于直接被链接进可执行程序中,之后,该可执行程序就不再依赖于运行环境的设置了(当然仍然会依赖于 CPU指令集和操作系统支持的可执行文件格式等硬性限制)。而动态库的优点在于,用户甚至可以在程序运行时随时替换该动态库,这就构成了动态插件系统的基础。具体使用静态库和动态库,由程序员根据需要自己决定。

    补充说明

    另外,需要说明的一点是,从底层实现上,动态库的效率可能会比静态库稍差一点点,注意,这里用了“可能”二字,具体差不差,还得看写程序的人。之所以可能会差,主要原因在于,程序总无法直接调用动态库中的函数符号,而只能通过调用操作系统的runtime enviroment接口来动态载入某个函数符号,同时获得该函数符号在内存中的地址,将其保存为函数指针进行调用,这就在函数调用时增加了一次间接寻址的过程。

    还是那句话,希望大家都能深入opencv源码库中去,不要仅仅满足于会调几个API,这样很难对自己有提高的。深入进去读源码,看看人家是怎么组织软件架构的,怎么划分模块的。实际上,如果任何一个软件体系的层次模块划分足够清晰和灵活的话,移植性就不会成为很大的问题,无非就是字节对齐、部分算法利用特殊指令集进行优化之类的,这些改动应该仅限于局部调整,而不用全盘重写的。软件架构,很重要的一条就是open-close 原则,要清楚哪些是可变的哪些是不可变的。就像上面,将来会发生变化的算法,就可以考虑放到动态库中,以免将来程序统一全部升级。

    另外,在移植软件的过程中,保持接口不变是有多重含义的,我们通常知道的是:

    1. 函数、变量名称不变
    2. 函数、变量语法属性不变(比如一个声明为C形式的函数,必须以C形式对其进行调用,否则由于重载特性会找不到函数名)
    3. 函数返回值类型不变
    4. 函数参数个数不变
    5. 函数参数类型不变

    这里,常常被人们遗忘的,也是最重要的一点是:

    保持函数语义不变

    这是什么意思,对于一段程序,除了词法分析、语法推导之外,还有很重要的一条就是语义分析。简单来说,对于一个函数,必须保持移植前后,该函数的返回值含义不变、参数含义不变、函数内部行为的外部表现不变。忽视其中任意一条,都会造成上层应用程序的行为变为未定义,从而移植失败。

    展开全文
  • 自己写简单的Library

    2018-08-20 13:52:16
    在实际的工作中,肯定会发现有些功能RF自身的Library,或者第三方的Library都无法实现,这个时候我们就得自己写library来实现它了。 不要想的太复杂,太难,其实很简单。 下面我们举例子来演示吧一.编写Library 你有...
    在实际的工作中,肯定会发现有些功能RF自身的Library,或者第三方的Library都无法实现,这个时候我们就得自己写library来实现它了。
    不要想的太复杂,太难,其实很简单。
    下面我们举例子来演示吧
    一.编写Library
    你有3个方法,要自己写library
    1:公式:(a+b)的a次方,a,b是正整数
    2:有一网址(字符串),http://www.example.com?ip=192.187.111.198&code=12345&name=cat,想得到ip内容,即192.187.111.198
    3:(用户名+10位随机数+一个key)进行md5加密

    比如我这样子已经写好了,编译调试一下,确保自己没有错误哦。若是有错误,导入RF会失败哦。
    然后,将这个文件保存的文件名要和这个class的类名一样,所以我把他保存成MyLibrary.py
    二.放置位置及导入
    最后,我们把这个文件放在了RF项目的同一目录下,即可
    如果你放在其他地方,也是可以的,但是导入的时候,地址要写对哦

    来到RF中,我们导入它(记得写.py哦)

    三.确认导入成功
    按F5,是不是看到自己写的那些关键字了?而且还有自己的中文注解哦

    四,使用library
    使用这3个关键字,我们跑一下

    五.查看结果
    运行结果

    想了解更多关于自己写library内容,可以查看官方文档http://robotframework.googlecode.com/hg/doc/userguide/RobotFrameworkUserGuide.html?r=2.8.1#creating-test-libraries
    展开全文
  • 『杭电1553』Library

    2020-08-29 20:39:20
    Problem Description ... One day a ship carrying a royal library has wrecked nearby. Usually Robinson brings any useful stuff from the shipwreck to his island, and this time he has brought a big che
  • 跳出坑爹的 Runtime Library

    千次阅读 2019-04-13 20:22:38
    在 Windows 下进行 C++的开发,不可避免的要与 Windows 的底层库进行交互,然而 VS 下的一项设置 MT、MTd、MD 和 MDd 却经常让人搞迷糊,相信不少人都被他坑过,特别是你工程使用了很多第三库的时候,及容易出现各种...
  • library

    2019-07-28 01:00:07
    NULL 博文链接:https://udukwilliam.iteye.com/blog/770674
  • JAVALibrary

    2015-07-06 11:35:50
    25.图书借阅管理系统 参考表结构: ? 图书(书号,书名,作者,价格) ? 读者(卡号,姓名,性别,单位,类型,级别)(级别:学生2 老师5 教授10) ? 借阅(书号,书名,卡号,借书时间,还书时间)(30天) ...
  • RU FORUM SitemapError report DOWNLOAD ...Libgen.io - 2M (main)Gen.lib.rus.ec - 2M (catalog only)Libgen.pwB-OK.org (BookZZ.org, BookOS.org, BookZa.org)BookFI.netI2P - 2M ...P2P...
  • Library图书馆图书管理系统)
  • Java项目---图书馆

    千次阅读 2019-11-02 14:24:04
    //Library.book包 //book包下 Book类 package Library.book; public class Book { private String name; private String author; private String id ; private int price; private String type; ...
  • 笔者使用的Navicat Premium 12启动界面截屏: 请注意是64位的。...连接Oracle时提示“oracle library is not loaded”。 解决方法: 1.前往“http://www.oracle.com/technetwork/database/database-te...
  • The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path:XXXX出现原因分析:Tomcat建议使用apache的apr,来更好的运行...
  • gcc - shared library vs static library

    千次阅读 2015-04-14 16:47:42
    Shared libraries and static libraries Although the example program above has been successfully compiled and linked, a final step is needed before being able to load and run the executable file.
  • Android Library的创建及使用详解

    万次阅读 2018-01-25 12:18:56
    Android Library和Android APP、Java Library的区别 Android Library在目录结构上与Android App相同,它能包含构建APP所需的一切(如源代码、资源文件、Android Manifest)。Android App最终被编译打包成能在...
  • Oracle Library Cache Lock 解决思路

    万次阅读 2012-09-07 23:26:27
     Library Cache Lock Library cacheHandle 里保存了lock 和 pin 的信息。而且在Library cache handle 和child cursor 上都有lock 和pin。它们称为library cache lock和library cache pin。 Library cachelock/pin...
  • Library Module详解

    千次阅读 2016-08-04 23:40:29
    Create an Android Library原文:https://developer.android.com/studio/projects/android-library.html Android library的结构跟Android app module一样。它里面可以包含:源码,资源文件和Android manifest文件。...
  • Oracle Library Cache 的 lock 与 pin 说明

    千次阅读 2011-07-28 16:29:23
    一. 相关的基本概念之前整理了一篇blog,讲了Library Cache 的机制,参考: Oracle Library cache 内部机制 说明 http://blog.csdn.net/tianlesoftware/article
  • Support Annotation Library使用详解

    千次阅读 2016-12-18 22:20:17
    概述Support Annotation Library是在Android Support Library19.1版本开始引入的一个全新的函数包,它包含了诸多有用的元注解。用来帮助开发者在编译期间发现可能存在的bug。Support Library本身也使用Annotations ...
  • 二、刚开始我下载最新版本Instant Client 发现不好用还是报oracle library is not loaded。换了个低版本的可以连接不在报错。 下面具体步骤 1.连接Oracle时提示“oracle library is not loaded”。 2.直接下载...

空空如也

1 2 3 4 5 ... 20
收藏数 1,003,929
精华内容 401,571
关键字:

library