问题列表 - 第279872页

如何使用 launchpadlib 获取特定 Ubuntu 系列的完整软件包和版本列表

我正在寻找一些帮助(一个例子会很好)弄清楚如何只获取特定版本的 Ubuntu 的包名称列表。例如,使用 Web 界面我可以简单地在 Launchpad 的 Ubuntu 部分搜索一个包,它会给我所有的子包(组件?),例如:https : //launchpad.net/ubuntu/+源/linux-meta

我正在寻找的是上游包的列表 + 它们的所有子包及其所有依赖项。我目前只对 Ubuntu-17.10-desktop 感兴趣,但我确实关注未来的自动化。

不幸的是,提供的示例列表非常稀少,因此我无法理解要使用哪个函数。

我花了一段时间才到这里,但这是我到目前为止的代码,我希望它使我朝着正确的方向前进:

    import pandas as pd
    from launchpadlib.launchpad import Launchpad
    import launchpadlib as lp

    launchpad = Launchpad.login_anonymously('just testing', 'production', 
    cachedir, version='devel')
    ubuntu = launchpad.distributions['ubuntu']
    series = ubuntu.getSeries(name_or_version='17.10')
    archive = ubuntu.main_archive
    arch_series = series.getDistroArchSeries(archtag='amd64')

    manifest = pd.DataFrame(columns=['asset','pkg_set'])
    pkgs = launchpad.packagesets
    
    for i in range(34):
        name = pkgs.getBySeries(distroseries=series)[i].name
        sources_incl = pkgs.getBySeries(distroseries=series)[i].getSourcesIncluded()
        new_man=pd.DataFrame({'asset':sources_incl,'pkg_set':[name]*len(sources_incl)})
         manifest = manifest.append(new_man,ignore_index=True)
    manifest=manifest.sort_values(by=['asset'])
    
Run Code Online (Sandbox Code Playgroud)

理想情况下,我应该能够稍微修改此脚本以更改为其他 Ubuntu 系列,尤其是较新的版本。但是,我是 API JSON 提取领域的新手,所以我可以使用一些帮助。

比如知道Artful里面有34个包集,我就是通过实验得出的。如果我可以获取一些属性来了解给定系列的答案,那就太好了。

此外,我希望能够获取每个源的版本号,特定于 Artful,但我似乎无法弄清楚除了 …

python ubuntu launchpad

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

如何通过 Dart 中的 async* 传输错误?

在 flutter 中,我们使用 StreamBuilder 和接收流 e 给我们一个包含“数据”但也包含“错误”对象的快照对象。

我想用 async* 制作一个产生数据的函数,但由于某些条件,它也会产生一些错误。我怎样才能在 Dart 中实现这一目标?

Stream<int> justAFunction() async* {
  yield 0;

  for (var i = 1; i < 11; ++i) {
    await Future.delayed(millis(500));
    yield i;
  }

  yield AnyError(); <- I WANT TO YIELD THIS!
}
Run Code Online (Sandbox Code Playgroud)

然后,在 StreamBuilder 中:

StreamBuilder(
            stream: justAFunction(),
            builder: (BuildContext context, AsyncSnapshot<RequestResult> snapshot) {
              return Center(child: Text("The error tha came: ${snapshot.error}")); <- THIS SHOULD BE THE AnyError ABOVE!
            },
          )
Run Code Online (Sandbox Code Playgroud)

dart flutter

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

printf()内的整数运算

C编程新手.为什么下面这段代码的输出不是0 20 0,而是它1 20 0

printf ( "\n%d %d %d", x != 1, x = 20, x < 30 ) ;
Run Code Online (Sandbox Code Playgroud)

我的理解是代码将x分配给1以外的值(1 = true因此!= true为0)?有人能指引我完成逻辑吗?

c integer-arithmetic

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

react-native-elements按钮backgroundColor不起作用

我是React Native的新手。在我的简单测试应用程序中,我想尝试使用react-native-elements 按钮

但是,我无法显示按钮的背景色。

我按照文档进行操作,并尝试添加如下所示的按钮:

import React, { Component } from 'react';
import { Text, View } from 'react-native';
import { Button } from 'react-native-elements';

export default class loginForm extends Component {
  render() {
    return (
      <View>
        <Button
            backgroundColor={'red'}
            title='Login' 
            />
      </View>
    )
  }
}
Run Code Online (Sandbox Code Playgroud)

在App.js中,我将其导入为:

import React from 'react';
import { StyleSheet, Text, View, TouchableHighlight, TextInput } from 'react-native';
import { createStackNavigator, createBottomTabNavigator, createAppContainer } from 'react-navigation';
import loginForm from './app/src/components/loginForm.js'

const TestStack = createStackNavigator(
  {
    Login: {screen: loginForm} …
Run Code Online (Sandbox Code Playgroud)

mobile ios react-native react-native-elements

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

从构造函数中的catch块调用析构函数安全吗?

在我的构造函数中,如果其中包含任何代码,我必须销毁所有剩余资源。我想避免编写重复的代码,所以我只在catch块中调用析构函数即可释放已创建的任何资源。这样安全吗?

我知道如果构造函数抛出异常,则不会调用析构函数,因此我尝试在msvc中编译一些代码,但似乎没有什么错,但是我不确定这是否很幸运。

Object::Object(){
    try{
        // Initialize multiple resources here.
    }catch(...){
        this->~Object(); // Is this safe?
        throw;
    }
}

Object::~Object(){
    // release multiple resources, if initialized.
}
Run Code Online (Sandbox Code Playgroud)

c++ constructor try-catch object-lifetime explicit-destructor-call

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

如何删除网格线但保留主轴

我正在绘制一些群图,并且想删除与数据交叉的网格线,但保留主轴线。

我曾经通过使用 sns.despine() 来完成此操作,但我最近更新了 matplotlib,它出现在某处,不再起作用。我见过的大多数解决方案都删除了主轴和网格线。

例如,推荐一个问题:

ax.grid(False)
Run Code Online (Sandbox Code Playgroud)

这会删除网格线和主轴线。

第二种解决方案建议明确设置书脊颜色:

for spine in ['left','right','top','bottom']:
    ax1.spines[spine].set_color('k')
Run Code Online (Sandbox Code Playgroud)

这对我不起作用。

import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns

%matplotlib inline

df = pd.read_csv('fig3full_tidy.csv', comment = '#')
df.head()

plt.style.use('dark_background')
fig, ax = plt.subplots()

# ax.grid(False)

barwidth = 0.2
temps = [15, 20, 25]
types = ['sc', 'sk', 'direct']
i = 1
for g in types:
    for t in temps:
        ys = df.loc[(df['Temperature'] == t) & …
Run Code Online (Sandbox Code Playgroud)

python matplotlib

7
推荐指数
0
解决办法
3822
查看次数

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

如何将流式数据帧写入 PostgreSQL?

我有一个流数据帧,我正在尝试将其写入数据库。有将 rdd 或 df 写入 Postgres 的文档。但是,我无法找到有关如何在结构化流中完成此操作的示例或文档。

我已阅读文档https://spark.apache.org/docs/latest/structed-streaming-programming-guide.html#foreachbatch,但我无法理解在哪里创建 jdbc 连接以及如何编写它到数据库。

def foreach_batch_function(df, epoch_id):
    # what goes in here?
    pass

view_counts_query = windowed_view_counts.writeStream \
    .outputMode("append") \
    .foreachBatch(foreach_batch_function)
    .option("truncate", "false") \
    .trigger(processingTime="5 seconds") \
    .start() \
    .awaitTermination()
Run Code Online (Sandbox Code Playgroud)

该函数接收常规数据帧并写入 postgres 表

def postgres_sink(config, data_frame):
    config.read('/src/config/config.ini')
    dbname = config.get('dbauth', 'dbname')
    dbuser = config.get('dbauth', 'user')
    dbpass = config.get('dbauth', 'password')
    dbhost = config.get('dbauth', 'host')
    dbport = config.get('dbauth', 'port')

    url = "jdbc:postgresql://"+dbhost+":"+dbport+"/"+dbname
    properties = {
        "driver": "org.postgresql.Driver",
        "user": dbuser,
        "password": dbpass
    }

    data_frame.write.jdbc(url=url, table="metrics", mode="append", …
Run Code Online (Sandbox Code Playgroud)

postgresql apache-spark pyspark spark-structured-streaming

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

.NET Core中的自定义“ CoreLib”?

试图在.NET Core项目中获取自定义CoreLib以便在VS 2017中加载。这在.NET Framework中非常容易,因为您需要的只是“ NoStdLib ”,但使用.NET Core似乎需要更多的部件。我不断收到:“项目文件不完整。预期的导入丢失了。”

<?xml version="1.0" encoding="utf-8"?>
<!--<Project Sdk="Microsoft.NET.Sdk">-->
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

  <PropertyGroup>
        <ProjectGuid>{3DA06C3A-2E7B-4CB7-80ED-9B12916013F9}</ProjectGuid>
    <OutputType>Library</OutputType>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>

    <!--<TargetFramework>netcoreapp2.2</TargetFramework>-->
        <GenerateTargetFrameworkAttribute>false</GenerateTargetFrameworkAttribute>
        <AddAdditionalExplicitAssemblyReferences>false</AddAdditionalExplicitAssemblyReferences>
        <ExcludeMscorlibFacade>true</ExcludeMscorlibFacade>
        <NoStdLib>true</NoStdLib>
        <NoCompilerStandardLib>true</NoCompilerStandardLib>

        <LangVersion>latest</LangVersion>
        <RootNamespace>System</RootNamespace>
  </PropertyGroup>

    <PropertyGroup>
    <AssemblyName>System.Private.CoreLib</AssemblyName>
    <AssemblyVersion>4.0.0.0</AssemblyVersion>
    <MajorVersion>4</MajorVersion>
    <MinorVersion>6</MinorVersion>
    <ExcludeAssemblyInfoPartialFile>true</ExcludeAssemblyInfoPartialFile>
  </PropertyGroup>

</Project>
Run Code Online (Sandbox Code Playgroud)

正在关闭System.Private.CoreLib.csproj在做什么,并且不确定缺少的部分是什么?删除“ Sdk =“ Microsoft.NET.Sdk” “会导致部分问题,因为我认为自定义corelib无法使用

我基于的基础是:https : //github.com/dotnet/coreclr/blob/master/src/System.Private.CoreLib/System.Private.CoreLib.csproj

有谁知道csproj的设置是什么使它起作用?我似乎找不到任何好的信息。

.net c# csproj .net-core

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

如何将 Gradle 插件发布到 Artifactory?

我正在使用这个示例 Gradle 插件项目:https : //github.com/AlainODea/gradle-com.example.hello-plugin

当我运行./gradlew publishToMavenLocal 时,它会在 M2_HOME 中创建这些文件:

  1. com/hello/com.example.hello.gradle.plugin/maven-metadata-local.xml
  2. com/hello/com.example.hello.gradle.plugin/0.1-SNAPSHOT/com.example.hello.gradle.plugin-0.1-SNAPSHOT.pom
  3. com/hello/com.example.hello.gradle.plugin/0.1-SNAPSHOT/maven-metadata-local.xml
  4. com/hello/gradle-com.example.hello-plugin/maven-metadata-local.xml
  5. com/hello/gradle-com.example.hello-plugin/0.1-SNAPSHOT/gradle-com.example.hello-plugin-0.1-SNAPSHOT.jar
  6. com/hello/gradle-com.example.hello-plugin/0.1-SNAPSHOT/gradle-com.example.hello-plugin-0.1-SNAPSHOT.pom
  7. com/hello/gradle-com.example.hello-plugin/0.1-SNAPSHOT/maven-metadata-local.xml

当我运行./gradlew artifactoryPublish 时,它会记录:

Deploying artifact: https://artifactory.example.com/artifactory/libs-release-local-maven/com/example/hello/gradle-com.example.hello-plugin/0.1-SNAPSHOT/gradle-com.example.hello-plugin-0.1-SNAPSHOT.jar
Deploying artifact: https://artifactory.example.com/artifactory/libs-release-local-maven/com/example/hello/gradle-com.example.hello-plugin/0.1-SNAPSHOT/gradle-com.example.hello-plugin-0.1-SNAPSHOT.pom
Deploying build descriptor to: https://artifactory.example.com/artifactory/api/build
Build successfully deployed. Browse it in Artifactory under https://artifactory.example.com/artifactory/webapp/builds/gradle-com.example.hello-plugin/1234567890123
Run Code Online (Sandbox Code Playgroud)

尝试从另一个 build.gradle 加载插件:

plugins {
    id 'java'
    id 'com.example.hello' version '0.1-SNAPSHOT'
}
Run Code Online (Sandbox Code Playgroud)

使用 settings.gradle:

pluginManagement {
    repositories {
        maven {
            url 'https://artifactory.example.com/artifactory/libs-release-local-maven/'
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

导致此错误:

Plugin [id: 'com.example', version: '0.1-SNAPSHOT'] was not found in …
Run Code Online (Sandbox Code Playgroud)

artifactory gradle kotlin gradle-plugin

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