小编Ric*_*lli的帖子

如何使用java将图像插入到openoffice编写器文档中?

我正在尝试从模板创建一个openoffice编写器文档.我可以用这段代码替换报告的文本部分

private static void searchAndReplace(final String search,
        final String replace, final XTextDocument mxDoc) {
    XReplaceable xReplaceable = (XReplaceable) UnoRuntime.queryInterface(
            XReplaceable.class, mxDoc);
    XReplaceDescriptor xRepDesc = xReplaceable.createReplaceDescriptor();
    xRepDesc.setSearchString(search);
    xRepDesc.setReplaceString(replace);
    xReplaceable.replaceAll(xRepDesc);
}
Run Code Online (Sandbox Code Playgroud)

我从这里找到了一些示例代码,用于将图像链接或嵌入到xTextDocument中.但是,我无法插入到xTextDocument中.有没有其他方法可以用Java做到这一点?Openoffice版本是3.1.0.

有答案吗?

java openoffice.org image openoffice-writer

5
推荐指数
1
解决办法
3784
查看次数

无法解析'adb version'的输出

我正在使用Ubuntu 11.10和Eclipse进行android开发.我已经创建了一个新项目,但它包含错误:

Failed to parse the output of 'adb version'
Run Code Online (Sandbox Code Playgroud)

如果有人知道我该如何解决这个问题,我将感激不尽?

eclipse ubuntu sdk android adb

5
推荐指数
1
解决办法
7664
查看次数

Crypt和Salt如何比MD5对蛮力攻击更安全?

我在PHP.net上看到MD5没用,他们建议使用crypt + salt.

所以,我去了他们的功能描述并阅读

<?php
$password = crypt('mypassword'); // let the salt be automatically generated

/* You should pass the entire results of crypt() as the salt for comparing a
   password, to avoid problems when different hashing algorithms are used. (As
   it says above, standard DES-based password hashing uses a 2-character salt,
   but MD5-based hashing uses 12.) */
if (crypt($user_input, $password) == $password) {
   echo "Password verified!";
}
?>
Run Code Online (Sandbox Code Playgroud)

或者在我的情况下:

$stored_password=fetch_password($user);
if (crypt($_REQUEST['password'],$stored_password)===$stored_password) {
// ok
}
Run Code Online (Sandbox Code Playgroud)

因此,当我看到salt存储在散列密码中并且您使用散列密码作为salt时,我认为Crypt + Salt对于输出上的暴力(黑客成功窃取哈希密码)并不安全.它更安全吗? …

php md5 crypt

5
推荐指数
1
解决办法
4293
查看次数

在matlab中定义使用函数作为参数的函数

我想定义一个这样的函数:

function f = f1(fun,a,b,c)
f = c*fun(a+b);
Run Code Online (Sandbox Code Playgroud)

fun是我在使用函数时会传递的一些函数f.我怎样才能在Matlab中做到这一点?

matlab

4
推荐指数
2
解决办法
4057
查看次数

如何在perl中找到两个日期之间的差异?

在perl中,根据用户输入的日期,我如何检查从今天起12个月后不会更长?

我试过这种方式:

#!/usr/bin/env perl
use 5.010;
use warnings;
use DateTime;
use Data::Dumper;

$given = DateTime->new( year=>"2013", month => "11", day =>"23" );
$now = DateTime->now;
$delta = $given->delta_md($now);

say $delta->months;
print Dumper($delta);
Run Code Online (Sandbox Code Playgroud)

但我得到的输出是这个.为什么$ delta->月份值与自卸车的价值不同?

11
$VAR1 = bless( {
                 'seconds' => 0,
                 'minutes' => 0,
                 'end_of_month' => 'wrap',
                 'nanoseconds' => 0,
                 'days' => 24,
                 'months' => 23
               }, 'DateTime::Duration' );
Run Code Online (Sandbox Code Playgroud)

perl date

3
推荐指数
1
解决办法
3840
查看次数

htaccess中的变音符重定向

由于变音符号,以下htaccess规则不起作用.

Redirect 301 /xyz/händedruck.html  /new/händedruck.html
Run Code Online (Sandbox Code Playgroud)

如何修改此重定向以使其有效?

php apache .htaccess redirect

3
推荐指数
1
解决办法
1552
查看次数

如何将重复数组作为集合进行比较?

我有两个可能有重复的数组.我需要将它们作为集合进行比较.

例如{1, 4, 9, 16, 9, 7, 4, 9, 11}相当于{11, 11, 7, 9, 16, 4, 1}.我已经尝试了很多方法,但我一直得到错误或错误的答案.这是我现在的代码:

import java.util.Scanner;
public class sameElement{
  public static void main(String[] args){
        int[] value1 = {11, 7, 9, 16, 4, 1};
        int[] value2 = {11, 11, 7, 9, 16, 4, 1};
   sort(value1);
   sort(value2);
   System.out.println(sameSet(value1, value2));

   }
public static boolean sameSet(int[] a, int[] b){
int j = 0;
int counter2 = 0;
for(int i = 0; i < b.length; i++){
  if(a[j] == b[i]){j++;} …
Run Code Online (Sandbox Code Playgroud)

java arrays equals set

3
推荐指数
1
解决办法
1885
查看次数

如何在android中修复windows-1256 xml解析错误?

在android中使用sax解析器解析xml文档时出错.有人可以帮我解决这个错误吗?错误如下所示:

org.apache.harmony.xml.ExpatParser$ParseException: At line 5, column 9: not well-formed (invalid token)
Run Code Online (Sandbox Code Playgroud)

xml文档编码是windows-1256.以下是xml代码中的示例:

<?xml version="1.0" encoding="windows-1256"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>??????? ???? ??????</title>
        <link>http://forum.mn66.com/</link>
        <description>?????,?????? ????,?????,?????,???????,???????,??????,??????,?????,???????,fashion</description>
        <language>ar</language>
        <lastBuildDate>Wed, 23 Nov 2011 08:38:36 GMT</lastBuildDate>
        <generator>vBulletin</generator>
        <ttl>60</ttl>
        <image>
            <url>http://forum.mn66.com/images/Ops_fayez/misc/rss.jpg</url>
            <title>??????? ???? ??????</title>
            <link>http://forum.mn66.com/</link>
        </image>
        <item>
            <title>???? ????? ????</title>
            <link>http://forum.mn66.com/t312645.html</link>
            <pubDate>Wed, 23 Nov 2011 08:31:20 GMT</pubDate>
            <description><![CDATA[?&#8203;?&#8203;???? ?? ????? : [ ????? ????? ??????? &#58974; ] !&#8233;???? ???? : ????? ??????? . .  &#8233;??????? ?? ???? ?? ???????&#8233;????? ?? : ??????? ..&#8233;?? &#1649;??? …
Run Code Online (Sandbox Code Playgroud)

android xml-encoding

1
推荐指数
1
解决办法
1618
查看次数

如何初始化ArrayList的元素?

如何初始化ArrayList的值?

我在互联网上找到了这个,但它不起作用.

ArrayList<Kaart>[] hand = (ArrayList<Kaart>[]) new ArrayList[AANTALSPELERS];
Run Code Online (Sandbox Code Playgroud)

所有元素hand都是null.我得到了一个nullPointerException因为那个.Kaart是我创建的课程.AANTALSPELERS是一个私有静态final int.

java arrays arraylist

1
推荐指数
1
解决办法
2503
查看次数

困惑的Android控件

有人可以告诉我小部件和控件之间的区别是什么?一个定义说,小部件是一个完整的应用程序,位于手机主页上.其他人说这是一个像按钮一样的简单控制.真正的答案是什么?

此外,我在哪里可以找到适用于Android 4.0的完整控件列表.我知道有按钮,复选框,textview,Listcontrol等.我假设没有树视图,但似乎没有任何文档列出所有可用的控件.在.net中有许多常用控件,如果包含其他控件库,还有数百个.我想要一个特定的控件,不知道它是否已经存在或者我是否需要从头开始创建它.

没有关于如何构建自定义控件(我认为称为自定义组件而不是控件)的完整示例,书籍和视频,除了对应使用http://developer.android的类的引用. com/guide/topics/ui/custom-components.html.

我如何绘制它,如何基于用户交互动画它.在互联网上搜索了一个星期之后,我得出的结论是它要么无法完成,要么没有人想出来.

user-controls android

0
推荐指数
1
解决办法
273
查看次数