bsd

How to use list from sys/queue.h?

♀尐吖头ヾ 提交于 2019-12-03 04:52:33
问题 Currently, I have implemented a singly linked list, like so: struct PeerNode { struct Peer* cargo; struct PeerNode* next; }; ...and I have a struct that contains a couple of these linked lists, like so: struct Torrent { ... struct PeerNode* peer_list; struct PeerNode* unchoked_peers; ... } I would like to replace this by using the macros provided by sys/queue.h . I gather that I could replace my code with something like this: struct Torrent { ... LIST_ENTRY(PeerNode, Peer) peer_list; struct

BlockingSenderDestination.sendReceive() UTF-8 issue

匿名 (未验证) 提交于 2019-12-03 01:46:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: In my Blackberry application I am loading JSON using the following method. private static Object loadJson ( String uriStr ){ Object _json = null ; Message response = null ; BlockingSenderDestination bsd = null ; try { bsd = ( BlockingSenderDestination ) DestinationFactory . getSenderDestination ( "CommAPISample" , URI . create ( uriStr )); if ( bsd == null ) { bsd = DestinationFactory . createBlockingSenderDestination ( new Context ( "CommAPISample" ), URI . create ( uriStr ), new JSONMessageProcessor () ); } response = bsd .

How do I timestamp every ping result?

自闭症网瘾萝莉.ら 提交于 2019-12-03 00:14:11
问题 Ping returns this by default: 64 bytes from 203.173.50.132: icmp_seq=0 ttl=244 time=57.746 ms Is there some way I can get it to add the timestamp? For example, Mon 21 May 2012 15:15:37 EST | 64 bytes from 203.173.50.132: icmp_seq=0 ttl=244 time=57.746 ms I'm on OS X v10.7 (Lion) which seems to have some BSD version of ping. 回答1: I could not redirect the Perl based solution to a file for some reason so I kept searching and found a bash only way to do this: ping www.google.fr | while read pong;

How can I detect BSD vs. GNU version of date in shell script

泄露秘密 提交于 2019-12-02 22:35:15
I am writing a shell script that needs to do some date string manipulation. The script should work across as many *nix variants as possible, so I need to handle situations where the machine might have the BSD or the GNU version of date. What would be the most elegant way to test for the OS type, so I can send the correct date flags? EDIT: To clarify, my goal is to use date's relative date calculation tools which seem distinct in BSD and GNU. BSD example date -v -1d GNU example date --date="1 day ago" Use portable flags. The standard is available here For the particular problem of printing a

Linux的不同版本以及应用领域

匿名 (未验证) 提交于 2019-12-02 21:59:42
1.什么是操作系统 2.现实生活中的操作系统 win7 Mac Android iOS 3. 操作系统的发展史 Unix 1965年之前的时候,电脑并不像现在一样普遍,它可不是一般人能碰的起的,除非是军事或者学院的研究机构,而且当时大型主机至多能提供30台终端(30个键盘、显示器),连接一台电脑 为了解决数量不够用的问题 1965年左后由贝尔实验室、麻省理工学院 以及 通用电气共同发起了Multics项目,想让大型主机支持300台终端 1969年前后这个项目进度缓慢,资金短缺,贝尔实验室退出了研究 1969年从这个项目中退出的Ken Thompson当时在实验室无聊时,为了让一台空闲的电脑上能够运行“星际旅行”游行,在8月份左右趁着其妻子探亲的时间,用了1个月的时间 编写出了 Unix操作系统的原型 1970年,美国贝尔实验室的 Ken Thompson,以 BCPL语言 为基础,设计出很简单且很接近硬件的 B语言(取BCPL的首字母),并且他用B语言写了第一个UNIX操作系统。 因为B语言的跨平台性较差,为了能够在其他的电脑上也能够运行这个非常棒的Unix操作系统,Dennis Ritchie和Ken Thompson 从B语言的基础上准备研究一个更好的语言 1972年,美国贝尔实验室的 Dennis Ritchie在B语言的基础上最终设计出了一种新的语言

Good collection of libraries for C? [closed]

☆樱花仙子☆ 提交于 2019-12-02 19:17:27
I'm looking for a good collection of libraries for ANSI-C, stuff for handling vectors, hash maps, binary tress, string processing, etc. Try glib ? It's used by GTK+, but it can also be used on other platforms. You can also try Apache APR , which is used by the Apache web server and some of their other C components, or NSPR , which is used by Mozilla projects in C. gnu's glib collection. furthermore, it's portable for many platforms. BobbyShaftoe You might also find this question useful: Container Class / Library for C As well, this book might be interesting: Mastering Algorithms with C The

How to use list from sys/queue.h?

只愿长相守 提交于 2019-12-02 18:06:29
Currently, I have implemented a singly linked list, like so: struct PeerNode { struct Peer* cargo; struct PeerNode* next; }; ...and I have a struct that contains a couple of these linked lists, like so: struct Torrent { ... struct PeerNode* peer_list; struct PeerNode* unchoked_peers; ... } I would like to replace this by using the macros provided by sys/queue.h . I gather that I could replace my code with something like this: struct Torrent { ... LIST_ENTRY(PeerNode, Peer) peer_list; struct PeerNode* unchoked_peers; ... } Then, from looking at man queue , I believe I would initialize the lists

How do I timestamp every ping result?

大憨熊 提交于 2019-12-02 15:42:38
Ping returns this by default: 64 bytes from 203.173.50.132: icmp_seq=0 ttl=244 time=57.746 ms Is there some way I can get it to add the timestamp? For example, Mon 21 May 2012 15:15:37 EST | 64 bytes from 203.173.50.132: icmp_seq=0 ttl=244 time=57.746 ms I'm on OS X v10.7 (Lion) which seems to have some BSD version of ping. richk I could not redirect the Perl based solution to a file for some reason so I kept searching and found a bash only way to do this: ping www.google.fr | while read pong; do echo "$(date): $pong"; done Wed Jun 26 13:09:23 CEST 2013: PING www.google.fr (173.194.40.56) 56

技术开发手册之Openbiz 概述

こ雲淡風輕ζ 提交于 2019-12-02 09:00:12
什么是 Openbiz Openbiz 是一个应用程序框架,其提供了面向对象的基于元数据驱动的平台,使应用程序开发人员可以通过编写尽可能最少的程序代码就可以建立出 Web 应用程序。 Openbiz 框架从 2003 年开始,并不断由社区开发者和用户的反馈改进。它在诸多领域中得到了广泛的应用。 Openbiz 框架的重点在于帮助开发人员更有效的实现应用层逻辑,为了实现这个目标,框架实现了 “ 基于元数据驱动 ” 的核心理念。有了 Openbiz XML 元数据的神奇力量,开发人员可以: · 在数据表与数据对象之间轻松定义映射关系 (ORM) · 定义如何在用户界面上展示数据 · 定义对象的行为和对象间的映射关系 · 描述数据的增删读改( CRUD )操作,数据查询,数据有效性校验,模板,访问控制,高级缓存,甚至导航流及多数据库操作等 · 定义自动以对象货服务的装载位置 在一个典型的 Openbiz 应用程序中,有大约 80% 比例是由 Openbiz XML 元数据实现的描述代码,及通常少于 20% 的程序代码。 除了以元数据为核心, Openbiz 还是一个全面面向对象的多层框架系统。它同时采用了许多高级 Web 技术,例如 MVC , AJAX 等,及业界先进的开源类库,例如 Zend 框架和 Smarty 模板引擎。 Openbiz 框架是基于 BSD 许可协议发布

grep whole words made of only uppercase letters

て烟熏妆下的殇ゞ 提交于 2019-12-02 05:48:34
问题 Seems like this is rather simple, but I'm having trouble. I have a text document that looks, for example, like this: This is a TEXT DOCUMENT with SOME capitalized words BUT NOT all of them are ALL CAPS iPhone What I would like is to parse this document and match only whole words made up of only uppercase letters, like so: TEXT DOCUMENT SOME BUT NOT ALL CAPS I wrote this: grep -o "\w[[:upper:]]\w" Untitled.txt This gets pretty close but, alas, returns this: TEX DOC UME SOM BUT NOT ALL CAP iPh