小编Jas*_*her的帖子

为特定提交生成git补丁

我需要编写一个脚本,为SHA1提交号列表创建补丁.

我尝试过使用git format-patch <the SHA1>,但是从那个SHA1开始为每个提交生成一个补丁.在生成几百个补丁之后,我不得不杀死这个过程.

有没有办法只为特定的SHA1生成补丁?

git patch

1144
推荐指数
10
解决办法
57万
查看次数

PostgreSQL自动增量

我正在从MySQL切换到PostgreSQL,并想知道如何做自动增量值.我在PostgreSQL文档中看到了一个数据类型"serial",但是在使用它时会出现语法错误(在v8.0中).

postgresql auto-increment

556
推荐指数
10
解决办法
57万
查看次数

设置UITextField的最大字符长度

UITextField当我加载一个时,如何设置iPhone SDK上的最大字符数UIView

cocoa-touch objective-c uitextfield ios

467
推荐指数
17
解决办法
27万
查看次数

如何检测C#中是否存在此字典密钥?

我正在使用Exchange Web服务托管API和联系人数据.我有以下代码,它是功能性的,但并不理想:

foreach (Contact c in contactList)
{
    string openItemUrl = "https://" + service.Url.Host + "/owa/" + c.WebClientReadFormQueryString;

    row = table.NewRow();
    row["FileAs"] = c.FileAs;
    row["GivenName"] = c.GivenName;
    row["Surname"] = c.Surname;
    row["CompanyName"] = c.CompanyName;
    row["Link"] = openItemUrl;

    //home address
    try { row["HomeStreet"] = c.PhysicalAddresses[PhysicalAddressKey.Home].Street.ToString(); }
    catch (Exception e) { }
    try { row["HomeCity"] = c.PhysicalAddresses[PhysicalAddressKey.Home].City.ToString(); }
    catch (Exception e) { }
    try { row["HomeState"] = c.PhysicalAddresses[PhysicalAddressKey.Home].State.ToString(); }
    catch (Exception e) { }
    try { row["HomeZip"] = c.PhysicalAddresses[PhysicalAddressKey.Home].PostalCode.ToString(); }
    catch …
Run Code Online (Sandbox Code Playgroud)

c# exchangewebservices ews-managed-api

452
推荐指数
4
解决办法
44万
查看次数

RelativeLayout中的百分比宽度

我正在为Activity我的Android应用程序中的登录工作.下面的图片是我希望它看起来像:

在此输入图像描述

我能够使用以下XML实现此布局.问题是,它有点hackish.我不得不为主机EditText硬编码宽度.具体来说,我必须指定:

android:layout_width="172dp" 
Run Code Online (Sandbox Code Playgroud)

我真的想给主机和端口EditText提供一个百分比宽度.(主机为80%,端口为20%.)这可能吗?以下XML适用于我的Droid,但似乎并不适用于所有屏幕.我真的想要一个更强大的解决方案.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent" >

    <TextView
        android:id="@+id/host_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/home"
        android:paddingLeft="15dp"
        android:paddingTop="0dp"
        android:text="host"
        android:textColor="#a5d4e2"
        android:textSize="25sp"
        android:textStyle="normal" />

    <TextView
        android:id="@+id/port_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/home"
        android:layout_toRightOf="@+id/host_input"
        android:paddingTop="0dp"
        android:text="port"
        android:textColor="#a5d4e2"
        android:textSize="25sp"
        android:textStyle="normal" />

    <EditText
        android:id="@+id/host_input"
        android:layout_width="172dp"
        android:layout_height="wrap_content"
        android:layout_below="@id/host_label"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:layout_marginTop="4dp"
        android:background="@android:drawable/editbox_background"
        android:inputType="textEmailAddress" />

    <EditText
        android:id="@+id/port_input"
        android:layout_width="100dp"
        android:layout_height="wrap_content"
        android:layout_below="@id/host_label"
        android:layout_marginTop="4dp"
        android:layout_toRightOf="@id/host_input"
        android:background="@android:drawable/editbox_background"
        android:inputType="number" />

    <TextView
        android:id="@+id/username_label"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/host_input"
        android:paddingLeft="15dp"
        android:paddingTop="15dp"
        android:text="username"
        android:textColor="#a5d4e2"
        android:textSize="25sp"
        android:textStyle="normal" />

    <EditText
        android:id="@+id/username_input"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/username_label"
        android:layout_marginLeft="15dp"
        android:layout_marginRight="15dp"
        android:layout_marginTop="4dp"
        android:background="@android:drawable/editbox_background" …
Run Code Online (Sandbox Code Playgroud)

android android-layout android-relativelayout

437
推荐指数
10
解决办法
49万
查看次数

AppCompat v7 r21在values.xml中返回错误?

我正在使用Android Studio,当我添加compile "com.android.support:appcompat-v7:21.0.0" 到Gradle文件时,我遇到了大量错误:

C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v11\values.xml
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(36, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
C:\Users\WindowsSucks\AndroidStudioProjects\MMMeds\app\build\intermediates\exploded-aar\com.android.support\appcompat-v7\21.0.0\res\values-v14\values.xml
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, 21) No resource found that matches the given name: attr 'android:actionModeShareDrawable'.
Error:(9, …
Run Code Online (Sandbox Code Playgroud)

android android-appcompat android-studio

280
推荐指数
5
解决办法
29万
查看次数

读/写INI文件

.NET框架中是否有可以读/写标准.ini文件的类:

[Section]
<keyname>=<value>
...
Run Code Online (Sandbox Code Playgroud)

Delphi有TIniFile组件,我想知道C#是否有类似内容?

.net c# ini

248
推荐指数
8
解决办法
45万
查看次数

是否需要std :: unique_ptr <T>才能知道T的完整定义?

我在头文件中有一些代码如下:

#include <memory>

class Thing;

class MyClass
{
    std::unique_ptr< Thing > my_thing;
};
Run Code Online (Sandbox Code Playgroud)

如果我有一个CPP这个头不包含的Thing类型定义,那么这并不在VS2010 SP1的编译:

1> C:\ Program Files(x86)\ Microsoft Visual Studio 10.0\VC\include\memory(2067):错误C2027:使用未定义类型'Thing'

替换std::unique_ptrstd::shared_ptr和编译.

所以,我猜这是当前VS2010 std::unique_ptr的实现,需要完整的定义,而且完全依赖于实现.

或者是吗?它的标准要求中是否有某些东西使得std::unique_ptr实施只能使用前向声明?感觉很奇怪,因为它应该只有一个指针Thing,不应该吗?

c++ stl visual-studio-2010 unique-ptr c++11

236
推荐指数
5
解决办法
4万
查看次数

在C++中转发嵌套类型/类的声明

我最近遇到了这样的情况:

class A
{
public:
    typedef struct/class {...} B;
...
    C::D *someField;
}

class C
{
public:
    typedef struct/class {...} D;
...
    A::B *someField;
}
Run Code Online (Sandbox Code Playgroud)

通常你可以声明一个类名:

class A;
Run Code Online (Sandbox Code Playgroud)

但是你不能转发声明一个嵌套类型,以下导致编译错误.

class C::D;
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?

c++ nested class forward-declaration

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

IE9中的占位符

这似乎是一个众所周知的问题,但我在Google上找到的所有解决方案都不适用于我新下载的IE9.

为了Placeholderinputtextarea标签上启用属性,您最喜欢哪种方式?

可选:我在这上面浪费了很多时间,但还没有寻找required房产.你也对此有一些建议吗?显然我可以检查PHP中的值,但是为了帮助用户这个属性非常方便.

html javascript html5 placeholder internet-explorer-9

139
推荐指数
5
解决办法
17万
查看次数