如何解析编译一个静态二进制文件,其代码包含一个函数gethostbyname,如果编译时没有像这样的警告:
警告:在静态链接的应用程序中使用'gethostbyname'需要在运行时从用于链接的glibc版本中获取共享库
我使用命令在ubuntu 12.04上编译:
$ gcc -static lookup.c -o lookup
Run Code Online (Sandbox Code Playgroud)
这是lookup.c的代码:
/* lookup.c */
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
extern int h_errno;
int main(int argc,char **argv) {
int x, x2;
struct hostent *hp;
for ( x=1; x<argc; ++x ) {
hp = gethostbyname(argv[x]);
if ( !hp ) {
fprintf(stderr,
"%s: host '%s'\n",
hstrerror(h_errno),
argv[x]);
continue;
}
printf("Host %s : \n" ,argv[x]);
printf(" Officially:\t%s\n", hp->h_name);
fputs(" Aliases:\t",stdout);
for …Run Code Online (Sandbox Code Playgroud) 如何在relativelayout中以编程方式设置重力.我有一个名为chat_viewer_message.xml的XML布局,如下所示:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="4dip"
android:paddingBottom="4dip"
android:gravity="left"
android:background="@drawable/chat_bg_in">
<ImageView
android:id="@+id/avatar"
android:layout_width="32dip"
android:layout_height="32dip"
android:layout_marginLeft="4dip"
android:src="@drawable/avatar_1_1"
/>
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/avatar"
android:paddingLeft="4dip"
/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
编程中的代码视图如下:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final int type = getItemViewType(position);
final View view;
if (convertView == null) {
final int resource = R.layout.chat_viewer_message;
view = activity.getLayoutInflater()
.inflate(resource, parent, false);
if (type == TYPE_MESSAGE)
((TextView) view.findViewById(R.id.text)).setTextAppearance(
activity, appearanceStyle);
} else
view = convertView;
final MessageItem …Run Code Online (Sandbox Code Playgroud) 如何标记结束前身体移动的div </body>.我正在使用openx,我无法更改div内容,因为其他人拥有的内容.我只是从openx中输入代码javascript以获得横幅我<body>在内容中的任何标记之前将代码放在标记之后.我的问题是,当我把javascript中的OpenX产生横幅我得到两个格平行,其旗帜<div id="div1">和<div id="div2">有下面的标签<body>,我想<div id="div1">标签开始后体内<body>的含量点儿标签上面.并且<div id="div2">在任何标签</body>之后标签结束之前.
这是我从openx获取html,如下所示:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="div1"><img src="blablabla" /></div>
<div id="div2"><img src="blablabla" /></div>
Here is content other div id or div class,
I not define example insert after div id footer
Because this is content owned by others.
This is justexample content.
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我想转换如下:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<div id="div1"><img src="blablabla" /></div> …Run Code Online (Sandbox Code Playgroud) 我正在使用Oracle 10g,我在将带双引号的字符串插入表中时遇到问题.这是我的发言
INSERT INTO USERS (ID, NAME, USERNAME) VALUES (NULL, "tes", "hello");
Run Code Online (Sandbox Code Playgroud)
上面的查询失败,并显示错误"此处不允许Oracle列".
如果我将双引号更改为单引号,则如下所示语句成功.
INSERT INTO USERS (ID, NAME, USERNAME) VALUES (NULL, 'tes', 'hello');
Run Code Online (Sandbox Code Playgroud)
但是,我想在表格中插入双引号.
是否可以在insert语句中的字符串中使用双引号?我不想使用REPLACE(),因为我的查询是从数组自动生成的.
在使用OpenX API和XML-RPC2进行连接编码时,我遇到了麻烦.我遇到的问题是fire函数需要的数据类型是dateTime.iso8601.
这是我的代码:
$sdatetime = new DateTime('2013-01-01 00:00:00');
$edatetime = new DateTime('2013-06-01 00:00:00');
$startDate = $sdatetime->format(DateTime::ISO8601);
$endDate = $edatetime->format(DateTime::ISO8601);
try {
$result = $aClient->agencyPublisherStatistics($sessionId, 1, $startDate, $endDate);
print_r($result);
} catch (XML_RPC2_FaultException $e) {
die('Exception #' . $e->getFaultCode() . ' : ' . $e->getFaultString());
}
Run Code Online (Sandbox Code Playgroud)
当我运行上面的脚本时,这是结果错误:
异常#3:传递给方法的参数不正确:通缉dateTime.iso8601,在参数3处得到了字符串
如果我运行print_r(gettype($startDate));我得到的类型数据是字符串而不是日期.
我的问题,对于变量$startDate以及$endDate如何使他们的数据类型成为dateTime.iso8601或date不是string.
谢谢.
我在查询数据时遇到麻烦.我不知道从哪里开始查询if else condition if inside if.
问题是:如何查询其类型= cpm和end_date <now()然后将结果值类型更改为之前,如果其类型= cpm和end_date> now(),则将结果值类型更改为after.我在表中有数据,结果如下:

我想得到如下结果:
Array(
[0] => Array
(
[id] => 1
[type] => free
[end_date] => 2013-06-20
)
[1] => Array
(
[id] => 4
[type] => after
[end_date] => 2013-08-29
)
[2] => Array
(
[id] => 5
[type] => before
[end_date] => 2013-06-20
)
)
Run Code Online (Sandbox Code Playgroud)
提前致谢.
Swift 中isSpaceChar的类Characterstdlib上是否有类似于 Java 中的函数的方程?
在 Java 中,此函数用于从 AsciiValue 字符的值中获取真或假。
例如一个字符空间" "的 AsciiValue 是 32。
如何SUM用查询JOIN表获取查询,我有两个表,我的表是laporan和laporan_pengeluaran.
表laporan
id name shell
9 loli 12000
10 ardi 24000
11 dian 5500
Run Code Online (Sandbox Code Playgroud)
table laporan_pengeluaran
id laporan_id harga
1 9 15000
2 9 29000
3 10 7500
4 10 5000
5 11 3000
6 11 3000
Run Code Online (Sandbox Code Playgroud)
我的问题,如何使用连接表获取SUM,在表laporan中按id/name分组,所以我想获得如下结果:
id name shell harga
9 loli 12000 44000
10 ardi 24000 12500
11 dian 5500 6000
Run Code Online (Sandbox Code Playgroud)
谢谢.
我有两行的表,其中一个ID有自动递增,有很多行的最后一个数字ID是89.然后我截断表中的数据/行.然后我再次插入行.
但是数字ID从90而不是从1(一).如果在mysql中我是否截断表中的数据自动增量再次从1(一)开始.那么如何在oracle中再想一次ID自动增量.感谢名单.
我创建表时的下一步:
// create table;
CREATE TABLE tes (
id NUMBER NULL,
ip_address varchar2(25) NOT NULL
PRIMARY KEY (id)
);
// and create increment;
CREATE SEQUENCE tes_sequence START WITH 1 INCREMENT BY 1;
// and create trigger;
CREATE OR REPLACE TRIGGER tes_trigger
BEFORE INSERT
ON tes
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT tes_sequence.nextval INTO :NEW.ID FROM dual;
END;
Run Code Online (Sandbox Code Playgroud)