小编fli*_*ixe的帖子

D3:鼠标悬停时从序号轴获取最接近的值

在我的D3折线图中,我正在尝试创建鼠标悬停效果,如下例所示:http://bl.ocks.org/mbostock/3902569

在这个例子中,作者使用平分函数,据我所知,只支持线性尺度.问题是,在我的图表中,我有一个带有不同的离散rangePoint元组的序数x轴.因此,如果它像下面的情况(m =鼠标位置),我想得到最接近的x值的像素位置,在这个例子中将是x2.

         m
         |
x1----------x2----------x3
Run Code Online (Sandbox Code Playgroud)

有没有办法做到这一点?

javascript d3.js

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

Ubuntu 16.04:Tomcat 8 不会以 setenv.sh 启动

setenv.sh在我的tomcat8/bin目录中创建了一个文件,内容如下:

#!/bin/sh
#
# ENVARS for Tomcat
#
export CATALINA_HOME="/usr/share/tomcat8"

export CATALINA_BASE="/usr/share/tomcat8"

export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java"

# TDS specific ENVARS
#
# Define where the TDS content directory will live
#   THIS IS CRITICAL and there is NO DEFAULT - the
#   TDS will not start without this.
#
CONTENT_ROOT=-Dtds.content.root.path=/var/lib/tomcat8/content

# set java prefs related variables (used by the wms service, for example)
JAVA_PREFS_ROOTS="-Djava.util.prefs.systemRoot=$CATALINA_HOME/content/thredds/javaUtilPrefs \
                  -Djava.util.prefs.userRoot=$CATALINA_HOME/content/thredds/javaUtilPrefs"

#
# Some commonly used JAVA_OPTS settings:
#
NORMAL="-d64 -Xmx4096m -Xms512m -server …
Run Code Online (Sandbox Code Playgroud)

java ubuntu tomcat

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

如何从Windows命令行使用gimpfu运行python脚本?

我正在尝试使用gimp 2.8.22的功能将pdf转换为jpeg,我想使用Windows cmd中的gimpfu库使用python脚本进行此操作(我已经安装了python 3.6.1)。

现在,我不尝试使用示例脚本来做到这一点:

#!/usr/bin/env python

# Hello World in GIMP Python

from gimpfu import *

def hello_world(initstr, font, size, color) :
    # First do a quick sanity check on the font
    if font == 'Comic Sans MS' :
        initstr = "Comic Sans? Are you sure?"

    # Make a new image. Size 10x10 for now -- we'll resize later.
    img = gimp.Image(1, 1, RGB)

    # Save the current foreground color:
    pdb.gimp_context_push()

    # Set the text color
    gimp.set_foreground(color)

    # Create …
Run Code Online (Sandbox Code Playgroud)

python cmd gimp gimpfu

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

Postgres 和大对象:无效的大对象描述符:0

在我的 Java 应用程序中,我使用 LargeObject 接口编写 lo (大对象)类型的二进制数据:

        LargeObjectManager lLOManager = ((org.postgresql.PGConnection) aDatabaseConnection).getLargeObjectAPI();
        long oid = lLOManager.createLO();
        LargeObject lo = lLOManager.open(oid, LargeObjectManager.WRITE);

        if (aBLOB != null)
            lo.write(aBLOB);

        lo.close();
Run Code Online (Sandbox Code Playgroud)

读取表格时,我使用相同的 api 来获取输入流:

LargeObjectManager lLOManager = ((org.postgresql.PGConnection) aDatabaseConnection).getLargeObjectAPI();
            long lOid = aRs.getLong(aIndex);
            if (lOid != 0)
            {
                LargeObject lObj = lLOManager.open(lOid, LargeObjectManager.READ);
                inputStream = lObj.getInputStream();
                lObj.close();
            }
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试读取流时,出现异常:

int number = inputStream.read()
Run Code Online (Sandbox Code Playgroud)

或者替代地

byte[] byteArray = new byte[1024];
int number = inputStream.read(byteArray);
Run Code Online (Sandbox Code Playgroud)

例外:

org.postgresql.util.PSQLException:错误:无效的大对象描述符:0

我在这里总结了代码,因为在我的应用程序中它是分布式的。要点是,当流来自的数据库连接已经关闭时,当前会读取输入流中的内容。然而,这段代码以前可以在 postgres 上运行,现在仍然可以在 oracle 上运行。我尝试将 postgres 驱动程序 9.3 以及 …

java postgresql inputstream resultset

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

标签 统计

java ×2

cmd ×1

d3.js ×1

gimp ×1

gimpfu ×1

inputstream ×1

javascript ×1

postgresql ×1

python ×1

resultset ×1

tomcat ×1

ubuntu ×1