小编eld*_*his的帖子

很难理解git-fetch

我很难理解git-fetch的细微差别.我知道做一个fetch,将远程refs提取到本地跟踪分支.

我有几个问题:

  1. 是否有可能本地跟踪分支不存在?如果是,那么它会自动创建吗?

  2. 如果我执行fetch并指定非跟踪分支作为目标,会发生什么?

  3. git-fetch的手册页指定:

    git-fetch <options> <repository> <refspec>
    
    Run Code Online (Sandbox Code Playgroud)

我如何使用refspec从远程主站获取内容到其远程跟踪分支?我相信如果我现在的HEAD在主人身上并且我跑了,这可能是可能的

git fetch origin master

但是,我可以使用<+?src:dest>refspec来实现同样的目的吗?我认为这将有助于我更好地理解这些概念.

还有一个问题:

我的.git/config文件有以下行用于获取(仅显示相关行):

fetch = +refs/heads/*:refs/remotes/origin/*
Run Code Online (Sandbox Code Playgroud)

有人可以解释这条线的确切含义吗?

git git-fetch

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

如何在python中迭代文件

我有一个带有一些十六进制数字的文本文件,我试图将其转换为十进制.我可以成功转换它,但它似乎在循环存在之前它读取一些不需要的字符,所以我得到以下错误.

Traceback (most recent call last):
  File "convert.py", line 7, in <module>
    print >>g, int(x.rstrip(),16)
ValueError: invalid literal for int() with base 16: ''
Run Code Online (Sandbox Code Playgroud)

我的代码如下

f=open('test.txt','r')
g=open('test1.txt','w')
#for line in enumerate(f):  
while True:
    x=f.readline()
    if x is None: break
    print >>g, int(x.rstrip(),16)
Run Code Online (Sandbox Code Playgroud)

每个十六进制数字都以新行输入

python

38
推荐指数
3
解决办法
12万
查看次数

OnTouchEvent不能处理子视图

我有一个线性布局,上面有一个Button和一个TextView.我为活动写了一个OnTouchEvent.如果我触摸屏幕,代码工作正常,但如果我触摸按钮代码不起作用.这有什么可能的解决方案?

public boolean onTouchEvent(MotionEvent event) {
   int eventaction=event.getAction();


   switch(eventaction)
   {
   case MotionEvent.ACTION_MOVE:
      reg.setText("hey");


   break;
   }
   return true;

  }
Run Code Online (Sandbox Code Playgroud)

android ontouchlistener

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

websocket可以支持gzip压缩吗?

在WebSocket成功握手之后,我们可以使用gzip压缩吗?

这是我的测试:

  1. 我使用autobahn lib构建服务器,然后响应客户端:
    HTTP/1.1 101 Switching Protocols content-encoding: gzip Connection: Upgrade Server: AutobahnPython/?.?.? Upgrade: WebSocket Sec-WebSocket-Accept: RIR8KmljoV8Cv9mdiLY7GM2nYMc=
  2. 然后我的服务器使用gzip压缩
  3. 并且Chrome浏览器得到了结果,但它告诉我"无法将文本框架解码为UTF-8"

gzip websocket

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

遍历数字中的每个数字

我正在尝试创建一个程序,用于判断给定的数字是否为" Happy Number ".找到一个快乐的数字需要将数字中的每个数字平方,并将每个数字的平方的结果加在一起.

在Python中,您可以使用以下内容:

SQUARE[d] for d in str(n)
Run Code Online (Sandbox Code Playgroud)

但是我找不到如何在Java中迭代数字中的每个数字.正如您所知,我是新手,并且在Java文档中找不到答案.

java iteration math numbers

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

购买音乐意图

我知道可能没有"购买歌曲"的标准意图,但有没有人知道是否有一个特定的Android音乐商店,如亚马逊MP3或7数字?在iPhone上,Apple提供了一个API,可以让您将应用程序的用户链接到iTunes商店.我正在开发一个拥有歌曲列表的Android应用程序,我希望能够将用户发送到商店购买这首歌,就像我在iOS上一样.

mp3 android

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

为什么ListView每隔6个项重复一次?

我有一个ListView,由具有特定布局的自定义适配器填充.适配器映射到具有特定元素的HashMap,其中包含每个ListView元素的数据.

hashMap中的数据是正确的,但ListView重复绘制每6个相同的第6个元素,直到它到达Map的末尾?

我的显示器允许显示5个项目,如果你滚动一下它是6个项目.

这是适配器的代码,ListActivity的相关代码和ListView的布局文件.

请帮忙,我不知道为什么会这样.

package de.View;

import java.util.ArrayList;
import java.util.Map;

import de.carSync.R;
import de.Common.Date_Conversion;
import de.Common.GUI_Output;
import de.Model.DriversLog.Fahrt;
import de.Model.DriversLog.Geladene_Fahrten;

import android.content.Context;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class Fahrten_List_Adapter extends BaseAdapter{

    private static  String TAG = "Fahrten_List_Adapter";

    private Map<Integer,Fahrt> fahrten_Liste;

    private final LayoutInflater mLayoutInflater;

    int zeilen_Layout;

    public Fahrten_List_Adapter(Context ctx, Map<Integer,Fahrt> f_l, int zeilen_Layout){
        this.zeilen_Layout = zeilen_Layout;
        fahrten_Liste = f_l;
        mLayoutInflater = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    }

    @Override
    public int getCount() {
        return fahrten_Liste.size(); …
Run Code Online (Sandbox Code Playgroud)

android listview repeat

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

如何在一个Web应用程序中执行Jersey 1.6和axis2 1.3期间解决"java.lang.LinkageError:loader constraint violation"?

我已经使用axis2 1.3运行基于soap的Web服务.这一天,我们计划使用Jersey 1.6开发RESTful Web服务.

我用axis2 1.3和Jersey 1.6制作了web应用程序(war文件),并尝试在jboss5.1.0上部署它.

启动jboss后,我看到下面的错误信息.

com.sun.jersey.api.container.ContainerException: Unable to create resource
    at com.sun.jersey.server.impl.resource.SingletonFactory$Singleton.init(SingletonFactory.java:139)
    at com.sun.jersey.server.impl.application.WebApplicationImpl$9.f(WebApplicationImpl.java:533)
    at com.sun.jersey.server.impl.application.WebApplicationImpl$9.f(WebApplicationImpl.java:531)
    at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
    at com.sun.jersey.server.impl.application.WebApplicationImpl.getResourceComponentProvider(WebApplicationImpl.java:531)
.....
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at com.sun.jersey.server.spi.component.ResourceComponentConstructor._construct(ResourceComponentConstructor.java:200)
    at com.sun.jersey.server.spi.component.ResourceComponentConstructor.construct(ResourceComponentConstructor.java:182)
    at com.sun.jersey.server.impl.resource.SingletonFactory$Singleton.init(SingletonFactory.java:137)
    ... 87 more
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.bind.JAXBElement.<init>(Ljavax/xml/namespace/QName;Ljava/lang/Class;Ljava/lang/Object;)V" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, com/sun/jersey/server/wadl/WadlGeneratorImpl, and the class loader (instance of <bootloader>) for resolved class, javax/xml/bind/JAXBElement, have different Class …
Run Code Online (Sandbox Code Playgroud)

jboss axis2 jaxb jersey

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

检测插入的设备

我希望能够检测设备是否已插入.我希望能够以与连接状态相同的方式查询.这是可能的还是我需要创建一个侦听电池事件的广播接收器?

android battery power-state

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

Android SDK Manager,包的本地副本

在Windows XP上,有没有办法:

  • 查找Android SDK Manager下载的软件包,
  • 创建包的备份副本,

然后,在全新安装的Windows XP上:

  • 安装Android SDK Manager,
  • 将软件包的备份副本复制到"正确"的位置,
  • 并安装包?

sdk android

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