More than one file was found for OS independent 'META-INF/INDEX.LIST' - meta-inf

when above error come inside project file build.graddle(Module:app) file add
packaging Options {
exclude 'META-INF/INDEX.LIST'
}
so this will excluded all 'META-INF/INDEX.LIST'
this will work 100%
after adding any libraries/independencies/ this error came some time
this did not work :
packaging Options {
/* exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/NOTICE'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/NOTICE.txt'*/
}
DO NOT ADD THIS IN YOUR build.graddle file

Related

How do I list files and directories those are not hidden in current directory using crystal language?

I wrote my own minimal version of "ls" command (Linux) using crystal language and here is my code:
require "dir"
require "file"
def main()
pwd = Dir.current
list_dir = Dir.children(pwd)
puts("[+] location: #{pwd}")
puts("------------------------------------------")
list_dir.each do |line|
check = File.file?(line)
if check == true
puts("[+] file : #{line}")
elsif check == false
puts("[+] directory: #{line}")
else
puts("[+] unknown : #{line}")
end
end
end
main
It works but it also listing all hidden files and directories (.files & .directories) too and I do not want to show those. I want the result more like "ls -l" command's result not like "ls -la".
So, what I need to implement to stop showing hidden files and directories?
There is nothing special about "hidden" files. It's just a convention to hide file names starting with a dot in some contexts by default. Dir.children does not follow that convention and expects the user to apply approriate filtering.
The recommended way to check if a file name starts with a dot is file_name.starts_with?(".").

select some of (EOF) extension files in specific folder based on part of filenames in text file :explained in image file with connected arrow

I want to Select files in specific folder based on part of the name of files(date)
so:
1-first: (in names.csv) extract part of file name(date) :find all("1SDV_(\d+)T", name)
2-second: (in name of files in specific folder) extract part of file name(date):
find all ("OPOD__(\d+)T", name)
of all (EOF) extension file names in specific folder
3-third: relate extraction: as image that I attached (red connected arrow)
my code is not complete please help me to complete it
enter code here
import OS
import re
# open the file, make a list of all filenames, close the file
with open('names.csv') as name file:
# use .strip() to remove trailing whitespace and line breaks
names= [line strip() for line in name file]
for name in names:
res = re find all ("1SDV_(\d+)T", name)
if not res: continue
print res[0]
# You can append the result to a list
# Find all ("OPOD__(\d+)T")
# how can I relate (EOF) extension files name to res like image file I
attached
# move the selected (EOF) extension file
OS rename(OS path join('path', (EOF) file extension folder),
'/path/to/somewhere/else')
break
csv or text file is like this:
S1A_IW_SLC__1SDV_20190826T022837_20190826T022904_028734_0340DD_654D-SLC
S1A_IW_SLC__1SDV_20190919T022838_20190919T022905_029084_034D09_0129-SLC
S1A_IW_SLC__1SDV_20191013T022839_20191013T022906_029434_03590E_A824-SLC
S1A_IW_SLC__1SDV_20191106T022839_20191106T022906_029784_036538_06CC-SLC
S1A_IW_SLC__1SDV_20191130T022838_20191130T022905_030134_037166_4019-SLC
S1A_IW_SLC__1SDV_20191224T022837_20191224T022904_030484_037D7B_0FC4-SLC
S1A_IW_SLC__1SDV_20210217T062720_20210217T062747_036626_044D90_4570-SLC
.
.
.
And (EOF) extension files in specific folder are like :
S1A_OPER_AUX_POEORB_OPOD_20190915T120743_V20190825T225942_20190827T005942.EOF
S1A_OPER_AUX_POEORB_OPOD_20190916T120658_V20190826T225942_20190828T005942.EOF
S1A_OPER_AUX_POEORB_OPOD_20190917T120653_V20190827T225942_20190829T005942.EOF

accessing recources when compiling QT application with Bazel

I'm using Bazel to compile a Qt application (https://github.com/bbreslauer/qt-bazel-example) that is using shaders defined in a qrc file.
When I'm trying to access the resource file, it is not available (as I did not connect the qrc file to the compilation).
How can I define the qrc file content in the build?
UPDATE
following the response by #ypnos, I'm trying to add a macro to my qt.bzl file. I would like the macro to recieve a list of files as an argument, create the (temporary) qrc file, and run the rcc command.
I am currently struggling with:
running a python script in the bzl file is not as straightforward as I though. It cannot generate a file ("open" is undefined). Is it possible? if yes how (see example below)
even with a given qrc file, I cant get the command to work, I guess i'm doing somthing wrong with the command line arguments but I cant find refrence/manual for that
this is what I got so far(my qt.bzl file)
...
def qt_resource(name,file_list, **kwargs):
## following doesnt work inside the bzl file:
# fid = open('%s.qrc' % name, 'w')
# fid.write("<RCC>\n")
# fid.write("\t<qresource prefix=\"/%s\">\n" % name)
# for x in file_list:
# fid.write("\t\t<file>%s</file>\n" % x)
# fid.write("\t</qresource>\n")
# fid.write("</RCC>\n")
# fid.close()
native.genrule(
name = "%s_res" % name,
outs = ["rcc_%s.cpp" % name],
cmd = "rcc %s.qrc -o $#/rcc_%s.cpp"%(name,name) ,
)
srcs = [":rcc_%s.cpp" % name]
native.cc_library(
name = name,
srcs = srcs,
hdrs = [],
deps = [],
**kwargs
)
It seems the bazel example that you are using does not come with support for qrc (it only does moc and ui files).1
QRC files need to be transformed into C++ sources using rcc and then compiled.2 The concept is similar to the one of .ui files which are converted to headers.
Maybe you can patch qt.bzl to add that functionality.

SwiftLint: Exclude file for specific rule

I'm trying to do something like this in my .swiftlint.yml file:
force_cast:
severity: warning # explicitly
excluded:
- Dog.swift
I have this code and I don't like the force_try warning I'm getting for it:
let cell = tableView.dequeueReusableCellWithIdentifier(Constants.dogViewCellReuseIdentifier,
forIndexPath: indexPath) as! DogViewCell
I want to suppress the warning for this file by excluding this file from the rule.
Is there a way to do that ?
Well, if you don't want some specific rules to be applied to a specific file you can use the technique mentioned by #Benno Kress. For that you need to add a comment in your swift file as given below.
The rules will be disabled until the end of the file or until the linter sees a matching enable comment:
// swiftlint:disable <rule1>
YOUR CODE WHERE NO rule1 is applied
// swiftlint:enable <rule1>
It is also possible to skip some files by configuring swiftlint.
add a ".swiftlint.yml" file in the directory where you'll run SwiftLint.
Add the following content to exclude some files. Lets say file1, file2 ... etc
excluded:
- file1
- file2
- folder1
- folder1/ExcludedFile.swift
To disable some rules completely add the following to the same ".swiftlint.yml" file.
disabled_rules: # rule identifiers to exclude from running
- colon
- comma
- control_statement
for more information, refer the following links.
https://swifting.io/blog/2016/03/29/11-swiftlint/
https://github.com/realm/SwiftLint#disable-rules-in-code
You can write // swiftlint:disable force_cast at the beginning of the file in which you want to supress the warning for this rule. It gets disabled until the end of the file or until you add the line // swiftlint:enable force_cast.
Source: https://github.com/realm/SwiftLint#disable-rules-in-code
I just get rid with force_cast
Step 1:
cd path-to-your-project
Step 2:
touch .swiftlint.yml
Step 3:
open .swiftlint.yml and add the rule
disabled_rules: # rule identifiers to exclude from running
- force_cast
Reference - https://github.com/realm/SwiftLint#disable-rules-in-code
Configure SwiftLint by adding a .swiftlint.yml file from the directory you'll run SwiftLint from. Here is the complete set of options you can use in your .swiftlint.yml file
disabled_rules: # rule identifiers to exclude from running
- colon
- comma
- control_statement
opt_in_rules: # some rules are only opt-in
- empty_count
# Find all the available rules by running:
# swiftlint rules
included: # paths to include during linting. `--path` is ignored if present.
- Source
excluded: # paths to ignore during linting. Takes precedence over `included`.
- Carthage
- Pods
- Source/ExcludedFolder
- Source/ExcludedFile.swift
- Source/*/ExcludedFile.swift # Exclude files with a wildcard
analyzer_rules: # Rules run by `swiftlint analyze` (experimental)
- explicit_self
# configurable rules can be customized from this configuration file
# binary rules can set their severity level
force_cast: warning # implicitly
force_try:
severity: warning # explicitly
# rules that have both warning and error levels, can set just the warning level
# implicitly
line_length: 110
# they can set both implicitly with an array
type_body_length:
- 300 # warning
- 400 # error
# or they can set both explicitly
file_length:
warning: 500
error: 1200
# naming rules can set warnings/errors for min_length and max_length
# additionally they can set excluded names
type_name:
min_length: 4 # only warning
max_length: # warning and error
warning: 40
error: 50
excluded: iPhone # excluded via string
identifier_name:
min_length: # only min_length
error: 4 # only error
excluded: # excluded via string array
- id
- URL
- GlobalAPIKey
reporter: "xcode" # reporter type (xcode, json, csv, checkstyle, junit, html, emoji, sonarqube, markdown)
Reference: github.com/realm/SwiftLint#disable-rules-in-code
You can add a new .swiftlint.yml file to the excluded folder and override rules there:
project_root/.swiftlint.yml:
opt_in_rules:
force_unwrapping
.. and other rules
and in
project_root/your_excluded_folder/.swiftlint.yml
disabled_rules:
- force_unwrapping
Then force_unwrapping will not be applied to your_excluded_folder and all subfolders
Config file from subfolder will "override" rules in the root config file.
This is useful for example for the unit tests folder
Maybe this is a better approach:
guard let cell = tableView.dequeueReusableCellWithIdentifier(Constants.dogViewCellReuseIdentifier,
forIndexPath: indexPath) as? DogViewCell else {
return UITableviewCell()
}

Running EXE files in a folder sequence

I have a sequence of folders (planx 1 , planx 2 ,.......,planx 35) each folder contains an exe file triton.exe, I wrote the following code but it gives me a syntax error,apparently the format I wrote especially '+str(i)' is wrong.
I tried to correct that by adding " "before +str(i) but it reads the folder name (planx1) without space and surly there is no such folder.
what can I do to make it work ?
import sys, string, os
for i in range(1, 35):
os.chdir( 'E:\\project\\x\\CR 0\\planx'+str(i))
os.system( '"E:\\project\\x\\CR 0\\planx'+str(i)'\\triton.exe"')
print('done')
You are missing the + after the str(i) to add the third string as well:
'...\planx'+str(i)+'\\trit...'
# ^ this one
although you may want to use os.path.join instead of adding them together