我有一个mapview,我想跟踪用户的当前位置.我的手机设置中激活了GPS以及"使用无线网络".然而,由于我在室内,我没有得到GPS定位,因此位置是通过网络确定的; wifi点可用.
我正在运行Google地图应用以及我的应用运行.
奇怪的是,谷歌地图和我的应用程序之间的当前位置不同,谷歌地图非常准确,而在我的应用程序中,位置不知何故离开了几百米.
在我的应用程序中,我基本上执行以下操作(现在用于调试目的):
1)最初在地图上放置一个标记:通过检索到的geopoint locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
2)最初在地图上放置另一个标记:通过检索到的geopoint locationManager.getLastKnownLocation(LocationManager.NETWORK_PROVIDER);
这会将两个提供者的最后已知位置放在地图上(最终从我的应用程序外部知道).
3)然后定期更新(因为我在这里室内没有获得GPS修复),我这样做:
locationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, baseLocationListener);
Run Code Online (Sandbox Code Playgroud)
在两种情况下,您都可以看到我传递0参数的频率和距离.
在应用清单中,授予以下权限:
android.permission.ACCESS_COARSE_LOCATION
android.permission.ACCESS_FINE_LOCATION
android.permission.ACCESS_MOCK_LOCATION
Run Code Online (Sandbox Code Playgroud)
实际上我的baseLocationListener确实被调用,我在日志中看到了,但更新的位置与上一个已知的当前位置(LocationManager.NETWORK_PROVIDER)相同,相同的纬度/经度.
我想也许我忽略了某些东西或错过了参数或设置,或者我的代码有错误.因此,我在Android市场安装了一些其他(总共3个)LBS应用程序,这些应用程序也显示当前用户的位置.这些应用程序中显示的当前位置等于我的应用程序中的位置 - 它们都是100米关闭 - 但至少完全相同.
请看截图: 截图http://img33.imageshack.us/img33/8679/mapproblem.png
http://img33.imageshack.us/img33/8679/mapproblem.png
现在我想知道:
1)据我所知,getLastKnowLocation是系统范围而不是应用程序范围,为什么Google地图中的位置与所有其他应用程序之间存在差异?
2)Google Maps不会更新提供商的lastKnownLocation吗?
3)Google地图是否使用了除GPS_PROVIDER或NETWORK_PROVIDER之外的其他自定义位置提供商(即由于许可原因),因为它们在SDK中?
4)如何使用像Google Maps这样的NETWORK_PROVIDER实现同样准确的结果呢?
更新代码
- (void) searchBarSearchButtonClicked:(UISearchBar *)theSearchBar {
mytimer3=[NSTimer scheduledTimerWithTimeInterval:.03 target:self selector:@selector(show) userInfo:nil repeats:NO];
NSLog(@" search is down");
//////////// rnd to hold keyboard
//ovController.view.backgroundColor = [UIColor grayColor];
self.tableView.scrollEnabled = NO;
UserText=[self.searchDisplayController.searchBar text];
myInt= UserText.length;
//int myInt= [save length];
// NSString *myStringPrt1 = [[NSString alloc] init];
// NSString *myStringPrt2 = [[NSString alloc] init];
if(UserText.length>3)
{
//[ovController.view removeFromSuperview];
//[tableView reloadData];
url=nil;
// myStringPrt1=@"http://find.php?keyword=";
NSString * myStringPrt2=UserText;
// myStringPrt1=[myStringPrt1 stringByAppendingString:myStringPrt2];
// myStringPrt1 = [myStringPrt1 stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
// loadingView.hidden=NO;
NSString *outputString = [[NSString stringWithString:@"http://find.php?keyword="] stringByAppendingString: UserText];
outputString …Run Code Online (Sandbox Code Playgroud) 什么是最简单的MDX请求?
我想测试我的MDX端点是否正确回答了一个非常简单的请求.
在SQL中,我会说SELECT 1;
我的意思是,如果我想存储例如11110011我想将它存储在内存中的1个字节而不是字符数组中.
例如:如果我在使用scanf时写入10001111作为输入,它只获取第一个1并将其存储在变量中,而我想要的是将整个值放入char类型的变量中,只消耗一个字节的内存.
可能重复:
是否可以解密md5哈希?
我散列数据,ComputeHash如何从散列数据中学习原始数据?
private void btn_Hash_Click(object sender, EventArgs e)
{
HashAlgorithm ha = HashAlgorithm.Create();
Stream file = new FileStream(@"C:\temp\simetrik.txt", FileMode.Open, FileAccess.Read);
hashClass.hash = ha.ComputeHash(file);
listBox1.Items.Add(BitConverter.ToString(hashClass.hash));
}
Run Code Online (Sandbox Code Playgroud) 我XPath应该使用什么查询来访问GetLogisticsOfferDateResult节点?我附上了我正在使用的vbscript.我怀疑问题与文档中的多个名称空间有关.但是如何在XPath中引用第二个命名空间?
Dim responseXML
responseXML = '"<s:Envelope xmlns:s=""http://schemas.xmlsoap.org/soap/envelope/""><s:Body><GetLogisticsOfferDateResponse xmlns=""http://schneider-electric.com/OrderEntryService""><GetLogisticsOfferDateResult>2010-07-20</GetLogisticsOfferDateResult></GetLogisticsOfferDateResponse></s:Body></s:Envelope>"'
Dim responseDoc
Set responseDoc = WScript.CreateObject("MSXML2.DOMDocument.6.0")
responseDoc.loadXML(responseXML)
responseDoc.setProperty "SelectionNamespaces", "xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'"
Dim requestedNode
'This node is not found
'Set requestedNode = responseDoc.selectSingleNode("//s:Envelope//s:Body//GetLogisticsOfferDateResponse//GetLogisticsOfferDateResult")
'This node is found
Set requestedNode = responseDoc.selectSingleNode("//s:Envelope//s:Body")
'This node is found
'Set requestedNode = responseDoc.selectSingleNode("//s:Envelope")
If requestedNode Is Nothing Then
WScript.Echo "Node not found"
Else
WScript.Echo requestedNode.text
End If
Set responseDoc = Nothing
Set LODateNode = Nothing
Run Code Online (Sandbox Code Playgroud) 请帮我创建一个包含10'where'子句的选择查询,顺序应该是这样的:结果应该按照大多数关键字(条件)匹配到最不匹配的顺序显示.
注意:所有10个条件都带有"OR".
请帮我创建这个查询.我正在使用ms-sql server 2005
喜欢:
Select *
from employee
where empid in (1,2,4,332,434)
or empname like 'raj%'
or city = 'jodhpur'
or salary >5000
Run Code Online (Sandbox Code Playgroud)
在上面的查询中,所有那些匹配最大条件的记录应该在顶部,而较少匹配的条件记录应该在底部.
我在使用XML创建相对布局时遇到问题,列表项用于ListView中的一系列项目.我已经尝试了好几个小时,我试图让它看起来像我想要的但是不能让所有东西出现在正确的位置而不是重叠或错位.我可以获得第一个图像和下两个textview,但无法获得最后的textview和imageview.
我附上了一个线框样式的图像,说明我是如何尝试它的,并且想知道是否有人可以帮助我?
替代文字http://i26.tinypic.com/6fz702.jpg
如果有人可以提供一些帮助,我将非常感激.
干杯伙计们
Event.observe(window, 'load',
function() {
$$('a.tag_links').each(function(s) {
//alert(s.parent.parent.id); //How to get id of its parent to parent
});
}
);
Run Code Online (Sandbox Code Playgroud)
我想获得父元素的id.
结构是这样的.
<div class="home-page" id='entity-1'>
<div class="index-page-category">
<a href="/entities/category/food" class="tag_links">food</a>
</div>
Run Code Online (Sandbox Code Playgroud)
结果应该是entity-1
我有一个ListBox,我需要将其ControlTemplate设置为Virtualizing WrapPanel,它是一个扩展VirtualizingPanel的类,使用如下所示的样式:
<Style TargetType="{x:Type ListBox}" x:Key="PhotoListBoxStyle">
<Setter Property="Foreground" Value="White" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}" >
<s:VirtualizingVerticalWrapPanel>
</s:VirtualizingVerticalWrapPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
现在,在下面虚拟化WrapPanel的私有方法中,我尝试访问this.ItemContainerGenerator,但我得到null值,任何想法是什么问题?
private void RealizeFirstItem()
{
IItemContainerGenerator generator = this.ItemContainerGenerator;
GeneratorPosition pos = generator.GeneratorPositionFromIndex(0);
using (generator.StartAt(pos, GeneratorDirection.Forward))
{
UIElement element = generator.GenerateNext() as UIElement;
generator.PrepareItemContainer(element);
this.AddInternalChild(element);
}
}
Run Code Online (Sandbox Code Playgroud) android ×2
.net ×1
android-maps ×1
binary ×1
c ×1
c# ×1
char ×1
cryptography ×1
google-maps ×1
html ×1
imageview ×1
iphone ×1
javascript ×1
listview ×1
mdx ×1
objective-c ×1
prototypejs ×1
select ×1
sql ×1
sql-order-by ×1
textview ×1
vbscript ×1
where-clause ×1
wpf ×1
xpath ×1