小编Nav*_*oid的帖子

如何在MySQL中使用自动增量字段复制行并插入同一个表中?

我有一张桌子Eg- tab.我要做的是复制一个自动增量列ID = 1的行,并将数据插入到同一个表中,行和列ID = 2.

使用MySql.如何在单个查询中执行此操作?请帮助

mysql sql copy insert

211
推荐指数
7
解决办法
41万
查看次数

加密视频文件?

我正在使用此方法加密视频文件:

public static void encryptToBinaryFile(String password, byte[] bytes, File file) throws EncrypterException {
    try {
        final byte[] rawKey = getRawKey(password.getBytes());
        final FileOutputStream ostream = new FileOutputStream(file, false);

        ostream.write(encrypt(rawKey, bytes));
        ostream.flush();
        ostream.close();

    } catch (IOException e) {
        throw new EncrypterException(e);
    }
}

private static byte[] encrypt(byte[] raw, byte[] clear) throws EncrypterException {
    try {
       final SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
       final Cipher cipher = Cipher.getInstance("AES");
       cipher.init(Cipher.ENCRYPT_MODE, skeySpec);

       return cipher.doFinal(clear);

    } catch (Exception e) {
        throw new EncrypterException(e);
    }
}
Run Code Online (Sandbox Code Playgroud)

但它给出了一个错误Outofmemoryerror说拒绝分配301023321元素. …

java encryption android file out-of-memory

14
推荐指数
2
解决办法
2万
查看次数

带HTML的JSP输出字符串?

我想在JSP页面中输出一个字符串.该字符串包含HTML标记.如何在JSP中显示字符串的HTML版本?

例如

            `String str = "<b><u>bold and underlined</u></b>"`;
Run Code Online (Sandbox Code Playgroud)

在JSP中,我使用 <%=str%>

不显示字符串的HTML版本(带有粗体和下划线的文本),而是显示上面的字符串.你能帮我吗?

我也试过了

                   <% out.print(str); %>
Run Code Online (Sandbox Code Playgroud)

但是对我没有用.

html string jsp

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

如何从Byte阵列播放视频?

我正在开发一个需要加密视频文件的应用程序,它运行得很好.但是我用来解密的方法返回像Byte数组一样的视频.所以无论如何我可以使用该阵列播放视频而无需创建新文件.

我的方法解密:

  private static byte[] decrypt(byte[] raw, byte[] encrypted) throws EncrypterException {
SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
try {
    final Cipher cipher = Cipher.getInstance("AES");
    cipher.init(Cipher.DECRYPT_MODE, skeySpec);

    return cipher.doFinal(encrypted);

} catch (Exception e) {
    throw new EncrypterException(e);
}
}
Run Code Online (Sandbox Code Playgroud)

请帮帮我,我被困在这里?

java encryption android bytearray

8
推荐指数
2
解决办法
8747
查看次数

使用Context.CONNECTIVITY_SERVICE检查Internet连接

我正在使用此代码检查互联网连接:

private boolean checkInternetConnection() {
    ConnectivityManager cm = (ConnectivityManager)
                              getSystemService(Context.CONNECTIVITY_SERVICE);
    // test for connection
    if (cm.getActiveNetworkInfo() != null
            && cm.getActiveNetworkInfo().isAvailable()
            && cm.getActiveNetworkInfo().isConnected()) {
        return true;
    } else {
        return false;
    }
}
Run Code Online (Sandbox Code Playgroud)

但即使我关闭wifi,它仍然会返回true.

在仿真器和设备上尝试了相同的结果?
怎么了 ?

networking android

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

在java中将图像嵌入到HTML中?

我有这个代码,我试图从Url读取图像:

   public class question_insert {
public static String latex(String tex) throws IOException {

    String urltext = "http://chart.apis.google.com/chart?cht=tx&chl="+tex;

    URL url = new URL(urltext);
    BufferedReader in = new BufferedReader(new InputStreamReader(url
            .openStream()));
    String inputLine;

    while ((inputLine = in.readLine()) != null) {
        // Process each line.
        System.out.println(inputLine.toString());

    }
    in.close();

    return inputLine;}
Run Code Online (Sandbox Code Playgroud)

但我得到的是无法读取的代码.网址只提供一张图片试试这个:

http://chart.apis.google.com/chart?cht=tx&chl=2+2%20\frac{3}{4}

我该怎么做才能将图像嵌入到Html中?

html java image embedded-resource

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

加快加密速度?

我有这个代码用于加密视频文件.

public static void encryptVideos(File fil,File outfile)
{ 
  try{
    FileInputStream fis = new FileInputStream(fil);
    //File outfile = new File(fil2);
    int read;
    if(!outfile.exists())
      outfile.createNewFile();
    FileOutputStream fos = new FileOutputStream(outfile);
    FileInputStream encfis = new FileInputStream(outfile);
    Cipher encipher = Cipher.getInstance("AES");
    KeyGenerator kgen = KeyGenerator.getInstance("AES");
    //byte key[] = {0x00,0x32,0x22,0x11,0x00,0x00,0x00,0x00,0x00,0x23,0x00,0x00,0x00,0x00,0x00,0x00,0x00};
    SecretKey skey = kgen.generateKey();
    //Lgo
    encipher.init(Cipher.ENCRYPT_MODE, skey);
    CipherInputStream cis = new CipherInputStream(fis, encipher);
    while((read = cis.read())!=-1)
      {
        fos.write(read);
        fos.flush();
      }   
    fos.close();
  }catch (Exception e) {
    // TODO: handle exception
  }
}
Run Code Online (Sandbox Code Playgroud)

但我使用的文件非常大,使用这种方法需要花费太多时间.我怎样才能加快速度呢?

java encryption video android aes

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

R.java文件没有生成?

我正在开发一个工作正常的应用程序.

我尝试了一些新的布局文件但是当我构建项目时,没有生成R.java文件.我尝试了清理和构建项目,但仍然没有生成文件.

  1. 为什么会这样?

  2. 我现在应该怎么做才能重新生成文件?

eclipse android r.java-file

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

用户按下一次后,如何从应用的最后一个屏幕恢复?

在我的应用程序中,我要求如果在应用程序工作期间按下主页按钮,并且如果用户从主屏幕的图标启动应用程序,则必须从上一个活动恢复.

如何保存上一屏幕历史记录并从同一屏幕恢复?

java android android-homebutton

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

导出项目后在bin中找不到.apk文件?

我使用Eclipse indigo导出我的项目,之前工作正常,但现在它正在导出项目,但在bin文件夹中找不到.apk文件.任何人都可以提供一些帮助吗?

android apk

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