小编max*_*max的帖子

提取和创建ipk文件

ipk包是opkg使用的安装包.

我正在尝试提取其中一个的内容,并创建我自己的ipk.

我读过我应该能够解开他们,但事实并非如此.

我试过了:

tar -zxvf mypack.ipk
Run Code Online (Sandbox Code Playgroud)

我得到:

zip: stdin: not in gzip format

我也尝试过:

tar -xvf mypack.ipk
Run Code Online (Sandbox Code Playgroud)

我得到:

tar: This does not look like a tar archive

我发现互联网上关于ipk的大部分信息都是不准确的.

我的ipk是由bitbake生成的.我在使用bitbake时遇到了困难,并希望避免使用它.

关于如何提取以及如何创建ipk文件的任何想法?具有单个包的简单模板将是有用的.

packages

22
推荐指数
4
解决办法
6万
查看次数

django 1.8无法django.db.utils.ProgrammingError:关系"auth_user"不存在

我有一个django 1.7的工作项目,现在我把它移到django 1.8.我可以syncdb用sqlite运行应用程序,但是当我切换到postgres时,它无法执行syncdb:

  Creating tables...
    Creating table x
    Creating table y
    Running deferred SQL...
Traceback (most recent call last):
  File "manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "~/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line
    utility.execute()
  File "~/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 330, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "~/venv/lib/python2.7/site-packages/django/core/management/base.py", line 390, in run_from_argv
    self.execute(*args, **cmd_options)
  File "~/venv/lib/python2.7/site-packages/django/core/management/base.py", line 441, in execute
    output = self.handle(*args, **options)
  File "~/venv/lib/python2.7/site-packages/django/core/management/commands/syncdb.py", line 25, in handle
    call_command("migrate", **options)
  File "~/venv/lib/python2.7/site-packages/django/core/management/__init__.py", line 120, in call_command
    return command.execute(*args, **defaults)
  File …
Run Code Online (Sandbox Code Playgroud)

django django-models

18
推荐指数
4
解决办法
3万
查看次数

django QueryDict仅返回列表的最后一个值

使用django 1.8,我观察到一些奇怪的东西.这是我的javascript:

function form_submit(){
  var form = $('#form1_id');
  request = $.post($(this).attr('action'), form.serialize(), function(response){
     if(response.indexOf('Success') >= 0){
        alert(response);
     }
  },'text')
  .fail(function() {
    alert("Failed to save!");
  });
  return false;
}
Run Code Online (Sandbox Code Playgroud)

以下是views.py中显示的参数

print request.POST
<QueryDict: {u'form_4606-name': [u''], u'form_4606-parents': [u'4603', u'2231', u'2234']}>
Run Code Online (Sandbox Code Playgroud)

但我无法提取父母:

print request.POST['form_4606-parents']
2234
Run Code Online (Sandbox Code Playgroud)

为什么它只给我最后一个价值?我认为序列化有问题,但我无法弄清楚如何解决这个问题.

django

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

在Windows上的EC2实例上记录用户数据脚本输出

我正在尝试获取ec2"用户数据"脚本日志并将其指向Windows上的系统日志.在linux上,有人已经找到了解决方案:http: //alestic.com/2010/12/ec2-user-data-output

基本上你可以将/var/log/user-data.log发送到系统日志.我需要知道如何为Windows实例做这件事.我在我的Windows实例上找不到任何user-data.log.

windows amazon-ec2 user-data output

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

在jenkins上使用docker插件 -

我正在尝试使用Jenkins上的docker插件来运行现有容器的实例.Docker版本1.6.0,内部版本为4749651

我选择了"创建容器"输入图像名称的图像ID,并尝试了主机http://172.16.42.43:4243并尝试了一个空主机.我一直收到这个错误:

ERROR: Build step failed with exception
java.lang.NullPointerException: uri was not specified
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)
    at com.github.dockerjava.core.DockerClientConfig$DockerClientConfigBuilder.withUri(DockerClientConfig.java:406)
    at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.createDockerClient(DockerBuilder.java:123)
    at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder$DescriptorImpl.getDockerClient(DockerBuilder.java:201)
    at org.jenkinsci.plugins.dockerbuildstep.DockerBuilder.perform(DockerBuilder.java:71)
    at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
    at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:779)
    at hudson.model.Build$BuildExecution.build(Build.java:205)
    at hudson.model.Build$BuildExecution.doRun(Build.java:162)
    at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:537)
    at hudson.model.Run.execute(Run.java:1744)
    at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43)
    at hudson.model.ResourceController.execute(ResourceController.java:98)
    at hudson.model.Executor.run(Executor.java:374)
Build step 'Execute Docker container' marked build as failure
Run Code Online (Sandbox Code Playgroud)

有人能告诉我如何解决它吗?此外,如果有人之前使用过这个插件,请告诉我这是否有用过.

还尝试了"执行docker container" - >使用指定的容器id启动容器导致相同的错误.

另一种方法:我尝试使用Execute shell插件,我收到此错误:

+ docker start d023eec1ff34
Post http:///var/run/docker.sock/v1.18/containers/d023eec1ff34/start: dial unix /var/run/docker.sock: permission denied. Are you trying to connect to a TLS-enabled daemon without …
Run Code Online (Sandbox Code Playgroud)

jenkins docker

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

Django Migration未应用迁移更改

使用django 1.7.7我想使用django的迁移来添加或删除字段.所以我修改了model.py并运行了

python manage.py makemigrations myproj
Migrations for 'myproj':
  0001_initial.py:
    - Create model Interp
    - Create model InterpVersion

python manage.py migrate myproj
Operations to perform:
  Apply all migrations: myproj
Running migrations:
  Applying myproj.0001_initial... FAKED

python manage.py runserver
Run Code Online (Sandbox Code Playgroud)

然后检查管理页面,它没有更新.然后我尝试删除迁移文件夹并再次尝试; migrate命令表示没有要应用的迁移.

我该如何进行迁移?注意:我想使用django迁移的新技术而不是旧的南方法.

django

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

NVD3折线图未捕获TypeError:无法读取未定义的属性"x"

我正在使用NVD3库根据Rails控制器中生成的数据制作简单的折线图.我用来在Rails中生成数据的代码是:

task.task_values.each do |u|
 array.push({ :x => u.created_at.to_i * 1000, :y => u.value.to_i })
end
data_label = task.name + " ("+ task_unit +")"
taskValuesList = [{:key => data_label, :values => array}]
data = {:type => "line", :data => taskValuesList}
Run Code Online (Sandbox Code Playgroud)

然后,在我看来,我有以下JS代码:

nv.addGraph(function() {
var chart = nv.models.lineChart()
  .x(function(d) { return d.x; })
      .y(function(d) { return d.y; });

chart.xAxis
   .showMaxMin(false)
       .tickFormat(function(d){return d3.time.format("%m/%d/%y")(new Date(d));});
chart.yAxis
   .tickFormat(d3.format(',d'));

d3.select('#chart<%= i %> svg')
  .datum(data.data)
  .transition().duration(500)
  .call(chart);

nv.utils.windowResize(chart.update);
  return chart;
});
Run Code Online (Sandbox Code Playgroud)

图表正确呈现,但是当我尝试鼠标悬停数据点以显示工具提示时,我收到错误"Uncaught TypeError:无法读取属性'x'未定义"

d3.js nvd3.js

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

python paramiko ssh session没有得到系统路径

我遇到一个问题,当我ssh到另一台机器时,我的paramiko ssh会话看不到与我手动ssh到机器时相同的系统路径.这是我的python代码:

cmd = "echo $PATH"
try:
    ssh.connect(ip, username=username, password=password)
except Exception as ex:
    raise Exception("Failed to connect to %s with credentials username='%s' password='%s' %s" \
          % (ip, username, password, ex.message) )

ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(cmd)
output = ssh_stdout.read()
Run Code Online (Sandbox Code Playgroud)

输出显示/ usr/bin:/ bin但是当我手动ssh到机器时,系统PATH上还有其他几个路径.请帮忙.

python system path paramiko

9
推荐指数
2
解决办法
4151
查看次数

如何在列表中显示多对多django更有效率

我正在使用django 1.8.我在django admin中显示了一个多对多的字段,就像这个例子一样.

class PurchaseOrder(models.Model):
    product = models.ManyToManyField('Product')
    vendor = models.ForeignKey('VendorProfile')
    dollar_amount = models.FloatField(verbose_name='Price')


class Product(models.Model):
    products = models.CharField(max_length=256)

    def __unicode__(self):
        return self.products

class PurchaseOrderAdmin(admin.ModelAdmin):
    fields = ['product', 'dollar_amount']
    list_display = ('get_products', 'vendor')

    def get_products(self, obj):
        return "\n".join([p.products for p in obj.product.all()])
Run Code Online (Sandbox Code Playgroud)

问题是如果我每页显示100行,它会进行100次查询.对于外键,有一个神奇的list_select_related,但你不能在那里放置多对多字段.如何避免重复查询?

---更新:

我试过了:

def get_queryset(self, request):
    qs = super(PurchaseOrderAdmin, self).get_queryset(request)
    return qs.prefetch_related('products')
Run Code Online (Sandbox Code Playgroud)

它仍在每行执行重复查询.

django-admin

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

如何在管理页面上调整django ManyToManyField小部件的大小

我正在尝试调整django 1.8 admin的多对多字段.

models.py

from django.db import models

class Material(models.Model):
    type = models.CharField(max_length=20, primary_key=True)
    def __unicode__(self):
        return self.type


class Pen(models.Model):
    label = models.CharField(max_length=20, blank=True, default='')
    materials = models.ManyToManyField(Material)
Run Code Online (Sandbox Code Playgroud)

admin.py

from django.contrib import admin
from django.conf.urls import url
from .models import *
from django.forms import SelectMultiple

@admin.register(Pen)
class PenAdmin(admin.ModelAdmin):
    filter_horizontal = ('materials',)
    #formfield_overrides = { models.ManyToManyField: {'widget': SelectMultiple(attrs={'size':'5', 'width': '50px', 'style': 'width:50px'})}, }

    def get_form(self, request, obj=None, **kwargs):
        form = super(PenAdmin, self).get_form(request, obj, **kwargs)
        form.base_fields['materials'].widget.attrs['style'] = 'width: 70px;'
        return form

    class …
Run Code Online (Sandbox Code Playgroud)

django admin

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