我有一个3D表面,(想想xy平面).飞机可以倾斜.(想想一条斜坡路).
鉴于三维坐标的列表定义面(Point3D1X
,Point3D1Y
,Point3D1Z
,Point3D12X
,Point3D2Y
,Point3D2Z
,Point3D3X
,Point3D3Y
,Point3D3Z
,等),如何计算表面的面积是多少?
请注意,我的问题类似于在2D平面中查找区域.在2D平面中,我们有一个定义多边形的点列表,使用这个点列表我们可以找到多边形的面积.现在假设所有这些点都具有z
这样的值,即它们在3D中升高以形成表面.我的问题是如何找到3D表面的区域?
默认情况下,Graphviz中的边标签位于边缘的右侧.我正在寻找一种方法将标签放在边缘上,以边缘为中心.(它仍然可读,因为我正在改变边缘的颜色).
有任何想法吗?
我以为我得到了可可内存管理的支持,但我显然还有很多需要学习的东西.
看看我写的这堂课:
Word.h
#import <UIKit/UIKit.h>
@interface Word : NSObject {
NSString *word;
NSMutableArray *wordArray;
}
@property (nonatomic ,retain) NSString *word;
@property (nonatomic ,retain) NSMutableArray *wordArray;
@end
Run Code Online (Sandbox Code Playgroud)
Word.m
#import "Word.h"
@implementation Word
@synthesize word, wordArray;
- (void)setWord:(NSString *)aWord {
NSMutableArray *newValue = [[NSMutableArray alloc] init];
self.wordArray = newValue;
[newValue release];
for (int i = 0 ;i < [aWord length] ;i++) {
NSString *character = [[NSString alloc] init];
character = [NSString stringWithFormat:@"%C",[aWord characterAtIndex:i]];
[wordArray addObject:character];
//[character release];
}
}
- (void)dealloc { …
Run Code Online (Sandbox Code Playgroud) 码.
Public Function comb1(ByVal SName As String) As DataTable
Dim dt As New DataTable
cmd = New SqlCommand("Select Distinct RName from tb_RS_New", con)
dr2 = cmd.ExecuteReader
While (dr2.Read())
dt.Rows.Add(dr2("RName"))
End While
Return dt
End Function
Run Code Online (Sandbox Code Playgroud)
在加载页面时,错误被抛出为"输入数组长于此表中的列数"
我的代码有什么问题.
需要帮忙
我尝试执行以下操作:
分离数据库
将文件复制到临时文件夹
再次附加数据库
这是第一次工作,但是当我尝试从同一个进程第二次运行此方法时,我得到一个错误.我总是可以访问从其他客户端再次附加的数据库,但不能从我的应用程序中访问.
错误是:
"尝试将请求发送到服务器时传输级别错误.(提供程序:共享内存提供程序,错误:0 - 管道另一端没有进程.)",当我尝试从sys.database_files读取数据时新附加的数据库.
该错误是从德语"FehleraufÜbertragungsebenebeimSenden der Anforderung an den Server"翻译而来的.
它发生在"cmdGetDBFileName.ExecuteReader"之后.我仍然可以打开连接,但查询sys.database_files failes.
源代码很长,但我想你可以在开始时跳过这部分,我将db的文件名分离.你看到我的错误或有任何想法我可以检查吗?
public bool DetachB2CPrepare()
{
_log.Debug("DetachB2CPrepare");
SqlConnection prepareDBConnection = null;
SqlConnection prepareMasterDBConnection = null;
SqlDataReader readerDbFiles = null;
bool result = true;
try
{
//rc_b2c_product_prepare.mdf
string prepareDBPysicalFileName = "";
//rc_b2c_product_prepare
string prepareDBFileName = "";
//D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\rc_b2c_product_prepare.mdf
string prepareDBFileNameComplete = "";
//rc_b2c_product_prepare_1.ldf
string prepareTransactionLogPhysicalFileName = "";
//rc_b2c_product_prepare_log
string prepareTransactionLogFileName = "";
//D:\Program Files\Microsoft SQL Server\MSSQL10.MSSQLSERVER\MSSQL\DATA\rc_b2c_product_prepare_1.ldf
string prepareTransactionLogFileNameComplete = "";
_log.DebugFormat("Try to open …
Run Code Online (Sandbox Code Playgroud) 我想控制音频的播放速度AVAudioplayer
.这可能吗?如果是这样,你会怎么做?
看起来GL已经成为所有游戏平台(甚至手持设备!)的主流.这已经推动了现代GPU芯片组部署到大量消费者.
这真太了不起了.
现在有了现代GPU系统,是否可以进行通用的老式图形编程(也就是说 - 使用VRAM从X rect到Y rect的blit)?(想想Amiga)或者是以顶点和像素着色器为中心的操作?
GL可以访问吗?OpenGL ES?
渲染纹理四边形是可以的,但它需要双缓冲和重新渲染整个场景.看看我是否可以避免这种情况.
我们实现了LowerCaseCharField.我们很乐意听到更好的实施建议.
from django.db.models.fields import CharField
class LowerCaseCharField(CharField):
"""
Defines a charfield which automatically converts all inputs to
lowercase and saves.
"""
def pre_save(self, model_instance, add):
"""
Converts the string to lowercase before saving.
"""
current_value = getattr(model_instance, self.attname)
setattr(model_instance, self.attname, current_value.lower())
return getattr(model_instance, self.attname)
Run Code Online (Sandbox Code Playgroud)
事实上我们喜欢的是:
> modelinstance.field_name="TEST"
> print modelinstance.field_name
'test'
Run Code Online (Sandbox Code Playgroud)
当前实现仅在保存时转换为小写.
我看到nhibernate缓存的一些奇怪的行为,无法理解推理.执行select操作时,我无法缓存查询
query.Select(x=>x).ToList()
Run Code Online (Sandbox Code Playgroud)
但是在执行时可以缓存:
var query = session.Linq<Promoter>();
var p = query.ToList();
Run Code Online (Sandbox Code Playgroud)
两者都产生相同的SQL查询,应该做同样的事情.以下测试解释了该问题.
[Test]
public void Can_Use_Cache()
{
ISessionFactory factory = Storage.Application.Get<ISessionFactory>("SessionFactory");
// initial hit on the database and load into cache - all fine
using (var session = factory.OpenSession())
{
Console.WriteLine("");
Console.WriteLine("First Query");
var query = session.Linq<Promoter>();
query.QueryOptions.SetCachable(true);
query.QueryOptions.SetCacheMode(CacheMode.Normal);
var p = query.ToList();
}
// no hit on the database and retrieved from cache as expected - all fine
using (var session = factory.OpenSession())
{
Console.WriteLine("");
Console.WriteLine("Second Query");
var query …
Run Code Online (Sandbox Code Playgroud) 我需要实现一种功能,允许用户以任何形式输入价格,即允许10美元,10美元,10美元......作为输入.
我想通过为Price类实现自定义模型绑定器来解决这个问题.
class Price { decimal Value; int ID; }
Run Code Online (Sandbox Code Playgroud)
表单包含一个数组或价格作为键
keys:
"Prices[0].Value"
"Prices[0].ID"
"Prices[1].Value"
"Prices[1].ID"
...
Run Code Online (Sandbox Code Playgroud)
ViewModel包含一个Price属性:
public List<Price> Prices { get; set; }
Run Code Online (Sandbox Code Playgroud)
只要用户在Value输入中输入十进制可转换字符串,默认模型绑定器就可以正常工作.我想允许输入"100美元".
我的ModelBinder for Price类型到目前为止:
public object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
Price res = new Price();
var form = controllerContext.HttpContext.Request.Form;
string valueInput = ["Prices[0].Value"]; //how to determine which index I am processing?
res.Value = ParseInput(valueInput)
return res;
}
Run Code Online (Sandbox Code Playgroud)
如何实现正确处理数组的自定义模型Binder?
arrays asp.net-mvc imodelbinder modelbinders custom-model-binder
c# ×3
ado.net ×1
area ×1
arrays ×1
asp.net-mvc ×1
class ×1
cocoa ×1
django ×1
dot ×1
geometry ×1
gpu ×1
graphviz ×1
imodelbinder ×1
iphone ×1
lowercase ×1
math ×1
modelbinders ×1
nhibernate ×1
objective-c ×1
opengl ×1
opengl-es ×1
python ×1
vb.net ×1