cron expressions

0 15 10 * * ? 2005 Fire at 10:15am every day during the year 2005
Field Name Mandatory Allowed Values Allowed Special Characters
Seconds YES 0-59 , – * /
Minutes YES 0-59 , – * /
Hours YES 0-23 , – * /
Day of month YES 1-31 , – * ? / L W
Month YES 1-12 or JAN-DEC , – * /
Day of week YES 1-7 or SUN-SAT , – * ? / L #
Year NO empty, 1970-2099 , – * /

http://www.quartz-scheduler.org/documentation/quartz-1.x/tutorials/crontrigger

Advertisements

send emails using linux command

# echo “Sending an attachment.” | mutt -a backup.zip -s “attachment” calvin@cnh.com

This command will send a mail to calvin@cnh.com with the subject (-s) “attachment”, the body text “Sending an attachment.”, containing the attachment (-a) backup.zip. Like with the mail command you can use the “-c” option to mark a copy to another mail id.

source: http://www.simplehelp.net/2008/12/01/how-to-send-email-from-the-linux-command-line/

brown bag

fear is a feature, not a bug. ( it is fear which keep us alive for most times, not a problem that stops ppl from doing something.)

  • replace condtions with polymophism: switch operation depends on the type

make subclass, in superclass the method is abstract, and different type subclass overidden it

prefer polyphosim over switch conditions

example

instead of

class Opnode {double evaluate(){

switch op
case +
case *}}

make evaluate() in Opnode abstractclass

AdditionNode extends Opnode{double evaluate() { return left.evaluate() + right.evaluate()}}

class MultipleNOde extend Opnode{double evaluate() { return left.evaluate() * right.evaluate()}}

  • seperate if conditions to different subclass (piles of objects), one state of if conditions corresponds to one subclass
  • the if logic does not go away, it sits in the factories/builders/provider ( piles of construction)
  • Java, Guice for provider
  • benefit: condition is localized in only one place; no duplication; separate of responsibility and global state

performance levels

http://hr.ucmerced.edu/sites/hr/files/public/documents/Perf-Mgmt/Examples%20of%20Performance%20Rating.pdf

Exceptional

Performance consistently far exceeds expectations in the rated competencies and quality
of work performance was superior.

Exceeds Expectations

Performance consistently meet expectations in all essential areas of responsibility, and the quality of work over was excellent. Annual goals were met.

<>
Meets Expectations

Performance consistently met expectations in all essential areas of responsibility,
at times possibly exceeding expectations and the quality of work overall was very good. The most
critical annual goals were met.

<>
Improvement Needed

Performance did not consistently meet expectations。 performance failed to
meet expectations in one or more essential areas of responsibility, and/or one or more of the most
critical goals were not met. A professional development plan to improve performance must be outlined,
including timelines and monitored to measure progress.

Unsatisfactory

Performance was consistently below expectations in most essential areas of
responsibility, and/or reasonable progress toward critical goals was not made. Significant improvement
is needed in one or more areas. A plan to correct performance, including timelines, must be outlined
and monitored to measure progress.

super in ruby

The “super” keyword in ruby behaves a little differently than other languages. Instead of returning an instance of the superclass, it checks all the way up the ancestry tree to find the inherited method.

def foo(a)
super
end

Is the same as

void foo(a)
{
closest_ancestor_that_has_foo_method.foo(a)
}

  • supper is a keyword, not a method; Methods can be overridden in subclasses of ruby.

http://www.rubyinair.com/2011/04/super-is-keyword-not-method-call.html

  • ancestor tree: An ancestor of a class is either the class itself, a module included by any of the class’s ancestors or the superclass of any of the class’s ancestors. In short the ancestors of a class are all the classes and modules in which ruby will look for the method definition when you call a method on an object of that class.

http://ruby-doc.org/docs/keywords/1.9/files/keywords_rb.html#M000034

module Vehicular
  def move_forward(n)
    @position += n
  end
end

class Vehicle
  include Vehicular  # Adds Vehicular to the lookup path
end

class Car < Vehicle
  def move_forward(n)
    puts "Vrooom!"
    super            # Calls Vehicular#move_forward
  end
end
puts Car.ancestors.inspect

# Output
# [Car, Vehicle, Vehicular, Object, Kernel, BasicObject]

Note the inclusion of the Vehicular Module object!

new for struct

struct ListNode {
ListNode* next;
int data;
};

The first constructor –new ListNode- without parenthesis – provides what is called default initialization (do not confuse with default constructor). Default initialization leaves the values of fundamental types (int, double, etc) uninitialized, i.e. arbitrary. Therefore, with new ListNode; you get uninitialized chunk of memory with arbitrary values in the fields.

The second constructor –new ListNode() with parenthesis – provides what is called value initialization. Value initialization zeros fundamental types. Therefore, with new ListNode(); you get zero-initialized chunk of memory – all fields in this case will be zeros.