小编Yan*_*ang的帖子

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

C#从KnownColor中删除较暗的颜色

我从系统中得到了一份Knowncolor列表,但是我想删除一些太暗的内容并使前景字符看不见.我尝试了以下代码,但KnownColor.Black仍然出现.无论如何,他们在黑暗中命令他们?

if (knownColor > KnownColor.Transparent && knownColor < KnownColor.MidnightBlue && knownColor < KnownColor.Navy)
            {
                //add it to our list
                colors.Add(knownColor);
            }
Run Code Online (Sandbox Code Playgroud)

c# colors

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

javascript Date.parse和Date.UTC给出不同的结果

任何人都可以向我解释原因吗?

d = Date.parse('8/15/2012 '+'11:59:45 AM');
alert(d);
alert(Date.UTC(2012, 7, 15, 11, 59, 45));
Run Code Online (Sandbox Code Playgroud)

javascript date

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

Android:切换到ListActivity时无法设置setContentView

[更新]我收到错误,上面写着"你的内容必须有一个ListView,其id属性是'android.R.id.list'".我的xml中似乎没有任何东西是ListView.但这需要吗?

这是关于我之前的问题android的后续问题 :我应该使用哪个视图来显示文本和图像?

我阅读了有关为LinearLayout创建ListView的文章.但是,当我将"extends Activity"更改为"扩展ListActivity"时,我的以下代码在setContentView()函数中失败,任何想法为什么?

private TextView mSelection;
//private ImageView mImages;
static final String[] keywords = new String[]{"China", "Japan", "USA", "Canada"};
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.contactLayout);

    mSelection = (TextView)findViewById(R.id.ContactNames);
    ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.contactlayout, R.id.ContactNames,keywords);
    setListAdapter(adapter);
    }
Run Code Online (Sandbox Code Playgroud)

我的布局来自这篇文章:http://www.curious-creature.org/2009/02/22/android-layout-tricks-1/

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"

android:padding="6dip">

<ImageView
    android:id="@+id/icon"

    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:layout_marginRight="6dip"

    android:src="@drawable/icon" />

<LinearLayout
    android:orientation="vertical"

    android:layout_width="0dip"
    android:layout_weight="1"
    android:layout_height="fill_parent">

    <TextView
        android:id="@+id/ContactNames"
        android:layout_width="fill_parent"
        android:layout_height="0dip"
        android:layout_weight="1"

        android:gravity="center_vertical"
        android:text="My …
Run Code Online (Sandbox Code Playgroud)

layout android listactivity

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

正则表达式选项匹配多行以及忽略大小写

我有一些格式不正确的HTML,有时候"丢失了.此外,它有时会显示大写案例,而其他时候则是较低的案例:

<DIV class="main">
    <DIV class="subsection1">
   <H2>
   <DIV class=subwithoutquote>StackOverflow</DIV></H2></DIV></DIV>
Run Code Online (Sandbox Code Playgroud)

我想匹配多线并忽略这种情况.但以下的模式似乎并没有起作用.(对于连接,我也尝试过|而不是&)

const string pattern = @"<div class=""?main""?><div class=""?subsection1""?><h2><div class=""?subwithoutquote""?>(.+?)</div>";
Match m = Regex.Match(html, pattern, RegexOptions.IgnoreCase & RegexOptions.Singleline);
Run Code Online (Sandbox Code Playgroud)

或者我应该在模式中添加\n*来解决多行问题?

html c# regex multiline ignore-case

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

SQL嵌套查询可能吗?

我发现select语句基本上使用不同的where子句来计算.我的问题是,如何将结果合并到一个语句中,以便这些计数可以成为列?

  1. 从table1中选择count(*)作为c1,其中city ='nyc'
  2. 从table1中选择count(*)作为c2,其中city ='boston'
  3. 从table1中选择count(*)作为c3,其中city ='sf'

sql nested

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

使用Linq将Dictionary <String,double>转换为Dictionary <String,float>

我可以使用for循环进行转换,但是有一个Linq语句可以用作单行程序吗?

c# linq

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

在链接中添加参数会导致网络错误(Android 4.0.3 + PhoneGap)

当尝试从index.html页面导航到purchase.html时,如果我向链接添加参数,则会出现"发生网络错误"

<a href="purchase.html?id=2">. 
Run Code Online (Sandbox Code Playgroud)

删除"?id = 2"然后链接工作.

这是详细错误消息:04-08 21:09:23.850:D/Cordova(967):DroidGap:GapViewClient.onReceivedError:错误代码= -1说明=发生网络错误.URL =文件:///android_asset/www/purchase.html ID = 2

android jquery-mobile cordova

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

jquery mobile error:对象没有方法'on'

我有一个listview点击事件:http://jsfiddle.net/w2JZU/260/

$('#todayvalue').children('li').on('click', function () {
    var selected_index = $(this).attr('id');
    alert('Selected Index = ' + selected_index);
});?
Run Code Online (Sandbox Code Playgroud)

这种方法适用于jquery mobile.但是当我将它部署到PhoneGap javascript文件时,会出现此错误.

jquery jquery-mobile cordova

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

如何保持同一Android应用程序的两个版本?

我们经常看到Android应用程序的两个版本:付费版本和免费版本.我也正在开发一个想要发布两个版本的应用程序.做这个的最好方式是什么?创建两个项目并在其间复制文件似乎并不是我脑海中最好的方法.

android version

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