呼吁setFocus(null)对ItemizedOverlay不"无焦点的"当前标记.根据文件:
...如果找不到该项,则为无操作.您还可以传递null以删除焦点.
这是我的代码:
MapItemizedOverlay
public class MapItemizedOverlay extends ItemizedOverlay<OverlayItem> {
private ArrayList<OverlayItem> items = new ArrayList<OverlayItem>();
public MapItemizedOverlay(Drawable defaultMarker) {
super(defaultMarker);
}
public void addOverlay(OverlayItem overlay) {
items.add(overlay);
populate();
}
@Override
protected OverlayItem createItem(int i) {
return items.get(i);
}
@Override
public int size() {
return items.size();
}
}
Run Code Online (Sandbox Code Playgroud)
创建地图叠加层和一个标记:
StateListDrawable youIcon = (StateListDrawable)getResources().getDrawable(R.drawable.marker_icon);
int width = youIcon.getIntrinsicWidth();
int height = youIcon.getIntrinsicHeight();
youIcon.setBounds(-13, 0-height, -13+width, 0);
GeoPoint location = new GeoPoint(40800816,-74122009);
MapItemizedOverlay overlay = new MapItemizedOverlay(youIcon);
OverlayItem …Run Code Online (Sandbox Code Playgroud) 父母有几个子线程.
如果用户单击停止按钮,则应使用所有子线程终止父线程.
//calls a main thread
mainThread = new Thread(new ThreadStart(startWorking));
mainThread.Start();
////////////////////////////////////////////////
startWorking()
{
ManualResetEventInstance = new ManualResetEvent(false);
ThreadPool.SetMaxThreads(m_ThreadPoolLimit, m_ThreadPoolLimit);
for(int i = 0; i < list.count ; i++)
{
ThreadData obj_ThreadData = new ThreadData();
obj_ThreadData.name = list[i];
m_ThreadCount++;
//execute
WaitCallback obj_waitCallBack = new WaitCallback(startParsing);
ThreadPool.QueueUserWorkItem(obj_waitCallBack, obj_ThreadData);
}
ManualResetEventInstance.WaitOne();
}
Run Code Online (Sandbox Code Playgroud)
我想杀死mainThread.
下面的代码是一个silverlight应用程序,但在WPF中也是如此,所以它似乎只是我在委托,事件等方面缺少的东西.
任何人都可以告诉我为什么以下代码成功执行此事件:
OnLoadingComplete(this, null);
Run Code Online (Sandbox Code Playgroud)
但从不执行此事件处理程序?
void initialDataLoader_OnLoadingComplete(object obj, DataLoaderArgs args)
Run Code Online (Sandbox Code Playgroud)
码:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
using System.Diagnostics;
namespace TestEvent22928
{
public partial class MainPage : UserControl
{
public MainPage()
{
InitializeComponent();
DataLoader initialDataLoader = new DataLoader("initial");
initialDataLoader.RegisterText("test1", "http://test:111/testdata/test1.txt");
initialDataLoader.RegisterText("test2", "http://test:111/testdata/test2.txt");
initialDataLoader.BeginLoading();
initialDataLoader.OnLoadingComplete += new DataLoader.LoadingComplete(initialDataLoader_OnLoadingComplete);
}
void initialDataLoader_OnLoadingComplete(object obj, DataLoaderArgs args)
{
Debug.WriteLine("loading complete"); //WHY DOES EXECUTION NEVER GET HERE?
}
}
public class DataManager
{
public DataLoader CreateDataloader(string dataloaderIdCode)
{
DataLoader dataLoader = new DataLoader(dataloaderIdCode); …Run Code Online (Sandbox Code Playgroud) 使用以下Java代码将字节[]压缩/解压缩到GZIP或从GZIP解压缩.第一个文本字节为gzip字节:
public static byte[] fromByteToGByte(byte[] bytes) {
ByteArrayOutputStream baos = null;
try {
ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
baos = new ByteArrayOutputStream();
GZIPOutputStream gzos = new GZIPOutputStream(baos);
byte[] buffer = new byte[1024];
int len;
while((len = bais.read(buffer)) >= 0) {
gzos.write(buffer, 0, len);
}
gzos.close();
baos.close();
} catch (IOException e) {
e.printStackTrace();
}
return(baos.toByteArray());
}
Run Code Online (Sandbox Code Playgroud)
然后将压缩字节转换为未压缩字节的方法:
public static byte[] fromGByteToByte(byte[] gbytes) {
ByteArrayOutputStream baos = null;
ByteArrayInputStream bais = new ByteArrayInputStream(gbytes);
try {
baos = new ByteArrayOutputStream();
GZIPInputStream gzis = …Run Code Online (Sandbox Code Playgroud) Java Build Path中的Order And Export选项卡有什么用?
我正在编写一个商业产品,它使用简单的注册机制,允许用户在购买前使用该应用程序进行演示.
我的应用程序必须在某处存储注册信息(如果输入)和/或第一次启动的日期,以计算用户是否仍在演示/试用期内.虽然我已经完成了注册机制本身,但我现在必须找到一种将注册信息存储在用户磁盘上的好方法.
最明显的想法是将试用期存储在首选项文件中,但由于用户倾向于不时删除/修改试用期,因此将注册信息保存在单独的,更隐藏的文件中可能是个好主意.
所以这是我的问题:在Windows,Mac OS X和Linux上保留和创建隐藏文件的最佳位置/策略是什么?到目前为止,我想到的是:
当涉及到用户可以写文件的地方时,大多数类Unix系统都被锁定了.在大多数情况下,这只是/tmp目录和用户的主目录.我想这里最简单的可能就是创建一个带有点前缀的文件,使其不太明显,然后给它一个名称,使其与我的应用程序无关.
可能与Linux/Mac OS X非常相似 - 在文件系统权限方面,更新的Windows版本变得更加严格.
无论如何,我想听听你的想法和想法.如果你已经实现过类似的东西,那就更好了.
谢谢!
对我来说,如果复制保护的这种方式好或坏,这些文件的位置比问题的讨论更相关.
我安装了autotest gem并打算将它与rspec一起使用.问题是,当我在我的rails应用程序下运行自动测试时,我看到的只有:
railsapp $ autospec
加载autotest/rails_rspec
它卡在那里直到我从Ctrl-C出来.即使我更改了rspec测试或代码,也没有任何变化.
这是我的〜/ .autotest
要求"自动测试/重启"
需要'redgreen/autotest'
要求'自动测试/ fsevent'
要求"自动测试/咆哮"
在尝试使用javascript手动格式化我的JSON数据并且失败后,我意识到可能有更好的方法.以下是C#中Web服务方法和相关类的代码:
[WebMethod]
public Response ValidateAddress(Request request)
{
return new test_AddressValidation().GenerateResponse(
test_AddressValidation.ResponseType.Ambiguous);
}
...
public class Request
{
public Address Address;
}
public class Address
{
public string Address1;
public string Address2;
public string City;
public string State;
public string Zip;
public AddressClassification AddressClassification;
}
public class AddressClassification
{
public int Code;
public string Description;
}
Run Code Online (Sandbox Code Playgroud)
Web服务使用SOAP/XML很有效,但我似乎无法使用javascript和jQuery获得有效的响应,因为我从服务器返回的消息与我的手工编码的JSON有问题.
我不能使用jQuery getJSON函数,因为请求需要HTTP POST,所以我使用的是低级ajax函数:
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "http://bmccorm-xp/HBUpsAddressValidation/AddressValidation.asmx/ValidateAddress",
data: "{\"Address\":{\"Address1\":\"123 Main Street\",\"Address2\":null,\"City\":\"New York\",\"State\":\"NY\",\"Zip\":\"10000\",\"AddressClassification\":null}}",
dataType: "json",
success: function(response){
alert(response); …Run Code Online (Sandbox Code Playgroud) 我用不同的可绘制目录(ldpi,mdpi和hdpi)设置了我的项目.我有一个具有两种不同分辨率的背景png:drawable-mdpi文件夹中的320x480和drawable-hdpi中的480x800.两者都有相同的文件名.当我尝试将背景加载为清单中的样式(使用样式中的android:windowBackground)时,如果我使用1.6设备的模拟器,我会得到正确的加载(mdpi).但是,如果我在Nexus上尝试此操作,我会看到首先加载了hdpi文件夹中的正确背景,但它会快速切换到mdpi文件夹.我也尝试在布局xml文件中设置背景(android:src = ...)但在这种情况下只加载了mdpi.如果我删除mdpi版本,一切都加载好了.什么问题的任何想法?为什么加载mdpi drawable?
c# ×4
android ×2
asp.net ×1
autotest ×1
background ×1
buildpath ×1
compression ×1
dependencies ×1
drawable ×1
eclipse ×1
events ×1
file ×1
google-maps ×1
gzip ×1
gzipstream ×1
hidden ×1
invisible ×1
java ×1
javascript ×1
jquery ×1
json ×1
kill ×1
licensing ×1
parent ×1
setfocus ×1
silverlight ×1
web-services ×1
wpf ×1
zentest ×1