从周一到周五上午9:15到下午3:30每分钟运行一次cron工作(cron job to run each minutes from monday to friday from 9:15AM to 3:30PM)
我必须为以下场景运行两个cron作业。
- job1.php周一至周五上午9:12应该每天运行一次。 (一周五天)
- job2.php应该在周一至周五上午9:15到下午3:30的每分钟运行。 (一周五天)
我有另外4个cron工作需要在我的项目中实现。 但所有这些都可以从上述两个场景中得出。
I have to run two cron jobs for the following scenarios.
- job1.php Should run once in a day at 9:12 AM on Monday to Friday. (five days in a week)
- job2.php Should run in each minutes from 9:15 AM to 3:30 PM on Monday to Friday. (five days in a week)
I have another 4 cron jobs which needs to be implemented in my project. But all that can be derived from the above two scenarios.
原文:https://stackoverflow.com/questions/36238878
最满意答案
声明一个方法
const
有点像承诺它不会尝试修改对象。 它不会拒绝您访问对象状态,您仍然可以完全为非const对象调用它。 所以是的,解决方案是float bodyMassIndex() const;
Declaring a method
const
is somewhat like making a promise that it won't try to modify the object. It will not deny you access to the object state and you still will be perfectly able to call it for non-const objects. So yes, the solution isfloat bodyMassIndex() const;
相关问答
更多-
我会假设你关心的是将const*传递给动作。 template
static void process_helper(Data *d, Action *cb) { for (auto i = d->begin(); i != d->end(); i++) { Arg item = *i; cb->action(item); } } void process(Data *d, ModifyAction *cb) ... -
而不是使用_a数据成员直接使用const和非const重载创建访问器函数。 这将导致在B const成员函数中调用const超载时,这会导致您无法调用A非常量函数。 A const& GetA() const { return _a; } A& GetA() { return _a; } void DoSomethingElse() const { GetA().DoSomething(); // error } Instead of using the _a data member dire ...
-
同一个函数的const和非const版本 - 反模式?(Both const and non-const version of the same function - an anti-pattern?)[2022-10-07]
不,并不总是。 这种模式有合法用途。 例如,假设您正在编写一个集合,并且用于检索元素的代码相当复杂(例如哈希表)。 你不想复制所有的代码,但你也希望你的集合能够被用作const和非const。 所以,你可能会这样做: struct HashTable { ... const Value &get(Key key) const { ... complex code for retrieving the key } Value &get(Key key) { ... -
声明一个方法const有点像承诺它不会尝试修改对象。 它不会拒绝您访问对象状态,您仍然可以完全为非const对象调用它。 所以是的,解决方案是float bodyMassIndex() const; Declaring a method const is somewhat like making a promise that it won't try to modify the object. It will not deny you access to the object state and you s ...
-
不应该使用const选项设计迭代器来防止这种行为吗? 确实如此。 你只是期望它是一个不同的操作。 正如您所发现的,指针容器......包含指针 ,而不是对象。 因此,这样的指针的const_iterator意味着指针是常量,而不是它们指向的对象。 这不会改变,也不会改变。 标准库容器通常设计为包含完整的对象,而不是指针。 所以他们不应该鼓励用户制作指针和其他可疑结构的vector 。 如果您确实需要一个包含指针的vector ,那么您应该使用实际设计的容器。 就像Boost的指针容器类一样 。 他们的con ...
-
请注意,如果你这样做并且对象确实是const ,那么在抛弃const之后修改它是未定义的行为。 fgBlocks.CopyInto(const_cast
(backUpCopy)); 另一个是同样的事情: const_cast (backUpCopy).RemoveAll(true); Be aware that if you do this and the object really is const, then modifying it after casti ... -
y是非常量变量。 所以调用非const方法。 如果你将y2定义为const,它将调用const方法。 int main() { Y y; const Y y2 = y; X i = y.GetX(); const X& j = y2.GetX(); return 0; } y is non-const variable. So the non-const method is called. If you defined y2 as const, it will ...
-
编译器吃了它。 但落后演员更有用。 而且 - 最好不要使用它,const_cast通常只是一个快速而肮脏的解决方案,只有在没有任何其他解决方案时才应用。 回答更新 如果我理解正确,你将使用一个对象和两个函数。 第一个函数接受const对象和const成员函数,第二个函数接受非const对象和非const成员函数。 根据给定的信息,您可以更改第二个函数以接受非const对象和const成员函数。 并给它们一个非const对象及其const成员函数。 Compiler eats it. But the back ...
-
调用函数时,对非const的引用的初始值必须是左值(initial value of reference to non-const must be an lvalue when calling a function)[2023-10-21]
您的InsertNode2函数是树的私有细节。 您的树应该有一个公共插入界面,如下所示: class Btree { BtreeNode* root; public: void Insert(const T& data) { InsertNode2(data, root); } // ... }; 树根当然也应该是树的私有细节。 您的GetRoot函数返回根指针的副本 ,当然尝试修改副本是没有意义的。 你可能甚至不应该有 GetRoot函数,因为见上文。 Your In ... -
返回'const'或非const引用之间的区别[重复](Difference between returning 'const' or non-const reference [duplicate])[2022-06-05]
问题是函数get被声明为const : const std::list& get() const // ^ ,所以list被认为是const内的一个const 。 因此,将其作为非const引用返回的尝试失败。 The problem is that the function get is declared as const: const std::list & get() const ...