我有两个地区说rgn1和rgn2.我想使用CombineRgn函数将它们组合在一起.所以我写 -
if CombineRgn(rgnMain,rgn1,rgn2,RGN_OR) = error then
ShowMessage('error');
Run Code Online (Sandbox Code Playgroud)
它的返回值为ERROR.
我测试过rgn1和rgn2是正确的区域.
谢谢.
我正试图开始南方.我有一个现有的数据库,我添加了South(syncdb,schemamigration --initial).
然后,我更新models.py了添加字段并运行./manage.py schemamigration myapp --auto.它似乎找到了该领域并说我可以应用它./manage.py migrate myapp.但是,这样做会给出错误:
django.db.utils.DatabaseError: table "myapp_tablename" already exists
Run Code Online (Sandbox Code Playgroud)
tablename是第一个列出的表models.py.
我正在运行Django 1.2,South 0.7
如何用Asynctask替换以下代码行?你如何从Asynctask"取回"位图?谢谢.
ImageView mChart = (ImageView) findViewById(R.id.Chart);
String URL = "http://www...anything ...";
mChart.setImageBitmap(download_Image(URL));
public static Bitmap download_Image(String url) {
//---------------------------------------------------
Bitmap bm = null;
try {
URL aURL = new URL(url);
URLConnection conn = aURL.openConnection();
conn.connect();
InputStream is = conn.getInputStream();
BufferedInputStream bis = new BufferedInputStream(is);
bm = BitmapFactory.decodeStream(bis);
bis.close();
is.close();
} catch (IOException e) {
Log.e("Hub","Error getting the image from server : " + e.getMessage().toString());
}
return bm;
//---------------------------------------------------
}
Run Code Online (Sandbox Code Playgroud)
我想过这样的事情:
替换:
mChart.setImageBitmap(download_Image(graph_URL));
Run Code Online (Sandbox Code Playgroud)
通过类似的东西:
mChart.setImageBitmap(new DownloadImagesTask().execute(graph_URL));
Run Code Online (Sandbox Code Playgroud)
和
public class DownloadImagesTask extends …Run Code Online (Sandbox Code Playgroud) 它们empty()和remove()方法之间有什么区别jQuery,当我们调用这些方法时,正在创建的对象将被销毁并释放内存?
我认为使用我自己的自定义图钉进行注释会非常容易.
但我从来没有能够让它工作,我不明白为什么!
我只是使用:
Annotation *anno = [[[Annotation alloc] init] autorelease];
anno.coordinate = ridesMap.userLocation.location.coordinate;
anno.title = @"Current Location";
anno.subtitle = [NSString stringWithFormat:@"%f, %f", anno.coordinate.latitude, anno.coordinate.longitude];
static NSString *defaultPinID = @"LocationIdentifier";
MKPinAnnotationView *pinView = (MKPinAnnotationView *)[ridesMap dequeueReusableAnnotationViewWithIdentifier:defaultPinID];
if (pinView == nil){
pinView = [[[MKPinAnnotationView alloc] initWithAnnotation:anno reuseIdentifier:defaultPinID] autorelease];
}
pinView.image = [UIImage imageNamed:@"custom_pin.png"];
pinView.opaque = NO;
pinView.canShowCallout = YES;
pinView.draggable = NO;
pinView.annotation = anno;
NSLog(@"Adding current location annotation");
return pinView;
Run Code Online (Sandbox Code Playgroud)
我认为这应该工作,因为UIImage是它想要的,我在我的项目中有custom_pin.png文件.
它从不使用我的图像,只是标准的红色图钉.我在这做错了什么?
有什么简单的方法可以在Vim中的ruby中切换"do/end"和"{}"吗?
(TextMate这样做^{.)
Ayende有一篇关于如何使用事件处理程序为NHibernate(这里)实现简单审计跟踪的文章.
不幸的是,正如在注释中可以看到的那样,他的实现导致抛出以下异常:集合xxx未由flush()处理
问题似乎是在脏属性上对ToString的隐式调用,如果dirty属性也是映射实体,则会导致麻烦.
我尽最大努力建立一个有效的实施但没有运气.
有谁知道一个有效的解决方案?
有没有人知道Scala中是否有类似的东西:
case class Thing(property:String)
def f(thing:Thing, prop:String = thing.property) = println(prop)
Run Code Online (Sandbox Code Playgroud)
上面的代码没有编译; 给错误error: not found: value thing的thing.property
以下显示了预期的行为:
f(Thing("abc"), "123") // prints "123"
f(Thing("abc")) // prints "abc"
Run Code Online (Sandbox Code Playgroud)
我意识到我可以使prop参数成为一个Option[String]并在函数定义中进行检查,但我想知道是否有一种方法可以使用2.8.0中的新命名/默认参数支持.