我是powershell的新手,这个问题将证明这一点.我正在从命令行尝试一个简单的任务,我有一个包含由分号分隔的文件名的txt文件,如...
fnameA.ext;fnameB.ext;fnameC.ext;....
Run Code Online (Sandbox Code Playgroud)
我正在尝试运行一个将解析此文件的命令,以分号分隔内容,然后为每个文件运行一个复制命令到所需的目录.
这是我正在运行的命令:
gc myfile.txt |% {$_.split(";") | copy $_ "C:\my\desired\directory"}
但是我为列表中的每个项目收到这样的错误...
Copy-Item : The input object cannot be bound to any parameters for the command either because the command does not take
pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:36
+ gc bla.txt |% {$_.split(";") | copy <<<< $_ "C:\my\desired\directory"}
+ CategoryInfo : InvalidArgument: (fileA.txt:String) [Copy-Item], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.PowerShell.Commands.CopyItemCommand
Run Code Online (Sandbox Code Playgroud) 我正在使用NSExpression评估数学字符串,并且效果很好。但是,我想提供一种在输入字符串无效(例如“ 3 ++ 2”)时捕获错误的方法。有没有办法解决此问题,而不是由于“ NSInvalidArgumentException”而导致应用程序终止。抱歉,我对Objective-C并不陌生。我现在使用的代码是:
NSExpression *exp = [NSExpression expressionWithFormat: string];
NSNumber *result = [exp expressionValueWithObject:nil context:nil];
answer = [result stringValue];
Run Code Online (Sandbox Code Playgroud) 写入文件对我来说非常重要 O_DIRECT标志。
这是我打开文件的方式:
//Open the file
int fd;
if((fd = open(inFilepath, O_WRONLY | O_CREAT |O_SYNC |O_DIRECT,S_IRUSR|S_IWUSR))<0) {
//Error handling
return;
}
Run Code Online (Sandbox Code Playgroud)
我知道 O_DIRECT 的对齐限制。这就是我用 calloc 初始化缓冲区的原因:
char *buff = (char *) calloc((size_t) 1,sizeof(char));
if(write(fd,buff,(size_t)1)<1) {
//Error logging
free(buff);
return -1;
}
Run Code Online (Sandbox Code Playgroud)
我得到了 write: Invalid argument错误。我什至尝试使用更极端的措施,例如 memalign 和 posix_memalign,但遇到了问题(memalign 卡住了,并且 ARM 处理器缺少 posix_memalign)。
当我注释掉 O_DIRECT标志时,一切正常(但 I/O 不是直接的,这是我需要的)。
任何人都知道为什么会发生这种情况?如果O_DIRECT没有在 Android 中实现,那么它应该在 失败open(),而不是在write(); 所以我一定是做错了什么!
谢谢-LD
c java-native-interface android invalid-argument android-ndk
我有一些调用的内核代码memcpy(my_dst, my_src, my_num_bytes)- 有时我my_num_bytes等于0.奇怪的是,一些零星的实验(使用Titan X,CUDA 7.5,驱动程序358.16)表明,当我这样的调用时,数据会被写入目的地.
memcpy() 不说.在使用来自 Google Colab 的 TensorFlow Object Detection API 进行训练时,我收到以下错误(以下详细内容中有两个类似的错误......其中一个在它的末尾):
WARNING:tensorflow:Forced number of epochs for all eval validations to be 1.
W0528 21:13:21.113062 140292083513216 model_lib.py:717] Forced number of epochs for all eval validations to be 1.
INFO:tensorflow:Maybe overwriting train_steps: 200000
I0528 21:13:21.113316 140292083513216 config_util.py:523] Maybe overwriting train_steps: 200000
INFO:tensorflow:Maybe overwriting use_bfloat16: False
I0528 21:13:21.113430 140292083513216 config_util.py:523] Maybe overwriting use_bfloat16: False
INFO:tensorflow:Maybe overwriting sample_1_of_n_eval_examples: 1
I0528 21:13:21.113519 140292083513216 config_util.py:523] Maybe overwriting sample_1_of_n_eval_examples: 1
INFO:tensorflow:Maybe overwriting eval_num_epochs: 1
I0528 21:13:21.113614 140292083513216 config_util.py:523] Maybe …Run Code Online (Sandbox Code Playgroud) python invalid-argument assertion tensorflow google-colaboratory
这让我困惑了好几个小时了.为什么在IE8中测试时会出现"无效参数"错误?
function resizeContainer() {
wHeight = window.innerHeight;
$('.container').each(function () {
$(this).animate({
height: wHeight
}, 400);
});
$('.content').each(function () {
wHeight = window.innerHeight;
fullPad = wHeight - $(this).height();
if (wHeight < 750) {
cropFactor = 1.7;
}
else {
cropFactor = 2;
}
$(this).animate({
paddingTop: fullPad / cropFactor
});
});
}
Run Code Online (Sandbox Code Playgroud)
我得到的确切错误是:
无效的论点.jquery.js,第8826行5
我正在尝试获取我选择的视频的缩略图.
它似乎确实创建了缩略图,但在将其上传到firebase时崩溃了
thumbnailStorageRef我相信它崩溃了.
这是相关的代码:
guard let imagePickerUrl = info[UIImagePickerControllerMediaURL] as? URL else { return }
let videoUrl = imagePickerUrl
// Generate image thumbnail.
let asset: AVAsset = AVAsset(url: videoUrl as URL)
let imageGenerator = AVAssetImageGenerator(asset: asset)
imageGenerator.appliesPreferredTrackTransform = true
var time = asset.duration
time.value = min(time.value, 3)
do {
let thumbnailImage = try imageGenerator.copyCGImage(at: time , actualTime: nil)
let image = UIImage(cgImage: thumbnailImage)
let imageData = UIImagePNGRepresentation(image)!
let thumbnailStorageRef = FIRStorage.storage().reference()
thumbnailStorageRef.child("thumbnails/" + randomString(length: 20) + ".png")
thumbnailStorageRef.put(imageData, metadata: …Run Code Online (Sandbox Code Playgroud) 我在我正在构建的站点中遇到了“警告:为第 215 行 header.php 中的 foreach() 提供的无效参数”,并且没有任何线索。这一定与我不擅长编码的事实有关。
内容如下。第 215 行是第 2 行。
<div class="section-background-pagination caroufredsel-pagination">
<?php foreach ( $hero_slides as $i => $slide_id ) : ?>
<a href="#"></a>
<?php endforeach; ?>
Run Code Online (Sandbox Code Playgroud)
感谢这里所有的聪明人
我收到以下错误,我不明白为什么或它要求什么.
我试图在表格中显示的对象是:
function newURLObject()
{
# param ([String]$Value, [Int]$Count = "1", [String]$IP )
param ([String]$Value, [Int]$Count = "1" )
$obj = new-object PSObject
$obj | add-member -type NoteProperty -Name Value -Value $Value.substring(1)
$obj | add-member -type NoteProperty -Name Count -Value $Count
# $obj | add-member -type NoteProperty -Name IP -Value $IP
return $obj
}
Run Code Online (Sandbox Code Playgroud)
基本流程如下.
#< Declare Objects>
#< Code to create an array of those objects >
$z = @{Expression={$_.Count};Label="Count";width=5}, @{Expression={$_.Value};Label="URL";count=35}
$y = $listOfRequestedURLs | sort count -descending | …Run Code Online (Sandbox Code Playgroud) 我编译代码时收到下面报告的错误.你能错误地纠正我吗?
无效的类型参数
->(有int)
我的代码如下:
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
typedef struct bundles
{
char str[12];
struct bundles *right;
}bundle;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
unsigned long N;
scanf("%lu", &N);
bundle *arr_nodes;
arr_nodes = malloc(sizeof(bundle)*100);
int i=5;
for(i=0;i<100;i++)
{
scanf("%s", &arr_nodes+i->str);
printf("%s", arr_nodes+i->str);
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
我在这些方面面临问题:
scanf("%s", &arr_nodes+i->str);
printf("%s", arr_nodes+i->str);
Run Code Online (Sandbox Code Playgroud) 我有一个函数可以复制现有文档(模板),然后通过将标题名称与文档中列出的标签进行匹配来动态合并数据。该函数运行没有任何问题,但现在每当它尝试合并时突然我都会收到一条错误消息。任何人都可以让我深入了解问题可能是什么?
错误消息:异常:无效参数:替换
奇怪的是,它并没有阻止信息合并,但错误确实阻止了函数完成其他任务。
与错误一致
headers.forEach(function(e){
body.replaceText("<<"+e+">>",data[e]);
return;
});
Run Code Online (Sandbox Code Playgroud)
整个代码:
function documents(sheet, data){
var headers = Object.keys(data[0]);
var docsToMerge = data.map(function(e){
var name = e.location +" - "+e.employeeLastName+", "+e.employeeFirstName+" - "+e.docName+" "+Utilities.formatDate(new Date(e.effectivePayDate), "UTC-4", "M/d/yy");
var newDoc = DriveApp.getFileById(e.template).makeCopy(name, DriveApp.getFolderById(e.folderId));
e.documentLink = newDoc.getUrl();
e.documentId = newDoc.getId();
return e;
});
docsToMerge.forEach(function(e){
mergeDocuments(e, headers, signatureFolderId);
});
}
function mergeDocuments(data, headers){
var id = DocumentApp.openByUrl(data.documentLink).getId();
var doc = DocumentApp.openById(id);
var body = doc.getBody();
headers.forEach(function(e){
body.replaceText("<<"+e+">>",data[e]);
return;
});
doc.saveAndClose();
return;
}
Run Code Online (Sandbox Code Playgroud) invalid-argument ×11
c ×2
powershell ×2
android ×1
android-ndk ×1
assertion ×1
copy ×1
cuda ×1
dereference ×1
firebase ×1
foreach ×1
formatting ×1
html ×1
ios ×1
javascript ×1
jquery ×1
memcpy ×1
nsexpression ×1
objective-c ×1
php ×1
pointers ×1
python ×1
swift ×1
tensorflow ×1
warnings ×1
wordpress ×1