我正在使用此处提出的建议(http://www.odetocode.com/articles/473.aspx)使用模拟命名空间和原型设计编写JavaScript AJAX网络聊天系统.
在我的一个原型方法中,我在jQuery中调用$ .ajax方法.我当时想要做的是将返回的JSON数据传递到JavaScript webchat命名空间内的方法中.
问题似乎是因为我创建了一个JavaScript webchat的实例,我不能直接在其中调用一个方法,因为我需要通过实例解决它.
下面代码中的关键部分是
success: function(data, textStatus) {
this.GetUpdate_Success(data)
},
Run Code Online (Sandbox Code Playgroud)
我在想,因为我们在$ .ajax()方法中,这不再引用我们的WebchatV3对象.
完整的JavaScript代码如下所示:
/// <reference path="/JavaScript/jquery-1.3.2-vsdoc2.js" />
// Simulated 'namespace'
var AvonAndSomerset = {}
// Chatroom run time data
AvonAndSomerset.WebchatV3 = function(memberId, passcode) {
this.Members = new Array(); // Members in the chatroom
this.Questions = new Array(); // The questions queue in the chatroom
// Details about the current user
this.currentMember = new AvonAndSomerset.WebchatV3.Member(memberId, passcode, null, …Run Code Online (Sandbox Code Playgroud) 我编写了一个小应用程序,它从一系列KML文件读入,然后Microsoft.SqlServer.Types.SqlGeography使用以下代码将它们转换为类型:
private SqlGeography CreateGeographyFromKML( string kml, bool debug )
{
// use SqlGeographyBuilder to help create the SqlGeography type
var geographyBuilder = new SqlGeographyBuilder();
// Get co-ordinates
var xml = XDocument.Parse(kml);
var df = xml.Root.Name.Namespace;
XElement coordinates = xml.Descendants(df + "coordinates").Single();
// set the Spatial Reference Identifiers that will used to create the point
geographyBuilder.SetSrid(_srid);
geographyBuilder.BeginGeography(OpenGisGeographyType.Polygon);
var longLat = coordinates.Value.Split(' ').Select(c => new { Lat = Convert.ToDouble(c.Split(',')[1]), Long = Convert.ToDouble(c.Split(',')[0]) });
Console.Write("Found {0} ", longLat.Count());
foreach (var coord …Run Code Online (Sandbox Code Playgroud) 我们有一个MS SQL Server 2005安装,它通过链接服务器连接连接到Oracle数据库。
许多 SELECT 语句是通过一系列OPENQUERY()命令执行的。大多数这些语句中的 WHERE 子句都是针对VARCHAR列的。
我听说如果 WHERE 子句区分大小写,它会对性能产生很大影响。
所以我的问题是,如何确保以不区分大小写的方式执行非二进制字符串 WHERE 子句以获得最大性能?
对于新闻编辑室系统,我有一个包含单个新闻故事的课程.在这个类中是一个私有变量,它包含一个通用的图像类列表.作为单个故事的想法可以包含多个图像.
问题是我应该将List变量设为公共,以便我可以通过直接寻址List来添加/删除图像
public class News
{
private _images List<Images>();
public Images
{
get { return _images; }
set { _images = value }
}
}
Run Code Online (Sandbox Code Playgroud)
要么
我应该将List变量设为私有,然后创建操作它的方法:
public class News
{
private _images List<Images>();
public void AddImage( Image image )
public Image GetImage( int imageId )
public int GetImageCount()
public void DeleteImage( int imageId )
}
Run Code Online (Sandbox Code Playgroud)
我的蜘蛛意识告诉我要做的更晚,因为它更抽象的东西.但另一方面,它创造了更多的代码.
我仍在努力思考如何正确使用 LINQ-to-SQL,而不仅仅是编写自己的 sproc。
在属于的代码中,将 userId 传递给方法,然后 LINQ 使用它从GroupTable表中获取与userId匹配的所有行。GroupUser表的主键是GroupUserId,它是Group表中的外键。
/// <summary>
/// Return summary details about the groups a user belongs to
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
public List<Group> GroupsForUser(int userId)
{
DataAccess.KINv2DataContext db = new DataAccess.KINv2DataContext();
List<Group> groups = new List<Group>();
groups = (from g in db.Groups
join gu in db.GroupUsers on g.GroupId equals gu.GroupId
where g.Active == true && gu.UserId == userId
select new Group
{
Name …Run Code Online (Sandbox Code Playgroud) 我正在用C#转换一个C++应用程序,并设法通过大部分工作.但是我坚持以下声明:
#define GET_SHCALL_ID(L) (((L) >> 24) & 0x000000FF)
Run Code Online (Sandbox Code Playgroud)
它由应用程序的另一部分调用,它接收一个Window消息,并将lParam传递给此调用,如下所示:
// We perform and event handling to display state as required here..
LRESULT CShockSampleDlg::OnShockCallEvent(WPARAM wParam, LPARAM lParam)
{
// Pass events here so that they will be displayed int the m_LogMessages window.
OnDebugCallEvents(wParam, lParam);
UINT callID = GET_SHCALL_ID(lParam);
UINT chanID = GET_SHCHAN_ID(lParam);
UINT info = GET_SHCHAN_INFO(lParam);
Run Code Online (Sandbox Code Playgroud)
所以我的问题是:
我有一个DotNetNuke网站,默认情况下人们匿名使用.当他们想要登录时,他们会点击一个链接,/DesktopModules/AuthenticationServices/ActiveDirectory/WindowsSignin.aspx然后将其重定向到首页.
在首页上有一些jQuery,它旨在将登录过程中创建的cookie从永久更改为基于会话(因此当用户浏览器关闭时它们将消失).
然而,虽然我可以在jQuery中创建和读取我自己的cookie(使用cookies插件)但我无法查看登录期间在服务器端创建的cookie.
下图显示了DotNetNuke网站的cookie.

Demo1并Demo3使用以下代码由jQuery创建:
$.cookie('Demo1', 'Fred', { expires: 0.005, path: '/' } );
$.cookie('Demo3', 'Peter', { expires: 0.005, path: '/', domain: 'internet.nt.avs' } );
Run Code Online (Sandbox Code Playgroud)
然后可以使用以下代码读取这些cookie:
alert( $.cookie('Demo3') );
但是,如果我然后尝试读取其他一个cookie,我没有通过jQuery设置,我得到null返回:
alert( $.cookie('.DOTNETNUKE') );
为什么会这样?
正如标题所说:)
在我的数据库中,我正在使用的表具有OrderID字段,该字段确定输出时将显示行的顺序(奇怪的是!).
在C#代码中,此数据表作为通用列表(List)加载,其中集合中的每个项目都是数据库表中行的副本.
因此,我应该在列表中的每个项目中都有一个OrderID字段,并将其用于订购.或者我应该只使用数据库中的OrderID来确定列表中对象的顺序.
要创建OrderID属性,这是一个问题
说明: 填充列表时,用户将添加和删除项目以及更改现有项目的顺序.然后,此数据将保存回数据库.
我正在编写一些Web服务器控件,以便更轻松地使用基本的jQuery UI主题控件和小部件.我在这个阶段需要做的就是在超链接中添加一些额外的CSS类.
下面的代码是我的Web服务器控件.
using System;
using System.ComponentModel;
using System.Security.Permissions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Fusion.UI.Controls
{
[
ToolboxData("<{0}:Hyperlink runat=\"server\"></{0}:Hyperlink>")
]
public class Hyperlink : System.Web.UI.WebControls.HyperLink
{
protected override void AddAttributesToRender(HtmlTextWriter writer)
{
writer.AddAttribute(HtmlTextWriterAttribute.Class, "fg-button ui-state-default ui-corner-all");
// Call underlying renderer
base.AddAttributesToRender(writer);
}
}
}
Run Code Online (Sandbox Code Playgroud)
这很好,并生成一个带有其他CSS类的超链接.但是,如果我还指定CssClass它最终创建一个double类属性:
<Fusion.UI:Hyperlink ID="Hyperlink1" runat="server" NavigateUrl="#" CssClass="ui-state-disabled" >Link</Fusion.UI:Hyperlink>
Run Code Online (Sandbox Code Playgroud)
这会生成以下HTML:
<a class="fg-button ui-state-default ui-corner-all" id="ctl00_cphMainContent_Hyperlink1" class="ui-state-disabled" href="#">Link</a>
Run Code Online (Sandbox Code Playgroud)
救命!我怎么能阻止这种情况发生?
c# ×5
jquery ×2
oop ×2
.net ×1
ajax ×1
asp.net ×1
c++ ×1
class ×1
cookies ×1
dotnetnuke ×1
geography ×1
geospatial ×1
javascript ×1
json ×1
kml ×1
linq ×1
linq-to-sql ×1
macros ×1
messaging ×1
openquery ×1
oracle ×1
prototype ×1
sql ×1
sql-server ×1
sqlgeography ×1