rem

find and delete from more-dimensional numpy array

匿名 (未验证) 提交于 2019-12-03 02:33:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have two numpy-arrays: p_a_colors=np.array([[0,0,0], [0,2,0], [119,103,82], [122,122,122], [122,122,122], [3,2,4]]) p_rem = np.array([[119,103,82], [122,122,122]]) I want to delete all the columns from p_a_colors that are in p_rem, so I get: p_r_colors=np.array([[0,0,0], [0,2,0], [3,2,4]]) I think, something should work like p_r_colors= np.delete(p_a_colors, np.where(np.all(p_a_colors==p_rem, axis=0)),0) but I just don't get the axis or [:] right. I know, that p_r_colors=copy.deepcopy(p_a_colors) for i in range(len(p_rem)): p_r_colors= np

Drag and drop batch file for multiple files?

匿名 (未验证) 提交于 2019-12-03 02:30:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I wrote a batch file to use PngCrush to optimize a .png image when I drag and drop it onto the batch file. In the what's next section, I wrote about what I thought would be a good upgrade to the batch file. My question is: is it possible to create a batch file like I did in the post, but capable of optimizing multiple images at once? Drag and drop multiple .png files on it? (and have the output be something like new.png, new(1).png, new(2).png, etc... 回答1: Yes, of course this is possible. When dragging multiple files on a batch file you get

“Padding is invalid and cannot be removed” -Whats wrong with this code?

匿名 (未验证) 提交于 2019-12-03 02:27:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Every time I run this and encrypt, the output is variable, and when I attempt to decrypt I get "Padding is invalid and cannot be removed." Been fighting with this for a day or two now and I am at a loss. private static string strIV = "abcdefghijklmnmo"; //The initialization vector. private static string strKey = "abcdefghijklmnmoabcdefghijklmnmo"; //The key used to encrypt the text. public static string Decrypt(string TextToDecrypt) { return Decryptor(TextToDecrypt); } private static string Encryptor(string TextToEncrypt) { //Turn the

Failed to run sdkmanager --list (Android SDK) with Java 9

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I downloaded and installed: JDK ( jdk-9.0.1_osx-x64_bin.dmg ) from Oracle here Android SDK ( sdk-tools-darwin-3859397.zip ) from Google here . After configuring the PATH variable, I tried running sdkmanager , which replaced the android command for managing SDK components. However, it failed as shown here: $ sdkmanager --list Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema at com.android.repository.api.SchemaModule$SchemaModuleVersion.<init>(SchemaModule.java:156) at com.android.repository.api

String processing in windows batch files: How to pad value with leading zeros?

匿名 (未验证) 提交于 2019-12-03 02:12:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: in a Windows cmd batch file (.bat), how do i pad a numeric value, so that a given value in the range 0..99 gets transformed to a string in the range "00" to "99". I.e. I'd like to having leading zeros for values lower than 10. 回答1: There's a two-stage process you can use: REM initial setup SET X = 5 REM pad with your desired width - 1 leading zeroes SET PADDED = 0 % X % REM slice off any zeroes you don 't need -- BEWARE, this can truncate the value REM the 2 at the end is the number of desired digits SET PADDED=%PADDED:~-2% Now

IISExpress returns a 503 error from remote machines

匿名 (未验证) 提交于 2019-12-03 02:11:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm attempting to test a website I have running in a local IISExpress instance with some other machines / devices on my local network. I am running Win7 Pro. When I first attempt to browse to my machine from another machine on my local network segment, I get a 400 error: Hostname is invalid. I understand that I need to grant remote access to the ACL with a command on the elevated command prompt like: netsh http add urlacl url=http://mymachinename:50333/ user=everyone Now I get a 503 service is unavailable error. Windows Firewall is currently

Responsive Font Size

匿名 (未验证) 提交于 2019-12-03 02:09:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've created a site using the Zurb Foundation 3 grid. Each page has a large h1. CSS body {font-size:100%} /* Headers */ h1 { font-size:6.2em;font-weight:500; } HTML <div class="row"> <div class="twelve columns text-center"> <h1> LARGE HEADER TAGLINE </h1> </div><!-- End Tagline --> </div><!-- End Row --> When I resize the browser to mobile size the large font doesn't adjust and causes the browser to include a horizontal scroll to accomodate for the large text. I've noticed that on the Zurb Foundation 3 Typography example page , the headers

Resolve absolute path from relative path and/or file name

匿名 (未验证) 提交于 2019-12-03 02:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Is there a way in a Windows batch script to return an absolute path from a value containing a filename and/or relative path? Given: "..\" "..\somefile.txt" I need the absolute path relative to the batch file. Example: "somefile.txt" is located in "C:\Foo\" "test.bat" is located in "C:\Foo\Bar". User opens a command window in "C:\Foo" and calls Bar\test.bat ..\somefile.txt In the batch file "C:\Foo\somefile.txt" would be derived from %1 回答1: In batch files, as in standard C programs, argument 0 contains the path to the currently executing

Find out if file is older than 4 hours in Batch file

匿名 (未验证) 提交于 2019-12-03 02:06:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Quite simply, how would I find out if a specific file in a folder is older than X hours? The file name and location will always be the same. Thanks 回答1: On comparing file times with batch code following must be taken into account: Date and time format settings File system of storage media Time zone, daylight saving time Automatic adjustment for daylight saving time Version of Windows 1. Date and time format settings There are the environment variables DATE and TIME which on access (and not on start of batch execution) return current date and

Regular expressions in findstr

匿名 (未验证) 提交于 2019-12-03 01:56:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm doing a little string validation with findstr and its /r flag to allow for regular expressions. In particular I'd like to validate integers. The regex ^[0-9][0-9]*$ worked fine for non-negative numbers but since I now support negative numbers as well I tried ^([1-9][0-9]*|0|-[1-9][0-9]*)$ for either positive or negative integers or zero. The regex works fine theoretically . I tested it in PowerShell and it matches what I want. However, with findstr /r /c:"^([1-9][0-9]*|0|-[1-9][0-9]*)$" it doesn't. While I know that findstr doesn't have