C++ 编译错误:error: invalid operands of types 'double***' and 'double' to binary 'operator/'?

error: invalid operands of types 'double***' and 'double' to binary 'operator/'

源代码是这样的:
void Porous::Compute_Force(Flow_solver* Flow, Parallel_MPI* MPI_parallel) {

int X, Y, Z;
double F_epsilon;
if (processor_id != MASTER) {
    for (X = 2; X <= MPI_parallel->actual_rows_XYZ[0]+1; ++X) {
        for (Y = 2; Y <= MPI_parallel->actual_rows_XYZ[1]+1; ++Y) {
            for (Z = 2; Z <= MPI_parallel->end_XYZ2[2]+1; ++Z) {
                F_epsilon = 1.75 / sqrt( 150 * pow(Porosity[X][Y][Z],3) );
                Flow->force[X][Y][Z][0] = Porosity[X][Y][Z] * (Flow->viscosity/Permeability[X][Y][Z]
                                        - F_epsilon * Flow->velocity_magnitude[X][Y][Z]/sqrt(Permeability[X][Y][Z]) ) * Flow->velocity[X][Y][Z][0]
                                        + Porosity[X][Y][Z] * Flow->force[X][Y][Z][0];
                Flow->force[X][Y][Z][1] = Porosity[X][Y][Z] * ( Flow->viscosity/Permeability[X][Y][Z]
                                        - F_epsilon * Flow->velocity_magnitude[X][Y][Z] / sqrt(Permeability[X][Y][Z]) ) * Flow->velocity[X][Y][Z][1]
                                        + Porosity[X][Y][Z] * Flow->force[X][Y][Z][1];
                Flow->force[X][Y][Z][2] = Porosity[X][Y][Z] * ( Flow->viscosity / Permeability[X][Y][Z]
                                        - F_epsilon * Flow->velocity_magnitude[X][Y][Z] / sqrt(Permeability[X][Y][Z]) ) * Flow->velocity[X][Y][Z][2]
                                        + Porosity[X][Y][Z] * Flow->force[X][Y][Z][2];
                }
            }
        }
    }

}

c++

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
C++ 编译错误:error: invalid operands of types 'double***' and 'double' to binary 'operator/'?
error: invalid operands of types 'double***' and 'double' to binary 'operator/' 源代码是这样的: void Porous::Compute_Force(Flow_solver* Flow, Parallel_MPI* MPI_parallel) { int X, Y, Z; double F_epsilon; if (processor_id != MASTER) { for (X = 2; X <= MPI_parallel->actual_rows_XYZ[0]+1; ++X) { for (Y = 2; Y <= MPI_parallel->actual_rows_XYZ[1]+1; ++Y) { for (Z = 2; Z <= MPI_parallel->end_XYZ2[2]+1; ++Z) { F_epsilon = 1.75 / sqrt( 150 * pow(Porosity[X][Y][Z],3) ); Flow->force[X][Y][Z][0] = Porosity[X][Y][Z] * (Flow->viscosity/Permeability[X][Y][Z] - F_epsilon * Flow->velocity_magnitude[X][Y][Z]/sqrt(Permeability[X][Y][Z]) ) * Flow->velocity[X][Y][Z][0] + Porosity[X][Y][Z] * Flow->force[X][Y][Z][0]; Flow->force[X][Y][Z][1] = Porosity[X][Y][Z] * ( Flow->viscosity/Permeability[X][Y][Z] - F_epsilon * Flow->velocity_magnitude[X][Y][Z] / sqrt(Permeability[X][Y][Z]) ) * Flow->velocity[X][Y][Z][1] + Porosity[X][Y][Z] * Flow->force[X][Y][Z][1]; Flow->force[X][Y][Z][2] = Porosity[X][Y][Z] * ( Flow->viscosity / Permeability[X][Y][Z] - F_epsilon * Flow->velocity_magnitude[X][Y][Z] / sqrt(Permeability[X][Y][Z]) ) * Flow->velocity[X][Y][Z][2] + Porosity[X][Y][Z] * Flow->force[X][Y][Z][2]; } } } } }
Ubuntu 12.04 Tse make 出错
flex 安装了。 错误信息为: for n in uri hlink stack lib; do make -C $n || exit 1; done make[1]: Entering directory `/home/jshan/Downloads/Tse/tse.code/tse/uri' gcc -c -O2 -I/home/jshan/Downloads/Tse/tse.code/tse/include lex.uri.c uri.l: In function ‘urilex’: uri.l:494: error: invalid lvalue in increment uri.l:494: error: invalid lvalue in increment uri.l:494: error: invalid lvalue in increment uri.l:500: error: invalid lvalue in increment uri.l:500: error: invalid lvalue in increment uri.l:500: error: invalid lvalue in increment uri.l:506: error: invalid lvalue in increment uri.l:506: error: invalid lvalue in increment uri.l:506: error: invalid lvalue in increment uri.l:511: error: invalid lvalue in increment uri.l:511: error: invalid lvalue in increment uri.l:511: error: invalid lvalue in increment uri.l: In function ‘__path_merge’: uri.l:842: error: invalid lvalue in decrement uri.l:843: error: invalid lvalue in decrement uri.l:849: error: invalid lvalue in increment uri.l:850: error: invalid lvalue in increment uri.l:873: error: invalid lvalue in decrement uri.l:874: error: invalid lvalue in decrement uri.l:880: error: invalid lvalue in increment uri.l:881: error: invalid lvalue in increment uri.l:938: error: invalid lvalue in decrement uri.l:940: error: invalid lvalue in decrement uri.l: In function ‘uri_combine’: uri.l:1073: error: invalid lvalue in increment uri.l:1073: error: invalid lvalue in increment uri.l:1073: error: invalid lvalue in increment uri.l:1097: error: invalid lvalue in increment uri.l:1097: error: invalid lvalue in increment uri.l:1097: error: invalid lvalue in increment uri.l:1108: error: invalid lvalue in increment uri.l:1108: error: invalid lvalue in increment uri.l:1108: error: invalid lvalue in increment uri.l:1119: error: invalid lvalue in increment uri.l:1119: error: invalid lvalue in increment uri.l:1119: error: invalid lvalue in increment uri.l:1129: error: invalid lvalue in increment uri.l:1129: error: invalid lvalue in increment uri.l:1129: error: invalid lvalue in increment uri.l:1139: error: invalid lvalue in increment uri.l:1139: error: invalid lvalue in increment uri.l:1139: error: invalid lvalue in increment uri.l:1150: error: invalid lvalue in increment uri.l:1150: error: invalid lvalue in increment uri.l:1150: error: invalid lvalue in increment uri.l:1162: error: invalid lvalue in increment uri.l:1162: error: invalid lvalue in increment uri.l:1162: error: invalid lvalue in increment make[1]: *** [lex.uri.o] Error 1
error A2070:invalid instruction operands
aveL: mov ax,word ptr [stu+si] ;判断学号空间是否为空,若为空则跳出 cmp ax,0 jz over_ave mov ax,0 mov dx,0 mov dl,[stu+si] mov al,[stu+si+1] sub dl,30h sub al,30h shl dl,4 add dx,ax add cx,dx add si,12 inc bx jmp aveL 在SHL DL,4处提示error A2070:invalid instruction operands,求解决办法
mat打不开,报错zlib.error: Error -3 while decompressing data: invalid literal/length code?请帮帮忙,谢谢
import scipy.io as scio<br> dataFile = './mnist.mat'<br> data = scio.loadmat(dataFile)<br> 报错 ``` File "mio5_utils.pyx", line 675, in scipy.io.matlab.mio5_utils.VarReader5.array_from_header File "mio5_utils.pyx", line 705, in scipy.io.matlab.mio5_utils.VarReader5.array_from_header File "mio5_utils.pyx", line 778, in scipy.io.matlab.mio5_utils.VarReader5.read_real_complex File "mio5_utils.pyx", line 450, in scipy.io.matlab.mio5_utils.VarReader5.read_numeric File "mio5_utils.pyx", line 355, in scipy.io.matlab.mio5_utils.VarReader5.read_element File "streams.pyx", line 195, in scipy.io.matlab.streams.ZlibInputStream.read_string File "streams.pyx", line 171, in scipy.io.matlab.streams.ZlibInputStream.read_into File "streams.pyx", line 158, in scipy.io.matlab.streams.ZlibInputStream._fill_buffer zlib.error: Error -3 while decompressing data: invalid literal/length code ```
QT 如何在其他cpp文件中调用Mainwindow中的单文本框
MainWindow w2; QString Starttime = w2.starttime->text(); QString Endtime= w2.endtime->text(); 报错信息如下: src/plot.cpp: In member function 'void Plot::saveToFile()': src/plot.cpp:222: error: invalid use of incomplete type 'struct QLineEdit' src/plot.h:17: error: forward declaration of 'struct QLineEdit' src/plot.cpp:223: error: invalid use of incomplete type 'struct QLineEdit' src/plot.h:17: error: forward declaration of 'struct QLineEdit'
一个好难理解的c++编译错误.
代码如下: #include<set> using namespace std; main(){ set<char*> s; const char* p; s.erase(p); } 编译器发出错误: error: invalid conversion from 'const char*' to 'std::set<char*>::key_type {aka char*}' [-fpermissive] s.erase(p);
Unexpected CUDA error: invalid argument
我在使用tensorflow-gpu时,运行如下的代码: ``` import tensorflow as tf a = tf.constant([1.0,2.0,3.0],shape = [3],name='a') print(a) ``` 能正确显示 ``tf.Tensor([1. 2. 3.], shape=(3,), dtype=float32)`` 但当我加入以下两行代码 ``` b = tf.constant([1.0,2.0,3.0], shape = [3],name='b') a+b ``` 会报如下的错误 ``` F tensorflow/stream_executor/cuda/cuda_driver.cc:209] Check failed: err == cudaSuccess || err == cudaErrorInvalidValue Unexpected CUDA error: invalid argument ``` 请大神帮忙解答 ================================================ 参照这篇博客,重新安装了一下,问题已经解决了 [https://blog.csdn.net/weixin_43411129/article/details/101390407](https://blog.csdn.net/weixin_43411129/article/details/101390407)
arm交叉编译STLport-5.2.1库,编译错误?
**编译环境:** Ubuntu 12.04.1 LTS (GNU/Linux 3.2.0-24-generic x86_64) **编译器:** arm-hisiv300nptl-linux **编译过程:** $tar -xvf STLport-5.2.1.tar.bz2 $cd STLport-5.2.1 $./configure --target=arm-hisiv300-linux $make **编译错误打印:** In file included from ../../src/c_locale.c:26:0: ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_ctype_name’: ../../src/c_locale_glibc/c_locale_glibc2.c:162:27: error: dereferencing pointer to incomplete type return ((locale_t)__loc)->__names[LC_CTYPE]; ^ ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_numeric_name’: ../../src/c_locale_glibc/c_locale_glibc2.c:172:27: error: dereferencing pointer to incomplete type return ((locale_t)__loc)->__names[LC_NUMERIC]; ^ ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_time_name’: ../../src/c_locale_glibc/c_locale_glibc2.c:177:27: error: dereferencing pointer to incomplete type return ((locale_t)__loc)->__names[LC_TIME]; ^ ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_collate_name’: ../../src/c_locale_glibc/c_locale_glibc2.c:182:27: error: dereferencing pointer to incomplete type return ((locale_t)__loc)->__names[LC_COLLATE]; ^ ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_monetary_name’: ../../src/c_locale_glibc/c_locale_glibc2.c:187:27: error: dereferencing pointer to incomplete type return ((locale_t)__loc)->__names[LC_MONETARY]; ^ ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_messages_name’: ../../src/c_locale_glibc/c_locale_glibc2.c:192:27: error: dereferencing pointer to incomplete type return ((locale_t)__loc)->__names[LC_MESSAGES]; ^ In file included from ../../src/stlport_prefix.h:21:0, from ../../src/c_locale.c:19: ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_ctype_table’: ../../src/c_locale_glibc/c_locale_glibc2.c:283:74: error: dereferencing pointer to incomplete type _STLP_STATIC_ASSERT( sizeof(_Locale_mask_t) == sizeof(((locale_t)__loc)->__ct ype_b[0]) ) ^ ../../stlport/stl/config/features.h:311:66: note: in definition of macro ‘_STLP_ STATIC_ASSERT’ # define _STLP_STATIC_ASSERT(expr) typedef char __static_assert[expr ? 1 : -1] ; ^ In file included from ../../src/c_locale.c:26:0: ../../src/c_locale_glibc/c_locale_glibc2.c:284:27: error: dereferencing pointer to incomplete type return ((locale_t)__loc)->__ctype_b; ^ ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_toupper’: ../../src/c_locale_glibc/c_locale_glibc2.c:288:27: error: dereferencing pointer to incomplete type { return ((locale_t)__loc)->__ctype_toupper[c]; } ^ ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_tolower’: ../../src/c_locale_glibc/c_locale_glibc2.c:291:27: error: dereferencing pointer to incomplete type { return ((locale_t)__loc)->__ctype_tolower[c]; } ^ ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_decimal_point’: ../../src/c_locale_glibc/c_locale_glibc2.c:463:10: error: invalid type argument of unary ‘*’ (have ‘int’) return *(nl_langinfo_l(RADIXCHAR, (locale_t)__loc)); ^ ../../src/c_locale_glibc/c_locale_glibc2.c: In function ‘_Locale_thousands_sep’: ../../src/c_locale_glibc/c_locale_glibc2.c:468:10: error: invalid type argument of unary ‘*’ (have ‘int’) return *(nl_langinfo_l(THOUSEP, (locale_t)__loc)); ^
c++ 这个报错是什么原因?如何解决?
以下代码在编译时报错: ``` #include<iostream> using namespace std; string type_get, str_empty, str_num1, str_num2; string to_do = "+-*/"; int empty, i, operator_num, num1, num2; int flag = 1;//flag=1:运行,flag=0:退出 int plus(int num1,int num2) { int result; result = num1 + num2; return result; } int minus(int num1,int num2) { int result; result = num1 - num2; return result; } int multiply(int num1,int num2) { int result; result = num1 * num2; return result; } int divide(int num1,int num2) { int result; result = num1 / num2; return result; } int main() { while(flag) { cin >> type_get; if (type_get == "exit") { flag = 0; } else { operator_num = type_get.find_first_of(to_do); char array_type_get[type_get.length()]; for (i = 0; i < type_get.length(); i++) { array_type_get[i] = type_get[i]; } for (i = 0; i < operator_num; i++) { str_num1[i] = array_type_get[i]; } for (i = operator_num + 1; i < sizeof(array_type_get); i++) { str_num2[i] = array_type_get[i]; } num1 = atoi(str_num1.c_str()); num2 = atoi(str_num2.c_str()); switch (array_type_get[operator_num]) { case "+" : plus(num1,num2); break; case "-" : minus(num1,num2); break; case "*" : multiply(num1,num2); break; case "/" : divide(num1,num2); break; default : cout << "请输入一个运算符!" << endl; break; } } } return 0; } ``` 报错信息如下: ``` calculator.cpp: In function 'int main()': calculator.cpp:73:10: error: invalid conversion from 'const char*' to 'int' [-fpermissive] case "+" : ^~~ calculator.cpp:73:10: error: conversion from pointer type 'const char (*)[2]' to arithmetic type 'int' in a constant expression calculator.cpp:74:6: error: reference to 'plus' is ambiguous plus(num1,num2); ^~~~ In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\string:48, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\locale_classes.h:40, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\ios_base.h:41, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ios:42, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ostream:38, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\iostream:39, from calculator.cpp:1: c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\stl_function.h:147:12: note: candidates are: 'template<class _Tp> struct std::plus' struct plus; ^~~~ calculator.cpp:8:5: note: 'int plus(int, int)' int plus(int num1,int num2) ^~~~ calculator.cpp:77:10: error: invalid conversion from 'const char*' to 'int' [-fpermissive] case "-" : ^~~ calculator.cpp:77:10: error: conversion from pointer type 'const char (*)[2]' to arithmetic type 'int' in a constant expression calculator.cpp:78:6: error: reference to 'minus' is ambiguous minus(num1,num2); ^~~~~ In file included from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\string:48, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\locale_classes.h:40, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\ios_base.h:41, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ios:42, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\ostream:38, from c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\iostream:39, from calculator.cpp:1: c:\mingw\lib\gcc\mingw32\8.2.0\include\c++\bits\stl_function.h:150:12: note: candidates are: 'template<class _Tp> struct std::minus' struct minus; ^~~~~ calculator.cpp:15:5: note: 'int minus(int, int)' int minus(int num1,int num2) ^~~~~ calculator.cpp:81:10: error: invalid conversion from 'const char*' to 'int' [-fpermissive] case "*" : ^~~ calculator.cpp:81:10: error: conversion from pointer type 'const char (*)[2]' to arithmetic type 'int' in a constant expression calculator.cpp:85:10: error: invalid conversion from 'const char*' to 'int' [-fpermissive] case "/" : ^~~ calculator.cpp:85:10: error: conversion from pointer type 'const char (*)[2]' to arithmetic type 'int' in a constant expression ``` **_在这上面卡了好几天了,求各位大神解答!_**
关于celery启动任务时报错Thread 'ResultHandler' crashed: ValueError('invalid file descriptor 13',)
我使用celery定时器执行任务,可启动时会出现这个错误 ``` [2019-10-22 09:13:30,334: INFO/MainProcess] Connected to redis://127.0.0.1:6379/14 [2019-10-22 09:13:30,361: INFO/MainProcess] mingle: searching for neighbors [2019-10-22 09:13:30,532: INFO/Beat] beat: Starting... [2019-10-22 09:13:31,072: ERROR/Beat] Thread 'ResultHandler' crashed: ValueError('invalid file descriptor 13',) Traceback (most recent call last): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 899, in body for _ in self._process_result(1.0): # blocking File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 864, in _process_result ready, task = poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 1370, in _poll_result if self._outqueue._reader.poll(timeout): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 285, in poll return self._poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 463, in _poll r = wait([self], timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 996, in wait return _poll(object_list, timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 976, in _poll raise ValueError('invalid file descriptor %i' % fd) ValueError: invalid file descriptor 13 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 504, in run return self.body() File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 904, in body self.finish_at_shutdown() File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 953, in finish_at_shutdown if not outqueue._reader.poll(): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 285, in poll return self._poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 463, in _poll r = wait([self], timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 991, in wait return _poll(object_list, 0) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 976, in _poll raise ValueError('invalid file descriptor %i' % fd) ValueError: invalid file descriptor 13 [2019-10-22 09:13:31,408: INFO/MainProcess] mingle: all alone [2019-10-22 09:13:31,423: INFO/MainProcess] celery@iZwz9h41nalpsqzz57x4tmZ ready. ``` 重启几次这个错误就不会出现,但运行一段时间后再次从定时器发布任务时还会出现该错误导致任务执行失败 ``` [2019-10-22 07:00:00,000: INFO/Beat] Scheduler: Sending due task monitoring_auto_run (run.monitoring_auto_run) [2019-10-22 07:00:00,008: INFO/MainProcess] Received task: run.monitoring_auto_run[469ee195-3e1a-4bf0-a7cb-783232e8d0bc] [2019-10-22 07:00:00,105: ERROR/ForkPoolWorker-11] Thread 'ResultHandler' crashed: ValueError('invalid file descriptor 14',) Traceback (most recent call last): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 504, in run return self.body() File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 899, in body for _ in self._process_result(1.0): # blocking File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 864, in _process_result ready, task = poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 1370, in _poll_result if self._outqueue._reader.poll(timeout): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 285, in poll return self._poll(timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 463, in _poll r = wait([self], timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 996, in wait return _poll(object_list, timeout) File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/connection.py", line 976, in _poll raise ValueError('invalid file descriptor %i' % fd) ValueError: invalid file descriptor 14 [2019-10-22 07:00:00,768: ERROR/MainProcess] Process 'ForkPoolWorker-11' pid:15068 exited with 'exitcode 1' [2019-10-22 07:00:11,186: ERROR/MainProcess] Task handler raised error: WorkerLostError('Worker exited prematurely: exitcode 1.',) Traceback (most recent call last): File "/pyenvs/spider/lib64/python3.6/site-packages/billiard/pool.py", line 1267, in mark_as_worker_lost human_status(exitcode)), billiard.exceptions.WorkerLostError: Worker exited prematurely: exitcode 1. ```
用指针在被调用函数中输出学生成绩,为什么提示我[Error] invalid operands to binary + (have 'float (*)[5]' and 'float')?
``` #include<stdio.h> int main() { void ave(float (*p)[5]); float a[10][5]; int i,j; for(i=0;i<10;i++){ for(j=0;j<5;j++){ scanf("%f",&a[i][j]); } } ave(a); return 0; } void ave(float (*p)[5]) { float sum,i,j; for(i=0;i<10;i++){ for(j=0;j<5;j++){ printf("%f",*(*(p+i)+j)); } } } ```
swift invalid number of items in section 0
collection view报错 代码如下: let selectIndex = self.photoData.seletedAssetArray.index(of: self.previewPhotoArray[currentIndex]) if selectIndex != nil{ self.rightButton.asyncSetImage(UIImage.zyCreateImageWithView(view: ZYPhotoNavigationViewController.zyGetSelectNuberView(index: "\(selectIndex! + 1)")), for: .selected) } if selectIndex != nil{ if self.rightButton.isSelected == false { let indexPath = IndexPath.init(row: selectIndex!, section: 0) self.photoData.seletedAssetArray.remove(at: self.photoData.seletedAssetArray.index(of: self.previewPhotoArray[currentIndex])!) thumbnailCollectionView.deleteItems(at: [indexPath]) }else{ let indexPath = IndexPath.init(row: selectIndex!, section: 0) thumbnailCollectionView.insertItems(at: [indexPath]) thumbnailCollectionView.reloadItems(at: [indexPath]) thumbnailCollectionViewCellToggeleSelect(indexPath: indexPath) } } 报错信息: 'Invalid update: invalid number of items in section 0. The number of items contained in an existing section after the update (1) must be equal to the number of items contained in that section before the update (1), plus or minus the number of items inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of items moved into or out of that section (0 moved in, 0 moved out) 希望指教,谢谢
GO语言打开文件失败,runtime error
打开文件直接失败了,是接受文件内容的变量空间不够嘛?这种情况不应该出现在打开文件时吧,大佬们,救救~ ``` import ( ... "github.com/tealeg/xlsx" ) func main() { ... xlFile, err := xlsx.OpenFile(file.Name()) if err != nil { fmt.Printf("open file: %s --> failed: %s\n", file.Name(), err) } ``` ``` open file: test.xlsx --> failed: runtime error: index out of range [63] with length 0 panic: runtime error: invalid memory address or nil pointer dereference [signal 0xc0000005 code=0x0 addr=0x30 pc=0x51d3db] goroutine 1 [running]: main.main() c:/GoWorks/src/github.com/xxx/project/excel/main.go:39 +0x3cb exit status 2 ```
百度人脸检测验证不通过 error_code":110,"error_msg":"Access token invalid or no longer valid
新学调用百度的人脸检测API,但是返回错误提示110. ![图片说明](https://img-ask.csdn.net/upload/201911/04/1572848755_801195.jpg) 但是我的token已经生成了,而且账号也是我的上周刚弄的. ![图片说明](https://img-ask.csdn.net/upload/201911/04/1572848864_874323.jpg) 拜托各位懂的大佬帮我看看
linux c++ sds库 提示 undefined reference to `sdsempty()'
> 报错: > /tmp/cc3R3ayZ.o: In function 'main' > c.cpp:(.text+0x9): undefined reference to 'sdsempty()' > collect2: error: ld returned 1 exit status** ``` #include <iostream> #include <unistd.h> #include <sds.h> using namespace std; int main(){ sds s= sdsempty(); return 0; } ``` 我更新了sds文件,然后: ``` [root@localhost c4]# g++ -std=c++11 -o test -I/wgs/sds c.cpp In file included from c.cpp:3:0: /wgs/sds/sds.h: In function ‘size_t sdsavail(sds)’: /wgs/sds/sds.h:83:87: error: invalid conversion from ‘void*’ to ‘sdshdr8*’ [-fpermissive] #define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T))); ^ /wgs/sds/sds.h:111:13: note: in expansion of macro ‘SDS_HDR_VAR’ SDS_HDR_VAR(8,s); ^ /wgs/sds/sds.h:83:87: error: invalid conversion from ‘void*’ to ‘sdshdr16*’ [-fpermissive] #define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T))); ^ /wgs/sds/sds.h:115:13: note: in expansion of macro ‘SDS_HDR_VAR’ SDS_HDR_VAR(16,s); ^ /wgs/sds/sds.h:83:87: error: invalid conversion from ‘void*’ to ‘sdshdr32*’ [-fpermissive] #define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T))); ^ /wgs/sds/sds.h:119:13: note: in expansion of macro ‘SDS_HDR_VAR’ SDS_HDR_VAR(32,s); ^ /wgs/sds/sds.h:83:87: error: invalid conversion from ‘void*’ to ‘sdshdr64*’ [-fpermissive] #define SDS_HDR_VAR(T,s) struct sdshdr##T *sh = (void*)((s)-(sizeof(struct sdshdr##T))); ^ /wgs/sds/sds.h:123:13: note: in expansion of macro ‘SDS_HDR_VAR’ SDS_HDR_VAR(64,s); ^ ``` 这个是啥原因啊?
C语言编译时,提示invalid conversion from ‘char’ to ‘char*’ [-fpermissive]错误,请问哪里问题?
编译环境: Armbian(arm嵌入式linux)64位系统,基于Ubuntu Bionic 18.04 LTS 4.19内核 错误提示: ![图片说明](https://img-ask.csdn.net/upload/201902/21/1550707793_4777.png) tools.c:63:13: error: invalid conversion from ‘char’ to ‘char*’ [-fpermissive] *pout = '\0'; ^~~~ 部分代码内容: 这是图片: ![图片说明](https://img-ask.csdn.net/upload/201902/21/1550707811_128009.png) 以下是文字代码: int code_convert(char *from_charset, char *to_charset, char *inbuf, size_t inlen, char *outbuf, size_t outlen) { iconv_t cd; char **pin = &inbuf; char **pout = &outbuf; cd = iconv_open(to_charset, from_charset); if (cd == 0) return -1; memset(outbuf, 0, outlen); if (iconv(cd, pin, &inlen, pout, &outlen) == -1) return -1; iconv_close(cd); *pout = '\0'; return 0; }
使用spark的standalone模式调整心跳时间时出现Error(Invalid argument to --conf: spark.worker.timeout)?
使用spark集群运行程序时报错日志显示: ERROR TaskSchedulerImpl:70 - Lost executor 1 on : Executor heartbeat timed out after 381181 ms 所以使用spark submit更改心跳时间 [hadoop@Master spark2.4.0]$ bin/spark-submit --master spark://master:7077 --conf spark.worker.timeout 10000000 --py-files id.py id.py --name id 但是显示没有指令,请问该怎么做? Error: Invalid argument to --conf: spark.worker.timeout
本地做的OAuth后台报错Handling error: InvalidGrantException, Invalid authorization code: Dyki6G
对接Alexa后台,enable 技能时需要通过我自己做的后台Oauth服务,经常会报错 Handling error: InvalidGrantException, Invalid authorization code: Dyki6G, 有人遇到类似这样的问题吗?还是我的浏览器配置有问题呢? ![图片说明](https://img-ask.csdn.net/upload/201910/17/1571282799_874523.png)
关于Mac下python pip版本问题以及pycharm安装python第三方库失败问题
我的电脑是mac 10.15版本 目前有两个python: 1. 系统自带Python 2.7.16 2. 自己安装python Python 3.7.3 在终端查询pip版本,结果是2.7的那个: pip 19.3.1 from /Library/Python/2.7/site-packages/pip (python 2.7) 查询pip3,结果显示错误: xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun 好像问题就是在这里,我在终端用 pip install 安装python第三方库的时候总会有问题,提示pip版本过低,我想更新pip又会失败;或者根本无法安装。 然后我就选择从pycharm上搜索第三方库并安装,奇怪的是有的库可以成功安装,有的库安装失败并提示说pip版本过低,让我尝试从终端安装,可是从终端安装的话又会遇到之前的问题。 请问这个该怎么解决?
Digital Calculator 数字的计算器
Problem Description The Advanced Calculator Machinery (ACM) is going to release a new series of calculators. Like it or not, as a member of ACM, you are asked to develop the software for the new calculator. Here is the detailed technical specification. The general usage of the calculator is that users input expressions, the calculator computes and displays the final result, or error messages if there is something wrong. The expression is in infix notation and the calculator supports following operators: People always make mistakes. When user inputs an invalid expression, the calculator should display an error message, telling user that error occurs. There are totally four possible errors: 1. Syntax error: Any kind of syntax error, such as missing operators, redundancy operators and unpaired brackets. 2. Divide by zero: The right operand of operator “/” or “%” is zero. 3. Integer overflow: At any step of the calculation, any intermediate values go beyond the range of 32-bit signed integers. 4. Invalid exponent: The right operand of operator“^” is negative, or both operands are zero (we consider 0^0 undefined). The calculation works this way: at first the calculator omits all space characters of the expression, check the syntax, and then computes. It always finds the highest priority part of the expression, then operators which combines them, then calculate the result and continue the process, until the final result has been got or error occurs. For example, for expression 2^3^(-4*5), there are mainly 5 steps (we use brackets to note every part of the expression): 1. Check the syntax, no syntax errors. 2. Fetch the highest priority operator 4, no errors. 3. Do arithmetic -(4), get result -4, no errors. 4. Do arithmetic (-(4))*(5), get result -20, no errors. 5. Because operator “^” has right associativity, we do arithmetic (3)^((-(4))*(5)), e.g. (3)^(-20) first. -20 is a negative number, and negative numbers are not allowed as an exponent, so the calculator simply outputs error message and stops. Notes: Because “-“ has two meanings, the calculator will treat it as an unary operation at first, and if it fails, “-“ would be treated as minus operation then. Write a program to simulate the calculator. Input The first line of the input file is an integer T<=200, then following T test cases. Each test case has only one line, the input expression given to the calculator. Each expression has no more than 2000 characters. Output For each test case, output one line contains the case number and the final result or “ERROR!” if any error occurs. See sample for detailed format. Sample Input 6 2^(1 2 - 9)^(5%3) 9-8**7 4%(2^0-1) -5%-3+-5%3 7^--100 (7-3)^(3-7) Sample Output Case 1: 512 Case 2: ERROR! Case 3: ERROR! Case 4: -4 Case 5: ERROR! Case 6: ERROR!
相见恨晚的超实用网站
相见恨晚的超实用网站 持续更新中。。。
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
JavaScript 为什么能活到现在?
作者 | 司徒正美 责编 |郭芮 出品 | CSDN(ID:CSDNnews) JavaScript能发展到现在的程度已经经历不少的坎坷,早产带来的某些缺陷是永久性的,因此浏览器才有禁用JavaScript的选项。甚至在jQuery时代有人问出这样的问题,jQuery与JavaScript哪个快?在Babel.js出来之前,发明一门全新的语言代码代替JavaScript...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
吐血推荐珍藏的Visual Studio Code插件
作为一名Java工程师,由于工作需要,最近一个月一直在写NodeJS,这种经历可以说是一部辛酸史了。好在有神器Visual Studio Code陪伴,让我的这段经历没有更加困难。眼看这段经历要告一段落了,今天就来给大家分享一下我常用的一些VSC的插件。 VSC的插件安装方法很简单,只需要点击左侧最下方的插件栏选项,然后就可以搜索你想要的插件了。 下面我们进入正题 Material Theme ...
实战:如何通过python requests库写一个抓取小网站图片的小爬虫
有点爱好的你,偶尔应该会看点图片文字,最近小网站经常崩溃消失,不如想一个办法本地化吧,把小照片珍藏起来! 首先,准备一个珍藏的小网站,然后就可以开始啦! 第一步 我们先写一个获取网站的url的链接,因为url常常是由page或者,其他元素构成,我们就把他分离出来,我找到的网站主页下有图片区 图片区内有标题页,一个标题里有10张照片大概 所以步骤是: 第一步:进入图片区的标题页 def getH...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
相关热词 c#委托 逆变与协变 c#新建一个项目 c#获取dll文件路径 c#子窗体调用主窗体事件 c# 拷贝目录 c# 调用cef 网页填表c#源代码 c#部署端口监听项目、 c#接口中的属性使用方法 c# 昨天
立即提问