我正在寻找一个.NET库或Google Maps包装器,它包含所有类型的响应作为C#类.
我希望能够做到这样的事情:
var url = "http://maps.googleapis.com/maps/api/geocode/json?address=Wellington&sensor=false";
//Utility functions would be ideal
string jsonResponse = GoogleMaps.GetJson(url);
string jsonResponse = GoogleMaps.GeocodeAddress("Wellington");
Run Code Online (Sandbox Code Playgroud)
我希望能够使用如下结果:
GeocodeResponse r = JsonConvert.DeserializeObject<GeocodeResponse>(jsonResponse); //I am using Json.NET
if(r.status.Equals("OK"))
{
DoSomethingWith(r.result.formatted_address); //intellisense documentation for all the bits in the result would be great
}
Run Code Online (Sandbox Code Playgroud)
这样的事情存在吗?
这有点像这些问题:
然而答案不是我的意思,我不是在寻找拖放地图控件.
大约百分之一的用户在使用我们的应用程序时遇到突然崩溃.日志显示在下面的异常,我到目前为止看到的唯一共同点是,它们都有XP SP3.
提前致谢
Out of memory. at System.Drawing.Graphics.CheckErrorStatus(Int32 status) at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttrs, DrawImageAbort callback, IntPtr callbackData) at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr, DrawImageAbort callback) at System.Drawing.Graphics.DrawImage(Image image, Rectangle destRect, Int32 srcX, Int32 srcY, Int32 srcWidth, Int32 srcHeight, GraphicsUnit srcUnit, ImageAttributes imageAttr) at System.Windows.Forms.ControlPaint.DrawBackgroundImage(Graphics g, Image backgroundImage, Color backColor, ImageLayout backgroundImageLayout, Rectangle bounds, Rectangle clipRect, Point …
var query = from emp in dbEmp.Employees
join dept in dbEmp.Departments on emp.DeptID equals dept.DeptID
where dept.DepartmentName.Contains(this.TextBox1.Text)
select new
{
EmpID = emp.EmpID,
EmpName = emp.EmpName,
Age = emp.Age,
Address = emp.Address,
DeptName = dept.DepartmentName
};
if (query == null)
Label1.Text = "no results match your search";
GridView1.DataSource = query;
GridView1.DataBind();
Run Code Online (Sandbox Code Playgroud)
一切都以正确的方式工作,但标签在查询结果返回null时不显示消息.标签可以无条件显示(query == null).那么如何测试var查询结果是否返回任何内容?谢谢
我正在使用Mac OS和emacs -nw(终端模式).我不知道如何在emacs之外粘贴东西(由emaw -nw中的Mw实现).
我知道emacs -ns可以做到.
搜索互联网和命令Ch b,我找到了那个方法,但它没有成功.
(setq x-select-enable-clipboard t)
(setq interprogram-cut-function 'x-select-text)
Run Code Online (Sandbox Code Playgroud)
我不太了解interprogram-cut-function的论点.x-select-text来自哪里,它意味着什么?
我有一个属性为"Position:relative;"的DIV.现在,这些DIV中有三个.他们都获得了一个独特的ID等.
现在,如果我单击DIV,我希望它能够动画到文档中的某个位置.虽然我无法确定左/上值,因为如果我使用"top"和"left",它会相对地将左侧设置为其父项位置.
也许有点不清楚,但这是我得到的.
将移动的可点击DIV的CSS.
div#left_hldr .switch_project {
z-index: 1001;
position: relative;
margin: 10px 0px 0px 0px;
cursor: pointer;
}
Run Code Online (Sandbox Code Playgroud)
现在,我现在得到的jQuery代码.
// Open project.
$(".switch_project").live('click', function() {
// Get the ID value.
var More_Id = $(this).attr("id");
// Explode the Id.
var Id_Split = More_Id.split("_");
// Get the project ID.
var Project_Id = Id_Split[2];
/*
Replacement of the switch project div.
1 ) Define the current position.
2 ) Define the new position.
3 ) Replace the DIV to the new position. …Run Code Online (Sandbox Code Playgroud) 我已经看到了各种事件处理的例子.这是一个:事件样本.
有时我看到在类之外声明的委托将引发事件(如上面的链接),有时在内部(我认为应该声明它).
它使我更有意义申报活动中,将引发该事件的类.原因是该类将声明的事件实际上只是辅助方法等的一些糖涂层,它们实际上正在添加,减去和调用委托等.
有没有最佳做法?是否有时候你想要在外面声明委托,有时你想在里面声明委托?如果是这样,应该如何决定做什么?
我有一个h:inputText和一个连接到它的h:消息:
<h:inputText id="myText" value="#{myController.myText}" />
<a4j:outputPanel>
<h:message for="myText" .../>
</a4j:outputPanel>
Run Code Online (Sandbox Code Playgroud)
我想从java发送消息,方式如下:
FacesContext.getCurrentInstance().addMessage(arg0, arg1);
Run Code Online (Sandbox Code Playgroud)
发送到h:消息,但发送到特定表单中的特定ID.我怎样才能做到这一点?(没有实现验证bean或验证方法 - 意味着没有抛出验证异常).
我有一个系统,我以字符串的形式提供日期和时间,例如"2011-03-13 03:05:00".我可能会在"2011-03-13 01:59:00"收到此字符串,我需要知道从现在到字符串中的时间之间的时间长度(由于DST更改,时间为6分钟).
我有代码解析字符串并创建一个tm结构,然后转换为time_twith mktime.问题是我必须tm_isdst在解析时间时手动设置标志,所以我正在寻找一种方法来检测是否tm_isdst应该设置.有任何想法吗?
我对如何处理那里有2个的情况下,2AMs这将是具体到我的应用程序的一些想法,但我仍然需要一种方式说"如果这个时间是当前系统时间,将DST生效?"
编辑:基于Pete建议的想法.如果我:
思考?
我有一个Competitions结果表,一方面保存团队成员的名字和他们的排名.
另一方面,我需要维护一个独特的竞争对手名称表:
CREATE TABLE Competitors (cName nvarchar(64) primary key)
Run Code Online (Sandbox Code Playgroud)
现在我在第一个表中有大约200,000个结果,当竞争对手表空时,我可以执行此操作:
INSERT INTO Competitors SELECT DISTINCT Name FROM CompResults
Run Code Online (Sandbox Code Playgroud)
查询只需要大约5秒钟就可以插入大约11,000个名称.
到目前为止,这不是一个关键应用程序,因此我可以考虑每月截断一次竞争对手表,当我收到大约10,000行的新竞争结果时.
但是,当新的和现有的竞争对手增加新的结果时,最佳做法是什么?我不想截断现有的竞争对手表
我只需要为新的竞争对手执行INSERT语句,如果它们存在则不执行任何操作.
根据MSDN Library中的GetMessage API,当出现错误时,它可能会返回-1.该文档提供了应避免的常见错误的代码片段:
while (GetMessage( lpMsg, hWnd, 0, 0)) ...
Run Code Online (Sandbox Code Playgroud)
文件说:
-1返回值的可能性意味着此类代码可能导致致命的应用程序错误.相反,使用这样的代码:
BOOL bRet;
while( (bRet = GetMessage( &msg, hWnd, 0, 0 )) != 0)
{
if (bRet == -1)
{
// handle the error and possibly exit
}
else
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,在每个示例代码中,包括从Microsoft Visual Studio创建的默认应用程序,主消息循环如下所示:
while (GetMessage(&msg, NULL, 0, 0))
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
Run Code Online (Sandbox Code Playgroud)
请注意,上面的GetMessage的第二个参数是NULL.如果上面的代码有效,这是否意味着此处的GetMessage将永远不会返回-1,因此不需要处理返回值-1?