<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ubuntu,debian,redhat -linuxany.com &#187; 4. Programming</title>
	<atom:link href="http://www.linuxany.com/archives/category/programming/feed" rel="self" type="application/rss+xml" />
	<link>http://www.linuxany.com</link>
	<description>ubuntu,debian,redhat,fedora,centos</description>
	<lastBuildDate>Thu, 29 Jul 2010 13:01:19 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>ant应用举例—远程部署web应用</title>
		<link>http://www.linuxany.com/archives/1323.html</link>
		<comments>http://www.linuxany.com/archives/1323.html#comments</comments>
		<pubDate>Wed, 23 Jun 2010 14:55:21 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java/jsp]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[deploy]]></category>
		<category><![CDATA[remote]]></category>
		<category><![CDATA[scp]]></category>
		<category><![CDATA[SSH]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1323</guid>
		<description><![CDATA[打包好web应用时，有时候上传也是比较烦琐，ant需要jsch.jar，可以到SourceForge：jsch，把它放到ant能找到地方，可以放到ANT_HOME/lib下。
然后写target：
&#60;target name=&#34;copy.to.remote&#34; depends=&#34;war&#34;&#62;
&#160; &#160; &#60;scp&#160;file=&#34;${build.dir}/${project.name}.war&#34; todir=&#34;${scp.username}:${scp.passwd}@${scp.host}:${scp.path}&#34; port=&#34;22&#34; trust=&#34;true&#34; verbose=&#34;true&#34;&#62;&#60;/scp&#62;
&#60;/target&#62;
延伸：
•使用时报 com.jcraft.jsch.JSchException: reject HostKey: 192.168.0.123。是没有加 trust=&#8221;true&#8221;，把它加上就好了。
•在 eclipse 中加 ant 额外的lib：首选项->Ant->Runtime->ClassPath->Global Entries，添加额外的jar
您还可能感兴趣的内容ant应用举例—执行源码补丁任务how do I find out all failed login attempts via ssh/telnet? (如何查找通过ssh登陆失败的尝试)Secure your SSH deployment with WiKID two-factor authentication 让debian启动到文本模式Howto perform UDP tunneling through SSH connection]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1323.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ant应用举例—执行源码补丁任务</title>
		<link>http://www.linuxany.com/archives/1311.html</link>
		<comments>http://www.linuxany.com/archives/1311.html#comments</comments>
		<pubDate>Wed, 23 Jun 2010 14:24:42 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java/jsp]]></category>
		<category><![CDATA[ant]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[patch]]></category>
		<category><![CDATA[target]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1311</guid>
		<description><![CDATA[发布的软件难免会有 bug。修改好 bug 后，没有提交到 svn 中，可以生成一个补丁文件，就可以发布这个补丁文件了。我们 down 到补丁文件后，就可fix bug了。比较开源软件的 patch。现我用 hello world 程序来示例下 ant 怎么让程序打上补丁。
假如已经发布了一个软件程序，HelloWorld.java：

package com.chenlb;&#160;&#160; 
&#160; 
public&#160;class HelloWorld {&#160;&#160; 
&#160; 
&#160; &#160; public&#160;static void main(String[] args) {&#160;&#160; 
&#160; &#160; &#160; &#160; String&#160;name = &#34;Hello World!&#34;;&#160;&#160; 
&#160; &#160; &#160; &#160; if(args.length &#62; 0)&#160;{&#160;&#160; 
&#160; &#160; &#160; &#160; &#160; &#160; name = args[0];&#160;&#160; 
&#160; &#160; &#160; [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1311.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>log4c使用—日志文件轮循</title>
		<link>http://www.linuxany.com/archives/1306.html</link>
		<comments>http://www.linuxany.com/archives/1306.html#comments</comments>
		<pubDate>Mon, 21 Jun 2010 14:56:45 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[appender]]></category>
		<category><![CDATA[category]]></category>
		<category><![CDATA[layout]]></category>
		<category><![CDATA[log4c]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1306</guid>
		<description><![CDATA[Log4c基本概念
Log4c中有三个重要的概念, Category, Appender, Layout。
Category用于区分不同的Logger, 其实它就是个logger。在一个程序中我们可以通过Category来指定很多的Logger，用于不同的目的。
Appender用于描述输出流，通过为Category来指定一个Appender，可以决定将log信息来输出到什么地方去，比如stdout, stderr, 文件, 或者是socket等等
Layout用于指定日志信息的格式，通过为Appender来指定一个Layout,可以决定log信息以何种格式来输出，比如是否有带有时间戳， 是否包含文件位置信息等，以及他们在一条log信息中的输出格式的等。

#include &#60;stdio.h&#62;
#include &#60;stdlib.h&#62;
#include &#60;string.h&#62;
#include &#34;log4c.h&#34;
&#160;
#define&#160;LOG(fmt,args...) \
&#160; log_message(__FILE__, __LINE__, __FUNCTION__,fmt ,## args);
&#160;
static&#160;int LOGNUM = 0;
&#160;
const&#160;char *format = &#34;%-5dFunction %20s at line %-5d in file %20s;&#34;;
&#160;
log4c_category_t* mycat = NULL;
&#160;
static&#160;void log_message(char* file, int line, const char* func,
&#160; &#160; &#160; &#160; const&#160;char* a_format, ...) {
&#160; &#160; char *file_info;
&#160; &#160; char *new_format;
&#160; [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1306.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>在vim/vi中快速执行php或c/c++的方法</title>
		<link>http://www.linuxany.com/archives/1277.html</link>
		<comments>http://www.linuxany.com/archives/1277.html#comments</comments>
		<pubDate>Wed, 26 May 2010 11:57:05 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[c]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[vi]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[vimrc]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1277</guid>
		<description><![CDATA[如果使用VIM来编写代码，可能很多朋友就会想了，有没有什么方法来建立一个快捷键，能快速的运行我们所编写的代码呢？！！答案当然是肯定了的，不然也不会写这篇日志来讨论这个问题了。
在介绍方法之前，先来谈一下自己以前的执行方式吧！
先拿PHP来讲吧，最传统的方式就是将编写好的代码放在apache的根目录，然后通过浏览器来运行，或者使用php命令来运行php.可以使用php的r参数
linuxany@~$ php -r &#34;echo 'hqlong';&#34;
来快速测试，或者使用q参数
linuxany@~$ php -q test.php
来运行。

接下来讲怎么将vim支持一键执行。
大致原理是使用键盘映射，将快捷键映射到执行的命令。
在.vimrc中添加
nmap &#60; F5 &#62; &#60; ESC &#62;:!clear &#38;&#38; php -q &#60; C-R &#62;%&#60; cr &#62;
即当我们按下F5时，就相当于执行了如下操作。
1.按下ESC，然后再按下:,进入vim命令行模式
2.执行clear清屏操作。
3.然后运行当前脚本。
4.最后执行回车操作.
下面有几个指令需要解释一下:
< C - R >%:得到当前文件的名字,包括路径.(按ctrl+r,然后再按%)
接下来可以测试一下.
vim /tmp/test.php
&#60; ? php
&#160; &#160; echo&#160;&#34;hqlong&#34;;

?&#62;
保存后,按F5,
就是快速的得出执行结果。
基于c/c++也同样可以做出映射来，比如我们用F6来执行C++代码。
那么就只需在.vimrc中添加
nmap &#60; F6 &#62; &#60; ESC &#62;:!clear &#38;&#38; g++ &#60; C-R &#62;% -o test &#38;&#38; ./test&#60; cr &#62;
这里如果我们测试如下代码。
vim test.cpp
#include &#60; iostream &#62;
using&#160;namespace std;
&#160;
int&#160;main() {
&#160; &#160;&#160; [...]]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1277.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python调用Linux下的动态库(so)</title>
		<link>http://www.linuxany.com/archives/1266.html</link>
		<comments>http://www.linuxany.com/archives/1266.html#comments</comments>
		<pubDate>Sun, 02 May 2010 12:29:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[loadlibrary]]></category>
		<category><![CDATA[so]]></category>

		<guid isPermaLink="false">http://www.linuxany.com/?p=1266</guid>
		<description><![CDATA[1、linuxany.c代码如下： 
#include &#34;stdio.h&#34;
void&#160;display(char* msg){
&#160; &#160; printf(&#34;%s\n&#34;,msg);
}
&#160;
int&#160;add(int a,int b){
&#160; &#160; return&#160;a+b;
}

2、编译c代码，最后生成Python可执行的.so文件 
（1）gcc -c linuxany.c，将生成一个linuxany.o文件 （2）gcc -shared linuxany.c -o linuxany.so，将生成一个linuxany.so文件
3、在Python中调用 
#!/usr/bin/python
&#160;
from&#160;ctypes import * 
import&#160;os&#160; 
//参数为生成的.so文件所在的绝对路径
libtest = cdll.LoadLibrary(os.getcwd() + '/linuxany.so')&#160; 
//直接用方法名进行调用
print&#160;
libtest.display('Hello,I am linuxany.com')&#160; 
print&#160;libtest.add(2,2010)
4、运行结果
Hello,I am linuxany.com2012
您还可能感兴趣的内容Linux下动态库的生成及链接方法解决Debian5编译环境头文件异常的办法Linux 守护进程的编程方法  GCC 4.x 的新特性GCC之C程序是如何编译成的]]></description>
		<wfw:commentRss>http://www.linuxany.com/archives/1266.html/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
