问题列表 - 第27218页

我们如何匹配任何单个字符,包括Perl正则表达式中的换行符?

我想使用UltraEdit正则表达式(perl)将以下文本替换为一堆html文件中的其他文本:

<style type="text/css">

#some-id{}

.some-class{}

//many other css styles follow

</style>
Run Code Online (Sandbox Code Playgroud)

我尝试使用<style type="text/css">.*</style>但当然它不匹配任何东西,因为点匹配除换行之外的任何字符.我想匹配换行符,换行也许\r\n或者\n.

正则表达式应该如何?

非常感谢大家.

regex text pcre ultraedit

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

Round .NET DateTime毫秒,因此它可以适合SQL Server毫秒

我想将datetime值转换为我将从SQL Server 2008获得的值.

SQL Server将毫秒截断为3位数,因此我已经截断了毫秒数.但问题是,正如您在此处看到的:从XML转换为SQL Server datetime时,毫秒错误.SQL Server也存在精度问题.

c# sql-server datetime sql-server-2008

15
推荐指数
4
解决办法
9251
查看次数

Rails - 为什么RAILS_ROOT/lib中的模型在生产模式下不可用?

我有一个位于RAILS_ROOT/lib文件夹中的类,我在其中一个帮助器中使用它,它在开发中很有用.

当我切换到生产时,应用程序抛出一个NameError (uninitialized constant SomeHelper::SomeClass),我必须在帮助器中手动加载它:

load "#{Rails.root}/lib/some_class.rb"

module SomeHelper
  def some_method
    sc = SomeClass.new
    # blah
  end
end
Run Code Online (Sandbox Code Playgroud)

我的印象是RAILS_ROOT/lib/*里面的所有内容都应该可以在应用程序中使用 - 我需要配置什么才能在prod模式下实现这一点?谢谢.

ruby-on-rails production-environment

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

检测接口的泛型类型参数的方差

有没有办法反映一个接口来检测其泛型类型参数和返回类型的差异?换句话说,我可以使用反射来区分两个接口:

interface IVariant<out R, in A>
{
   R DoSomething(A arg);
}


interface IInvariant<R, A>
{
   R DoSomething(A arg);
}
Run Code Online (Sandbox Code Playgroud)

两者的IL看起来都一样.

.net reflection covariance contravariance variance

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

如何使用foreachLoop迭代播放列表?

我有以下播放列表:

Playlist playList = new Playlist();
Run Code Online (Sandbox Code Playgroud)

我将playList ietms添加到我的playList中,如下所示:

if (strmediaExtension == "wmv" || strmediaExtension == "mp4" || strmediaExtension == "mp3" || strmediaExtension == "mpg")
                {
                    PlaylistItem playListItem = new PlaylistItem();
                    string thumbSource = folderItems.strAlbumcoverImage;
                    playListItem.MediaSource = new Uri(strmediaURL, UriKind.RelativeOrAbsolute);

                    playListItem.Title = folderItems.strAlbumName;

                    if (!string.IsNullOrEmpty(thumbSource))
                        playListItem.ThumbSource = new Uri(thumbSource, UriKind.RelativeOrAbsolute);

                    playList.Items.Add(playListItem);
                }
Run Code Online (Sandbox Code Playgroud)

现在假设我的plaList里面有9个项目.我想通过使用foreach循环遍历每个循环如下:

foreach (PlaylistItem p in playList)
                    { 
                    //Code Goes here
                    }
Run Code Online (Sandbox Code Playgroud)

但我得到了错误:

foreach语句不能对"ExpressionMediaPlayer.Playlist"类型的变量进行操作,因为"ExpressionMediaPlayer.Playlist"不包含"GetEnumerator"的公共定义

任何人都可以解释为什么会这样,以及正确的做法是什么.

谢谢,Subhhen

c# wpf silverlight-3.0

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

如何将字体粗体设置为表格小部件中的特定行

我想在tablewidget的特定行列位置中将字体设置为粗体。我确实喜欢这样,但是要休息一下。

QFont font("Helvetica", 12, QFont::Bold);
overviewTable->item(2,2)->setFont(font);
Run Code Online (Sandbox Code Playgroud)

请帮忙

qt qt4 qt-creator

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

如何在SQL Server中查找重复值

我正在使用SQL Server 2008.我有一张桌子

Customers

customer_number int

field1 varchar

field2 varchar

field3 varchar

field4 varchar
Run Code Online (Sandbox Code Playgroud)

......以及更多列,对我的查询无关紧要.

customer_number是pk.我试图找到重复的值和它们之间的一些差异.

请帮我查找所有相同的行

1) field1,field2,field3,field4

2)只有3列相等而其中一列不相同(列表1中的行除外)

3)只有2列相等而其中两列不相等(列表1和列表2中的行除外)

最后,我将有3个表,其中包含此结果和其他groupId,对于一组相似的组,它们将是相同的(例如,对于3列等于,具有3个相同列的行将是一个单独的组)

谢谢.

sql-server duplicates sql-server-2008

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

我正在使用spring,hibernate和mysql.如何让我的应用程序自动创建表格

我正在使用spring,所有带注释的实体类信息都放在ApplicationContext.xml中.我正在使用MySql数据库,现在如何在hibernate中使用SchemaExport函数来创建表?我的应用程序无法自动创建表,虽然我已设置<prop key="hbm2ddl.auto">create</prop>.这是我的ApplicationContext.xml:

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
 xmlns:context="http://www.springframework.org/schema/context" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:jee="http://www.springframework.org/schema/jee"
 xmlns:tx="http://www.springframework.org/schema/tx"
 xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
  http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
  http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd
  http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.0.xsd
  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">

 <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  <property name="driverClassName" value="com.mysql.jdbc.Driver" />
  <property name="url" value="jdbc:mysql:///edde" />
  <property name="username" value="root" />
  <property name="password" value="" />
 </bean>

 <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
  <property name="dataSource" ref="dataSource" />
  <property name="annotatedClasses">
   <list>
    <value>com.edde.Book</value>
   </list>
  </property>
  <property name="hibernateProperties">
   <props>
    <prop key="current_session_context_class">thread</prop>
    <prop key="show_sql">true</prop>
    <prop key="hbm2ddl.auto">create</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.use_sql_comments">true</prop>
    <prop key="hibernate.format_sql">true</prop>
   </props>
  </property>
 </bean> …
Run Code Online (Sandbox Code Playgroud)

java mysql spring hibernate mysql-error-1146

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

如何使用htaccess将url重写为html锚标记(#)

我有一种情况,我想采取以下URL:

/ 1 /约翰

并使用Apache的htaccess文件进行重定向

/page.php?id=1&name=john#john

所以它转到一个名为john的html锚点.

我发现了很多关于转义特殊字符的引用,并添加了[NE]标志,以便重定向忽略#符号,但这些不起作用.例如,添加[NE,R]表示该网址仅作为原始网址显示在浏览器地址中:http://example.com/page.php?id = 1&name = john#john.

.htaccess mod-rewrite uri-fragment

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

有没有解决方案来解析Java中的wikipedia xml转储文件?

我正在尝试解析这个巨大的25GB Plus维基百科XML文件.任何有用的解决方案都将受到赞赏.优选地是Java中的解决方案.

java xml parsing

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