将文件夹从一个fedora 15服务器同步到另一个(Sync folder from one fedora 15 server to another)
在一台服务器上[s1]我为一个页面创建并将一个图像调整为一个文件夹中的300x300和子文件夹中的[缩略图] 130x130。 s1是灯服务器。 我有另一台服务器[s2]运行相同的操作系统[fedora 15],仅通过nginx提供静态文件[images,css,js]。
是否可以在从s1创建[resized等]后将图像复制到s2。
这种情况每天只发生10-20次,但需要立即[如果可能]。 我读过有关使用php和sftp的内容,但我一直无法理解它。
我想我的问题,更重要的是,是; 任何人都可以推荐一种可靠的方法。
On one server [s1] I for a page I create and resize one image into a 300x300 in one folder and [a thumbnail] 130x130 in a subfolder. s1 is a lamp server. I have another server [s2] running the same OS [fedora 15] serving static files [images, css, js] only, via nginx.
Is it possible to copy the images to s2 after they are created [resized, etc] from s1.?
This only happens maybe 10-20 times a day but needs to be immediate [if possible]. I've read about using php & sftp but I have been unable to make sense of it.
I guess my question, more to the point, is; Can anyone recommend a method that is reliable.?
原文:https://stackoverflow.com/questions/9044511
最满意答案
试图循环观察是非常不必要的,因为Stata以任何方式这样做。
如果您只想使用最近的非缺失值,则可能需要此项:
clonevar issue, generate(clone) bys id1 id2 (date): replace issue = clone[n-1] if missing(issue)
除了标记之外,请注意代码中的以下错误:
foreach v in 1(1)_n
:foreach
不会用in
扩展numlist
; 它也不会为你评价_n
。
replace issue[n]
:不允许在该位置下标;replace issue
意味着同样的事情。
issue[nv]
:你需要一个本地参考。
and
不是关键字:你需要&
如果你想要一个逻辑“和”
n
大概是_n
的拼写错误另请参阅此有关替换缺失值的常见问题
The attempted loop over observations is quite unnecessary, as Stata does that any way.
If you want to use only the most recent non-missing value it is likely that you want this:
clonevar issue, generate(clone) bys id1 id2 (date): replace issue = clone[n-1] if missing(issue)
Note the following bugs in your code apart from that you flag:
foreach v in 1(1)_n
:foreach
won't expand anumlist
within
; nor will it evaluate_n
for you.
replace issue[n]
: subscripts are not allowed in that position;replace issue
means the same thing any way.
issue[n-v]
: you'd need a local reference there.
and
is not a keyword: you need&
if you want a logical "and"
n
presumably is a typo for_n
See also this FAQ on replacing missing values
相关问答
更多-
你可以先合并你的数组,比如 $new_array = array_merge($dogruA, $yanlisA); 然后在使用array_unique()方法将它传递给foreach之后,它会处理数组重复值, foreach(array_unique($new_array) as $single){ echo $single; } You can first merge your array,like $new_array = array_merge($dogruA, $yanlisA); the ...
-
试图循环观察是非常不必要的,因为Stata以任何方式这样做。 如果您只想使用最近的非缺失值,则可能需要此项: clonevar issue, generate(clone) bys id1 id2 (date): replace issue = clone[n-1] if missing(issue) 除了标记之外,请注意代码中的以下错误: foreach v in 1(1)_n : foreach不会用in扩展numlist ; 它也不会为你评价_n 。 replace issue[n] :不允许在 ...
-
结合两个foreach php(combine two foreach php)[2022-02-28]
我将为数字创建一个关联数组,数字为键,值为数字。 $numbers = array(); foreach (range(1, 70) as $num) { $numbers[$num] = 0; } 并与数据库循环结合起来 foreach ($dbnumbers as $num => $value) { $numbers[$num] += $value; } 然后你可以迭代它来显示;) I would make an associative array for that with the ... -
我怎样才能将Perl的拆分命令与空白调整结合起来?(How can I combine Perl's split command with white space trimming?)[2023-08-26]
您不必一次使用相同的功能执行两项操作。 有时单独执行这些操作可能会更清楚。 也就是说,先分割,然后从每个元素中剥离空白(然后对结果进行排序): @email_list = sort( map { s/\s*(\S+)\s*/\1/; $_ } split ';', $file_data ); 编辑:在同一时间剥离一个字符串的多个部分可能会导致陷入困境,例如,思南恩的要点在“伊丽莎白”部分留下尾随 ... -
报告的问题与foreach或regress无关,而是与您使用本地宏有关。 本地宏引用周围的左右引号不同。 否则宏引用无法嵌套,这将是一个严重的问题。 这是记录在案的,例如PDF文档中的[U] 18.3.1。 您的代码还有其他问题。 让我们先修复它,使用正确的引号并修复另一个语法错误: local Region "1 2 3 4 5 6" foreach i of local Region { reg x1 x2 x3 if Region == `i' } 这里假设您有一个名为Region的变量,并 ...
-
将foreach与linq结合起来(combine foreach with linq)[2023-09-07]
在LINQ中使用.ForEach: (from s in db.WfRADocStates.Include(x=>x.WfStateStatu).Include(xx=>xx.WfState).Include(xxx=>xxx.WfState.Dept).Include(d=>d.RADoc) where s.RADocID == docID && !s.isHistory && s.StatusID == 1 && ... -
将两个foreach合并成一个(Combine two foreach into one)[2023-05-10]
glob()返回一个简单的数组,所以只需合并两个数组,然后只有一个数组可以循环 $directory = "images/uploads/fexperience/"; $images = array_merge( glob($directory . "*.jpg"), glob($directory . "*.png") ); foreach($images as $image) { if (isset($_SESSION['loggedin']) && $_SESSION['lo ... -
结合foreach输出数据(Combine foreach output data)[2022-02-20]
使用一个帮助器数组和函数来查找相同的channel_id并存储其steam_name ! 在php数组中,调用相同的索引不会创建新的数组! 所以尝试将channel_id设置为索引键。 $result = findSameChannelId($array); foreach($result as $data) { echo $data["channel_description"]."
"; } function findSameChannelId($array) { foreach ... -
结合两个foreach循环(combine two foreach loops)[2024-04-28]
您可以使用MultipleIterator : $m = new MultipleIterator(); $m->attachIterator(new ArrayIterator($items), 'item'); $m->attachIterator(new ArrayIterator($linkai), 'linkas'); foreach ($m as $unit) { // $unit['item'] contains an entry from $items // $unit[' ... -
有几种方法可以做到这一点,包括但不限于以下几点。 全部在选择器中: $('input[type="checkbox"]:not(:first)').each(...) 使用.not()方法 : $('input[type="checkbox"]').not(':first').each(...) 使用.slice()方法 : $('input[type="checkbox"]').slice(1).each(...) 请注意,实际检查/取消选中框的行可以简化为: this.checked = !thi ...