这是一个不起眼的问题,但我正在使用jQuery Sortables并试图让两个连接列表很好地协同工作fixed.一切正常,直到你滚动页面,使两个列表最终位于彼此的顶部.然后列表似乎对哪一个应该接收被拖动的项目感到困惑,这意味着当每个列表中出现/消失时,会发生一堆抖动.
看起来问题是两个列表都在处理鼠标/排序事件,因为被拖动的项目在技术上是在两个列表上,但我想要的是让覆盖列表(即position: fixed一个)吞下事件以便底层主要列表不会尝试接收该项目.
这是最小的代码示例:
<html>
<head>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.3/jquery.min.js"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.6/jquery-ui.min.js"></script>
<style type="text/css">
ul { list-style-type: none; padding: 0; float: left; }
li { margin: 5px; padding: 5px; width: 500px; border: solid 1px #F00; background-color: #FFF; }
#overlayed { position: fixed; top: 0; background-color: #000; margin: 20px; padding: 10px; }
#overlayed li { width: 50px; float: left; }
</style>
<script type="text/javascript">
$(function() {
$("ul").sortable({ connectWith: "ul", opacity: 0.6 }).disableSelection();
});
</script>
</head>
<body>
<div …Run Code Online (Sandbox Code Playgroud) 我真的想把这个弄出来.请看下面的代码:
using (DataTable resultTable = DBUtility.GetSingleDBTableResult(connectionString, "SELECT * FROM MyDBTable")) {
List<string> resultsList = new List<string>();
foreach (DataRow dataRow in resultTable.Rows) {
resultsList.Add(dataRow[0].ToString());
}
return resultsList;
}
Run Code Online (Sandbox Code Playgroud)
数据表是否处理?有人可以解释这是如何转换为try/catch/finally块的吗?MSDN声明如果发生异常,仍会调用Dispose方法但是return语句呢?
或者我应该使用下面的代码:
List<string> resultsList = new List<string>();
using (DataTable resultTable = DBUtility.GetSingleDBTableResult(connectionString, "SELECT * FROM MyDBTable")) {
foreach (DataRow dataRow in resultTable.Rows) {
resultsList.Add(dataRow[0].ToString());
}
}
return resultsList;
Run Code Online (Sandbox Code Playgroud)
可能应该使用第二个,但我只需要启蒙:).请解释.谢谢.
使用对象初始化程序,是否可以选择包含属性设置?
例如:
Request request = new Request
{
Property1 = something1,
if(something)
Property2 = someting2,
Property3 = something3
};
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用NHibernate 2.0.1创建一个每层次表映射.我有一个基类,其中包含其他类继承的每个子类的属性.所有这些对象都持久保存到一个名为Messages的表中,该表包含每个类的所有可能字段.有一个SourceID是鉴别器,应该指出每个子类返回哪个Poco.这是我目前的映射.
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
assembly="NS.Core"
namespace="NS.Core.Model">
<class name="BaseMessage" table="Messages">
<id name="MessageID" type="Int64">
<column name="MessageID" />
<generator class="native" />
</id>
<discriminator column="SourceID" type="Int32"/>
<property name="DateCreated" access="property" column="DateCreated" type="DateTime" not-null="true"/>
<property name="DatePublished" access="property" column="DatePublished" type="DateTime"/>
<property name="SourceID" access="property" column="SourceID" type="Int32"/>
<many-to-one name="User" column="UserID" access="property" cascade="none" lazy="false" fetch="join" outer-join="true" />
<subclass name="NMessage" discriminator-value="0">
<property name="Body" access="property" column="Body" type="String"/>
</subclass>
<subclass name="BMessage" discriminator-value="1">
<property name="Title" access="property" column="Title" type="String"/>
<property name="Body" access="property" column="Body" type="String"/>
</subclass>
<subclass name="CMessage" discriminator-value="2">
<property name="Url" access="property" …Run Code Online (Sandbox Code Playgroud) 我有一个运行的Windows服务,BackgroundWorker我想知道当我停止我的Windows服务时我是否正在做正确的事情.
是否足够:
BackgroundWorker1_DoWork方法完成(我现在有一个while循环,做一些任务)BackgroundWorker,以null是否有某种Dispose()方法,我需要调用(同样的Timer类有Timer.Dispose();)?
运行时主机的确切定义是什么?
公共语言运行库旨在支持各种不同类型的应用程序,从Web服务器应用程序到具有传统丰富Windows用户界面的应用程序.每种类型的应用程序都需要运行时主机来启动它.运行时主机将运行时加载到进程中,在进程内创建应用程序域,并将用户代码加载到应用程序域中.
那么它是一个将运行时加载到另一个进程的进程吗?
如何在任务管理器中检查它?
任何人都可以指出我如何实现由数据库驱动的分层导航菜单?我不想在这里重新发明轮子,所以我想知道是否有一些已经完成的事情.我知道asp.net中的Menu控件,但从我认为它不适用于MVC.是否有一些已经作为框架的一部分提供的内容可以用于此目的?如果没有,那么可能有一些链接指向正确的方向?
谢谢.
让纹理贴图在openGL ES(iphone)中工作时遇到很多麻烦.
这就是我所做的:
以下是Jeff Lamarche的教程.获取对象渲染和移动不是问题.
现在我正在尝试获得立方体(实际上是一块瓷砖,Z在X或Y中更窄)以在两个相对的面上粘贴纹理(其他面板可以稍后出现).我已经能够让一张脸上班,但我在任何其他方面都没有得到可行的结果.
在OpenGL ES中纹理映射对象的最系统方法是什么,任何人都可以看到我的代码中的错误在哪里?
#import "GLViewController.h"
#import "ConstantsAndMacros.h"
#import "OpenGLCommon.h"
#import "Cube.h"
@implementation GLViewController
@synthesize initDone;
@synthesize tileArray;
@synthesize tileRows;
@synthesize tileCols;
@synthesize cubes;
@synthesize gridOffsetX;
@synthesize gridOffsetY;
@synthesize gridOffsetZ;
@synthesize tileSpacing;
- (void)drawView:(UIView *)theView
{
static GLfloat rot = 0.0;
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_NORMAL_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
// This is the same result as using Vertex3D, just faster to type and
// can be made const this way
static const Vertex3D vertices[]= { …Run Code Online (Sandbox Code Playgroud) 我刚才正在查看代码教程,并发现了一些有趣的东西 - import staticJDK 5中引入的功能:
import static org.junit.Assert.assertEquals;
public class AdditionTest {
private int x = 1;
private int y = 1;
@Test public void addition() {
int z = x + y;
assertEquals(2, z);
/* ^ this is a static method, normally called by Assert.assertEquals */
}
}
Run Code Online (Sandbox Code Playgroud)
它让我想知道,JDK 5和6中引入了哪些其他功能我不知道?还有其他新的关键字用法吗?任何值得注意的新库类或函数?
我知道那里有发行说明或更改日志,我不是在寻找"RTFM"的答案.我想知道一个简短的列表,在您看来,您认为哪些功能在JDK 5或6中最具游戏规则.
场景:
我有一个窗口表单,其中包含DataGridWiew3个预定义列.我在函数外部声明了3个变量并分配到函数内部.我有一个枚举东西的函数,并将它放在3列中,逐行:
string VARIABLE1;
string VARIABLE2;
string VARIABLE3;
private void FunctionEnumerateStuff()
{
foreach (StuffObject STUFF in StuffCollection)
{
VARIABLE1 = STUFF.SubStuff1.ToString();
VARIABLE2 = STUFF.SubStuff2.ToString();
VARIABLE3 = STUFF.SubStuff3.ToString();
DatagridWiew1.Rows.Add(VALUE1, VALUE2, VALUE3);
}
}
Run Code Online (Sandbox Code Playgroud)
我想要做的是从一个BackGroundWorker进程执行这个功能,这样应用程序的GUI将是平滑和响应的.我已经阅读了背景工作者,但我遇到了麻烦,因为所有的例子似乎都是完全不同的情况,而且大多数情况都非常复杂.
一些有用的教育灵魂可以帮助我和其他人有一个非常基本的例子,说明如何以最简单的方式使其工作.谢谢.
我有一个WPF应用程序,它有一个列表框,我正在尝试应用一些鼠标悬停效果.当我使用简单的Setters来改变鼠标悬停/选择时的背景颜色时,一切正常,但我认为如果它在状态之间动画会看起来更好,所以我将Setters 切换为进入/退出Storyboards.这一切都很好地工作(鼠标悬停动画输入和输出,选择动画输入和输出),但一旦选择了某些内容然后被取消,它将永远不会再次执行鼠标悬停效果.
这是显示问题的最小代码示例:
<Window x:Class="WpfTest.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="500" Width="500">
<Window.Resources>
<Style x:Key="ListboxItemStyle" TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<Border x:Name="border" BorderThickness="1" Height="50" Background="#000">
<ContentPresenter />
</Border>
<ControlTemplate.Triggers>
<MultiTrigger>
<MultiTrigger.Conditions>
<Condition Property="IsMouseOver" Value="True" />
<Condition Property="IsSelected" Value="False" />
</MultiTrigger.Conditions>
<MultiTrigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Duration="0:0:0.15" Storyboard.TargetName="border"
Storyboard.TargetProperty="Background.Color" To="#00F" />
</Storyboard>
</BeginStoryboard>
</MultiTrigger.EnterActions>
<MultiTrigger.ExitActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Duration="0:0:0.3" Storyboard.TargetName="border"
Storyboard.TargetProperty="Background.Color" To="#008" />
</Storyboard>
</BeginStoryboard>
</MultiTrigger.ExitActions>
</MultiTrigger>
<Trigger Property="IsSelected" Value="True">
<Trigger.EnterActions>
<BeginStoryboard>
<Storyboard>
<ColorAnimation Duration="0:0:0.15" …Run Code Online (Sandbox Code Playgroud) c# ×5
.net ×1
animation ×1
asp.net ×1
asp.net-mvc ×1
clr ×1
database ×1
fixed ×1
iphone ×1
java ×1
javascript ×1
jdk1.5 ×1
jdk1.6 ×1
jquery ×1
listbox ×1
menu ×1
navigation ×1
nhibernate ×1
opengl-es ×1
polymorphism ×1
process ×1
runtime ×1
storyboard ×1
textures ×1
timer ×1
using ×1
wpf ×1