mercredi, avril 21, 2010

An History Of Inventors

Good insight into inventors personality and more generally on the way innovation occurs.

dimanche, avril 11, 2010

3 most important questions to ask as a recruiter or to answer as a job applicant

 All questions asked during an interview for a job come down to one of the 3 following questions:
  1. Can the person do the work (qualifications)?
  2. Will the person do the work (motivation)?
  3. Will the person fit in company/team (adaptability)? 
The goal of the interview is that the interviewer has a clear view on answers on these 3 questions.

Read details and slightly different views here:
Ms. Sarah Zulfiqar wrote: We look for the following 4 A’s in a candidate:
  • Attitude (behavior and posture)
  • Appearance (attire and expression)
  • Aptitude (skills and talent)
  • Agility (communication skills)
Generally an individual excludes the first 2 A’s and concentrate on the last two. Observing the attitude of the interviewee helps the interviewer to determine if the candidate will fit in the prevailing organizational culture and environment. Appearance indicates interviewee’s interest towards the job and respect for the employer. According to a wise saying “You dress for the person you are going to meet and not for yourself.”

    jeudi, avril 08, 2010

    lambdaj errors explained

    java.lang.IllegalAccessException: Class ch.lambdaj.proxy.ProxyIterator can not access a member of class XYZ with modifiers "public" at line forEach(products_byname).cropDefects();
    assuming List products_byname = new List();
    means that class Product should be made public.

    java.lang.IllegalAccessException: Class ch.lambdaj.proxy.ProxyIterator can not access a member of class XYZ with modifiers "" at line forEach(products_byname).cropDefects();
    means that method cropDefects() should be made public.

    java.lang.RuntimeException: It is not possible to create a placeholder for class: java.lang.reflect.Field at line List l_null_fields = select(l_fields,having(on(Field.class).get(this),nullValue())); means that you encountered a Limitation of lambdaj caused by the Java language specification because Field is a final class.


    java.lang.IllegalArgumentException: forEach() is unable to introspect on an empty iterator. Use the overloaded method accepting a class instead at line forEach(defects).updateBugActivity(stateArray); means that you encountered a Limitation of lambdaj caused by the Java language specification because defects is an empty list.

    mercredi, avril 07, 2010

    Java program using lambdaj


    Today, I did the same thing (i.e. no for or while statements), but using lambdaj java library.

    There is still a for statement but if you make country as an object and not a string then you can use lambdaj features.

    1 Have a list of people belonging to various countries:
    European people: [Eric from France, Martine from France, John from Great-Britain, Martha from Great-Britain, Carine from France, Gerd from Deutschland, Giuseppe from Italia, Martha from Deutschland]

    2 Get the different countries:

    European countries: [Great-Britain, France, Italia, Deutschland]

    3 List the people that belong to each country
    :
    People from: [France]: [Carine from France, Eric from France, Martine from France]
    People from: [Deutschland]: [Gerd from Deutschland, Martha from Deutschland]
    People from: [Great-Britain]: [John from Great-Britain, Martha from Great-Britain]
    People from: [Italia]: [Giuseppe from Italia]

    Here is the code:
       1 import static ch.lambdaj.Lambda.*;
       2 import ch.lambdaj.group.*;
       3 import java.util.List;
       4 import java.util.Arrays;
       5 import java.util.Set;
       6 
       7 
       8 public class Europeans1 {
       9 
      10         static List<People> l_europeans = Arrays.asList(
      11                         new People("Eric", "France"),
      12                         new People("Martine", "France"),
      13                         new People("John", "Great-Britain"),
      14                         new People("Martha", "Great-Britain"),
      15                         new People("Carine", "France"),
      16                         new People("Gerd", "Deutschland"),
      17                         new People("Giuseppe", "Italia"),
      18                         new People("Martha", "Deutschland"));
      19 
      20         public static void main(String[] args) {
      21                 System.out.println("European people: "+l_europeans);
      22                 Group<People> g_countries = Groups.group(l_europeans, 
      23                         Groups.by(on(People.class).getNationality()));
      24                 Set<String> set_countries = g_countries.keySet();
      25                 System.out.println("European countries: "+set_countries);
      26                 for(String s_country:set_countries) {
      27                         print_inhabitants(s_country);
      28                 }
      29         }
      30 
      31         static void print_inhabitants(String s_country)  {
      32                 System.out.print("People from "+s_country+": ");
      33                 List<People> l_inhabitants = select(l_europeans,
      34                         having(on(People.class).getNationality(),
      35                         org.hamcrest.Matchers.equalTo(s_country)));
      36                 forEach(l_inhabitants).printFirstName();
      37                 System.out.println("");
      38         }
      39 }

    dimanche, avril 04, 2010

    Java vs Haskell


    At that time I did not know it, but I was doing some kind of functional programming. I discovered Haskell a few weeks ago, and I duplicated what I did in Java.

    As you can guess the Haskell code is way shorter, and goes even a little further.

    1 Have a list of people belonging to various countries:
    European people: [Eric from France, Martine from France, John from Great-Britain, Martha from Great-Britain, Carine from France, Gerd from Deutschland, Giuseppe from Italia, Martha from Deutschland]

    2 Get the different countries:

    European countries: ["Deutschland","France","Great-Britain","Italia"]

    3 List the people that belong to each country
    :
    People from: [France]: [Carine from France, Eric from France, Martine from France]
    People from: [Deutschland]: [Gerd from Deutschland, Martha from Deutschland]
    People from: [Great-Britain]: [John from Great-Britain, Martha from Great-Britain]
    People from: [Italia]: [Giuseppe from Italia]

    Here is the code:
    import Data.List
    import Data.Function

    le = [
    ("Eric", "France"),("Martine", "France"),
    ("John", "Great-Britain"),("Martha", "Great-Britain"),("Carine", "France"),
    ("Gerd", "Deutschland"),("Giuseppe", "Italia"),("Martha", "Deutschland")
    ]

    dla xs = "European people: " ++ show [ fst x ++ " from " ++ snd x | x <- xs]
    lc xs = [ head y | y <- group(sort([ snd x | x <- xs]))]
    dlc = "European countries: " ++ show(lc le)

    lpc5 xps = groupBy (\x y -> snd x == snd y) (sortBy (compare `on` snd)([ xp | xp <-xps ]))
    lpc9 xps = unlines [ "People from " ++ show (snd (head xp)) ++ ":" ++ (show [fst x | x<-xp ]) | xp <-xps ]
    fait9 = do { m <- [lpc5 le]; lpc9 m }
    dlad = [ dla le, dlc, fait9 ]

    main = putStrLn (unlines(dlad))