Copy multiple files to its subfolders - batch-file

MainFolder
|
|--- Folder1
| |
| |--- Extra
| |--- picture.jpg
|
|---Folder2
| |
| |--- Extra
| |--- picture.jpg
|---Folder3
| |
| |--- Extra
| |--- picture.jpg
|---Folder4
| |
| |--- Extra
| |--- picture.jpg
I'm using Windows 10.I want to place a batch-file into the "MainFolder"-folder and execute it from there. It should copy every file named picture.jpg into its "Extra" folder.

Related

How to include .a file in PLatformIO?

When I build my project a static library .a file is created (libtest.a).
How can I use this library in other projects?
Folder structure:
|--lib
| |--test
| | |- test.c
| | |- test.h
|
|- platform.ini
|
|--src
| |- main.c
|
|--.pio
| |--build
| | |--genericSTM32F103RB
| | | |--lib704
| | | | |- libtest.a
Is it possible to use libtest.a in other projects and have the same functions?

Excluding the transitive com.google.http-client:google-http-client:1.42.1 child dependency from included dependencies in Gradle

I'm facing this weird java.lang.NoSuchMethodError in my Groovy project, and I have it pretty much down to that there's some transitive grand-child dependency, that is being included by multiple child dependencies (below is just the compileClasspath):
compileClasspath - Compile classpath for source set 'main'.
+--- com.github.javafaker:javafaker:1.0.2
| +--- org.apache.commons:commons-lang3:3.5
| +--- org.yaml:snakeyaml:1.23
| \--- com.github.mifmif:generex:1.0.2
| \--- dk.brics.automaton:automaton:1.11-8
+--- com.google.apis:google-api-services-gmail:v1-rev20220404-2.0.0
| \--- com.google.api-client:google-api-client:2.0.0
| +--- com.google.oauth-client:google-oauth-client:1.34.1
| | _+--- com.google.http-client:google-http-client:1.42.0 -> 1.42.1_
| | | +--- org.apache.httpcomponents:httpclient:4.5.13
| | | | +--- org.apache.httpcomponents:httpcore:4.4.13 -> 4.4.15
| | | | +--- commons-logging:commons-logging:1.2
| | | | \--- commons-codec:commons-codec:1.11
| | | +--- org.apache.httpcomponents:httpcore:4.4.15
| | | +--- com.google.code.findbugs:jsr305:3.0.2
| | | +--- com.google.guava:guava:30.1.1-android -> 31.1-jre
| | | | +--- com.google.guava:failureaccess:1.0.1
| | | | +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
| | | | +--- com.google.code.findbugs:jsr305:3.0.2
| | | | +--- org.checkerframework:checker-qual:3.12.0
| | | | +--- com.google.errorprone:error_prone_annotations:2.11.0
| | | | \--- com.google.j2objc:j2objc-annotations:1.3
| | | +--- com.google.j2objc:j2objc-annotations:1.3
| | | +--- io.opencensus:opencensus-api:0.31.1
| | | | \--- io.grpc:grpc-context:1.27.2
| | | \--- io.opencensus:opencensus-contrib-http-util:0.31.1
| | | +--- io.opencensus:opencensus-api:0.31.1 (*)
| | | \--- com.google.guava:guava:29.0-android -> 31.1-jre (*)
| | +--- com.google.http-client:google-http-client-gson:1.42.0 -> 1.42.1
| | | _+--- com.google.http-client:google-http-client:1.42.1 (*)_
| | | \--- com.google.code.gson:gson:2.9.0
| | \--- com.google.guava:guava:31.1-android -> 31.1-jre (*)
| +--- com.google.http-client:google-http-client-gson:1.42.1 (*)
| +--- com.google.guava:guava:31.1-jre (*)
| +--- com.google.http-client:google-http-client-apache-v2:1.42.1
| | _+--- com.google.http-client:google-http-client:1.42.1 (*)_
| | +--- org.apache.httpcomponents:httpclient:4.5.13 (*)
| | \--- org.apache.httpcomponents:httpcore:4.4.15
| +--- org.apache.httpcomponents:httpcore:4.4.15
| +--- org.apache.httpcomponents:httpclient:4.5.13 (*)
| \--- _com.google.http-client:google-http-client:1.42.1 (*)_
\--- org.codehaus.groovy:groovy-all:2.4.7
My build.gradle looks like this :
plugins {
id 'java'
id "com.katalon.gradle-plugin" version "0.1.1"
}
repositories {
mavenCentral()
}
dependencies {
implementation 'com.github.javafaker:javafaker:1.0.2'
implementation 'com.google.apis:google-api-services-gmail:v1-rev20220404-2.0.0'
}
Notice that there are multiple instances of this com.google.http-client:google-http-client:1.42.1 across different child dependencies!
I try to get rid of those transitive dependencies with:
configurations.all {
exclude group: 'com.google.http-client', module: 'google-http-client'
}
but then my compileClasspath looks like:
compileClasspath - Compile classpath for source set 'main'.
+--- com.github.javafaker:javafaker:1.0.2
| +--- org.apache.commons:commons-lang3:3.5
| +--- org.yaml:snakeyaml:1.23
| \--- com.github.mifmif:generex:1.0.2
| \--- dk.brics.automaton:automaton:1.11-8
+--- com.google.apis:google-api-services-gmail:v1-rev20220404-2.0.0
| \--- com.google.api-client:google-api-client:2.0.0
| +--- com.google.oauth-client:google-oauth-client:1.34.1
| | +--- com.google.http-client:google-http-client-gson:1.42.0 -> 1.42.1
| | | \--- com.google.code.gson:gson:2.9.0
| | \--- com.google.guava:guava:31.1-android -> 31.1-jre
| | +--- com.google.guava:failureaccess:1.0.1
| | +--- com.google.guava:listenablefuture:9999.0-empty-to-avoid-conflict-with-guava
| | +--- com.google.code.findbugs:jsr305:3.0.2
| | +--- org.checkerframework:checker-qual:3.12.0
| | +--- com.google.errorprone:error_prone_annotations:2.11.0
| | \--- com.google.j2objc:j2objc-annotations:1.3
| +--- com.google.http-client:google-http-client-gson:1.42.1 (*)
| +--- com.google.guava:guava:31.1-jre (*)
| +--- com.google.http-client:google-http-client-apache-v2:1.42.1
| | +--- org.apache.httpcomponents:httpclient:4.5.13
| | | +--- org.apache.httpcomponents:httpcore:4.4.13 -> 4.4.15
| | | +--- commons-logging:commons-logging:1.2
| | | \--- commons-codec:commons-codec:1.11
| | \--- org.apache.httpcomponents:httpcore:4.4.15
| +--- org.apache.httpcomponents:httpcore:4.4.15
| \--- org.apache.httpcomponents:httpclient:4.5.13 (*)
\--- org.codehaus.groovy:groovy-all:2.4.7
There's NO instances of the com.google.http-client:google-http-client:1.42.1 ANYWHERE! It also doesn't resolve the Error.
java.lang.NoSuchMethodError: com.google.api.client.http.HttpTransport.isMtls()Z
at com.google.api.services.gmail.Gmail$Builder.chooseEndpoint(Gmail.java:11179)
at com.google.api.services.gmail.Gmail$Builder.<init>(Gmail.java:11212)
at com.signaturemd.utils.GmailQuickstart.GetLabels(GmailQuickstart.groovy:72)
at com.signaturemd.utils.GmailQuickstart$GetLabels.call(Unknown Source)
at SMDEmailUtils.run(SMDEmailUtils:6)
What should I do to make sure that only ONE instance of com.google.http-client:google-http-client:1.42.1 is in the project, and that this Error goes away?
When you are saying "multiple instances" of the dependency what do you mean? I would assume you are confused by seeing multiple versions of the same dependency in the dependency graph.
But that has nothing to do with how many physical instances (jar files) will be packed up into the resulting artifact of your own. There is always just one physical instance of any dependency in the resulting artifact managed by either Gradle or Maven. However, if there are multiple different versions of the same dependency in the dependency graph they both choose the most appropriate version of that one physical instance as they see fit:
Gradle
In case of conflict, Gradle by default uses the newest of conflicting versions.
Maven
Dependency mediation - this determines what version of an artifact will be chosen when multiple versions are encountered as dependencies. Maven picks the "nearest definition". That is, it uses the version of the closest dependency to your project in the tree of dependencies. You can always guarantee a version by declaring it explicitly in your project's POM. Note that if two dependency versions are at the same depth in the dependency tree, the first declaration wins.
And you can override that version. So, in case of Gradle, instead of configuration.all { exclude {...} } that excludes the dependency from everywhere you can try configuring the resolutionStrategy like this:
configuration.all {
resolutionStrategy {
force "com.google.http-client:google-http-client:1.42.1"
}
}
That would (snippet from the doc below):
Allows forcing certain versions of dependencies, including transitive dependencies
This is what you need as per your original question. Like obviously, you don't want to exclude the dependency but rather you want to enforce the specific version of it.
For more info you can refer to the official documentation:
https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html
https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.ResolutionStrategy.html#org.gradle.api.artifacts.ResolutionStrategy:force(java.lang.Object[])

makefile prerequisites rebuild failed when using .d-dependencies-file

As pleased i recreated this Question to give my actual example:
My Problem is, when httpd-fsdata-erw.h is missing at the very first build the rule httpd-fsdata-erw.h:: creates it for me and erverything works fine.
If i touch httpd-fsdata-erw.h make recognised it and is building sourcefile1.o, sourcefile2.o and everything else neede again. Wonderful!
But when i delete httpd-fsdata-erw.h it. Make is checking the prerequisites and does nothing because it said "nothing to be done" although httpd-fsdata-erw.h is missing.
Now when i touch sourcefile2.h make can't find a rule to make target httpd-fsdata-erw.h.
MAYBE i mixed up some error-messages
I can fix it with the .PONY:-target, but as you know every turn it will rebuild most of the stuff.
File-Overview:
extension
|
|-- Makefile
|--(httpd-fsdata-erw.h) (created by perl
|--(httpd-fsdata-erw.c) (created by perl)
|--(httpd-fsdata-erw.o)
|-- ext.o
|-- ext.bin
TOPDIR-- Makefile
|-- obj_dir
| |--sourcefile1.o
| |--sourcefile1.d
| |--sourcefile2.o
| |--sourcefile2.d
| |--...
|
|-- app
| |
| |--sourcefile1.c (needs httpd-fsdata-erw.h)
| |--sourcefile2.c
| |--sourcefile2.h (needs httpd-fsdata-erw.h)
| |--sourcefile3.c
| |--sourcefile4.c
| |
| |--appskt
| | |--webserver
| | | |-- Makefile
| | | |...
| | | |--fsdata
| | | |--index.html
| | | |--somejavascript.js
| | |
| | |
| | |--shell
| | | |...
| | |--crypto
| | | |...
| | |--ftp
| | | |...
| | |
|
|
|-- contiki
| |--Makefile.include
|
|
|
|-- plattform
| |-- cpu
| | |-- Makefile.r7s7210
| | |
| | |
The Makefile in directory=webserver creates with a perl-script httpd-fsdata-erw.h .c and .o to the extension-folder with the rule
HTTPD_FSDATA_ERW_FILES=httpd-fsdata-erw.c httpd-fsdata-erw.h
$(HTTPD_FSDATA_ERW_FILES): $(PATH_WEBSERVER)/index.html $(PATH_WEBSERVER)/somejavascript.js
perl makefsdata -d $(HT....
web_content: $(HTTPD_FSDATA_ERW_FILES)
TOPDIR-- Makefile:
include $(CONTIKI)/Makefile.include
all: project.bin
project.bin: $(somestuff1) $(somestuff2) $(TARGET_PATH)/$(CONTIKI_PROJECT).$(TARGET)
#cmd .... nothing important, just a windows batch-file
|-- contiki--Makefile.include:
-include $(PATH_...)/Makefile.r7s7210
-include ${addprefix $(OBJECTDIR)/,$(CONTIKI_SOURCEFILES:.c=.d) \
$(PROJECT_SOURCEFILES:.c=.d)}
#.PHONY: httpd-fsdata-erw.h
httpd-fsdata-erw.h::
#$(MAKE) -j1 $(EXT_BIN) -C $(EXT_PATH) -f Makefile
$(TARGET_PATH)/%.$(TARGET): %.co $(PROJECT_OBJECTFILES) $(PROJECT_LIBRARIES) contiki-$(TARGET).a
some linking stuff
|-- plattform -- cpu -- Makefile.r7s7210:
$(OBJECTDIR)/%.o: %.c | $(OBJECTDIR):
...
$(CC) $(CFLAGS) $(IAR_INCLUDES) ... $< --dependencies=n $(#:.o=.d) -o $#)
But when i delete the "missing.h"-file after the very first build, make is unable to find a target.
Is this because of the structure of the .d-file?
It is.
To fix that, use -MP gcc command line switch when generating the .d file:
-MP This option instructs CPP to add a phony target for each dependency
other than the main file, causing each to depend on nothing. These
dummy rules work around errors make gives if you remove header
files without updating the Makefile to match. This is typical output:
test.o: test.c test.h
test.h:

How to Structure React and bootstrap-react projects?

How to Structure React and bootstrap-react projects?
Here you can see my folder structure. Is this the best practice?
|-COPYRIGHT.md
|-dist
| |-app
| |-bundle.js
| |-bundle.js.map
|
|-index.html
|-.git
|-.gitignore
|- node_modules
|-package.js
|-README.md
|
|-src
| |-app
| | |-components
| | | |-Footer.js
| | | |-Header.js
| | | |-Home.js
| | |
| | |-index.js
| |
| |-css
| | |-bootstrap.min.css
| | |-footer.css
| | |-header.css
| | |-styles.css
| |
| |-fonts
| | |-glyphicons-halflings
| |
| |-images
| | |-logo.jpg
| |
| |-index.html
| |
| |-js
| | |-es5-sham.min.js
| | |-es5-shim.min.js
| | |-html5shiv.min.js
| | |-html5shiv-printshiv.min.js
| | |-react-bootstrap.js
| | |-react-bootstrap.min.js
|
|-webpack.config.js
In the next step I would make my homepage multilingual. I need three languages de, en, fr.
I would like separate the languages like this.
How to change the languages in the Navbar?
Which of you has something already programmed and sends me a link of his Github repository? How do I program the routes correctly? In Footer I'll use three images as a flag for switching languages. But to be recognized by the browser language principle.
|-Languanges
|-de
| |-Impressum.js
|
|-en
| |-Imprint.js
|
|-fr
| |-empreinte.js

How to show several loops and doing stuff in it in a sequence diagramm?

I want to show what my UserControl/Control is doing when I plug a list of data in it, what happens when the user press certain keys, selecting text etc...
I feel somehow a sequence diagramm is not really suited for showing several loops and doing stuff within the loops.
Am I wrong or how can I cope with that case?
If you are talking about a loop, then you have a series of operations that take place for all elements in the loop.
I would model the operations done in the loop as a sequence diagram by itself, if the operation in the loop are fairly complex.
I don't think we can have rules of thumb here, but when the process with the loop itself is complex, and the loop is relatively less complex, we can have them in a single sequence diagram.
If the process that has the loop is not very complex, but the loop is complex, then I would draw a sequence diagram for the operations of the loop and have a note that this entire sequence is called by a loop.
You can also have both sequence diagrams if needed.
Update:
We have to add some notes to the diagram because it is not straightforward to denote a "condition" in a sequence diagram.
The validate is part is something like
do validation
if validation succeeds
proceed to next (business or other) logic
if validation fails
feedback to user (or some other logic)
+----+ +----+ +----------------+ +----------------+
|User| | UI | | Your Validator | | Business Logic |
+----+ +----+ +----------------+ +----------------+
| select | | |
|--------------->| doValidation | |
| |------------------>|----+ |
| | | | Validate |
| | |<---+ |
| | | |
| | | (validation fails: |
| | Validation Fail | feedback to client) |
| |<------------------| |
| | | |
| | | |
| | | (validation succeeds: |
| | | proceed to |
| | | business logic) |
| | | |
| | | someLogic |
| | |----------------------->|
| | | |
UPDATE 2
Why use sequence diagram in a case as mine?
Because you still have to show the sequence of operations, and the developer still needs this information for coding :-)
With UML, as you probably already know, nothing is imposed. You are at your freedom to denote something in some fashion, provided your team also understands it the way you intended. These notes are also helpful.
I should have mentioned this before, some use an "option" fragment to denote a if else. This is more or less a note (I see it this way) but is perhaps more evident. I use them only when both the IF and the ELSE parts are both complex.
+----+ +----+ +----------------+ +----------------+
|User| | UI | | UI - Backend | | Busines Logic |
+----+ +----+ +----------------+ +----------------+
| Add Record | | |
|--------------->| doinsertOrUpdate | |
| |------------------>| |
| | | exists(record) |
| | |----------------------->|
| | | |
____|________________|___________________|________________________|__________
|[Record exists] | | | |
| | | | Get Record | |
| | | |----------------------->| |
| | | | | |
| | | |--------+ | |
| | | | | Set UI Values | |
| | | |<-------+ | |
| | | | | |
| | | | Update Record | |
| | | |----------------------->| |
| | | | | |
| | | Send Message | | |
| | |<------------------| | |
| | | "Record found, | | |
| | | Updated" | | |
|___|________________|___________________|________________________|_________|
| | | |
| | | |
______|________________|___________________|________________________|_________
| [Record does not | | | |
| exist] | | | |
| | | |--------+ | |
| | | | | Generate | |
| | | | | Seqeuence | |
| | | |<-------+ | |
| | | | | |
| | | | Create New Record | |
| | | |----------------------->| |
| | | Send Message | | |
| | |<------------------| | |
| | | "New Record | | |
| | | Created" | | |
|_____|________________|___________________|________________________|_________|
| | | |
| | | |
| | | |
See this for an example using an alt block.

Resources