小编Aar*_*esh的帖子

使用图表API获取Facebook好友帖子

我正在尝试构建一个需要访问朋友的帖子的应用程序.是否可以使用图形API检索朋友的墙贴?我在开发者控制台检查了一下,发现没有这样的功能.如果可能,有人可以解释我如何去检索它?

facebook graph posts

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

本机内存分配 (mmap) 未能映射用于提交保留内存的字节

我在 AWS t2.micro 实例中运行一个下载服务器,我为我的 java 进程配置了 512 MB 的最大堆和 256 MB 的最小堆。我正在从谷歌驱动器下载文件(大小 < 50MB)的单个线程中执行迁移类型的过程。但是当我运行它时,我收到以下错误

error='Cannot allocate memory' (errno=12) # # There is insufficient memory for the Java Runtime Environment to continue. # Native memory allocation (mmap) failed to map 33558528 bytes for committing reserved memory.
Run Code Online (Sandbox Code Playgroud)

以下是 hs_err_pid13942.log 的摘录

虚拟机参数:

jvm_args: -Xms256m -Xmx512m -XX:PermSize=32m -XX:MaxPermSize=64m -XX:+HeapDumpOnOutOfMemoryError
Run Code Online (Sandbox Code Playgroud)

这是我的记忆信息

/proc/meminfo:
MemTotal:        1016324 kB
MemFree:           58792 kB
Buffers:             344 kB
Cached:            15984 kB
SwapCached:            0 kB
Active:           899232 kB
Inactive:          14664 kB
Active(anon):     897692 …
Run Code Online (Sandbox Code Playgroud)

java linux memory memory-management out-of-memory

5
推荐指数
0
解决办法
3819
查看次数

Redis将所有密钥从一个数据库移动到另一个数据库

是否有将Redis密钥从一个数据库移动到另一个数据库的命令,还是只有使用lua脚本才有可能?

曾经有人问过这种类型的问题,但是以前redis会移动所有键,但答案并不恰当,这对于像我这样的初学者来说很有说服力。

redis

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

实例化枚举

下面的代码给我带来了很多错误.那么为什么不可能只有一个像下面的枚举只有构造函数,以便它可以实例化其他地方?

public  class TestEnum{
     enum Animal
     {
         public Animal(String name)
         {
             this.name = name;
         }
         String name;
     }
}
Run Code Online (Sandbox Code Playgroud)

有没有任何方法来实现枚举或它是否违反了枚举的基本属性/功能,它应该只用于创建一组,比如说现成的对象?

java enums

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

说明redis.call()和redis.pcall()之间的区别

我尝试执行以下错误的eval命令来理解redis.call()和redis.pcall()之间的区别

eval "return redis.call(ARGV[2],KEYS[1])" 1 key get   
eval "return redis.pcall(ARGV[2],KEYS[1])" 1 key get
Run Code Online (Sandbox Code Playgroud)

在这两种情况下,我都得到了以下错误,

(error) Lua redis() command arguments must be strings or integers
Run Code Online (Sandbox Code Playgroud)

此错误不会传达redis.call()和redis.pcall()之间的区别,如文档所示

"redis.call()类似于redis.pcall(),唯一的区别是如果Redis命令调用将导致错误,redis.call()将引发Lua错误,反过来将强制EVAL返回命令调用程序出错,而redis.pcall将捕获错误,返回表示错误的Lua表."

所以根据文档,在使用redis.pcall()的情况下,错误应该被困,对吧!在那种情况下为什么两个错误都相同?如果我误解了差异,那么如果有人能够清楚地说明命令之间的区别,那就更好了!!

lua eval redis

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

尝试使用openssl发送邮件时握手失败

我正在尝试使用openssl从终端发送邮件,通过端口465上的ssl连接到gmail的服务器.一切正常,直到我从地址输入并进行身份验证.但是当我输入RCPT TO时,我收到以下错误.

RCPT TO: <abc@gmail.com>
RENEGOTIATING
139815845389984:error:1409E0E5:SSL routines:SSL3_WRITE_BYTES:ssl handshakefailure:s3_pkt.c:59
Run Code Online (Sandbox Code Playgroud)

我可以猜测问题可能是由于缺少安全证书.有人可以帮我解决问题吗?

linux terminal openssl smtp

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

使用SMPP在JAVA中发送短信文本

我正在尝试使用JAVA发送短信.谷歌搜索后,我发现SMPP协议将用于它,并偶然发现下面的源代码.

public class SendSMS
{
public static void main(String[] args) throws Exception
{
    SendSMS obj = new SendSMS();
    SendSMS.sendTextMessage("<mobile number>");
}

private TimeFormatter tF = new AbsoluteTimeFormatter();

/*
 * This method is used to send SMS to for the given MSISDN
 */
public void sendTextMessage(String MSISDN)
{

    // bind param instance is created with parameters for binding with SMSC
    BindParameter bP = new BindParameter(
            BindType.BIND_TX, 
            "<user_name>",
            "<pass_word>", 
            "<SYSTEM_TYPE>", 
            TypeOfNumber.UNKNOWN,
            NumberingPlanIndicator.UNKNOWN,
            null);

    SMPPSession smppSession = null;

    try
    {
        // smpp session …
Run Code Online (Sandbox Code Playgroud)

java smpp jsmpp

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

在数组中查找具有最大度数的最小子数组的长度

我尝试在hackerrank中解决一个问题,即找到数组中最大度数的最小子数组的长度.数组的最大度数是具有最大频率的元素的数量.例如,考虑示例{2,2,1,2,3,1,1} min子阵列长度为4,因为2具有最大度,而具有3度的最小子阵列是{2,2, 1,2}

以下是我解决问题的方法

public class FindingMinSubArrayWithDegree {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        for (int i = 0; i < n; i++) {
            arr[i] = sc.nextInt();
        }
        System.out.println(degreeOfArray(arr));
        sc.close();
    }

    static int degreeOfArray(int[] arr) {
        HashMap<Integer, Integer> numbersByDegree = new HashMap<Integer, Integer>();
        for (int i = 0; i < arr.length; i++) {
            int degree = numbersByDegree.getOrDefault(arr[i], 0);
            numbersByDegree.put(arr[i], degree + 1);
        }
        List<Map.Entry<Integer, Integer>> sortedEntries …
Run Code Online (Sandbox Code Playgroud)

java arrays algorithm time-complexity

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

尝试验证数字签名时出现异常

我运行一个java程序来验证数字签名

package com.cryptography;

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.KeyFactory;
import java.security.NoSuchAlgorithmException;
import java.security.PublicKey;
import java.security.Signature;
import java.security.SignatureException;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.X509EncodedKeySpec;

public class VerifyDkimSignature {
    public static void main(String[] args) {
        FileInputStream fis;
        try {
            //Read encoded public key bytes
            fis = new FileInputStream
                    ("/home/src/com/cryptography/DkimPublicKey");
            byte[] encKey = new byte[fis.available()];
            fis.read(encKey);
            fis.close();

            //Generate public key
            X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(encKey);
            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
            PublicKey pubKey = keyFactory.generatePublic(pubKeySpec);

            //Read signature bytes from file
            BufferedInputStream …
Run Code Online (Sandbox Code Playgroud)

java verification cryptography digital-signature

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

运行 sqlplus 时加载共享库时出错

我正在尝试在我的 ubuntu 机器上安装和运行 sqlplus。我收到上述错误

error while loading shared libraries: libclntsh.so.12.1: cannot open shared object file: No such file or directory
Run Code Online (Sandbox Code Playgroud)

当我跑

sudo sqlplus64 <user>/<pass>@//<ip>:<port>/db
Run Code Online (Sandbox Code Playgroud)

尽管遵循 oracle 安装客户端文档中提到的步骤https://help.ubuntu.com/community/Oracle%20Instant%20Client

我已正确设置 ORACLE_HOME 和 LD_LIBRARY_PATH 我的 strace sqlplus /nolog 输出显示以下错误

write(2, "SP2-0667: Message file sp1<lang>"..., 47SP2-0667: Message file sp1<lang>.msb not found
) = 47
write(2, "SP2-0750: You may need to set OR"..., 76SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory
) = 76
Run Code Online (Sandbox Code Playgroud)

如果需要,我还可以附上完整的 strace。有人可以帮我解决这个问题吗?

oracle ubuntu sqlplus

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