最近我想在一个小项目中尝试Scala 2.9中的一些新功能.我想用maven来构建它.我如何告诉Maven使用最新的每晚Scala 2.9版本?如果有人知道如何用sbt而不是maven来做这件事,那也会很好.
我有一个Poly3DC++类,它有一个唯一的成员:list<Point_3>
using namespace std;
struct Poly3D
{
public:
Poly3D(const list<Point_3> &ptList);
private:
list<Point_3> ptList;
};
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何通过引用获取(在C#意义上),以便每次访问时都返回相同的副本Poly3D.ptList?
我正在计算一个值(应该反映方向矢量和XZ平面之间的角度的sin),就像这样
angle_between_direction_and_Xplane = (Math.Abs(enemyShip_.orientation.Forward.Y) / Math.Sqrt(Math.Pow(enemyShip_.orientation.Forward.X, 2) + Math.Pow(enemyShip_.orientation.Forward.Y, 2) + Math.Pow(enemyShip_.orientation.Forward.Z, 2)));
Run Code Online (Sandbox Code Playgroud)
它似乎工作得很好.当物体垂直于地面时,angle_between_direction_and_Xplane接近于1,当它与XZ平面并行时,它接近0.
当我应用Math.Asin我想获得一个角度(如70或20度),但我得到大约1的值.我用错了吗?
在SQLCMD中运行脚本时,是否有设置,参数或任何其他方法使其在每个SQL语句结束时有效地运行GO命令?
这样可以防止需要将定期GO命令插入到非常大的脚本中.
我有一个包含多个项目的解决方案,所有项目都输出dll(当然主要应用除外).对于所有引用,将local local设置为true,并且与exe在同一目录中的dll一切都很好.
我的问题是这很难看.我想将所有dll放在子文件夹中(实际上是两个子文件夹).如何在Visual Studio 2008中执行此操作?
我发现了一些似乎相似的问题,但我找不到我知道的简单答案.
编辑:为了更清楚,我想知道如何使程序集加载器在操作目录之外的某处寻找引用.用户将与目录中的一些其他文件进行交互,对他们来说,杂乱程度越低越好.
编辑2:我也想避免使用GAC.应用程序需要自包含.
我正在尝试导入由filemaker创建的csv并使用iTunes文件共享复制到我的设备上.我坚持应该是一个直截了当的步骤.我只是看不出我出错的地方.尝试了替代方法并设置了UTF8编码.还尝试从filemaker导出为xml UTF8,并尝试从手机中删除该应用程序并重新运行.即使我指定它,它似乎也不会读取编码.以下代码为我提供了此控制台输出.
文件存在导入(null)错误域= NSCocoaErrorDomain代码= 264"操作无法完成.(可可错误264.)"
-(void)importDatabase {
NSString *importString;
NSError *error;
NSString *documentsDirectoryPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
if ([[NSFileManager defaultManager] fileExistsAtPath:[documentsDirectoryPath stringByAppendingString:@"/iPhone.csv"]]) {
NSLog(@" File exists");
NSStringEncoding encoding;
importString = [NSString stringWithContentsOfFile:[documentsDirectoryPath stringByAppendingString:@"/iPhone.csv"] usedEncoding:&encoding error:&error];
NSLog(@"Import %@ %@ ",importString, error);
} else {
NSLog(@" File doesn't exist");
}
Run Code Online (Sandbox Code Playgroud)
}
我在rails应用程序中使用MySQL.我有一个用户表(标准的东西,如id,名称等)和书籍表(再次与id,user_id和标题等).
我想有一个列(让我们称之为user_book_id),它应该像id一样自动递增,但是用user_id限定.就像id一样,即使在books表中删除了一条记录,也不应该重用user_book_id.一个例子:
User
id | Name
------------
1 | Jerry
2 | Newman
Book
id | user_id | user_book_id | Title
-----------------------------------
1 | 1 | 1 | Jerry's First Book
2 | 1 | 2 | Jerry's Second Book
3 | 2 | 1 | Newman's First Book
4 | 1 | 3 | Jerry's Third Book
Run Code Online (Sandbox Code Playgroud)
有没有办法在MySQL中这样做?我搜索但找不到任何东西.
谢谢,Prateek
我在帖子中读到,您可以在Web配置中使用ASP.Net授权来控制对WCF Web服务的访问,以替换以下属性:
[PrincipalPermission(SecurityAction.Demand, Role="Administrators")]
Run Code Online (Sandbox Code Playgroud)
为了测试我一直在使用"管理员",这是一个有效的角色,所以应该允许我访问和"测试",这不是.这在使用上述属性时工作正常但是当我将其注释掉并在我的Web.Config文件中使用它时:
<authentication mode="Windows" />
<authorization>
<allow roles=".\TEST"/>
<deny roles="*"/>
</authorization>
Run Code Online (Sandbox Code Playgroud)
它仍然允许我访问.
所以我想知道我是否在web.config中遇到了错误,或者我读到的内容是否错误说使用它.
仅供参考,这是我看过的帖子:
在带有WCF的App.config中使用Windows角色身份验证
以下是我的web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<authentication mode="Windows" />
<authorization>
<allow roles=".\TEST"/>
<deny users="*"/>
</authorization>
</system.web>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpEndpointBinding">
<security mode="TransportCredentialOnly">
<transport clientCredentialType="Windows" />
</security>
</binding>
</basicHttpBinding>
</bindings>
<services>
<service behaviorConfiguration="WcfService1.ServiceBehaviour1" name="WcfService1.Service1">
<endpoint address="" binding="basicHttpBinding" bindingConfiguration="BasicHttpEndpointBinding"
name="BasicHttpEndpoint" contract="WcfService1.IService1">
<identity>
<dns value="localhost"/>
</identity>
</endpoint>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="WcfService1.ServiceBehaviour1">
<!-- To avoid disclosing metadata information, set the …Run Code Online (Sandbox Code Playgroud) 我在一个页面中使用Spinner,EditText和Button.微调器有这些项目......
以下:
String[] Items = {
"Alarm",
"Office",
"Meeting",
"Party",
"Lunch",
"Breakfast",
"Supper",
"Home",
"Private",
"Outdoor",
"Family",
"Friends",
"others"
};
Spinner s1;
Run Code Online (Sandbox Code Playgroud)
在其中如果我在微调器项目中选择"其他"意味着只需要启用Edittext,否则必须禁用它.如果我选择其他项目,则必须禁用Edittext
代码段:
s1 = (Spinner) findViewById(R.id.spinner);
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_spinner_item, Items);
s1.setAdapter(adapter);
s1.setOnItemSelectedListener(new OnItemSelectedListener()
{
public void onItemSelected(AdapterView<?> arg0,
View arg1, int arg2, long arg3)
{
int index = s1.getSelectedItemPosition();
Toast.makeText(getBaseContext(),
"You have selected item : " + Items[index],
Toast.LENGTH_SHORT).show();
}
public void onNothingSelected(AdapterView<?> arg0) {}
});
Run Code Online (Sandbox Code Playgroud)
谢谢,
这是一个有趣的请求.客户需要从北极博客.他们在卫星电话上的连接速度非常差,所以一切都需要尽可能精益.
过去,他们通过HTTP通过HTML表单提交文本,并对图像进行FTP.
有趣的是,从舒适的办公桌和高速宽带连接来看,与FTP相比,感觉HTTP上传文件的速度要快得多.但我只是一个程序员,我对将数据从网络的一部分传递到另一部分的基础技术一无所知所以我认为最好与那些对这些事情有更多了解的人进行双重检查.
我认为问题是:带宽和可靠性.
所以,鉴于这些非常严格的条件
他们应该使用FTP还是HTTP从北极上传图像?