我正在使用ESRI的ArcObjects COM库,我正在努力弄清楚"选择"应该是什么类型:
IMxDocument doc = m_application.Document as IMxDocument;
object selected = doc.SelectedItem;
Run Code Online (Sandbox Code Playgroud)
SelectedItem返回一个comobject(Not Null),通常表示当前选择的数据类型.但是我没有最微弱的想法,我应该把它投入到什么类型.当我调试它时,我真的没有看到任何有用的东西:
(在设置值后观察调试)
ESRI的ArcObjects库非常庞大,文档记录很差,我简直无法理解.我甚至竟然手动检查了大约50个我认为应该是的界面.
有没有人有任何想法我怎么能搞清楚这一点?
编辑澄清他们的文档绝对没有帮助,他们的论坛也没有.
我的应用程序已经对域层进行了单元测试我想知道单元测试控制器的优缺点是什么
在测试控制器时应该编写哪些测试用例.
谢谢
如何从另一个调用一个Capistrano任务?
例如:
task :foo do
# stuff
end
task :bar do
# INVOKE :foo
end
Run Code Online (Sandbox Code Playgroud) 我有一个 Windows (XP) 应用程序,需要在窗口中显示一个二维矩形。矩形不得被剪裁(即必须始终完全位于视口内),并且在调整大小时必须保留其纵横比。目前,处理布局的方法会扭曲矩形的纵横比以匹配窗口。我希望矩形缩放到窗口并在窗口中居中(同样,不进行裁剪)。目前的方法如下。lWinDist 和 lMaxDepth 是要显示的矩形的宽度和高度(如果重要的话,以 48 英寸为单位):
void CRoRRecView::RedoLayout( long lWinDist, long lMaxDepth )
{
CDC* pDC = GetDC() ;
if ( pDC != NULL )
{
m_lWinDist = lWinDist;
GetClientRect( m_rectClient ) ;
int nClientWidth = m_rectClient.Width();
int nClientHeight = m_rectClient.Height();
glViewport( 0, 0, nClientWidth, nClientHeight );
glMatrixMode( GL_PROJECTION);
glLoadIdentity();
m_fWinXDist = (float) lWinDist ;
m_fWinYDist = lMaxDepth ;
m_fAspectRatio = m_fWinXDist / m_fWinYDist;
glOrtho(0.0, m_fWinXDist, 0.0, m_fWinYDist, -1, 1 ) ;
glRotatef(180.0, 0,1,0);
glTranslatef( (float)(-1 * …Run Code Online (Sandbox Code Playgroud) 我只是发现自己心不在焉地from用作标识符.
我意识到可以使用@转义标识符名称,因此使用保留字,但我不明白为什么在这种情况下我没有警告或错误.
除了预期的目的之外,我不想使用保留字,但我不想再犯一个类似的错误,并且想知道在某些情况下不保留语言关键字的理由.
我需要计算我的应用程序中的代码行数(在PHP中,而不是命令行),并且因为Web上的代码片段没有太多帮助,所以我决定在这里问一下.谢谢你的回复!
编辑
实际上,我需要整个片段来扫描和计算给定文件夹中的行.我在CakePHP中使用这种方法,所以我很欣赏无缝集成.
我有以下型号
class Person
include Mongoid::Document
embeds_many :tasks
end
class Task
include Mongoid::Document
embedded_in :commit, :inverse_of => :tasks
field :name
end
Run Code Online (Sandbox Code Playgroud)
我如何确保以下内容?
person.tasks.create :name => "create facebook killer"
person.tasks.create :name => "create facebook killer"
person.tasks.count == 1
different_person.tasks.create :name => "create facebook killer"
person.tasks.count == 1
different_person.tasks.count == 1
Run Code Online (Sandbox Code Playgroud)
即任务名称在特定人员中是唯一的
检查了索引上的文档后,我认为以下内容可能有效:
class Person
include Mongoid::Document
embeds_many :tasks
index [
["tasks.name", Mongo::ASCENDING],
["_id", Mongo::ASCENDING]
], :unique => true
end
Run Code Online (Sandbox Code Playgroud)
但
person.tasks.create :name => "create facebook killer"
person.tasks.create :name => "create facebook killer" …Run Code Online (Sandbox Code Playgroud) 我需要确定我的Python脚本何时在Xen虚拟机中运行.VM将运行Linux.
我在平台模块中找不到任何明显的东西.我能得到的最接近的是platform.platform()中'xen'的外观
>>> platform.platform()
'Linux-2.6.18-194.el5xen-x86_64-with-redhat-5.5-Final'
Run Code Online (Sandbox Code Playgroud)
确定这个的最佳方法是什么?
谢谢.
我正在尝试组织3个LinearLayouts,这样一个是左对齐,一个是右对齐,而第三个是两个之间,两边有相同数量的空白.我想我将它们包装在RelativeLayout中来实现这一目标.然后将一个布局设置为alignParentLeft,将第二个布局设置为alignParentRight.但是对于第3个布局,我想设置layout_marginLeft =(RelativeLayout.width - (layout1.width + layout2.width + layout3.width))/ 2.虽然,我不知道如何在xml中这样做.有什么建议?
*编辑.基于建议,我现在使用LinearLayout.这更接近于工作,但3个布局不是均匀间隔,并且正确的布局不正确.下面是我的xml:
<LinearLayout
android:id="@+id/toolbar"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingTop="4dip"
android:paddingBottom="4dip"
android:background="#50000000"
android:visibility="visible">
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/open"
android:src="@drawable/open"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/prev"
android:src="@drawable/prev"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
<TextView
android:id="@+id/totalpages"
android:text="0 of 0"
android:layout_gravity="center"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="#FFFFFFFF">
</TextView>
<ImageButton
android:id="@+id/next"
android:src="@drawable/next"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
</LinearLayout>
<LinearLayout
android:orientation="horizontal"
android:layout_gravity="right"
android:layout_width="wrap_content"
android:layout_weight="1"
android:layout_height="wrap_content">
<ImageButton
android:id="@+id/zoomout"
android:src="@drawable/zoomout"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
<ImageButton
android:id="@+id/zoomin"
android:src="@drawable/zoomin"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
</ImageButton>
</LinearLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud) c# ×2
android ×1
asp.net-mvc ×1
capistrano ×1
com ×1
controller ×1
mongodb ×1
mongoid ×1
opengl ×1
php ×1
python ×1
syntax ×1
unit-testing ×1
xen ×1