zero

Declare a 0-Length String Array in VBA - Impossible?

℡╲_俬逩灬. 提交于 2019-12-05 10:47:10
Is it really not possible to declare a 0-length array in VBA? If I try this: Dim lStringArr(-1) As String I get a compile error saying range has no values. If I try to trick the compiler and redim at runtime like this: ReDim lStringArr(-1) I get a subscript out of range error. I've varied the above around a bit but with no luck e.g. Dim lStringArr(0 To -1) As String Use Case I want to convert a variant array to a string array. The variant array may be empty as it comes from the Keys property of a dictionary. The keys property gives back an array of variants. I want an array of strings to use

In C, is there a difference between a NULL pointer and a pointer that points to 0? If so, what?

北城余情 提交于 2019-12-05 07:31:00
In C, what is the difference between a NULL pointer and a pointer that points to 0? The ISO/IEC 9899:TC2 states in 6.3.2.3 Pointers 3 An integer constant expression with the value 0, or such an expression cast to type void *, is called a null pointer constant.55) If a null pointer constant is converted to a pointer type, the resulting pointer, called a null pointer, is guaranteed to compare unequal to a pointer to any object or function The macro NULL expands to an implementation-defined null pointer constant. Any two null pointers shall compare equal. Yes there is. The standard dictates that

How do I delete a row in a numpy array which contains a zero? [duplicate]

一笑奈何 提交于 2019-12-05 03:09:57
This question already has answers here : remove zero lines 2-D numpy array (3 answers) Closed 3 years ago . I'm trying to write a function to delete all rows in which have a zero value in. This is not from my code, but an example of the idea I am using: import numpy as np a=np.array(([7,1,2,8],[4,0,3,2],[5,8,3,6],[4,3,2,0])) b=[] for i in range(len(a)): for j in range (len(a[i])): if a[i][j]==0: b.append(i) print 'b=', b for zero_row in b: x=np.delete(a,zero_row, 0) print 'a=',a and this is my output: b= [1, 3] a= [[7 1 2 8] [4 0 3 2] [5 8 3 6] [4 3 2 0]] How do I get rid of the rows with the

f2py: some of returned arrays are unchanged/empty

好久不见. 提交于 2019-12-04 21:28:10
Hi I'm using f2py to wrap the lapack routine dgesvd, by compiling the dgesvd.f file and linking it against llapack, as explained here according to the docstring, the dgesvd module has the signature: dgesvd - Function signature: dgesvd(jobu,jobvt,m,n,a,s,u,vt,work,lwork,info,[lda,ldu,ldvt]) Required arguments: jobu : input string(len=1) jobvt : input string(len=1) m : input int n : input int a : input rank-2 array('d') with bounds (lda,*) s : input rank-1 array('d') with bounds (*) u : input rank-2 array('d') with bounds (ldu,*) vt : input rank-2 array('d') with bounds (ldvt,*) work : input

Replace column values in a CSV file with awk

穿精又带淫゛_ 提交于 2019-12-04 18:40:37
I have this file error.log [00:00:00.284],501, [00:00:00.417],5,5294100071980 [00:00:02.463],501, [00:00:05.169],501, [00:00:05.529],501, [00:00:05.730],501, so, if the field $3 its empty i want to print "No value" Im trying this code awk '{{FS=","} if($3=="") {print $1,$2,"No value"}}' But it prints >[00:00:00.284] 501 No value >[00:00:02.463] 501 No value >[00:00:05.169] 501 No value >[00:00:05.529] 501 No value >[00:00:05.730] 501 No value >[00:00:07.193] 501 No value >[00:00:09.899] 501 No value >[00:00:31.312] 501 No value awk -F ',' -v OFS=',' '$1 { if ($3=="") $3="No value"; print}' in

getChildCount() returns 0 on ListView

房东的猫 提交于 2019-12-04 16:27:35
I need to check all element on a ListView to set a label only to a one of those. I can't edit the database or the adapter, I just want to scroll the ListView to perform a check and set a string on a TextView. @Override protected void onResume(){ super.onResume(); ... cursor = getCursor(); startManagingCursor(cursor); adapter = new SimpleCursorAdapter(this,R.layout.profile_item_layout,cursor,from,to); lst_profiles.setAdapter(adapter); SharedPreferences customSharedPreference = PreferenceManager.getDefaultSharedPreferences(ProfilerActivity.this.getApplicationContext()); long current =

PHP remove first zeros

房东的猫 提交于 2019-12-04 16:05:44
问题 Want to remove all 0 placed at the beginning of some variable. Some options: if $var = 0002 , we should strip first 000 ( $var = 2 ) if var = 0203410 we should remove first 0 ( $var = 203410 ) if var = 20000 - do nothing ( $var = 20000 ) What is the solution? 回答1: cast it to integer $var = (int)$var; 回答2: Maybe ltrim ? $var = ltrim($var, '0'); 回答3: $var = ltrim($var, '0'); This only works on strings, numbers starting with a 0 will be interpreted as octal numbers, multiple zero's are ignored.

What would you use to zero pad a number in Flex/AS3?

大兔子大兔子 提交于 2019-12-04 11:09:56
问题 Duplicate of this one. What would you use to pad zeroes to the left of a number in Flex/AS3? Is there an equivalent to printf or NumberFormat that does this? I'm looking for the nicest implementation of this or something similar: public function zeroPad(number:int, width:int):String { // number = 46, width = 4 would return "0046" } 回答1: public function zeroPad(number:int, width:int):String { var ret:String = ""+number; while( ret.length < width ) ret="0" + ret; return ret; } 回答2: Performance

Fastest way to zero out a 2d array in C?

霸气de小男生 提交于 2019-12-04 07:23:09
问题 I want to repeatedly zero a large 2d array in C. This is what I do at the moment: // Array of size n * m, where n may not equal m for(j = 0; j < n; j++) { for(i = 0; i < m; i++) { array[i][j] = 0; } } I've tried using memset: memset(array, 0, sizeof(array)) But this only works for 1D arrays. When I printf the contents of the 2D array, the first row is zeroes, but then I got a load of random large numbers and it crashes. 回答1: memset(array, 0, sizeof(array[0][0]) * m * n); Where m and n are the

Can an MD5-hash begin with a zero?

只愿长相守 提交于 2019-12-04 03:07:26
Can an MD5-hash begin with a zero? What about SHA-1? Yes: $ echo -n "363" | md5sum 00411460f7c92d2124a67ea0f4cb5f85 - $ echo -n "351" | sha1sum 0026476a20bfbd08714155bb66f0b4feb2d25c1c Found by running the following in bash: for i in {1..1000} ; do echo $(echo -n $i | md5sum) $i ; done | sort | head I found a MD5 hash that beginns with a zero byte! 2 character String Unicode #7358 #34823 $returnValue = md5('Ჾ蠇'); result: 00000000 5e0a51c8 313ffb43 8a3a2861 Of course. Or two zeros. Or more. In general, the probability of a "random" input hashing to a result with k leading zero nybbles is about