我想将一个名为 Credentials 的文件添加到 .gitignore,所以我是这样做的,我将以下行添加到 app 目录中的 .gitignore 文件中:
/src/main/java/my/package/name/utils/Credentials.java
但它仍然显示在 git status 中。
对于给定整数N的用户,我需要制作一个计算3 ^ 2 + 6 ^ 2 + 9 ^ 2 + ... +(3×N)^ 2的程序.程序提示用户输入一个小于的整数程序应该在3次错误机会后停止.这是我的代码:
#include <stdio.h>
int main(){
int n,x,i ;
float p;
printf("Hey give me a positive integer number smaller than 20 \n ");
scanf("%d" ,&n);
x=3;
p=0;
while ((n<=0) && (n>=20)){
printf("wrong input %d chances left \n" ,x);
x--;
if (x==0) return 0;
scanf("%d" , &n);
}
for ( i=0; i<=n; i++){
p= (3*i)* (3*i) + p ;
}
printf("Yeah.. thats the result bro %f \n" , …
Run Code Online (Sandbox Code Playgroud) 我有一个.bat文件,我需要转换为Linux .sh文件.
在这个.bat脚本中有一些我不明白的代码,我找不到合适的关键字来搜索它的含义.
这是代码:
if not x%VERSION:SNAPSHOT=%==x%VERSION% (
echo " .... SNAPSHOT version detected "
echo VERSION=%VERSION:SNAPSHOT=%%formatdate%_%formattime%
)
Run Code Online (Sandbox Code Playgroud)
我的主要问题在于使用":".是什么%VERSION:SNAPSHOT=% do?
我也不知道' x%VERSION%
或'中的'x'的含义x%VERSION:SNAPSHOT%
.
有人能帮我理解这个吗?
我有一个简单的bash脚本:
#!/bin/bash
counter=0
while [ $counter < 100 ]; do
echo $counter
counter=$((counter+1))
done
Run Code Online (Sandbox Code Playgroud)
但是,当我尝试执行此操作时,我收到此错误:
./test: line 4: 100: No such file or directory
Run Code Online (Sandbox Code Playgroud) 好的,我们都知道GCM的功能,但是我的问题是:GCM在处理聊天应用程序方面是否可靠?我的意思是它可以处理(快速)向数百人发送消息的问题吗?如果没有,最好的方法是什么?
我已经阅读了很多有关聊天应用程序的内容,发现必须使用XMPP,但我所能找到的就是与我的服务器不集成的API,例如Parse(我们必须使用其后端进行注册和登录,不是很方便)
谢谢你们
编辑:带有XMPP的Google Cloud Messaging GCM CCS如何
我使用自定义图像选择器来选择时间流逝,我想获取所选时间流逝的网址,以便我可以播放时间流逝.
- (void)qb_imagePickerController:(QBImagePickerController *)imagePickerController didFinishPickingAssets:(NSArray *)assets {
for (PHAsset *asset in assets) {
NSURL *url = [NSURL URLWithString: assetURLgoesHere];
AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:url options:nil];
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:avAsset];
AVPlayer *videoPlayer = [AVPlayer playerWithPlayerItem:playerItem];
[videoPlayer play];
}
[self dismissViewControllerAnimated:YES completion:NULL];
}
Run Code Online (Sandbox Code Playgroud)
这就是我现在所拥有的,但我需要获得资产的网址.
我通常使用swift但这个自定义图像选择器是用objective-c编写的.所以我有点客观 - c菜鸟
更新的代码
- (void)qb_imagePickerController:(QBImagePickerController *)imagePickerController didFinishPickingAssets:(NSArray *)assets {
for (PHAsset *asset in assets) {
- (PHImageRequestID)requestAVAssetForVideo:(PHAsset *)asset options:(PHVideoRequestOptions *)options resultHandler:(void (^)(AVAsset *asset, AVAudioMix *audioMix, NSDictionary *info))resultHandler
NSURL *url = [NSURL URLWithString: asset];
AVURLAsset *avAsset = …
Run Code Online (Sandbox Code Playgroud) 我已经为我的web api 2项目创建了一个帮助区域文档(基于owin/katana).我打开配置中的所有设置并安装Microsoft.AspNet.WebApi.OData
.目前我有以下设置:
config.SetSampleObjects(new Dictionary<Type, object>
{
{typeof(string), "sample string"},
{typeof(IEnumerable<string>), new string[]{"sample 1", "sample 2"}}
});
config.SetSampleForMediaType(
new TextSample("Binary JSON content. See http://bsonspec.org for details."),
new MediaTypeHeaderValue("application/bson"));
config.SetSampleForType("[0]=foo&[1]=bar", new MediaTypeHeaderValue("application/x-www-form-urlencoded"), typeof(IEnumerable<string>));
config.SetSampleRequest("1234", new MediaTypeHeaderValue("text/plain"), "Values", "Put");
config.SetSampleResponse(new ImageSample("../images/aspNetHome.png"), new MediaTypeHeaderValue("image/png"), "Values", "Get", "id");
config.SetActualRequestType(typeof(string), "Values", "Get");
config.SetActualResponseType(typeof(string), "Values", "Post");
Run Code Online (Sandbox Code Playgroud)
但是,我没有生成任何响应样本.我的网页看起来像我在网上看到的那样
但它就像这样松散.如何显示JSON等样本响应格式,如第一张图片所示?
c# documentation asp.net-mvc-areas asp.net-web-api asp.net-web-api2
在我的ASP.NET 5 RC1项目中(仅针对dnx46)我正在尝试添加一个针对.net 4.6的(经典)类库项目的引用.
我在构建时遇到此错误:...\MSBuild\14.0\bin\Microsoft.Common.CurrentVersion.targets(1819,5):警告MSB3274:无法解析主要引用"...\ClassLibrary1.dll"因为它是针对".NETFramework,Version = v4.6"框架构建的.这是比当前目标框架".NETFramework,Version = v4.5.1"更高的版本.
为什么会这样?我的ASP.NET 5项目没有针对4.5.1.根据project.json文件,它只针对dnx46.在任何地方我都找不到.net 4.5.1.
这是我的WebApplication项目的project.json:
{
"version": "1.0.0-*",
"compilationOptions": {
"emitEntryPoint": true
},
"dependencies": {
"Microsoft.AspNet.IISPlatformHandler": "1.0.0-rc1-final",
"Microsoft.AspNet.Server.Kestrel": "1.0.0-rc1-final"
},
"commands": {
"web": "Microsoft.AspNet.Server.Kestrel"
},
"frameworks": {
"dnx46": {
"dependencies": {
"ClassLibrary1": "1.0.0-*"
}
},
},
"exclude": [
"wwwroot",
"node_modules"
],
"publishExclude": [
"**.user",
"**.vspscc"
]
}
Run Code Online (Sandbox Code Playgroud)
这是"包装"过程为我的ClassLibrary项目创建的project.json:
{
"version": "1.0.0-*",
"frameworks": {
"net46": {
"wrappedProject": "../../ClassLibrary1/ClassLibrary1.csproj",
"bin": {
"assembly": "../../ClassLibrary1/obj/{configuration}/ClassLibrary1.dll",
"pdb": "../../ClassLibrary1/obj/{configuration}/ClassLibrary1.pdb"
}
}
}
}
Run Code Online (Sandbox Code Playgroud) 如果automapper的集合为空,为什么会创建空的集合实例?这是我的配置
public class MapperProfile : Profile
{
protected override void Configure()
{
AllowNullCollections = true;
AllowNullDestinationValues = true;
Mapper.CreateMap<User, DAL.Models.User>();
Mapper.CreateMap<DAL.Models.User, User>();
Mapper.CreateMap<Role, DAL.Models.Role>();
Mapper.CreateMap<DAL.Models.Role, Role>();
Mapper.CreateMap<Task, DAL.Models.Task>();
Mapper.CreateMap<DAL.Models.Task, Task>();
Mapper.CreateMap<TaskReport, DAL.Models.TaskReport>();
Mapper.CreateMap<DAL.Models.TaskReport, TaskReport>();
Mapper.CreateMap<Project, DAL.Models.Project>();
Mapper.CreateMap<DAL.Models.Project, Project>();
}
}
Run Code Online (Sandbox Code Playgroud)
我的模型具有相同的属性:
public class User
{
public virtual List<Task> Tasks { get; set; }
public virtual List<Role> Roles { get; set; }
public virtual List<TaskReport> TaskReports { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
在Global.asax的MVC项目中,仅添加我的个人资料,如下所示:
Mapper.AddProfile(new BL.MapperProfile());
Run Code Online (Sandbox Code Playgroud)
谢谢!
android ×2
c# ×2
asp.net-core ×1
automapper ×1
avkit ×1
avplayer ×1
bash ×1
batch-file ×1
c ×1
chat ×1
colon ×1
comparison ×1
git ×1
ios ×1
javascript ×1
objective-c ×1
shell ×1
string ×1
syntax ×1
while-loop ×1