os-agnostic

Consistency guarantee of file system regarding sequential write

会有一股神秘感。 提交于 2020-01-05 15:11:31
问题 My program (only 1 process and 1 thread) sequentially write n consecutive chunks of data to a file on a HDD (regular kind of HDD) using plain old write system call. It's like some kind of append-only log file. After a system crash (power failure, not HDD failure), I read back and verified that chunks[i] (0 < i < n) had been entirely written down to disk (by checking length). May be the content of the chunk is not checksum correct but still the whole chunks[i] stably sit on the surface of the

Command line batch image cropping tool

别来无恙 提交于 2019-12-20 08:59:16
问题 is there any lightweight command line batch image cropping tool(Linux or Windows) which can handle a variety of the formats ? 回答1: Imagemagick is what you want -- tried and true. 回答2: In Linux you can use mogrify -crop {Width}x{Height}+{X}+{Y} +repage image.png for CLI image manipulation 回答3: Imagemagick's convert does the trick for me (and much more than cropping): convert -crop +100+10 in.jpg out.jpg crops 100 pixels off the left border, 10 pixels from the top. convert -crop -100+0 in.jpg

How a servlet can get the absolute path to a file outside of the servlet?

浪子不回头ぞ 提交于 2019-12-07 12:20:50
问题 We have been using System.getProperties("user.dir") to get the location of a properties file. Now that it has been deployed on Tomcat(via servlet), the System call is giving the location as tomcat and not at the location at where the properties file exist. How can we call the the properties file dynamically? Given: Tomcat is not the only way the app will be deployed We have no control on where the app may be placed. Relative paths will not work as that Vista is being used and Vista breaks

Command line batch image cropping tool

混江龙づ霸主 提交于 2019-12-02 17:53:39
is there any lightweight command line batch image cropping tool(Linux or Windows) which can handle a variety of the formats ? Imagemagick is what you want -- tried and true. Ralph In Linux you can use mogrify -crop {Width}x{Height}+{X}+{Y} +repage image.png for CLI image manipulation Imagemagick's convert does the trick for me (and much more than cropping): convert -crop +100+10 in.jpg out.jpg crops 100 pixels off the left border, 10 pixels from the top. convert -crop -100+0 in.jpg out.jpg crops 100 pixels off the right, and so on. The Imagemagick website knows more: http://www.imagemagick.org

OS detecting makefile

老子叫甜甜 提交于 2019-11-26 00:56:27
问题 I routinely work on several different computers and several different operating systems, which are Mac OS X, Linux, or Solaris. For the project I\'m working on, I pull my code from a remote git repository. I like to be able to work on my projects regardless of which terminal I\'m at. So far, I\'ve found ways to get around the OS changes by changing the makefile every time I switch computers. However, this is tedious and causes a bunch of headaches. How can I modify my makefile so that it