小编Jas*_*per的帖子

在 Java Spark 中使用 Jackson 2.9.9

我正在尝试使用 MLLIB 库 (java),但我的依赖项之一使用 Jackson 2.9.9。我注意到提出了一个拉取请求,以便主分支的依赖项升级到这个特定版本。现在我想使用这个主分支,所以我使用./dev/make-distribution.sh. 但不确定要将哪些 jar 包复制到我的项目中。我试图复制所有 3.0.0 快照,但最终class file for scala.Cloneable not found在我的 Java 程序中得到了一个。

我还在./build/mvn -DskipTests install~/.m2 下安装了 SNAPSHOT 依赖项。

我将它们添加到 gradle 构建文件中

    // https://mvnrepository.com/artifact/org.apache.spark/spark-core
    compile group: 'org.apache.spark', name: 'spark-core_2.12', version: '3.0.0-SNAPSHOT'

    // https://mvnrepository.com/artifact/org.apache.spark/spark-mllib
    compile group: 'org.apache.spark', name: 'spark-mllib_2.12', version: '3.0.0-SNAPSHOT'
Run Code Online (Sandbox Code Playgroud)

但是在 java 11 下执行时,它会抱怨:

Exception in thread "main" java.lang.NoSuchFieldError: JAVA_9
    at org.apache.spark.storage.StorageUtils$.<init>(StorageUtils.scala:207)
Run Code Online (Sandbox Code Playgroud)

由于 java 9 不再可用,我想知道如何进一步调试这个问题。我假设至少需要 java 9 但该字段不再存在?

java jackson apache-spark apache-spark-mllib

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

Python正则表达式与密码子

努力争取RE再次搜索序列'TAA'(3个字符的三元组)'TAA'.

我尝试了以下方法:

re.findall('TAA...+?TAA',seq) 这当然不会给三胞胎,但确实给了我序列

re.findall('TAA([ATGC]{3})+?TAA' , seq) 但是给我一个列表作为输出

'AGG', 'TCT', 'GTG', 'TGG', 'TGA', 'TAT',
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?因为我当然可以检查输出

re.findall('TAA...+?TAA',seq)

如果长度%3 == 0,但如何用RE做到这一点?

python regex

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

检查字符串中的字符串

我有一个包含许多字符串的巨大列表:

['xxxx','xx','xy','yy','x',......]
Run Code Online (Sandbox Code Playgroud)

现在我正在寻找一种有效的方法来删除另一个字符串中存在的所有字符串.例如'xx''x'适合'xxxx'.

由于数据集很大,我想知道旁边是否有一种有效的方法

if a in b:

完整的代码:可能有一些优化部分:

for x in range(len(taxlistcomplete)):
if delete == True:
    x = x - 1
    delete = False
for y in range(len(taxlistcomplete)):
    if taxlistcomplete[x] in taxlistcomplete[y]:
        if x != y:
            print x,y
            print taxlistcomplete[x]
            del taxlistcomplete[x]
            delete = True
            break
    print x, len(taxlistcomplete)
Run Code Online (Sandbox Code Playgroud)

代码的更新版本:

for x in enumerate(taxlistcomplete):
if delete == True:
    #If element is removed, I need to step 1 back and continue looping.....
    delete = False
for y in enumerate(taxlistcomplete):
    if …
Run Code Online (Sandbox Code Playgroud)

python string comparison list

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

加载本地infile不允许perl mysql

谁知道如何在Ubuntu上的最新MySQL中打开加载本地infile设置?我编辑了 /etc/mysql/my.cnf文件并添加了

local-infile=1
Run Code Online (Sandbox Code Playgroud)

并在Perl代码中

dbConnectString=dbi:mysql:orthomcl:mysqllocalinfile=1
Run Code Online (Sandbox Code Playgroud)

但仍然得到

DBD::mysql::st execute failed: The used command is not allowed with this MySQL version...
Run Code Online (Sandbox Code Playgroud)

它由名为OrthoMCL的应用程序使用

我尝试配置my.cnf文件:

sudo vim /etc/mysql/my.cnf

[mysqld]
user            = mysql
pid-file        = /var/run/mysqld/mysqld.pid
socket          = /var/run/mysqld/mysqld.sock
port            = 3306
basedir         = /usr
datadir         = /var/lib/mysql
tmpdir          = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
local-infile = 1
[mysql]
#no-auto-rehash # faster start of mysql but no tab completition
local-infile = 1
Run Code Online (Sandbox Code Playgroud)

然后重启mysql服务器:

sudo service mysql restart
mysql stop/waiting
mysql start/running, process …
Run Code Online (Sandbox Code Playgroud)

mysql perl

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

SPARQL字符串RANGE

我试图通过使用索引号提取字符串的一部分.当有

"OEIUFHWOIEFWNFOPQWJFHQWOIHFEB..."
Run Code Online (Sandbox Code Playgroud)

我需要字符串,5:10 (FHWOIE)我发现它不可能通过REGEX,因为它只返回布尔而不返回组.但是,我没有设法通过位置找到字符串上的区域选择.现在我想知道是否有?

我发现部分可能通过......

BIND(REPLACE(?sequence, '^.{100}', "") AS ?sequencestrip1)
Run Code Online (Sandbox Code Playgroud)

但不是

BIND(REPLACE(?sequence, '^.{?start}', "") AS ?sequencestrip1)
Run Code Online (Sandbox Code Playgroud)

我认为这适用于任何有兴趣的人:

BIND(REPLACE(?sequence, "^.{"+str(?start)+"}", "") AS ?sequencestrip1)
Run Code Online (Sandbox Code Playgroud)

当然要删除你感兴趣的区域

BIND(REPLACE(?region, ".{"+str(strlen(?region)-10)+"}$", "") AS ?upstream)
Run Code Online (Sandbox Code Playgroud)

string sparql selection region

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

子图大小python

我现在面临的问题可以在图片中看到

这是左下图中的Y轴是大的,从-100到+600.有没有办法修改这个?我尝试了很多,但找不到它.

    # the random data
    x = np.random.randint(0,500,100000)
    y = np.random.randn(100000)



    fig = plt.figure(1, figsize=(5.5,5.5))

    from mpl_toolkits.axes_grid1 import make_axes_locatable

    # the scatter plot:
    axScatter = plt.subplot(111)
    axScatter.scatter(x, y)
    axScatter.set_aspect(1.)
    # create new axes on the right and on the top of the current axes
    # The first argument of the new_vertical(new_horizontal) method is
    # the height (width) of the axes to be created in inches.
    divider = make_axes_locatable(axScatter)
    axHistx = divider.append_axes("top", 1.2, pad=0.1, sharex=axScatter)
    axHisty = divider.append_axes("right", 1.2, pad=0.1, …
Run Code Online (Sandbox Code Playgroud)

python matplotlib subplot

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

来自主题的 sparql 完整树

例如,当我有一个人图时,例如约翰和约翰有一个工作地址家庭地址电话号码关系等。

是否有可能在不知道它是什么的情况下检索与 john 和 john 的子类相关的所有内容?

这样我就可以检索例如以下内容

John < address < house_number
     < mobile_number
     < company < address
               < function < office number < etc...

And retrieve this via:
     "John" rdfs:everything ?everything ... as deep as the tree goes.
Run Code Online (Sandbox Code Playgroud)

还是我需要知道图表?

tree rdf sparql

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

python中的副本列表

因为我正在尝试制作列表的副本,并使用列表的副本做一些事情.不知何故,我的原始列表也被修改了.我已经看过不同的内存分配和不同的分配方式.到目前为止没有运气......有什么想法?

    row = 0
    column = 0
    table1 = copy.copy(table[:])

    temptable = []
    temptable = table[:]

    print id(table)
    print table
    print id(table1)
    print table1
    print id(temptable)
    print temptable

    for i in temptable:
        for j in i:
            if type(j) == str:
                temptable[row][column] = 0
            column = column + 1
        column = 0
        row = row + 1
    result=[]   

    for column in zip(*temptable):
        try:
                result.append(sum(map(int,column)))
            except ValueError:
                result.append(0)


    print table
    print table1
    print temptable
Run Code Online (Sandbox Code Playgroud)

/ ####结果

163783148
[[0, 'ZZZ', 'XXX', 'YYY', 'AAA', …
Run Code Online (Sandbox Code Playgroud)

python memory list multidimensional-array

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

chdir未声明,编译错误g ++

我正在尝试编译一个我从网上获得的相对简单的应用程序.

运行make时出现以下错误:

In file included from main.cpp:2:0:
os.h: In function ‘void myOpenDir(const char*)’:
os.h:13:16: error: ‘chdir’ was not declared in this scope
Run Code Online (Sandbox Code Playgroud)

os.h文件如下所示:

#ifndef OS_H
#define OS_H


#if defined(__GNUG__)

#define INT64 long long
#define UINT64 unsigned long long
#include <dirent.h>
#define SPRTR '/'
void myOpenDir(const char* dirpath)
{
    chdir(dirpath);
}

#elif defined(_MSC_VER)
    #define INT64 __int64
    #define UINT64 unsigned __int64
    #include <direct.h>
    #define SPRTR '\\'
    void myOpenDir(const char* dirpath)
    {
        _chdir(dirpath);
    }
        #else
        #error "Platform not supported. Need to update source …
Run Code Online (Sandbox Code Playgroud)

compilation g++ chdir

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

MySQL OR语句输出没有意义

尝试此查询时:

SELECT * FROM superpart WHERE
Brick_subpart_id = 603 OR 145;
Run Code Online (Sandbox Code Playgroud)

输出是:

'200', '144'
'10002', '144'
'620', '145'
Run Code Online (Sandbox Code Playgroud)

为什么"144"会出现?我不要求603到145之间的范围对吗?即便如此,144低于145 ......

mysql

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