How do I include a directory (not its contents) in proguard? - proguard

I have a directory called pngs (containing images) that I want included in the generated jar:
-injars /whatever/pngs
However, this "flattens" the directory contents into the jar directly, without the pngs directory itself.
How do I include the directory pngs itself, not just its contents?

Ah, filters seem to do the trick:
-injars /whatever(pngs/*)
If there is a better/more idiomatic version, let me know.

Related

What files do webpack loaders work through?

When you set the regex after the test key in a loader object, does that look through all files in your project and load them using the loader you've designated, even if those files weren't required by the file in your entry point? Does this then get placed in the bundle.js file?
No it will only include what is required by your script.
<img src={ require('../some/img.png') } /> is a way to tell Webpack that your source code needs this image to run.
In a production Webpack build, this will get compiled into something like <img src="http://yoursite/whatever/89de0f2.png" />. The require() statement is never executed, it's replaced with valid Javascript code. This replaced code is what's put in bundle.js.
The image is then put into whatever output folder you specify (like a local dist/ folder), and it's renamed to something unique, which is usually some hash of the file contents, resulting in 89de0f2.png. (I made up this name for the example, but it usually looks something like that).
Now when you upload that file, 89de0f2.png, your source code will reference 89de0f2.png exactly, so that version of the image is guaranteed to exist. This is how Webpack gives you production guaranteed asset loading.
Wepback will only put img.png in your dist/ folder as 89de0f2.png if you specifically require it. Any other images will not be put in that folder.
You may also be asking about base64 encoding images and putting them directly into your bundle.js file. In this case, no image is put into dist/, but all the other rules reply. The require() call is still replaced with valid Javascript.
There is one case where Webpack will require multiple assets. You can require patterns, like <img src={ require.context( './images', true, /\.png/ ) } /> and Webpack will build all png files in that directory into the dist/ folder. See this Stackoverflow question for more context.

I cannot install PhpWord Yii

I have tried to install PhpWord to yii. I have downloaded zip file and extracted it into extentions folder:
extenstions
--PHPWord
--PHPWord.php
However, I cannot make it to run. I got following error:
include(PHPWord.php): failed to open stream: No such file or directory
How can i solve it?
After extracting the file in extension folder, you have to import that file in controller.
Yii::import('ext.phpword.PHPWord');
First of all, you didn't say if it's Yii 1 or 2. They have different autoloading methods.
Second, you have extracted it into extension folder, and I assume your file where you want to include it is in a completely different folder.
You should do it like this
include('/full/path/to/PHPWord.php');
You need either absolute or a relative path to the file (I suggest using abosulte path (the one I used as an example).
Relative path means the path to the file you want to include compared to where your file, in which you are including it, is.

How to mark package as a resource folder?

I have a dir structure for Intellij 12:
...
...test
- java
- com.mycompany.myproject
- package1 (contains code, etc,.)
- resourcePackage (want to contain .json files but can't mark as a resource)
- myOtherJunk.json
- o o o
- resources
- aResource.json
The thing is if I right click on my package name (com.mycompany.myproject) I can only add packages and not directories (like that of an existing resource folder).
However, I don't want to use that existing resource folder for the .json files that I'm going to read into per my test class.
So, I need something to support:
// this already works for the resources directory per the .json file but doesn't for the
// myOtherJunk.json per the resourcePackage.
InputStream is = MyClassTest.class.getResourceAsStream("aResource.json");
This can be solved in several ways. An example of a good approach would be the following folder structure:
src
main
java
resources
test
java
resources
When this is done, you put all you java classes under src/main/java/com.mycompany package and any resources under /src/main/resources/com/mycompany folder.
To link them together, go to the project properties, and find the Path tab. Mark the src/main/java and src/main/resources as source folders. (see the screen-shot attached)
If you link them together, you'll be able to use getResourceAsStream() method.
If you wonder why you should use the following folder structure - this is standard maven way of keeping things clean and tidy.
Directories Creation
Intellij creates directories when you ask her to create package. It is not an error.
If you create package "com", it will create the dir "com", and if you create a source file there, it will think that the file is in the package "com".
If you create package "com.next.pack", it will create three nested dirs "com", then "next", then "pack", and if you create a source file there, it will think that the file is in the package "com.next.pack".
Directories Structures
Only the path under the source root is taken as a package. Any directory(ies) can be set as a source root(s).
Resources roots
Make practically any structure of directories. Somewhere in it there is the root dir of resources. Right-click it and Mark Directory As ... Resources Root.
Notice, the same method can be used for the directories structures for tests, test classes, and test resources. Look here.
Please use #ContextConfiguration annotation to load the resource files. Please see below example.
#ContextConfiguration( { "/app-config.xml", "/test-data-access-config.xml",application-test.yml })

Confused with two zlib1.dll of SDL_image extension and SDL_ttf?

Inside the SDL_image extension bin folder there is a file zlib1.dll and inside the SDL_ttf bin folder there is also zlib1.dll file,are these two files the same or different because when i tried to copy all the files under bin of SDL_ttf to widows/system32 it says "replace" or "skip this file" ,i have already install SDL_image extension and using it with code blocks 13.12.What should i do?
The files should be the same (differing only in when the were compiled) so you can safely replace one of them. Both libraries use and therefore include the zlib1.dll as they are independent from each other, but when you use both this happens.

IntelliJ include a directory contained in an excluded directory?

Can IntelliJ include a source directory contained in an excluded directory?
I am using Google Protocol Buffers and am placing the generated class files in the target/proto-generated directory. I have already excluded the target directory, is there a way to mark proto-generated as a source directory and leave the target directory excluded?
target <excluded>
classes
proto-generated <include>
Thanks CrazyCoder for
"See youtrack.jetbrains.com/issue/IDEABKL-6054 for the workaround."