Creating a variable thickness line in d3.js - d3.js
full source code is at: http://codepen.io/geewhizbang/full/XKLdLE/
I'd like to have the stroke-width vary along the the length of the snake. Just before the end of the snake, the stroke-width should taper to zero.
but if I write a function to do this, it doesn't know about "(d)"
gameBoard.append('path')
.attr("id", snakeId)
.attr("d", interpolator(data))
.attr('stroke-width', snakeStroke + 2)
.attr('fill', 'none')
.attr('stroke', config.snakeOutlineColor);
gameBoard.append('path')
.attr("d", interpolator(data))
.attr('stroke-width', snakeStroke)
.attr('fill', 'none')
.attr('stroke', config.snakeColor);
You can use markers at the start and the end to make your head and tail, and it's possible to hack a variable width stroke using a carefully designed combination of stroke-dasharray and a filter - here's an example.
(But as Robert says above - it's easier to just draw a path and fill it!)
<svg width="800px" height="600px" color-interpolation-filters="sRGB" viewBox="0 0 1500 1000">
<defs>
<filter id="var-width">
<feGaussianBlur in="SourceGraphic" stdDeviation="6" result="blur-source"/>
<feComponentTransfer result="clipper">
<feFuncA type="table" tableValues="0 1 1 1 1"/>
</feComponentTransfer>
<feComponentTransfer result="clipper2">
<feFuncA type="table" tableValues="0 1 1 1 1"/>
</feComponentTransfer>
</filter>
</defs>
<g filter="url(#var-width)">
<path fill="none" stroke="red" stroke-width="10" stroke-dasharray="40,2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"
d="m 1258.5,638.2714 c -7.5386,-1.87182 -33.9939,-11.02201 -39.8682,-13.78935 -11.8775,-5.59544 -20.9684,-11.05227 -23.0439,-13.8322 -1.8443,-2.47024 -1.8682,-2.8389 -0.3852,-5.94882 1.0032,-2.10363 4.2273,-5.10701 8.8214,-8.21732 11.269,-7.62954 15.6404,-12.9223 17.3957,-21.06234 0.3651,-1.69325 -0.03,-25.31825 -0.8777,-52.5 -2.9735,-95.33422 -3.586,-124.03659 -4.2229,-197.87915 l -0.6421,-74.45779 -4.4256,4.95779 c -2.4341,2.72678 -10.6977,12.60778 -18.3636,21.95778 -7.6659,9.35 -15.6811,18.8 -17.8115,21 -3.7423,3.86447 -5.8767,7.72575 -7.7291,13.98218 -0.5779,1.95206 -1.8586,3.3253 -3.7074,3.9755 -2.3893,0.84027 -3.7801,0.48275 -9.0266,-2.32045 -8.9188,-4.76521 -22.7502,-15.29413 -32.8795,-25.02886 -10.012,-9.622 -13.0072,-13.87833 -12.5523,-17.83719 0.318,-2.76657 0.3347,-2.77224 10.0705,-3.40751 5.7327,-0.37406 10.6786,-1.2287 12,-2.07356 20.5761,-13.15527 52.0465,-32.92983 65.9619,-41.44744 l 17.7139,-10.84267 0.4224,-92 c 0.2504,-54.531463 0.043,-94.036334 -0.5086,-97 -0.5121,-2.75 -1.1944,-6.287354 -1.5161,-7.860787 -0.3838,-1.876808 -0.1104,-3.161369 0.7947,-3.734687 4.1441,-2.624742 27.1746,0.346621 56.2384,7.255796 18.3348,4.35864 20.3214,7.159946 11.9848,16.899447 -5.1909,6.064358 -8.5251,12.824946 -10.2015,20.685129 -2.7521,12.903832 -3.6418,68.318932 -3.6248,225.755102 0.016,151.69554 0.5864,197.15726 3.6505,291.17828 1.3097,40.18569 0.6939,51.75256 -3.1568,59.30055 -2.463,4.82796 -4.6906,5.73771 -10.5108,4.29257 z M 532.94465,619.5607 c -4.15545,-2.42174 -15.1636,-10.04526 -24.46257,-16.94116 -25.33227,-18.78581 -38.63045,-24.60698 -51.43828,-22.5167 -3.04909,0.49762 -15.4438,2.0654 -27.5438,3.48397 -38.21518,4.48022 -68.73764,11.51345 -79.36797,18.2886 -3.46987,2.21149 -11.54542,1.96514 -14.1972,-0.4331 -2.39051,-2.16195 -5.31837,-7.55542 -6.28168,-11.5716 -0.34686,-1.4461 -2.37798,-5.50543 -4.51359,-9.02072 C 319.2275,571.11854 307.71914,547.86135 302.45162,535 290.2059,505.10051 280.70789,474.83194 271.4532,436.21324 c -2.46647,-10.29228 -5.60245,-22.18503 -6.96885,-26.42833 -3.05313,-9.48144 -3.07894,-11.03333 -0.23435,-14.09542 1.6445,-1.77024 4.13376,-2.74576 9.25,-3.625 3.85,-0.66163 12.48987,-2.98822 19.19971,-5.1702 20.65457,-6.71668 52.31498,-13.02081 102.30029,-20.36975 9.625,-1.41509 26.73197,-4.11437 38.01548,-5.99841 64.6974,-10.8027 110.88469,-13.04319 132.66359,-6.43538 15.29655,4.64104 27.54679,9.41596 40.82093,15.91123 20.81828,10.18676 30.41695,19.72863 30.47804,30.29768 0.0254,4.40096 -0.82411,6.17957 -8.45451,17.70034 -6.5974,9.9611 -15.99703,28.94651 -20.299,41 -1.66854,4.675 -6.49294,19.3 -10.7209,32.5 -12.29635,38.39015 -32.82397,92.80004 -43.39456,115.02032 -4.65253,9.78003 -10.1609,17.49788 -12.46266,17.46162 -0.63053,-0.01 -4.54632,-1.99949 -8.70176,-4.42124 z M 507.6904,564.56385 c 3.36684,-1.56758 6.3121,-3.93564 8.38311,-6.74023 14.27335,-19.3292 33.07756,-85.5587 36.86017,-129.82362 1.05006,-12.2881 0.28669,-22.17788 -2.16272,-28.01867 -2.9387,-7.00755 -12.30976,-11.92715 -26.73793,-14.03683 -9.55212,-1.3967 -34.74526,-0.82738 -50.23629,1.13526 l -9.70326,1.22936 -1.6437,4.09544 c -2.19389,5.4663 -3.38973,18.68898 -3.42268,37.84544 L 459,446 l 3.01585,0 c 1.65872,0 9.19622,-1.62912 16.75,-3.62027 10.0126,-2.63928 16.59405,-3.75578 24.28843,-4.12038 10.11135,-0.47914 10.67373,-0.39737 13.40081,1.94837 l 2.84654,2.44848 -1.42172,10.33843 c -0.81276,5.91022 -1.15552,12.94414 -0.80023,16.4219 0.73892,7.233 -0.1094,9.28011 -4.62805,11.16813 -4.10035,1.71323 -9.91944,1.78683 -21.71115,0.27461 -8.5037,-1.09056 -15.69315,-0.65103 -29.59766,1.80945 l -3.35717,0.59407 0.48672,25.61861 c 0.26769,14.09023 0.91941,26.9686 1.44826,28.6186 l 0.96154,3 8.40891,-0.45591 c 18.09353,-0.981 19.98363,-0.80409 22.13904,2.07209 1.25506,1.67476 2.2596,5.27322 2.79158,10 0.98163,8.72206 2.2089,12.3393 4.67286,13.7727 2.54423,1.48009 3.16849,1.38814 8.99584,-1.32503 z M 371,556.98657 c 14.51804,-2.22981 34.99616,-7.39833 35.45257,-8.94796 0.77825,-2.64242 2.47372,-23.86076 3.17935,-39.78861 0.59209,-13.36514 0.48502,-15.25 -0.8663,-15.25 -1.70191,0 -17.52785,4.39734 -22.26562,6.18664 -1.65,0.62315 -4.37197,2.13994 -6.04883,3.37063 -9.86604,7.24099 -19.23389,3.83236 -26.39563,-9.60445 -8.38482,-15.73153 -9.83765,-28.90854 -3.50542,-31.7937 1.39919,-0.63752 6.68531,-1.18318 11.74693,-1.21258 5.28594,-0.0307 17.71547,-1.42209 29.20295,-3.26901 l 20,-3.21555 -0.19841,-13.11095 c -0.22114,-14.61265 -2.4427,-29.58932 -5.37538,-36.23819 l -1.93509,-4.38716 -5.33458,0.62698 c -8.19745,0.96345 -28.46102,6.31301 -37.78468,9.97511 -10.27121,4.03428 -21.46384,10.4748 -25.65705,14.76372 -4.21885,4.31514 -4.72008,7.99356 -4.68856,34.40851 0.0286,23.99296 1.17779,34.00167 6.42471,55.95682 3.66388,15.33106 10.78116,37.4891 12.76385,39.73731 2.47655,2.80822 10.35298,3.4715 21.28519,1.79244 z m -192.5,52.07042 c -2.75,-0.44007 -8.825,-1.83696 -13.5,-3.1042 -9.01886,-2.4447 -14,-5.94484 -14,-9.83748 0,-1.1212 2.09783,-4.19332 4.66185,-6.82693 9.14276,-9.39091 8.36954,-1.04132 10.08162,-108.86508 0.83197,-52.39661 1.21232,-96.4633 0.84521,-97.92598 -0.62116,-2.47491 -1.62289,-1.45695 -14.43843,14.67242 -12.24875,15.41601 -25.51283,30.49588 -42.22916,48.01011 -15.805655,16.5601 -38.698015,35.15284 -50.133135,40.71718 -9.454661,4.60066 -16.734211,6.10878 -29.248054,6.05942 -12.737694,-0.0503 -19.055188,-1.04317 -21.3708673,-3.35884 -2.3606342,-2.36064 -0.9444684,-4.077 9.2420843,-11.20123 C 51.256014,454.42545 85.848748,418.65441 125.17101,367 c 26.5994,-34.94142 43.9835,-62.67912 48.2165,-76.93316 2.07833,-6.99849 2.03097,-8.64836 -0.3156,-10.99493 -1.81047,-1.81047 -2.29576,-1.84231 -7.95512,-0.52207 -21.9096,5.11116 -76.799404,29.84746 -80.537391,36.29448 -5.770496,9.95256 -13.808146,7.56946 -20.732148,-6.14691 C 60.069722,301.21416 50.62515,276.20122 48.542824,268.16526 46.702614,261.06366 46.527228,251.87277 48.2,250.2 c 1.526426,-1.52643 5.465848,-1.46571 9.234478,0.14231 5.426073,2.31524 16.836196,0.18446 50.065522,-9.34949 34.99184,-10.03965 58.31512,-18.74398 89,-33.21513 36.94053,-17.42135 45.89748,-20.67483 50.39879,-18.30663 3.09785,1.62982 8.23103,6.99681 17.72175,18.52894 14.36976,17.46065 15.72533,19.63344 16.18124,25.93641 0.59762,8.26204 -1.1902,11.10767 -9.83151,15.64855 -4.99501,2.62481 -9.10156,5.90525 -14.15358,11.30634 -14.39406,15.38863 -26.02202,30.26181 -34.32841,43.90905 l -3.83471,6.30035 6.92322,7.03788 c 6.55184,6.66036 22.97302,19.1946 32.78171,25.02219 6.78157,4.02911 8.1501,6.78447 8.09447,16.29719 -0.064,10.95168 -3.21715,20.21714 -8.89751,26.1455 -6.18163,6.45151 -10.99073,5.79539 -22.51411,-3.07164 -6.45238,-4.96499 -19.01988,-12.95428 -25.87279,-16.44759 l -4.33145,-2.20798 0.66415,117.31188 c 0.66237,116.99729 0.65868,117.32048 -1.37932,120.52153 -3.9413,6.19055 -14.29582,9.1598 -25.62194,7.34733 z m 596.16667,-57.72366 c -1.34025,-1.34024 -0.61395,-5.58572 1.39865,-8.1756 1.13592,-1.46175 15.21885,-15.93273 31.29539,-32.15773 40.01132,-40.38079 51.96635,-54.89172 62.44398,-75.79403 15.15418,-30.23176 24.95936,-64.15459 31.13172,-107.70597 3.7631,-26.55187 7.17596,-72.08033 5.35063,-71.37872 -2.26256,0.86966 -22.11335,20.27797 -32.60553,31.87872 -18.93188,20.93217 -29.60984,36.06663 -37.43322,53.05615 -7.1,15.41861 -12.50642,16.63894 -23.35792,5.27231 -6.62653,-6.94111 -10.5885,-13.23476 -15.89612,-25.25126 -6.37249,-14.42735 -9.18104,-23.26 -8.80783,-27.69988 0.30658,-3.64731 0.43784,-3.75865 5.88222,-4.98957 3.06275,-0.69245 14.53775,-5.76821 25.5,-11.27946 24.40142,-12.26776 50.51042,-24.10844 71.39675,-32.37912 L 906.6962,238.5 l 0.6519,-8.90362 c 1.03833,-14.18152 0.75507,-97.01461 -0.43434,-127.01103 -0.82278,-20.75009 -0.80325,-27.923313 0.0805,-29.574607 1.82869,-3.41693 7.03768,-5.01455 16.22363,-4.975855 16.21944,0.06832 33.67143,4.610617 40.64347,10.578425 3.65346,3.127231 4.13865,4.043611 4.13865,7.816727 0,2.965264 -0.75778,5.314761 -2.47447,7.672077 -1.36096,1.868836 -2.9683,4.522883 -3.57187,5.897883 -3.7292,8.49552 -6.23899,39.9317 -7.94385,99.5 -1.78581,62.39657 -5.48825,101.86347 -13.06562,139.27555 -5.2089,25.71813 -9.68489,39.9514 -21.45479,68.22445 -12.63846,30.35946 -17.21086,46.57302 -18.4717,65.5 -1.07664,16.16175 -2.79502,22.05084 -7.91855,27.13776 -2.13951,2.12423 -11.35103,8.52406 -20.47003,14.22183 -28.39954,17.74473 -53.04423,29.16439 -75.9241,35.18108 -10.51012,2.76384 -20.52529,3.80572 -22.03835,2.29266 z m 280.71453,-51.86666 c -5.0153,-0.81428 -10.8653,-2.0897 -13,-2.83429 -3.5223,-1.22859 -3.8702,-1.66723 -3.7621,-4.74308 0.066,-1.86412 0.8742,-5.36952 1.797,-7.7898 4.6838,-12.28466 6.6006,-56.55419 6.5328,-150.87754 -0.033,-45.50464 -0.3845,-68.07075 -1.0547,-67.65655 -1.6271,1.00557 -15.2248,18.38911 -20.2779,25.92359 -4.9381,7.36301 -10.1998,17.75499 -13.1701,26.011 -2.2827,6.34478 -6.3268,10.5 -10.2192,10.5 -5.65359,0 -16.67035,-10.33666 -21.58636,-20.25374 -6.69563,-13.5071 -11.98579,-27.42541 -12.06164,-31.73395 -0.079,-4.48626 -0.0777,-4.48787 3.921,-5.08656 2.2,-0.32938 10.975,-4.04715 19.5,-8.2617 8.525,-4.21456 24.275,-11.61337 35,-16.4418 l 19.5,-8.77897 0.1152,-65.76366 0.1151,-65.76367 2.2819,-2.42895 c 3.4733,-3.69712 8.2453,-4.839319 17.415,-4.168334 15.0375,1.100364 38.0875,8.710164 41.8502,13.816574 2.1822,2.96161 2.0984,3.21797 -4.0676,12.44251 -3.7185,5.56288 -5.7292,11.72572 -7.1524,21.92225 -4.8668,34.86857 -9.6988,164.76827 -8.723,234.5 0.7041,50.31166 2.1688,68.28316 7.1976,88.31329 4.157,16.55746 4.4629,23.4185 1.2129,27.19687 -2.2127,2.57238 -2.5371,2.62935 -17.25,3.02935 -10.2785,0.27944 -17.8631,-0.058 -24.1137,-1.07284 z M 373.20218,340.75817 C 368.9436,338.70753 348.23012,308.25683 334.93367,284.5 326.6507,269.70077 317.75024,251.23688 313.2402,239.49716 c -1.69095,-4.40156 -4.23674,-10.31691 -5.65732,-13.14522 -5.66012,-11.26905 -3.18327,-14.56887 12.2142,-16.27258 10.49408,-1.16115 40.32289,-8.29021 88.20292,-21.08041 38.06271,-10.16769 53.52235,-12.9486 72.16203,-12.98063 12.34687,-0.0212 21.00728,1.45859 38.08012,6.50677 26.55738,7.85261 42.37024,15.73243 47.32646,23.58359 4.35799,6.90351 2.99259,11.17418 -6.96667,21.79024 -22.16311,23.62473 -35.89136,49.53278 -41.64942,78.60108 -1.55481,7.84908 -4.48559,13.96403 -7.70312,16.07225 -2.47646,1.62263 -2.92663,1.58198 -10.39371,-0.93857 C 475.81529,313.8563 443.7669,315.93243 406,327.649 c -13.7844,4.27638 -16.22813,5.45563 -21.72766,10.48487 -4.35542,3.98297 -6.96425,4.60142 -11.07016,2.6243 z M 398,284.95799 c 17.80245,-2.03609 42.47792,-6.08994 52.93506,-8.69651 12.22121,-3.04629 16.06415,-5.84129 21.52774,-15.6573 6.96724,-12.51751 10.4397,-24.22223 10.50207,-35.39963 0.0459,-8.23156 -1.78098,-10.12634 -12.57068,-13.03772 -18.18113,-4.90579 -43.40549,-1.87163 -73.88974,8.88797 -18.70405,6.60171 -23.24983,9.76661 -25.46044,17.72625 -1.33797,4.81755 -1.32367,21.90204 0.0253,30.21669 1.86382,11.48819 7.89746,18.59727 14.82735,17.47019 1.43185,-0.23288 6.87836,-0.91235 12.10336,-1.50994 z M 337.0964,160.74822 c -4.03254,-2.09414 -5.99957,-5.8658 -7.65747,-14.68271 -1.95213,-10.3817 -7.58234,-29.16217 -11.50854,-38.38862 -3.63337,-8.538295 -3.70601,-11.599548 -0.35004,-14.752576 2.52009,-2.367691 3.09816,-2.439833 24.75,-3.088745 24.71972,-0.740857 54.26648,-3.683061 74.66965,-7.435446 14.04913,-2.583801 17.11268,-3.299263 46,-10.74284 21.54148,-5.55073 44.18838,-10.137428 57.71096,-11.688261 13.33155,-1.528923 16.32668,-0.309645 20.77904,8.45889 2.83858,5.590314 3.01,6.595803 3.01,17.655461 0,17.681597 1.68629,16.262197 -38.57482,32.469727 -17.83385,7.17921 -39.38019,16.12169 -47.88076,19.87219 -19.74549,8.71183 -26.49289,11.23266 -36.46688,13.62402 -10.25709,2.45925 -18.10915,2.4301 -27.57754,-0.10238 -10.69039,-2.85932 -20.42746,-1.49287 -39.5,5.54321 -11.50683,4.245 -14.44424,4.7949 -17.4036,3.25808 z M 198.08099,147.92077 c -7.38045,-1.56358 -17.85589,-3.50154 -23.27876,-4.30657 -14.34891,-2.13011 -15.59982,-3.08445 -19.59617,-14.95025 -6.99243,-20.76162 -9.21734,-42.521914 -5.72043,-55.947465 3.35123,-12.866247 14.10669,-29.385827 21.68323,-33.303806 3.63646,-1.880487 10.23427,-1.789746 14.42392,0.198374 6.50545,3.087037 12.31161,12.244475 20.85282,32.888947 3.47653,8.402937 9.64416,18.27782 15.65064,25.057999 C 227.79769,103.99385 244,128.3106 244,130.43159 c 0,5.50999 -7.89654,15.6953 -14.5,18.70275 -5.65933,2.57745 -15.27834,2.20591 -31.41901,-1.21357 z" />
</g>
</svg>
Related
Script to copy all text from one file into template file
I'm extremely new to scripting (this will be the first I've ever written on my own), and I'm struggling... Essentially, a program I'm using outputs a multiple lists of atomic cartesian coordinates for a molecule, where each set of coordinates contains a slightly different geometry. I then want to run calculations on this molecule at each of these geometries in another program. To do this, I need to create input files containing these coordinates based on a template file, and am hoping to do this via a bash or zsh script. The first program outputs all geometries in a single file, of the form: 13 -15.02035015 C 3.0629012683 -0.1237662359 -0.0004161296 C 1.5725410176 -0.4599705612 -0.0010537192 H 3.6545324244 -1.0351015878 -0.0040975574 H 3.3232895577 0.4531937573 0.8855087768 H 3.3225341254 0.4598595336 -0.8822056347 N 0.6972014643 0.7054585380 0.0017284824 H 1.3274001069 -1.0545725774 0.8830977697 H 1.3271390154 -1.0504225891 -0.8878762403 H 0.8745667924 1.2800026498 -0.8166554074 H 0.8753847581 1.2767560879 0.8221982135 S -2.4024384670 -0.0657095889 -0.0009217321 H -2.1207044390 -1.3609141502 0.0227283569 H -1.0945221361 0.2739471520 0.0001162389 13 -15.02029090 C 3.0458878237 -0.1642767706 -0.0538270794 C 1.5490175255 -0.4572401536 0.0316764611 H 3.3628431459 0.4546044246 0.7845264240 H 3.2796163460 0.3602842378 -0.9790015411 H 3.6124852940 -1.0910645341 -0.0311065021 N 0.7057821467 0.7323073404 0.0100678359 H 1.3291157247 -0.9968212951 0.9565729700 H 1.2449884019 -1.0864558318 -0.8086148493 H 0.8643815373 1.2571851525 -0.8447936589 H 0.9361625337 1.3407384060 0.7900308086 S -2.3784808925 -0.1009812166 -0.0319557326 H -2.4637876581 -0.0476175701 1.2900767837 H -1.0744168237 0.2509451631 -0.0171658709 etc... essentially, one line where the number of atoms is written (always the same number within a file, but will depend on the molecule you are interested in [3 if I'm looking at water, H2O; 5 for methane, CH4; 4 for ammonia, NH3; etc.]), one comment line (in the case of this program, the energies are written there) and then the cartesian coordinates, followed directly by the next set of coordinates. In my test file, there are 49 sets of coordinates. The template file will look something like this: #Comment line, molecule number CONF_NUMBER # !B97M-D4 verytightscf verytightopt freq DefGrid3 NoRI Mass2016 UseSym %method functional mgga_xc_b97m_v end etc etc etc... * xyz 0 1 COORDINATES * So, ideally I would end up writing a script which would take the coordinates of each molecule from the coordinates file and generate an input file for every listed geometry based on the template, replacing the COORDINATES text in the template with the one of the geometries (and, if possible, to include a number in the first comment line, replacing CONF_NUMBER with a number matching the directory and file name): ~/c1/molecule-c1-name.inp: #Comment line, molecule number 1 # !B97M-D4 verytightscf verytightopt freq DefGrid3 NoRI Mass2016 UseSym %method functional mgga_xc_b97m_v end etc etc etc... * xyz 0 1 O 1.0 23.21 1.1 H 2.0 2.90 1.1 H 3.0 2.33 1.1 * ~/c2/molecule-c2-name.inp: #Comment line, molecule number 2 # !B97M-D4 verytightscf verytightopt freq DefGrid3 NoRI Mass2016 UseSym %method functional mgga_xc_b97m_v end etc etc etc... * xyz 0 1 O 2.0 23.21 1.1 H 3.0 2.70 1.43 H 2.0 2.33 1.1 * etc... So far, I've been able to break up the individual geometries into separate each geometry into individual coordinate files and even remove the two lines above each geometry (which are not needed). Unfortunately, I cannot find a way to copy the whole geometry into the template; I'm stuck in a position where only a single line from the coordinate file is copies over per input file. The code I've got so far is: #!/bin/zsh input_file=$1 #arguments while getopts t:j:p:s: flag do case "${flag}" in t) template_file=${OPTARG};; j) job_file=${OPTARG};; p) prefix=${OPTARG};; s) suffix=${OPTARG};; esac done #Determine number of atoms n_atoms=$(sed -n 1p $1) #Determine number of lines to separate splitlines=$(echo $n_atoms | awk '{print ($0+2)}') #determine number of conformers n_conformers=$(grep -c "$n_atoms" $1) #echo $splitlines #Split the coordinates into individual .xyz files split -dl $splitlines $1 coords #Rename coordinate files for file in coords* do sed -i -e 1,2d $file mv "$file" "$file.xyz" done rm *-e #Copy coordinates into template file n=1 while read file do sed -i "" "s/COORDINATES/"$file"/r" template.inp > ea.h2s-input${n}.inp ((n++)) done < coords00.xyz #first coordinate file produced In this example, coords00.xyz is the first of the separated coordinate files the script generates, template.inp is the template file, and ea.h2s-input${n}.inp is the name of the resulting input file (which I will later make customisable with arguments, hopefully). Bear in mind that, during testing, I've been trying to get the simple things working, so this script is only written to get the first geometry copied into the template file (hence why the files are named explicitly, rather than as variables - although I'm hoping to use the arguments at the beginning of the script to help name each resulting input file), but I can't even get that to work! Unfortunately, all other forum posts I've found only talk about copying small bits of text (a name, a word, one line of text) into templates - never multiple lines, let alone the entire contents of a file. I have tried everything I can think of to get this to work, and this script is as close as I have gotten, but I cannot figure out how to print all of the coordinate lines into the template. Any help would be greatly appreciated!
If you are open to using awk: awk -v tmpl="$(<src.tmpl)" 'BEGIN{cnt=1} \ NR==1 {n_atoms=$1} \ NF==1 {flag=1; close(out); out=sprintf("coords""%02d"".xyz", cnt)} \ {if(flag==0) {print $0 > out; coord_cnt++}} \ {if(coord_cnt==n_atoms){printf "*\n" > out; coord_cnt=0}}\ {if (NF==1 && $1!=n_atoms) { flag=0; \ printf "#Comment line, molecule number %s\n%s\n", cnt, tmpl > out; cnt+=1}}' src.txt template file contents should look like: (newlines escaped) # \ !B97M-D4 verytightscf verytightopt freq DefGrid3 NoRI Mass2016 UseSym \ %method \ functional mgga_xc_b97m_v \ end \ etc etc etc... \ \ * xyz 0 1 src.txt contents: 13 -15.02035015 C 3.0629012683 -0.1237662359 -0.0004161296 C 1.5725410176 -0.4599705612 -0.0010537192 H 3.6545324244 -1.0351015878 -0.0040975574 H 3.3232895577 0.4531937573 0.8855087768 H 3.3225341254 0.4598595336 -0.8822056347 N 0.6972014643 0.7054585380 0.0017284824 H 1.3274001069 -1.0545725774 0.8830977697 H 1.3271390154 -1.0504225891 -0.8878762403 H 0.8745667924 1.2800026498 -0.8166554074 H 0.8753847581 1.2767560879 0.8221982135 S -2.4024384670 -0.0657095889 -0.0009217321 H -2.1207044390 -1.3609141502 0.0227283569 H -1.0945221361 0.2739471520 0.0001162389 13 -15.02029090 C 3.0458878237 -0.1642767706 -0.0538270794 C 1.5490175255 -0.4572401536 0.0316764611 H 3.3628431459 0.4546044246 0.7845264240 H 3.2796163460 0.3602842378 -0.9790015411 H 3.6124852940 -1.0910645341 -0.0311065021 N 0.7057821467 0.7323073404 0.0100678359 H 1.3291157247 -0.9968212951 0.9565729700 H 1.2449884019 -1.0864558318 -0.8086148493 H 0.8643815373 1.2571851525 -0.8447936589 H 0.9361625337 1.3407384060 0.7900308086 S -2.3784808925 -0.1009812166 -0.0319557326 H -2.4637876581 -0.0476175701 1.2900767837 H -1.0744168237 0.2509451631 -0.0171658709 Output: (note output files numbering starts with '01') $ ls coords0* coords01.xyz coords02.xyz $ cat coords0* #Comment line, molecule number 1 # !B97M-D4 verytightscf verytightopt freq DefGrid3 NoRI Mass2016 UseSym %method functional mgga_xc_b97m_v end etc etc etc... * xyz 0 1 C 3.0629012683 -0.1237662359 -0.0004161296 C 1.5725410176 -0.4599705612 -0.0010537192 H 3.6545324244 -1.0351015878 -0.0040975574 H 3.3232895577 0.4531937573 0.8855087768 H 3.3225341254 0.4598595336 -0.8822056347 N 0.6972014643 0.7054585380 0.0017284824 H 1.3274001069 -1.0545725774 0.8830977697 H 1.3271390154 -1.0504225891 -0.8878762403 H 0.8745667924 1.2800026498 -0.8166554074 H 0.8753847581 1.2767560879 0.8221982135 S -2.4024384670 -0.0657095889 -0.0009217321 H -2.1207044390 -1.3609141502 0.0227283569 H -1.0945221361 0.2739471520 0.0001162389 * #Comment line, molecule number 2 # !B97M-D4 verytightscf verytightopt freq DefGrid3 NoRI Mass2016 UseSym %method functional mgga_xc_b97m_v end etc etc etc... * xyz 0 1 C 3.0458878237 -0.1642767706 -0.0538270794 C 1.5490175255 -0.4572401536 0.0316764611 H 3.3628431459 0.4546044246 0.7845264240 H 3.2796163460 0.3602842378 -0.9790015411 H 3.6124852940 -1.0910645341 -0.0311065021 N 0.7057821467 0.7323073404 0.0100678359 H 1.3291157247 -0.9968212951 0.9565729700 H 1.2449884019 -1.0864558318 -0.8086148493 H 0.8643815373 1.2571851525 -0.8447936589 H 0.9361625337 1.3407384060 0.7900308086 S -2.3784808925 -0.1009812166 -0.0319557326 H -2.4637876581 -0.0476175701 1.2900767837 H -1.0744168237 0.2509451631 -0.0171658709 *
The html file restored after deleting in windows looks different. How to restore the previous format?
I deleted my windows folder because of my inattention. I had important html files there that I didn't have time to push to the repository. So I ran popular software to restore files (like CCleaner or Disk Drill), but the file I care about the most always looks the same (as in the photo below, this is the appearance after its restoration). /#˙/s• ˙/ro˙Đ#„„9i·•#˙/uâđ/yTOŰńfő #qvsđls˙/˙} ń/.Ń5xppk zĐ8 qT xp 3p€z0}5»PVq Đ*‘‘37wĐbt 0Đ»~0U/-0 Nwp cmŇ-lń| P±d‹°t±3'đ EPundĐŽ™ ż0o3?l˙}±=?Ueµ??“í?lĐ“s·oµ?5 1 7p˝So0'ń4q5p5r8t5?Ů5˙´˙´ ]d2 5w5Ż5#˙5s5• 55peúođŁsđµ˙´˙´˙´:ď:s5u5ś|5˙´ń©îc2Ť˙´q)tp,ŃR˙´4t ˙4_¸˙4g ˙ő4ńa´‘1Ó;´Q6?1ý?1e5?1´?1?1_“?1?1»g?1cspż0AÓ#}´q0ń0Řp´ę9ô0˙0˙0˙0˙0á– { ´˙0˙ó0• ˙0˙0˙0P‹˙0±QźŐaffffc ű0}y´`´pM7_.^.oµ p _ k z f 8 q x p3 Hz g 5€ c - 0 SŘ ** € ř :h 0 dcQ#“× ŘP&ˇŁ& : 2 A 4 > â ' Y F —Č! łm ‚#q Éá" k <3 Ä ™ 9 ˛dF©: żc{Gé M i Ýr oD s€f t€tWQ€ n d€w€ -P S e€t‚ g€y n€;čÖ ŁH5W ekodt·$/ "D€0b u€µ€ë8p1÷ zH „ ¦S 7 E€Gp€r a€FiQ€n €Ot€r€e€X €Úo rU€p€ c€ça€)eE„t€- m€cck€‡x.€k€2Aa[Ŕ_‚,#Ĺ%O#eŁŔG%F l#g#Ň:Ŕ 4 AI#A9˘vBe T#uŔ©Á$d Á fŔl#Şe |i#eŔo#Z¶eŔZÁ4eŔGA'\ŔŞh#2lŔ\#oŔ ]Á4n#:ÁÉjsÄNh#KsŔH\Ŕi b Á CUAA.e .UŔpŔ2 Ân# P 2 9Ä˝sŔ…S+Á»Á˝h Ž;Ä˝?Î&$˙˝ { Ń˝żĎ˝EŐ˝E&˙˝` t &ľi 0˙^?h-h÷^ňŕ^"L mS PbCT ×!>ˇ]eas`s Aĺ`®f <˙^ď^tâeŕ>Şu`Icŕa e`J5aA_ w ˇcb Ę3 l8 Gb a!˘® `!…cow`[t Ş `Fx` 0j H¨ Nŕ w [c [!Xc+ â! l rD '` Eŕ.dŰ áws`ˇaFŕ aëˇaTcäu"áZcŻcec%aco``aŕ_·ˇ+'?%p˘m!xd˘?-ql1 7 6l 4B·#Sákál <äl~á˙l÷˙ËáĐńlżđË%ől%?˙lâ&˙ˤd–˙Ë- ×?Ő!Ő÷l¬ělC ±/}QYC%*ńW‘;Ń' Őp2a0"kĐ&g0 ×S]etUńł[pĐ[rÝhŃ%uf8˛4˙5ŞeĐ20˛?SPa0ÚF’.C”2Ó=6ź6k?2˙ceP.lp`‘a˙2q˙clóF?2“j?2?2ľlpÓ>_5Ń?2cPÚp0Bl°>sh6h2WŇnq1ń1čŔ=ô1Ęń˙1 ˙—12˙—˙—ű—‹ !Pś r˙ř—˙1ó—• ˙1˙—0ý˙1o°!rw&—u‡˙1'źś˙1źśc ű1ő Ľ“™ Ş pýCp _/12_/_/_/o_e[e˘P# ńqĺpP>uPU%˙†˛¶—{§P#~˙s• 0u÷±8¶ođ®»»S<űPu¶”pPő¶¶¶_¶¶q¶˙†˙†ep»yop†˙†·ŮŔF0MqsűrS·cp4··ż…·ďS·Ń”QˇtpV±L·ď14?y·1qdń/q0qâ?t0<Ď&000MpL2 ˙ć őć ý·#0s0• 00ď00Ň_·˙ćĐźëźS.0p0$µ ö L S P : T h e 8s y n c$e s i oQ D f r \pT a >k g bs t t - mT i 2r Ns f 2. v p 9Q i d Fo x5 .e Qs -Ys _ 8 w k {b 3 )8 b q- 0 s/?dU w 7t xE 0 - #N w c ›l lQ 1n g h nE _l€6r '€n ´ E€Ed€‰vF€U €#n€c€rĹ€u€p \€–é,\ wa‚}1 şe€pt„9…§… \€FŞo€’a€s€(t€Zi€#g€)Ľp‚(vë€xr€6l€>dŁę.€/p€» €1-ë€1 7 6 4€ü €8eh ** Ŕ#h„ Öá&“×€†Ř&€ˇŁ& € Ť ‚Ä Ŕ h Ŕ#Á D  # E –Ŕ F#Ă! #łÂ #E Éá"Ŕ<3 ÄH E& A #˛d F©:żc{Gjé€/M#JcÂLEť-¬ WŔÁyoŔ•s#„ SJZSĸ;čÖ ŁH5Wekodtw/ D#b u#™ë#8p1÷ = ¬ ° SÉŮC#*e#‘íAĚCŔuÁeŔkÁ‹ĂŮ{˙×ÁnŔ“Cîß×áS`aŕPF`r C‡ŕkˇ#|= 0 /m˙dd+_dĄidío-Ńqd6 2$dsábácĘđ€UAäc$â˙c˙c#aińcŹ ! l ţrčc%őc%˙c˙c ‚?e&˙c?m#;% ëcő༓™ #‰a‘"ţ •żĘĄżĘˇ_˝Ę…ŤWâÖá<á= ŠBä=DĽa'˙ˇ˙ˇ :ń=«đˇż%ő=%˙=˙=˙ ˙Pżý|źUźUŃ˙PőPđPëU!ŃuppSrňPu†…Úrđ ez‡a0V±z•‡o0OopŠt "eLQ‡y‡, «pSyO*ePap -“ FĐu±sň“4 ]ŃI‘`Ń{c Tu0‘drf°ęle#qi±yq_Ő1`oĐe0da°?†»?†=Nh°[Ń1†iđ“_1Ó3QO PO9[^ń0pń/q0Pp0Cńt0š<)0˛†° súń0#0s• 0ű2oR!ß+ß+Ń+0O0†YźOg {Ţűp0˙· !‘ ©0»0˙·.đŹ‘¦±¬t¶˙p·¶¶ß1ą¶¶qŻ¶WĹ?„?0eP2lP°ű¶¶cPŚ¶Ý2?„׶ű‰?„c:pPB“/}¶P#q4ueDô4RZ˙4¶ł¶˙4˙4{¶e ţ#˙4ó4• ˙4˙4˙4˙PZ¶±ĐU0˙4˙4˙4˙4Ľc eye¶ŃZeЬćo2$¶c ěěńdîwr[4˙ę0r^˙´˙´˙›ëż0ż0ż0?ç—ä˙´’g0µ t i n g s y pc p r o v i d e X\ lŃ <c a s DÄÄ. Šp b¶e 6 2 4 i ** Ř Eh Z)“ × Ř&ˇŁ& B ˘ ' : D F w ! E X rm #q p Éá"€5 < 3 ćL ˛d F©:żc{TGé cM€’c‚—sE€‘f€Ą- W€ n€ťo w€©- SŠ™S„˛;čÖ ŁH5Wekodt·$/ D€0b u€áő Ľ“™ • \ }Ťp€Ýc kU€g€s€Ra€eĐ - mŽ_.#-Az‚l# t _ 8Ŕ‚eŔy b 3#5Š8ŔbÂ- 0FµP€[ ÁsÁuđ#S2FÄudÓ˙u×u“ô! AgłČuEŐuE&ë˙uBHtB{g#yCĎ˙uEËuë8p1÷b #t € ÉE µŔťp#"r#wÁ"oŔđ* ŔťtŔrByd h f# rŔ‚k[ŕW1A, eO`e« bˇLi n€plŕĄaŚ:ŕ4 ˇI «!W!Ťc T u"VeŕLáf`l e]ŕi`‰ááeŕ‹oU e`^a` \`hŐ l`\ŕoŕ![»ˇšaeŕ ĺ4Ąśhŕű!aˇ›i`Zá#8çcńh2 9ä^yá\á]h Gä]DW.Ď˙˙ •ń ď]%˙ő]%˙]"'˙ŁĹe=˙]W?˘ă.÷]öŕ]L lSâ ⌠T ˇ=ˇ\#ő!e`#s`qă_˙]3źŞe Am Id aŕ Zx"hn`ăXs>˘ W ˇżaX ŕ¤i hQ`^0 xŕF0j Ń ° N Qw #ěVl áV `a`ydâ^r '` Eë"!ĘsfF ˇµ!Şn cŕ rŕ u `úp`Ŕs˘%c€ź]4ż‚ż‚ó"ß…Ó…?6 Ŕ 1 7 6Ô‚Uń5q6 Ht6\l6˙‚˙‚ 5[2 ˙‚đ„ó‚Ăe#˙6ó‚• 6˙‚6Ż˙‚q 6˙‚ođ]t°$_ź‡™O•6ue°|6CŐAeP$tĐ$C01$˙±WQ s6˙dź…•‘…˙5w±˙5‡w0‡qaS‹đ_±1F0 r C”2˝łŤ=6ź6?2˙ce6ölđ2ŃŻa’‘ń˙c3Gż?2“jß±?2?2?2o¸m?2 đ1ő´lq1ń1đŐŔIô1T˙1˙1˙1Ł˙1h Ź˙´#˙˙1ó1• ˙1˙1p˙1˙1ű˙1˙´opR˙1źąśű1=ů´tĐ—˙´÷‚˙´t Ý_/e`_/¶b°hU/y…¶p qńqÔJůôőí˙P˙˙˙˙č «˙P#˙ó˙• ˙˙˙ ˙˙˙}˙dĐ˙˙óÓy¶÷đPUS¶n0{ł¶QwQQ1iđV"‡dŻŮ"˙·ÁF°Ma2ţńSř·Tµ e v i c pT r u s t Xd : # f a l De F Śl \ oT n c r uQ „p \ Fh lU Z\ Šo *m bnT g6e ¦tsÄ y ‚c h ‚Öâ\ 3i b'Ša…. —p p ‰ l=e 2 9 0 S ** h Kh{1“ × Ř&ˇŁ& B ˘€ €€ ‚ U€ „€ # ! € ł,‚ #…8 Éá"€5<3 Ä …L ! €˛ dF©:żc{¨Gé _M€oc‚śŠs€‹f€~- W‚yŠd€w€Ż- S€°jt€i€źg€–; čÖŁH€5Wekodt·$¨/ D#bŔ€g€N€ë8p1÷ €B( ö SL#S şPÂ…T#oÁbĹr Ŕ'şeŔ s#,Á‡AŽo#3Ş ŔnaŔpkŔgŔGv- Á‡K<. wÂp#mDe xŤ#<e#<Ĺ_ 8 ‚kŔ‘b 3 dŔbŔŹÁ- 0 UŔn#eŔ # iŐŔh#0#0ŔÉ ¨ -#NBX Ŕ)ëA»CšgŔhŔ AÁ˝r 'Ŕ7 E#"~d#BI;˙ĆÍĆE×ÁĆoÝÄ%sŔ5GE^pÂŚAđŞdŔr#Ńl#3c#.Ăí_ql1 7 6Ä 4"Yo sákál LälĎ˙l˙láqńlĂďl%˙ől%˙lb&˙l˙l?v)źVS$ź÷l°ělC eŰ`9!˛Cŕ:á«eŕAáEĺălp c ˙k!Š˙k×a ýkáÂSbRn#˘ˇ|ZC aŕb#|=`lx˙` kmd˙Çă1%_ddGdŁjqd6 2$di«ábácđ€ÂMäc]˙c˙Đ€Ż ńcŹ !ń Ů rčĐ%őc%×˙c˙1ROoĐTsShînđ hQ…rP+ź6ź‘‚˙1qhőĽ“™´ { \C_e§P012_et _/eR˙_e_eYe˘P# rvqńĺń‡Nôd“˙P‡‡ p2 ‡ ę s‡«˙P#˙s‡˙• ˙‡_Đs_Y˙g˙Ś˙Pc ˙Pu‡WđPU!‘§pr˛imn0z…r!ó~fýprpQĄ""qL«‡Q8P‡b01e01X0 ,Pµ O*eWP41“ FP®aĐ°sőň“4ŇI…—Ń{˙·k˙·˙·e°ša°˙·a˙ň•ń±YUQ˙·•WšO POő·éů·Ot0xî6˙·˙·˛O˙·g0¸0w0’ BH¨| Yäpp ×ő·• 0˙0Đ#ßJ00˙·p“ĐßźĽTU#0u0ňp0˙·ßQ·3Ŕ˙·0ÓytźRP(îoŢs01v30“¸‘)e.µ"_p^w 5ŐĐ`102P7x0ŤÖy20ż·tp ·ż·ŃŤ3~ P…dP3~ep4ż·ŐŔ…‰1l˙±±h1ż·ż·ťż·źż·ó•5˙5 ą·ËôĄů·Pt6#6˙f˙fýf1µ# : FA 8ż! łh##6 “×’BH ¨| Yp ×<3 Ä PhVr l˛d F©:żc{ Gé M i c r o s f t - WQ n d w -P S e tg y n 3;čÖ ŁH5W ekodt7I/ D ab u g ë8p1÷ z ¬ L€8S P : C€Te a€F˘e€o l€ e€EEMo€J p€cÔ k€g€)s€- m€_‹t. w‚i3 2€e bÔ v€e€h€}"_€-w 5€,1 ‚h€t x y€+˘w€- 0‚IS€Şa€F€r€Jh€=Şn€de€ť=€x€Ş0ŠF€2l€" €Şn€c‚e€a€_Z\Ŕ h#Á6\BfaďÂ.ÁÁÉbsŔ!ÁbEj\ŔCoÂ#l#Q pKBÁ9dŔr o.UŔpŔ) ŔiŔ=euŔe6ŔF4ĄŔ#5 ** čU QDˇdD«€t Ř&ˇŁ& D { Ä D Ŕ Ŕc#Á  ŃÇ‹„ !# r€»Ŕ€ #EŐÇE& ˙Ç=IZSÄd˙Ç% ëcő Ľ“™ #% 0ő'ŕ a 2ż^á{ż^c˝^ă+ uá;á<ĺŕ=Rä<ŹŕŁ’˙<Ŕ?÷ ;˙<é §đ %ő<%˙˙<bc˙ ˇ^˙ ?Ş-Ş÷ ®”€fĄAˇ†pŕlrŕŚçž#ťr"Łd ľfbŠ˙ˇ)ż?C=C, µĺO Re *áŻi jn Ůl`g “aą4ş ˇI ˇż!’c ŞT u`t`dâ«ţf`Ł™˙¦˙¦c7ĺ¦ĺĽýˇ iŕżá«ŁŰă)ˇńť 2 9 0Â`c Wŕ|á_á`pŕ`Sä`ÂlwA˘ó˙` ˙ť ÍŔđPó€˙€0ó€• 0˙€đ0oýqsđ˙€˙€˙€ź…ź…·ł0ő€üp0ů€TPyŰńgő #qwsvó€ß0u0.(oŇr0)p ń hp€±zlp 1‚ 0±”eUđ” đi:hP20«[0P-0 N°jwp cr/l‘ [Q†dPwQ5' t Eđwdđ‘9_2oű05ß…l°Ń?ß…uIUoß…ß…“ß…lĐ“s=tĐ8ß6 Ŕ1 7 6 ó…ro+q6ń6(đ6Tô6Ä~B˙6˙…2†˙…˙…ű6Éýg#˙6ó6• ˙6˙6˙P˙6˙6‘ őU˙…źĽźĽŮźŠc ˙6ő6¶ü6˙·Ýq¬cR˙·Q)tP,QTÝ˙·t4ó·6e°c6{ź¸±şyIź¸ź¸70ýiiň41uź¸Ń`eó+ß±ąż2ź/ź/oÇź¸×ż2Vż2cpp°BSBŻ›¸9ń1q2ř#±Ut2ü 2¸ł¸22{2ú•¸#2s2• 2ż22ęS2ęop’ßiiÓM{2y¸z‚ɸß/Wˇ_feîµ r e p . c h x a °p _ hw 5 n 1 ¨2 t dy św y -( 0 k Ľg eř ** € Vh >ÓdB“× ŘP&ˇŁ& : 2 A 4 " ' ‚: F ż ! E sm #q’BH¨€| Yp ×<3 x‘™ O ˛dF©:ż c{Gé M i€}r o Šs€f€|- W€ (n d€w€ - ŞS€„t€i€Źg€y€c ;čÖ ŁH5Wekodt·$/ DA€0b u g ť… 桖©ˇ‚X źŔUB;Ń`z¸p °˙˙d A˙˙/€F€!€=€jD C€_l l€,c‚]o€ZI€j ř # AA A[D B u# t €l V€`hwLFt#‹eÜ mŔ#… :Â…Á‡Ę€"Wćś‹˙‡×‡±! AyłÇ‡ĂEŃ‡Ä E&˙‡;Ŕ?˙‡s#ÚSšË‡ë8°p1÷ŔpŔ[ž ŰŞSŔčnŔ° Ŕ{p#"ZrŔčtŔiÁ{ ŔŻtŔr#€eŔ~ fŃ# r ~a`äy5¤t - 9-b. uë>. p ?‰/‰,«`%O`eŕ‘aćS*FŕUa `s€ ´4 ˇI ácv`ęc T u"!€MŐ`aŕs`F`!^Őa!nŕc˘e káśZ\ h ˇb\ oµŕm n aeŕ«!'ás¤*h sŕÂ\ i b áăۡ!eb©á! bá# 2 9 ä¦ á`áa° Xyäa`ľ˙a˙ĄáŞńĄS˙đa%őĄ%˙ab'˙Ą˙ĄŢc? h2ĺF÷a#˙aŕ öa a]d`Qĺa7›?V'V8?V"[f Ol Qje€Űi Fe áueí`ro ?Vg"Q?V?V7Qń+iq*ń*ŘH Yô*Ŕż˙* > ˙}1+˙}Ác˙} őő}y˙*#˙*ó}• ×˙*˙}R<oBtPV˙}?yU&˙}ź‚źźc «˙*ő[fđ*C…ER!¶NP ńGf°Gł3 ň ő]| üX-0-qMqx_`‚n˛S Y NĐ} O P E R €A T I O0¨F LĐ GP=W˝mYqTQ2V °Lşx0 0: ßVż+eĐ-¶l°*–a˛eÓVcpZopYdP0óT\°lupjŐWegZ>e0?ů_X5 >7pˇ‰đśń,q-p Zt-˝dD«ź-˛«--{«‰ó- q‰• --űđXođ!ß„-«2Ź°°-u- P%ęS0%PŇ'Tr˘Ńłő‘ es°sŠ‰pĆoŃ‹Q(‰tpw}‰curUl#gĐŐ~_Îhűz]Î °qż“’±ńëż/Q0 pD Đ3±13«u Đa+d0.ęeĐ\' P7±žęsđ inß_PQ•ęupp/sr˙Šß_÷3ŹńŠo5•‘÷©•Rp o Q•dprĐŃ7±”7 ´ 1đ66pD7oq6•ń60đ6[ô6űy˙6ëdâ đß2 dwdúÍd#˙6ó6• ˙6˙6đ˙6˙61N˙6˙6ożi°!çS3˙6ő6şpdZLĐ6SĐ]ńZC°e0$‘3|චo n p# a c k Pg# e s t HtA H- m i dr śs f d. wQ Ln d <w ¬.Q >a l i –g- "h ra ®p "_ >w 5 61 h 2 ‚x y B‚w - 0 : "SCn F Sr ZC 'aK‹= #xU 0 F l E 1n c9e u‘ ąp \…\ ˝˘aÉn ge …VtĹWy€5c€#oU€e€l€%c€#l«€"‘p‚(v€d€<Vr°™p€Ž „šee€6€Ť4 Ş- S0 ** ř \h € LzD“ × Ř&ˇŁ& B€ ˘€ €€ ‚ U€ €_Ŕ€^ ™ !# r, #E’B H¨| YpŔ×<3 DÄG& €˛dF©€:żc{Gé€1MŔJcBME‘- WoŔG‘Ŕ;ŔRtŔeC‘S#‡nŔd;čÖ ŁH5Wekodtw/ D# b#g€NőĽ“™ €J ~DöŔcÁlB5oÁÂN W#ĄÁ{Á} N]Ä}â†ô˙}×}µ! ˇ7ţłč>%ő>%˙>˙>¨q˙>?H+Hë>ë8p1÷ > ˘€hëĺ ápŕCrŕ~!ă˘#ˇrŕeŕť fO˘Ś˙Ą˙Ą˙Ąn óĄ,«`…ĄO`Veŕ+a ęi`nŔxl áOáŞt4 ˇIŕa_!–cµ`T u`!ĽdâŻ~f`Łť˙ŞĄ»˙ŞăŞh«ŕá(\bťb Ąsd{Ł+ˇńˇ2 9 0_Âbˇ¶ áaáb ŕb^ńäbwE˙ˇ˙ˇ žńˇćżŕbŔ« ±čb%ńbpx %˙b 0oĺ 0o Jt ˙ˇŁ)˙ˇ·? # ÷b¬p1ń/e6q«_ußcđoĐUd0 m\đ±tu°35eżr}:‘v?ůU!(0€4 7 6 )Đ#VS,bHT&.Đx0 !°#701FĐ 1 3 4 8 `B E Ađ ń1(» ł‹eĐ30đşFp7U±D¨ Rđtr°jHp(P)P9qCdŞ Ń dđ8˛8rŞ4P FpŤDP 4 şC27lP±Q0xP<h: [0A méđ=t Ő>AĐ 1q<jt04] 2px–hq1ő1_ô1ů˙1k˙‚˙‚ 12 ˙‚9ö‚Ăc˙1 ˙ń1• ˙1˙‚2˙1ô‘RçńôAĐc ˙1ý«˙1Ż%‘‡˙1uc°đ1CPÚE˛SNP Qf“gÚ poĐ0ń©c“Y¨ b°"oĐłsVrP2»Ą-P2oPŞau„sđ%gĐŞÓ¸-Ż’q!‘'Ń-x0"-Q6rRlnR S Y N°&O Pđ/‚R0T I O0¨F LĐ Gđ=đ1_łq'ѱQ1 đ+xWP.Ń1±,fdđ1iďP±«ßB?¸ođ.ŃÄŃ}źAcP/ß#ßBFßBp×013q 2pÇ70 B2Aő1p `ô1dĽ˘F˙c˙´2µ˙´0µó˙1÷1˙1˙1ó´ż• ˙1˙1˙12$˙1gĐ˙3Y˙1˙1źą™*ŐH˙1ő1jüđ1LS°&Ń#T×đÜŃ5` ˛/sP •1Ż•č} čc&pđ6Úup6eP1kR1?č˝;č P±ČSžńít0×S/au °z p3‘<[Ń2ąď P‘ëdr1rô '0 đ6±QF7˙–ÓçźvźvńCpUđyq–o ±˙ë3 řë¶ e r \ l# o c a ps t t i n# g s y cD p ”o v TdŐÄ. ´p T ÄR e 1 7 P6 4 c.p ** ( ah0l˝F “× Ř&ˇŁ& B Ť ' : F ÉČ! łm #q’BH¨| Yp × <3 Ä …L €˛dF©:#żc{Gé _MU€|c‚s€”f€Ź-D W€ n d€wQ€“- SŠśS„ś; čÖŁH€5Wekodt·$/ D€0b u€Ë ë8p1÷˘ z ¶ ¦L€?S P ‡ C€TŞe€ćt€C€Ol€ĆVe€Řęo€ç €ÜaU€k€gŔsŔ3aAŔ e - mN:.¬ wJ:Á~a#t#"*r#pBk#r "_#w 5Ŕ1 ¨h 2ŔxŔAe#ŞyŔ0B'SŔa#jF#&rŔ*h#!ÁšeA#Q= 0 xŔ 0UĘ F#lŔ #nµŔcBeŔÁ!\Ŕ Öh#A9\ÂhaB1ÁýÁe#!ÍłEoľ˙ĘÁĘľ6ŔFCĘŔ\ÁÇÁÉř bÄÉĹ˙ÉŘÉ• !ń#Ű rČÉ%őd%˙˙db0˙d#Ś˙d? + ëd€őĽ“™ #Š¨ z eŔp NÜc ż_á|ż_iŕYż_Î- Z ‹G <3á=á> cä>3ŢG˙Ł˙Ł ;ńŁżŕŁŔś ±č>%ń>x'˙>˙>(q˙>˙>ů>飬·ŕŁáža o ?‡g`âµaŘo`Śdŕ‹Łŕ\ =!ĺu ľ%ăe ™gŕ“Çá’ýĄć( 1ŕäˇĺ¶)ŕóĆH`śá˛. ›Zx` !ŕGŁ˘7#ÝF`í1 3 8 B E Aŕ: Ü ( ˇřˇĄr˘%©QŻ4 8 Ę)PR#đÓ\n Hđ( ¬9 qQSd01đV7Đ18r4P FŐ°[DĐ 4 CP51XUgne\t0[Ő0A’epYp µ®AĐ 1q…tpb]f 2py hq1ń1 dô1=˙1k˙˙ 12 ˙ú ő±đ1Q€ů˙1źó• ˙1˙2o ˙vsĐq nđ˙ńFrűź0opvźŐ˙ő®žđ1U1vpđ rĐW±ó‚‚r°ep wq4„tR„źTs6 „źTn2„0 Ö,"O°eP+Śęipnđ1lpŃ«11ş4ŇIP<ń“±&cđ ZTu01’d’2fŐ0leđi“˙†ż˙†‘˙†‘ń‡UBhňęt0l°Bbp •“WQŐA9µ2801t¬ .q0ń0đ0eô0|Žž˙0˙0˙0˙0˙b4 »˙0#˙0 ßńb• ˙0˙0Ro˙0P˙˙´3X˙0˙0źą9 u#˙0Uő0¨đ0Cđ´Er!N[P ńfJg p9o"QVc01S' b[0%38e ťÔ-pak0Ô‘3i’4uP'-[ňc1 rĐd± -*x×p-Ńf1¶rđ.o~.Ń- S Y NXO°żE R`T I ˘O0F LĐ Gp¶=pb3m2e˛ ¬ ń¶7]f d˙/ëQu2p˛+˙¶“ýpcđźt_s›vů1Ş Đł5o5’1lń0q1xp1ft1'›Kż”ć˛ććA˘bvbüć1sb• 1˙1đߏß]FŐ,111e¶ t i n g S y pc / D e b u ë8p1÷ L śS P : T h± ¤ sre s i o – f r Rp a ¨c k g bs ć‚a e - m +¨c r 's f . w n d Şw M. 9l u e x p Ar !*ee o %t ˘_ 'w 5 1 Ş2 Ix —e My gÖ0 …1d =d c˘t ' 0€)0€E‰ € N‚# ±€+a l€ “ €Şa€2d€e€\'€>¨ E‚S€.s€UF€Rl€ €#nU€c€r€u€p\ \€ź,\‚€aׂ†Ĺ e€`t€ «…°… \€=o„Ks€(k‡â…p‚(v€xrë€6ˇc€<l€;‘-MµÁ]p#[ ŔA>e#M€1 7 6 4Ŕ‚ lx ** 8Ŕgh K˛K“ × Ř&ˇŁ& " ‘ Ä ” Ŕ#Á  # šŔ FA#Ő! #ł, #E’B H¨| YpŔ×<3 Ä E& A # ˛d F©:żc{4Gé€/MŔIKˇ- vWŔGˇ-Ŕ˝IMEË; čÖŁH€5Wekodtw©×ÝÂËÝCŔve#rÚt#~CŔ”Ae#A‹;ĂÝ˙Űoŕ!G˙mn «óm!„SbTn€7o`ćC$gc€= 1off?ătfkf=qf6 Š2$f8`‘e káeÓáfŔ` häfś˙f˙föfˇ ! o rčf%őf%˙f ;!°oí ˝tŕ¦˙fn B˙f?pńŐőĽ“™ éa+ †"`żĎżĎżaąĎ€ŽB ˇ$ ˘á? Ĺ Źiä?h.L˙¦€—a§˙¦! :€ ă¦ćÁঀ ±č?%˙Ŕ x • ˙S0Hő_1q_†˙iP!y€źź‘$SőŠ®ŻpSńP±QńGe0MaĐ »źw™wc˛uцD\ ×5±„gbe°u?«ůUA(R4t)0‹ßŃH˛t .°]Zx0 !PR“‰7PTFĐ1 3đD8 Bm0‡Ađ qV( 3ŠeŹĐ8ŐŚ_4 8ž ) Rđt0šr°‹Hpń 0 ‘©qNd ń d82Š8’4P F Cv 3 C°h1h±hn«P‹Qšt€{[PARŚÚeŤp UsAđ 1Őń‰tPš]° ő1q1ĺő1jô1±3˙1…ł…˙1°……v…˝đ1˙}…˙1s…• ˙1˙1˙1˙Ö…SM˙1˙1źVŠ˙Ľý÷ĽŞđ11Ş“µ‘ąő»µ“şre˙Ľa0Âýżt Ń˙Ľ‘,˙ĽŐ4o˙Ľ˙Ľ˙…óĽ,0#ŐOGP=‘/·F l0 g´ sp( đ2ŃIĐ «±ÍQ'c°/T0/u0ő‘drf0ó±Dúe0l0.QKż»ń-ą»öh”=±»iđŐQHł÷Đő˙ Đ907Á1tžő1 kô1P×˙1˙1˙1 p2 ˙1ő÷1µ˙1#˙1óc• ˙˙1˙1˙1˙1˛VWę˙1˙1Ż˙1˙1˙1÷1˘đ1CpżîE˛!Ńŕ1fđJ¦‘áÖo2 Ű·bp%o°ž‘ŮVrđ%Ys’f0ií+ađ°qĽd0q(ű±Xń-đ)±·‘21ăQôFo^.‘^S YęC O PaR AUpůIĐ NđbLĐ Gí=0Ó m01é±Đňµ 0 x 8 P0 4 Pf c d F i lD e čo n c o r u a p \ s hU 4l Ś\ .o *mQ bn g 6c *oD u Šs y zcU&e 2gfe.Ő “p w Yi 7— 2 5 7 a we s # ** lh ´®M “× Ř&ˇŁ& ! € €F€ ‚D € :€ ‘ Á!a€ ±6 #…8’BH¨| Yp€×<€3 x …LH ‚' ˛ dF©:żcP{Gé _M€Śc‚¬s€Ľf t -T W‚–d€w€ż-´ S€Ŕt€g€µ;čÖŁ H5Wekod˘t·$/ D#b#rg€Në8p1÷â ? ® S˙…˙…Ĺ…( 1Ŕ®7 6¬ )Ŕ’ÓEHŔMs#KŠ.Ŕ4xŔ ! 0D Š7€rFŔ’1 3#€8 B E AŔj:#ż(#ža#ťÁÂrŻ€~AËĂ O 4#ŃD# ¨ RŔtŔMrŔŞVH#qÁ'1BtŔpdj Ád#8ÂÇŢF´ CŔ\ ŔĂ CŔŐUÁŘCŔ.nŔ.e#ętU#![#9AŔtŔmµŔĹtFAŔ+ÁvŔęt#ß]Ŕ ‚™ŔćÁĹ‹ÁÇÁÉmÄÇŁ4N˙c·˙c`ińcąŕcˇ\łčc˙%őc%˙c˙cb$˙c?mVe0 ÷c¦ŕcC`2Em"FN 7a2fŕ1c U 4o¤Jc iâ; ¬ b"ˇ{e s˘H+!áŞs €fŕr jm u žgŕ!Z-Ż`=ŁCáM!- xŕBVlâa p r J! ˇwá[S Y ˘N NO P ^Rŕ^ T I O`F ęL G = b#aM˙!aáNˇˇaÇÇÇëÉ'Ç!&a-e }Çr ‚oĺĆ€ näb<ăĺ˙b˙ĆáËńb#ś! íb%ńbÄ'Ż˙b˘H˙ĆcQSP)nđ(ťciPĐĐ&o hń(źV‘1ucUP%S0%P’1TR„ łk‘ p|đ 1/ µ°,aĐkĐ+U/ap3e01±#c. wż1•r ń.Q+q2dp0Şlvň0yđ4apZQ3„r _pwp…nQ0eh 2PxeU0yĐ1 pnŐĐŤe0 ˛tpł0«5eu 0 Đ4op714łd“ P‘d uÓe'p P8±‘s×vßßePlpa~a0 3‘šąK™59\˝Poq ýF3p˛[ńdqrQEcl{đ żc°18 k°Ńz4’irq7qi#Ĺđ7oô7Ű+Oi›Ű˛››°››pťs›śÝ˙7˙7 ń7˙• ˙7›ĐV˙71 _3˙7ý›o˙7° ˙7ő7jĘpiLĐ7SĐ^ń[C˝°e‘11†±†eĐ ëb7tÔ-&7Q'»7ńZt3771p1Ő75CS˛*n›0ćC43A= ‘Ě8ż3˙ż3ż3ńcż3óż3ź0“żż3ż3s:u9ż3 P®>2yˇ3Ô7q3ń3Č pô3",˙3ĎuĎ ś2 ˙3÷3©Ä !0 rxť˙˙3ó3• ˙3˙3˙3Đ#˙3Q˙3˙3˙3ÔÔű3#őĽ“™ bŢŽËĐϡEpP0c ßh_1Ntđ‡ßhßhi ßheĐ9ßhÝh"T# 2+ńq pTqt j‰ y </td> <td>Vertical gap between items</td> </tr> <tr> <td>caption</td> <td> 'pushTop' <br>'pushDown' <br>'revealBottom' <br>'revealTop' <br>'revealLeft' <br>'moveRight' <br>'overlayBottom' <br>'overlayBottomPush' <br>'overlayBottomReveal' <br>'overlayBottomAlong' <br>'overlayRightAlong' <br>'minimal' <br>'fadeIn' <br>'zoom' <br>'opacity' </td> <td>'pushTop'</td> <td>Caption - the overlay that is shown when you put the mouse over an item. <br>NOTE: If you don't want to have captions set this option to an empty string (e.g. caption: '')</td> </tr> <tr> <td>displayType</td> <td> 'default' <br>'bottomToTop' <br>'fadeIn' <br>'fadeInToTop' <br>'sequentially' </td> <td>'fadeIn'</td> <td> The plugin will display his content based on the following values. <br>- default (the content will be displayed without any animation) <br>- fadeIn (e.g. lazyLoading) (the plugin will fully preload the images before displaying the items with a fadeIn effect) <br>- fadeInToTop - fadeInToTop (the plugin will fully preload the images before displaying the items with a fadeIn effect from bottom to top) <br>- sequentially (the plugin will fully preload the images before displaying the items with a sequentially effect) <br>- bottomToTop (the plugin will fully preload the images before displaying the items with an animation from bottom to top) </td> </tr> <tr> <td>displayTypeSpeed</td> <td>only integers, values in ms (e.g. 200, 300, 500)</td> <td>400</td> <td>Defines the speed of displaying the items (when <i>displayType: 'default'</i> this option will have no effect)</td> </tr> <tr> <td> lightboxDelegate </td> <td>strings that represent the elements in the document (DOM selector)</td> <td>'.cbp-lightbox'</td> <td>Define any clickable elements you wish to use to trigger lightbox popup on click. </td> </tr> <tr> <td> lightboxGallery </td> <td>true or false</td> <td>true</td> <td>Enable / disable gallery mode for lightbox popup</td> </tr> <tr> <td> lightboxTitleSrc </td> <td>HTML atributte</td> <td>'data-title'</td> <td>Attribute of the delegate item that contains caption for lightbox</td> </tr> <tr> <td> <span style="color: #D66767">lightboxShowCounter</span> </td> <td>-</td> <td>-</td> <td>This options is deprecated. Please use lightboxCounter option instead</td> </tr> <tr> <td> lightboxCounter </td> <td>HTML markup code</td> <td> '<div class="cbp-popup-lightbox-counter">{{current}} of {{total}}</div>' </td> <td> Markup of the lightbox counter. To hide the counter for lightbox put this option to an empty string (e.g. '') </td> </tr> <tr> <td> singlePageDelegate </td> <td>strings that represent the elements in the document (DOM selector)</td> <td>'.cbp-singlePage'</td> <td>Define any clickable elements you wish to use to trigger singlePage popup on click. </td> </tr> <tr> <td> singlePageDeeplinking </td> <td>true or false</td> <td>true</td> <td>Enable / disable the deeplinking feature for singlePage popup</td> </tr> <tr> <td> singlePageStickyNavigation </td> <td>true or false</td> <td>true</td> <td>Enable / disable the sticky navigation for singlePage popup</td> </tr> <tr> <td> <span style="color: #D66767">singlePageShowCounter</span> </td> <td>-</td> <td>-</td> <td>This options is deprecated. Please use singlePageCounter option instead</td> </tr> <tr> <td> singlePageCounter </td> <td>HTML markup code</td> <td> '<div class="cbp-popup-singlePage-counter">{{current}} of {{total}}</div>' </td> <td> Markup of the singlePage counter. To hide the counter for singlePage put this option to an empty string (e.g. '') </td> </tr> <tr> <td> singlePageAnimation </td> <td> 'left' <br>'fade' <br>'right' </td> <td> 'left' </td> <td> Defines which animation to use when singlePage appear </td> </tr> <tr> <td> singlePageCallback </td> <td> function(url, element) { <br> // to update singlePage content use the following method: this.updateSinglePage(yourContent)<br> } </td> <td>null</td> <td>Use this callback to update singlePage content. The callback will trigger after the singlePage popup is open. (#param url = the href attribute of the item clicked, #param element = the item clicked)</td> <li class="page-item"><a class="page-link" href="javascript: void(0);">7</a></li> <li class="page-item"><a class="page-link" href="javascript: void(0);">8</a></li> <li class="page-item"><a class="page-link" href="javascript: void(0);">9</a></li> <li class="page-item"><a class="page-link" href="javascript: void(0);">...</a></li> <li class="page-item"><a class="page-link" href="javascript: void(0);">394</a></li> <li class="page-item"> <a class="page-link" href="javascript: void(0);" aria-label="Next"> <span aria-hidden="true">»</span> <span class="sr-only">Next</span> </a> </li> </ul> </nav> </div> </div> </div> <!-- container --> </div> <!-- content --> <!-- Footer Start --> <footer class="footer"> <div class="container-fluid"> <div class="row"> <div class="col-md-6"> <script> document.write(new Date().getFullYear()) </script> © Konektia - Wszystkie prawa zastrzeĹĽone. </div> <div class="col-md-6"> <div class="text-md-right footer-links d-none d-md-block"> Wsparcie techniczne Wyloguj </div> </div> </div> </div> </footer> <!-- end Footer --> </div> <!-- ============================================================== --> <!-- End Page content --> <!-- ============================================================== --> </div> <!-- End --> <div class="rightbar-overlay"></div> <!-- /Right-bar --> <!-- bundle --> <script src="{% static 'assets/js/vendor.min.js' %}"></script> <script src="{% static 'assets/js/app.min.js' %}"></script> </body> </html> Is there any way to restore the file in classic form or change these unusual characters to correct HTML code? I tried to change the UTF encoding but to no avail (I use Windows 10). How can I restore a deleted file in the correct form or change the html file restored to the correct form?
So I ran popular software to restore files (like CCleaner or Disk Drill), but the file I care about the most always looks the same (as in the photo below, this is the appearance after its restoration). According to me you didn't permanently delete the file right? cause whenever a file is deleted it goes to the recycle bin...you could've easily restored it from there, but now there is no reason crying on spilt milk. I think this should work as I have never seen this error...ping me if this works or not! right click on the file, go to properties and then click on previous version and then if there is a previous version then jump in the air and yell hooray! This link might help you! That's all I have, welcome.
RPGLE End Field Name with an Ascending Variable
I have a simple question that involves numbering the end of field names with a numeric variable. Exp: FIELD,X = FIELD01, FIELD,X = FIELD02, ETC.... Z-ADD 1 X 2.0 DOU X = 10 FIELD,X IFEQ *BLANK MOVE FIELDREAD FIELD,X ENDIF ADD 1 X ENDDO I could do this in RPG but I'm not sure how to do this in RPGLE. When I try to I get this error: Entry contains data that is not valid; only valid data is used. Thanks!!
The syntax for array indexes in RPGLE is ARR(X). FIELD(X) IFEQ *BLANK If you're not sure about the syntax for RPGLE, try writing a little bit of code in RPG, and then use CVTRPGSRC to convert it to RPGLE.
fSomeFile if e k disk D ArMax c 10 D Key1 S like(KeyField) D Field S dim(ArMax) like(FieldRead) Exsr $Sample1; *inlr = *on; return; Begsr $Sample1; c z-add 1 X 3 0 setll (key1) SomeFile dou x = 10; if Field(x) = *blank; reade (key1) SomeFile; if %found(SomeFile); Field(x) = FieldRead; endif; endif; X = X +1; enddo; Endsr;
Add one column from one file to the end of multiple files
I want to put one column from one file, the column 7, (i.e motherfile) to the end column of many files (i.e child1.c, chil2.c child3.c and so on) motherfile 38 WAT1 1 TIP3 OH2 OT -0.834000 15.9994 0 39 WAT1 1 TIP3 H1 HT 0.417000 1.0080 0 40 WAT1 1 TIP3 H2 HT 0.417000 1.0080 0 41 WAT1 2 TIP3 OH2 OT -0.834000 15.9994 0 42 WAT1 2 TIP3 H1 HT 0.417000 1.0080 0 child1.c O -5.689000 -0.628000 -10.423000 H -6.663000 -0.744000 -10.224000 H -5.166000 -1.340000 -9.957000 O 11.405000 3.612000 1.674000 H 11.331000 4.609000 1.663000 child2.c O -4.689000 -0.628000 -10.423000 H -5.663000 -0.744000 -10.224000 H -6.166000 -1.340000 -9.957000 O 1.4405000 3.612000 1.674000 H 14.331000 4.609000 1.663000 and so on ... I tried to use awk '{f1 = $0; getline<"motherfile"; print f1, $7}' < child1.c > newchild1.c but this only function to add a column to one file , and I want to put the column to many files. Note the newchild.c need to be like this one. O -5.689000 -0.628000 -10.423000 -0.834000 H -6.663000 -0.744000 -10.224000 0.417000 H -5.166000 -1.340000 -9.957000 0.417000 O 11.405000 3.612000 1.674000 -0.834000 H 11.331000 4.609000 1.663000 0.417000
In awk print statements can be redirected to a file using > or >>. The following example will read column 7 of the motherfile into memory, and write to a new file, pretended with the string new, including the saved column. awk 'NR==FNR{a[FNR]=$7;next}{print$0,a[FNR]>"new"FILENAME}' motherfile child1.c child2.c ...
Random Generator follows special rule
I am creating a random number from a special rule. That rule is defined as: The random number generator Rand[X, i, m] in range 0 to 255 that is defined as follows, where X is a non-negative integer, i is a non-negative integer, and m is a positive integer and the value produced is an integer between 0 and m-1. Let V0 and V1 be arrays of 256 entries each, where each entry is a 4-byte unsigned integer Rand[X, i, m] = (V0[(X + i) % 256] ^ V1[(floor(X/256)+ i) % 256]) % m With V0={251291136, 3952231631, 3370958628, 4070167936, 123631495, 3351110283, 3218676425, 2011642291, 774603218,...} V1={807385413, 2043073223, 3336749796, 1302105833, 2278607931, 541015020, 1684564270, 372709334, 3508252125,...} Now given X,i,m, I want to create a matlab function to make a random number. However, my problem is that, V0[(X + i) % 256] and V1[(floor(X/256)+ i) % 256] will return a huge number, so V0[(X + i) % 256] ^ V1[(floor(X/256)+ i) % 256] is possible to implement. Note that, random number will return a value in range 0 to 255. I have no idea to implement that problem. Could you suggest to me some way to do it. This is my matlab code function r=RD( X, i, m) V0=[251291136, 3952231631, 3370958628, 4070167936, 123631495, 3351110283, 3218676425, 2011642291, 774603218, 2402805061, 1004366930, 1843948209, 428891132, 3746331984, 1591258008, 3067016507, 1433388735, 504005498, 2032657933, 3419319784, 2805686246, 3102436986, 3808671154, 2501582075, 3978944421, 246043949, 4016898363, 649743608, 1974987508, 2651273766, 2357956801, 689605112, 715807172, 2722736134, 191939188, 3535520147, 3277019569, 1470435941, 3763101702, 3232409631, 122701163, 3920852693, 782246947, 372121310, 2995604341, 2045698575, 2332962102, 4005368743, 218596347, 3415381967, 4207612806, 861117671, 3676575285, 2581671944, 3312220480, 681232419, 307306866, 4112503940, 1158111502, 709227802, 2724140433, 4201101115, 4215970289, 4048876515, 3031661061, 1909085522, 510985033, 1361682810, 129243379, 3142379587, 2569842483, 3033268270, 1658118006, 932109358, 1982290045, 2983082771, 3007670818, 3448104768, 683749698, 778296777, 1399125101, 1939403708, 1692176003, 3868299200, 1422476658, 593093658, 1878973865, 2526292949, 1591602827, 3986158854, 3964389521, 2695031039, 1942050155, 424618399, 1347204291, 2669179716, 2434425874, 2540801947, 1384069776, 4123580443, 1523670218, 2708475297, 1046771089, 2229796016, 1255426612, 4213663089, 1521339547, 3041843489, 420130494, 10677091, 515623176, 3457502702, 2115821274, 2720124766, 3242576090, 854310108, 425973987, 325832382, 1796851292, 2462744411, 1976681690, 1408671665, 1228817808, 3917210003, 263976645, 2593736473, 2471651269, 4291353919, 650792940, 1191583883, 3046561335, 2466530435, 2545983082, 969168436, 2019348792, 2268075521, 1169345068, 3250240009, 3963499681, 2560755113, 911182396, 760842409, 3569308693, 2687243553, 381854665, 2613828404, 2761078866, 1456668111, 883760091, 3294951678, 1604598575, 1985308198, 1014570543, 2724959607, 3062518035, 3115293053, 138853680, 4160398285, 3322241130, 2068983570, 2247491078, 3669524410, 1575146607, 828029864, 3732001371, 3422026452, 3370954177, 4006626915, 543812220, 1243116171, 3928372514, 2791443445, 4081325272, 2280435605, 885616073, 616452097, 3188863436, 2780382310, 2340014831, 1208439576, 258356309, 3837963200, 2075009450, 3214181212, 3303882142, 880813252, 1355575717, 207231484, 2420803184, 358923368, 1617557768, 3272161958, 1771154147, 2842106362, 1751209208, 1421030790, 658316681, 194065839, 3241510581, 38625260, 301875395, 4176141739, 297312930, 2137802113, 1502984205, 3669376622, 3728477036, 234652930, 2213589897, 2734638932, 1129721478, 3187422815, 2859178611, 3284308411, 3819792700, 3557526733, 451874476, 1740576081, 3592838701, 1709429513, 3702918379, 3533351328, 1641660745, 179350258, 2380520112, 3936163904, 3685256204, 3156252216, 1854258901, 2861641019, 3176611298, 834787554, 331353807, 517858103, 3010168884, 4012642001, 2217188075, 3756943137, 3077882590, 2054995199, 3081443129, 3895398812, 1141097543, 2376261053, 2626898255, 2554703076, 401233789, 1460049922, 678083952, 1064990737, 940909784, 1673396780, 528881783, 1712547446, 3629685652, 1358307511]; V1=[807385413, 2043073223, 3336749796, 1302105833, 2278607931, 541015020, 1684564270, 372709334, 3508252125, 1768346005, 1270451292, 2603029534, 2049387273, 3891424859, 2152948345, 4114760273, 915180310, 3754787998, 700503826, 2131559305, 1308908630, 224437350, 4065424007, 3638665944, 1679385496, 3431345226, 1779595665, 3068494238, 1424062773, 1033448464, 4050396853, 3302235057, 420600373, 2868446243, 311689386, 259047959, 4057180909, 1575367248, 4151214153, 110249784, 3006865921, 4293710613, 3501256572, 998007483, 499288295, 1205710710, 2997199489, 640417429, 3044194711, 486690751, 2686640734, 2394526209, 2521660077, 49993987, 3843885867, 4201106668, 415906198, 19296841, 2402488407, 2137119134, 1744097284, 579965637, 2037662632, 852173610, 2681403713, 1047144830, 2982173936, 910285038, 4187576520, 2589870048, 989448887, 3292758024, 506322719, 176010738, 1865471968, 2619324712, 564829442, 1996870325, 339697593, 4071072948, 3618966336, 2111320126, 1093955153, 957978696, 892010560, 1854601078, 1873407527, 2498544695, 2694156259, 1927339682, 1650555729, 183933047, 3061444337, 2067387204, 228962564, 3904109414, 1595995433, 1780701372, 2463145963, 307281463, 3237929991, 3852995239, 2398693510, 3754138664, 522074127, 146352474, 4104915256, 3029415884, 3545667983, 332038910, 976628269, 3123492423, 3041418372, 2258059298, 2139377204, 3243642973, 3226247917, 3674004636, 2698992189, 3453843574, 1963216666, 3509855005, 2358481858, 747331248, 1957348676, 1097574450, 2435697214, 3870972145, 1888833893, 2914085525, 4161315584, 1273113343, 3269644828, 3681293816, 412536684, 1156034077, 3823026442, 1066971017, 3598330293, 1979273937, 2079029895, 1195045909, 1071986421, 2712821515, 3377754595, 2184151095, 750918864, 2585729879, 4249895712, 1832579367, 1192240192, 946734366, 31230688, 3174399083, 3549375728, 1642430184, 1904857554, 861877404, 3277825584, 4267074718, 3122860549, 666423581, 644189126, 226475395, 307789415, 1196105631, 3191691839, 782852669, 1608507813, 1847685900, 4069766876, 3931548641, 2526471011, 766865139, 2115084288, 4259411376, 3323683436, 568512177, 3736601419, 1800276898, 4012458395, 1823982, 27980198, 2023839966, 869505096, 431161506, 1024804023, 1853869307, 3393537983, 1500703614, 3019471560, 1351086955, 3096933631, 3034634988, 2544598006, 1230942551, 3362230798, 159984793, 491590373, 3993872886, 3681855622, 903593547, 3535062472, 1799803217, 772984149, 895863112, 1899036275, 4187322100, 101856048, 234650315, 3183125617, 3190039692, 525584357, 1286834489, 455810374, 1869181575, 922673938, 3877430102, 3422391938, 1414347295, 1971054608, 3061798054, 830555096, 2822905141, 167033190, 1079139428, 4210126723, 3593797804, 429192890, 372093950, 1779187770, 3312189287, 204349348, 452421568, 2800540462, 3733109044, 1235082423, 1765319556, 3174729780, 3762994475, 3171962488, 442160826, 198349622, 45942637, 1324086311, 2901868599, 678860040, 3812229107, 19936821, 1119590141, 3640121682, 3545931032, 2102949142, 2828208598, 3603378023, 4135048896]; a=V0(mod(X+i,256)); b=V1(mod(floor(X/256)+i,256)); r=mod(a^b,m); %% Problem in here end
Firstly, you must convert it to binary expression. And then take exponentiation a=V0(mod(X+i,256)); b=V1(mod(floor(X/256)+i,256)); a1=zeros(1,32); b1=zeros(1,32); c1=zeros(1,32); %% Convert to binary a1=dec2bin(a); b1=dec2bin(b); A= sscanf(a1,'%1d'); B= sscanf(b1,'%1d'); c1=mod(A+B,2);% Bitwise i=0; temp=0; for j=32:-1:1 temp= ((c1(j)* 2^ i)+temp); i=i+1; end %% Random number r= mod(temp, m);