我有一个相当明显的问题 - 我想在不使用图形界面的情况下在生产服务器上运行Smalltalk.这可能与大众或Pharo(甚至可能是Squeak)?
我有一个没有X的VPS托管,并希望在Smalltalk上运行很少的网站,同时使用功能齐全的Smalltalk env在本地开发它们,包括GUI.
我注意到有很多的Objective-C的实例将转发与@class声明类,那么实际导入与进口.m文件的类.我理解这被认为是最佳实践,如问题答案中所述:@class vs. #import
来自C++,这感觉倒退了.我通常会在新类头文件中包含所有需要的.h文件.这似乎是有用的,因为它会导致编译器生成一个警告,当两个类互相包含,在这一点上,我可以决定这是否是一件坏事或不然后用同样的Objective-C的风格和向前在头声明类和将它包含在.cpp文件中.
前向声明@class并在实现文件中导入有什么好处?在C++中转发声明类而不是包含头文件应该是最佳实践吗?或者从这些类似的术语开始考虑Objective-C和C++是错误的吗?
是否可以使用ONE SINGLE语句从一组数字中打印C++中的随机数?
假设这个集是{2,5,22,55,332}
我查了一下rand()但是我怀疑它可以在一个声明中完成.
任何人都可以解释(或建议一个网站或论文)触发器,断言和检查之间的确切区别,还描述我应该在哪里使用它们吗?
编辑:我的意思是在数据库中,而不是在任何其他系统或编程语言.
我正在为客户管理系统编写RESTful服务,我正在尝试找到部分更新记录的最佳实践.例如,我希望调用者能够使用GET请求读取完整记录.但是为了更新它,只允许记录上的某些操作,比如将状态从ENABLED更改为DISABLED.(我有比这更复杂的场景)
出于安全原因,我不希望调用者仅使用更新的字段提交整个记录(这也感觉有点过分).
是否有推荐的构建URI的方法?在阅读REST书籍时,RPC样式调用似乎不受欢迎.
如果以下调用返回ID为123的客户的完整客户记录
GET /customer/123
<customer>
{lots of attributes}
<status>ENABLED</status>
{even more attributes}
</customer>
Run Code Online (Sandbox Code Playgroud)
我该如何更新状态?
POST /customer/123/status
<status>DISABLED</status>
POST /customer/123/changeStatus
DISABLED
...
Run Code Online (Sandbox Code Playgroud)
更新:增加问题.如何将"业务逻辑调用"纳入REST API?这是否有商定的方式?并非所有方法都是CRUD本质上.有些更复杂,比如' sendEmailToCustomer(123) ',' mergeCustomers(123,456) ',' countCustomers() '
POST /customer/123?cmd=sendEmail
POST /cmd/sendEmail?customerId=123
GET /customer/count
Run Code Online (Sandbox Code Playgroud)
谢谢弗兰克
CharacterJava中的类定义了一些方法,这些方法检查给定char参数是否与某些Unicode字符相等或属于某种类型类别.这些字符和类型类别已命名.
由于在给定的javadoc说,对于名为字符的例子是
HORIZONTAL TABULATION,FORM FEED,...;
例如名为类型类别
SPACE_SEPARATOR,PARAGRAPH_SEPARATOR...
但是,作为byte或int值而不是枚举,这些类型的名称在运行时被"隐藏".
那么,是否有可能在运行时获取字符和/或类型类别的名称?
如果一个实例完全属于给定类型,我需要测试.但是,如果子类型被测试为超类型,则似乎instanceof也返回true(情况3).我以前从来不知道这一点,我很惊讶.我在这里做错了吗?我如何准确测试给定类型?
//..
class DataSourceEmailAttachment extends EmailAttachment
//...
EmailAttachment emailAttachment = new EmailAttachment();
DataSourceEmailAttachment emailAttachmentDS = new DataSourceEmailAttachment();
if (emailAttachment instanceof EmailAttachment){
System.out.println(" 1");
}
if (emailAttachment instanceof DataSourceEmailAttachment){
System.out.println(" 2");
}
if (emailAttachmentDS instanceof EmailAttachment){
System.out.println(" 3 ");
}
if (emailAttachmentDS instanceof DataSourceEmailAttachment){
System.out.println(" 4");
}
Run Code Online (Sandbox Code Playgroud)
结果:
1
3
4
Run Code Online (Sandbox Code Playgroud)
我想避免案例3,我只想要"完全匹配"(案例1和4)我该如何测试它们?
这只发生在一些IE中.这里:http://animactions.ca/Animactions/volet_entreprise.php
您可能会注意到,当你点击和圆的一个阻力,你会得到一些与此类似:http://img534.imageshack.us/img534/7578/errorra.png
我想不明白.这是我的图像地图:
<p class="style2">
<map id="FPMap0" name="FPMap0">
<area coords="405, 8, 375, 10, 353, 13, 322, 30, 317, 48, 327, 69, 344, 75, 370, 84, 401, 86, 428, 81, 454, 69, 466, 56, 468, 37, 452, 19, 419, 9" href="le_developpement_des_equipes_de_travail.php" shape="poly" style="outline:0" target="_blank" />
<area coords="95, 164, 65, 166, 43, 174, 21, 186, 16, 206, 27, 225, 48, 237, 76, 241, 99, 241, 129, 236, 151, 228, 165, 214, 167, 194, 154, 177, 130, 168, 105, …Run Code Online (Sandbox Code Playgroud) 我正在使用ExtJS来创建一个formPanel:
new Ext.FormPanel({
labelAlign: 'top',
title: 'Loading Contact...',
bodyStyle:'padding:5px',
width: 600,
autoScroll: true,
closable: true,
items: [{
layout:'column',
border:false,
items:[{
columnWidth:.5,
layout: 'form',
border:false,
items: [{
xtype:'textfield',
fieldLabel: 'First Name',
name: 'first_name',
id: 'first_name',
anchor:'95%'
}, {
xtype:'datefield',
fieldLabel: 'Birthdate',
name: 'birthdate',
width: 150,
}]
},{
columnWidth:.5,
layout: 'form',
border:false,
items: [{
xtype:'textfield',
fieldLabel: 'Last Name',
name: 'last_name',
anchor:'95%'
},{
xtype:'textfield',
fieldLabel: 'Email',
name: 'email',
vtype:'email',
anchor:'95%'
}]
}]
},{
xtype:'tabpanel',
plain:true,
activeTab: 0,
height:300,
/*
* By turning off …Run Code Online (Sandbox Code Playgroud) 我想为用户的位置显示蓝色脉冲点.我这样做:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation{
//some other stuff here
[self.mapView setShowsUserLocation:YES];
}
Run Code Online (Sandbox Code Playgroud)
但我最终得到了
-[MKUserLocation establishment]: unrecognized selector sent to instance 0x125e90
Run Code Online (Sandbox Code Playgroud)
我应该以其他方式这样做吗?
- 编辑 -
我也这样做,这是我最终获得上述异常的地方:
- (MKAnnotationView *) mapView:(MKMapView *)_mapView viewForAnnotation:(AddressNote *) annotation{
if(annotation.establishment != nil){
//do something}
Run Code Online (Sandbox Code Playgroud)
establishment是我在AddressNote上的一个自定义类.当establishment具有值时,会发生异常.如果我没有设置ShowsUserLocation,一切正常,但当然,我没有看到用户位置.
c++ ×2
java ×2
assertions ×1
character ×1
cocoa-touch ×1
css ×1
database ×1
extjs ×1
html ×1
image ×1
instanceof ×1
iphone ×1
javascript ×1
map ×1
mapkit ×1
objective-c ×1
random ×1
rest ×1
smalltalk ×1
sql ×1
srand ×1
triggers ×1
unicode ×1