How to make logrotate working for already existing log files? - logrotate

I have written a conf that would compress the logs daily to the maximum size of 2GB. I have allowed a total of 3 such log rotated files:
/var/log/upstart/*.log {
daily
rotate 3
size 2G
compress
delaycompress
}
However, the directory where this file is located, it is not experiencing any log rotation. It became 10B in size.

Related

Adding Small Assets Increases Standalone Data Folder Size Exponentially

I added 33 mb worth of sprite assets (they are large character illustrations), so I would expect the data folder to increase proportionally. However, the size actually increases by 2 GB (6000% increase!) increasing total data size by over 500% too.
Doesn't make any sense to me. Is there a mistake with my import options? I use mip maps, bilinear/trilinear filters. Truecolor/ vs compressed doesn't change anything.
Additional info: It's like 10 files with 5-8 large sprites each. Another weird thing is that when it's compressed to a zip file the size collapses to 142mb (from like 2.3 GB). Which is weird because that's too big of a difference.
It's also very slow to start.
I believe this is related to how unity handles image compression. The assets live in your project in compressed (jpg/png) form, but they get recompressed (or not) to a form thats fastest to decode on the target platform. Try playing with the compession settings with the asset import settings (available if you highlight your asset in the project window)
There are a few reasons why file sizes can get so big.
As #zambari said, PNG/JPEG are compressed forms, which compress much better than what unity will. Due to that, you have to be careful with your file sizes, since they will be much bigger in-game.
Another issue I had was that my files weren't sized properly. The compression method that I was trying to utilize requires file sizes divisible by 4 (DTX5).
Another big issue was I had large images that I did not need. I used "generate mip-maps" + trilinear filtering, and that once again doubled the file sizes. The best thing you can do is just use image sizes that reflect their use. Relying on Unity to do that for you by using max image size does not guarantee good quality (in fact it looked terrible). This was all in Unity 5

TileMill exports too big mbtile file

I'am trying to export mbtile file from TileMill to use it in my map server. But file is too huge, 17th level will cost 100+GB only for my country. However, i found free mbtile from openmaptiles.org with only 1GB size for the same are.
My question is: How openmaptiles.org reduced 100GB mbtile to 1GB?
I don't want to use 1gb file because they have watermarks all over the map
I found out that openmaptiles.org provides only 14 zoom levels and can be over zoomed till 18. Overall, 14 layers are >1gb size

how to compress apk size in unity3d

I am making a simple test game in unity3d using c#, the size of the apk of my game is 70 MB.I have reduced the resolution of each and ever sprites, but its still 58 MB, how do i compress the game so that the apk file is of the least possible size.
Apart from following this short guide by Unity themselves, there are a couple things to keep in mind:
Files which are not used or dependent on are removed by Unity when building.
Textures, music and videos take up most of the size. Sound files should ideally be .mp3 format (otherwise .wav for very short clips).
I would recommend you go through the link above and properly analyse Editor.log as it provides valuable information to trim the build size.
You can also choose to set the Device filter to Arm7. This will exclude certain devices, but I believe the number is quite small and it does minimize the apk size a bit. (This is located in Player Setting -> Other Settings -> Device Filter). You could try a build and see how much it would reduce it by and decide whether it was worth it.
Some Info on device filter: http://answers.unity3d.com/questions/971648/device-filter-to-arm-7-only.html
Additionally, if you look in your editor build file you can find information on what is taking up the majority of space in your build (it is a long log so you'll have to search for the right parts). There should be a part in it after you do a build that will list how much space things are taking up. It will be followed by a list of the assets from largest to smallest so you can identify particular assets that may be too large.
E.g.
Build Report
Uncompressed usage by category:
Textures 81.1 mb 92.0%
Meshes 0.0 kb 0.0%
Animations 17.1 kb 0.0%
Sounds 0.0 kb 0.0%
Shaders 90.0 kb 0.1%
Other Assets 549.9 kb 0.6%
Levels 338.3 kb 0.4%
Scripts 993.0 kb 1.1%
Included DLLs 5.1 mb 5.8%
File headers 33.1 kb 0.0%
Complete size 88.2 mb 100.0%
How to find editor file: https://docs.unity3d.com/Manual/LogFiles.html
One most effective and important change for reduce image size is
Set your image size square and
Set unity suggested pixels.(32, 64, 128, 256, 512, 1024, 2048, 4096, 8192)
If your image size is 567x890 pixels then set this image in a 1024x1024 pixels background transparent blank image and save it as a png file.
Then in unity inspector set this image as a sprite and slice it by sprite editor.
This process will make your image size reduce minimum 20%.
Example image and changes given below.
Before: resolution 567x890 pixel, size 1.9MB
After: resolution 1024x1024 pixel, size 1.3MB
Result: size 0.6MB reduced, almost 32%.
Image file Link: https://drive.google.com/file/d/0B9zkzr6JdNYlaHhqcDVUSk9KNjA/view
It is also good to set texture / sprite compression format.
Check this website:
https://docs.unity3d.com/Manual/class-TextureImporterOverride.html
Most texture compression format needs image in power of 2 resolution (128, 256, 512, 1024, 2048). Resolutions 4096 and 8192 may not work on some android devices.
For example texture with no alpha in 1024x1024 resolution using RGB ETC2 compressions takes about 0,5MB in memory. Image 1280x800 with compression format RGB 16bit takes 2MB.

Batch process images using OS X SIPS (scriptable image processing system) to downsize images only?

I'd like to batch process several folders of 1000's of images to downsize any images with a long side greater than 1440 pixels down to 1440 while ignoring any files that are already smaller than that.
I was looking at sips and can't tell if it skips upsizing by default or if there is a way to filter it using getProperty perhaps? (I'm not the best at deciphering CLI options from man pages).
I was thinking maybe I could use a find or sips query first and then pipe it into another sips to resize, I'm not sure exactly how though and don't think find can search by image size.
(also open to something other than sips to handle this, just seemed the quickest way)
Using spotlight to filter results to to images larger than a particular size works perfectly:
mdfind -0 -onlyin . "kMDItemPixelHeight > 1440 || kMDItemPixelWidth > 1440" | xargs -0 sips -Z 1440
This find images recursively from the current directory with width OR height greater than 1440 pixels and resizes them down to 1440. Files under 1440 get left alone.

memory issues with UIImage when we load 2000 images

I'm trying to run an animation by changing the images of my UIImageView . I need about 200 images of 24K to create a 5 sec animation. I am able to load all the images into the memory (into an NSArray), but when I start the animation (switching the UIImage of the UIImageView) - after about 60 images I get a memory warning and if I continue displaying images the app crashes.
Just because your image files are 24Kb on disk, doesn't mean that is the amount of memory they will take up.
If you have an image that is 480x960 with 1 byte per pixel, that may only be a small file size due to compression (jpeg, for example), but when it is in memory in your app, it will be 450KB. Multiply that by 60 (the point at which you get the memory warning) and you will see that is approx 27MB.
If your images are larger, or have a greater colour depth, then obviously they will consume more memory. I think I read once that iOS gives you a memory warning when you hit 22Mb, but that includes other memory allocated to your app for other things as well.
And just because your app "loads" the images into the array, doesn't mean it actually loads it into memory, or expands it until it really needs it.
So, to calculate how much memory your image is going to use, don't look at the file size, but instead work it out from the image dimensions.