小编Pet*_* O.的帖子

C#Generics不允许委托类型约束

是否可以在C#中定义一个类

class GenericCollection<T> : SomeBaseCollection<T> where T : Delegate
Run Code Online (Sandbox Code Playgroud)

我无法为我的生活在.NET 3.5中完成这一切.我试过用

delegate, Delegate, Action<T> and Func<T, T>

在我看来,这应该是允许的某种方式.我正在尝试实现自己的EventQueue.

我最终只是这样做[原始近似注意你].

internal delegate void DWork();

class EventQueue {
    private Queue<DWork> eventq;
}
Run Code Online (Sandbox Code Playgroud)

但是后来我失去了为不同类型的函数重用相同定义的能力.

思考?

c# generics events delegates constraints

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

`atoi`的名字来自哪里?

在C语言中,他们在哪里提出了atoi将字符串转换为整数的名称?我唯一能想到的是Array To Integer的首字母缩略词,但这并没有多大意义.

c naming-conventions atoi

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

"Unparseable date:1302828677828"试图用Gson反序列化从服务器收到的毫秒格式日期

经过4个小时不停试图解决问题,我决定在这里询问是否有人可以帮助我.

问题是我的Android客户端在尝试反序列化从服务器收到的数据时会抛出"Unparseable:1302828677828"异常.

我想知道是否可以使用Gson反序列化毫秒格式的日期.

serialization android json date gson

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

估计神经元的数量和人工神经网络的层数

我正在寻找一种方法来计算层数和每层神经元的数量.作为输入,我只有输入向量的大小,输出向量的大小和trainig集的大小.

通常,通过尝试不同的网络拓扑并选择具有最小误差的网络来确定最佳网络.不幸的是我做不到.

artificial-intelligence machine-learning neural-network deep-learning

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

Android TextView Text没有被包装

谁能告诉我文本出了什么问题?长于一行的文本不会换行到下一行但超出屏幕.

以下是代码:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" 
    android:layout_height="wrap_content"
    android:orientation="horizontal" 
    android:padding="4dip">

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="fill_parent" 
        android:layout_height="wrap_content"
        android:orientation="vertical" 
        android:padding="4dip">

        <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:orientation="horizontal" 
            android:padding="4dip">
            <TextView 
                android:id="@+id/reviewItemEntityName"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:text="event/venue" 
                android:textColor="@color/maroon"
                android:singleLine="true" 
                android:ellipsize="end" 
                android:textSize="14sp"
                android:textStyle="bold" 
                android:layout_weight="1" />

            <ImageView 
                android:id="@+id/reviewItemStarRating"
                android:layout_width="wrap_content" 
                android:layout_height="wrap_content"
                android:layout_alignParentTop="true"
                android:layout_alignParentBottom="true"
                android:src="@drawable/title_1_star" />
        </LinearLayout>

        <TextView 
            android:id="@+id/reviewItemDescription"
            android:layout_width="fill_parent" 
            android:layout_height="wrap_content"
            android:text="Description comes here" 
            android:textSize="12sp" 
            android:layout_weight="1"/>
    </LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

android textview

74
推荐指数
5
解决办法
14万
查看次数

找到一个点是否位于矩形内

我想找出一个点是否位于矩形内部.矩形可以以任何方式定向,并且不需要轴对齐.

我能想到的一种方法是旋转矩形和点坐标以使矩形轴对齐,然后通过简单地测试点的坐标是否位于矩形的坐标内.

上述方法需要旋转,因此需要浮点运算.有没有其他有效的方法来做到这一点?

algorithm geometry

74
推荐指数
8
解决办法
11万
查看次数

什么是Dalvik和dalvik-cache?

我知道这可能是Android中的一个基本问题.但什么是Dalvik和dalvik-cache?

android dalvik

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

属性或索引器不能作为out或ref参数传递

我收到上述错误,无法解决.我google了一下,但无法摆脱它.

场景:

我有类BudgetAllocate,其属性是预算,是双重类型.

在我的dataAccessLayer中,

在我的一个课程中,我试图这样做:

double.TryParse(objReader[i].ToString(), out bd.Budget);
Run Code Online (Sandbox Code Playgroud)

这引发了这个错误:

在编译时,属性或索引器不能作为out或ref参数传递.

我甚至试过这个:

double.TryParse(objReader[i].ToString().Equals(DBNull.Value) ? "" : objReader[i].ToString(), out bd.Budget);
Run Code Online (Sandbox Code Playgroud)

其他一切工作正常,层之间的引用存在.

.net c# error-handling

73
推荐指数
6
解决办法
7万
查看次数

Jshint.com要求"严格使用".这是什么意思?

Jshint.com提供错误:

第36行:var signin_found; 缺少"使用严格"声明.

javascript jshint

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

Android模拟器不在视野范围内,我该如何移动它?

我在笔记本电脑上使用了额外的显示器,并在那里移动了Android模拟器.即使显示器不再连接,它似乎记住了位置.

有没有办法重置窗口的位置,使其再次可见?

android android-emulator

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