Thursday, April 26, 2007

A bug I saw today in the front yard




Here are a few shots of a bug I saw today in the front yard.

Independence Day BBQ









Here are a few pictures from the traditional BBQ party in Independence day. Every year on Independence day we meet at Michal's aunt''s house to celebrate with the family.


Wednesday, April 25, 2007

Monday, April 23, 2007

Birds I saw in the park next door today





Here are a few shots of birds I saw in the park next door today. All of them seems to me as the same bird... :-)

Israel's 59th independence day

Celebrations for Israel's 59th independence day begin this evening.

Today: Israel remembers its fallen fighters

Today is the memorial day for Israel's fallen fighters. In the recent years this memorial day is also dedicated for remembering the many casualties of the terror acts against Israeli citizens.

This evening, the memorial day will end and the celebrations for the 59th year of independence for the State of Israel will begin.

This move from deep sorrow and memorial day ceremonies to the celebrations of the independence day is one of the symbols of this day.

Thursday, April 19, 2007

new interview questions

This week's interview questions were prepared for candidates with a background in algorithms in bioinformatics and a few years of C++ experience, with an academic background in statistics. The last two questions in probability are due to Shmuel Fomberg.


.A.

Let S1 and S2 be strings over the same alphabet. The edit distance between S1 and S2 is the smallest number of changes sufficient to transform a substring of S1 into S2, where the changes may be:

1. Substitution --two corresponding characters may differ: KAT -> CAT

2. Insertion -- we may add a character to S1 that is in S2: CT -> CAT

3. Deletion – we may delete from S1 a character that is not in S2: CAAT -> CAT

The cost for every operation is 1, regardless of the operation. Suggest an efficient algorithm for calculating the edit distance between two strings. Suggest a design for an efficient implementation (data structures)

.B.

You have a very large and static text T that you have available a-priory, and a set of strings S that you receive in run-time. Describe a data structure and an algorithm that facilitate efficient multiple queries on the same text. What is the required time complexity for executing a query and getting the result?

.C.

Describe an algorithm for searching the existence of a string S in a text T. Write an implementation in a programming language of your choice. What is the time and space complexity of your solution?

.D.

Describe an algorithm for searching the existence of any string from a set of strings {S1 S2, …, Sn} in a text T What is the time and space complexity of your solution? How will your solution change if you want to know which settings exactly from your set of strings was matched in the text?

.E.

Write an implementation of a function that receives a string containing an arithmetic expression (that has numbers, the +-*/ operators and the parentheses () for precedence ordering) and returns the result of the expression.

.F.

How would you copy a class instance in C++? How would you implement a function that receives the source instance and cloned instance and determines that the two are copies?

.G.

Please suggest an object oriented design for a database layer. So that a developer can write code using an object oriented interface and does not need to know anything about database tables, SQL, etc.

.H.

You have three roads that form a triangle. In every node of the triangle (in every intersection of two roads) there’s one car. At a certain point in time every cars chooses a direction and starts moving. They all start moving at the same time and drive. What’s the probability for a collision? A collision is defined as a meeting where at least one car is headed in one direction and at least one other car is heading in the opposite direction.

.I.

There’s a 95% chance that a car drives by your house within 30 minutes. What is the probability that a car drives by your house within 10 minutes.

Monday, April 16, 2007

Jewish Holocaust Memorial Day

Today is the annual Jewish Holocaust Memorial Day. Here is a good link where you can read all about it: Yad VaShem (יד ושם): http://www.yadvashem.org/

egg shortage

For over a week now there is a shortage of eggs in Kfar Yona. You simply cannot find eggs in the stores.

Yesterday in Petah-Tikva I could not find any eggs other than very expensive ones in מחסני מזון. It looks like the eggs suppliers that normally supply eggs to the stores are not doing do.

I don't have any idea why and I didn't see any information about this in the media.

Sunday, April 15, 2007

Interview questions for developers

I get to participate a lot lately in job interviews. (I'm interviewing, that is...). When it comes to trying to see how technical is the candidate in front of me I normally ask one or more from the following questions:

1. "Please describe your part in a recent project." I then try to eliminate as much hype and buzz talk and get the candidate the draw a diagram that describes a system and its components. I then query about the exact locations where that person was developing and drill down from there. -- Here I try to understand how well the candidate can describe what s/he did, how well s/he communicates technical information, and of course, how well s/he knows what s/he was working on.
2. "Tell me about a bug or customer problem that you were responsible to solve. What was the problem? How did you realize what was the real cause? How did you solve the problem?" -- Here I try to see what counts as a "problem worth talking about", the organization and manner used by the candidate to solve the problem. I try to understand the methods and the tools used to solve problems of that kind.
3. When I see that a candidate lists a programming language other than the expected Java/C/C++, such as Lisp, Haskell, Perl, Prolog, etc. I tend to cook up a simple question suitable for that language (that is: something that is pretty easy to write down using that language) and ask the candidate. Unfortunately, I usually get disappointed when I either hear the candidate giving excuses why s/he cannot write down a solution, although s/he was bragging in the CV that this is one of the strong programming languages s/he uses. I do, nonetheless, sometimes get to see people who actually can write down some code in the programming language they say they know.
4. Depending on the area of expertise of the candidate, I then ask a few questions in that area.

Here are some questions that I sometimes ask (it's pretty easy to make up new questions):

  1. Please implement a function that receives an array of integers and the size of the array and returns the same array sorted. For example, for a given array {1,3,5,11,2,2,7,41,17,3,3} the resulting ordering of the array is {1,2,2,3,3,3,5,7,11,17,41}. Please make sure you take into consideration the following requirements:
    1. For every number i in the array, i is equal or greater than 0 and equal or less than 100.
    2. Your implementation should be as efficient as possible.
    3. Note that the returned sorted array must use the same memory as the received array.
  2. Please write down the definition of a C structure that describes a node in a tree data structure. Note that a node in a tree can have zero or more children. The number of possible children is not known.
  3. Please write down an implementation of a function that receives a pointer to a node in a tree (the same node description you implemented in the previous question) and returns the number of nodes in the sub-tree, including the node itself.
  4. Please implement a function that receives an array of pointers to some structure and the size of the array and returns the same array sorted according to the color field of the struct. The structure is defined elsewhere and is of no relevance to us. All you know is that the structure has a field color and that the possible values of that field are RED=0, GREEN=1, BLUE=2. (RED, GREEN and BLUE are constants representing the numbers 0, 1 and 2, respectively.). Please take into consideration the following requirements:
    1. The array should be ordered in place, i.e., using the same memory.
    2. You are allowed to use only a constant number of additional memory units that is not dependent on the size of the input. You may use a hint that the amount of necessary additional memory is proportional to the number of colors used.
    3. Once a color field of an array element has been read, it is not possible to read it again. This means that you’re allowed to view the contents of the color field only once per array element.
  5. Solve question 4 for the general case of K colors using O(1) of memory.
  6. Please describe a hashtable data structure, specify a hash function for it and explain the probability for a collision using your hash function.
  7. Please describe an algorithm that accepts a pointer to a tree node of the same kind of the one in question 2, that can locate tree nodes that have child links to some ancestor node, i.e., can locate all loops. Reason about the complexity of your algorithm.

Mozex -- vim in your browser for editing textarea

Check out Mozex
As its development page states:

"Mozex is an extension which allows the user to use external programs for these actions:

  • edit content of textareas (possibly utilizing a spell-checker in the text editor)
  • view page source
  • handle mailto, news, telnet and FTP links
  • download files
  • ... and many more :)"

Thursday, April 12, 2007

israel.pm meeting for April 2007

Shmuel Fomberg will explain how to code in Perl in your C code.
Yuval Yaari will introduce how the Perl Regular Expressions work.

See: http://perl.org.il/pipermail/perl/2007-April/008605.html

Wednesday, April 11, 2007

Haskel and Functional Programming learning group

I initiated a study group for learning Functional Programming (via learning and using Haskell) at work. There's also a blog for this purpose at http://haskellstudy.blogspot.com/

Stephanie Forrest's papers

I came across the publications of Stephanie Forrest, which look extremely interesting.
See: http://www.cs.unm.edu/~forrest/isa_papers.htm

Generate GUI from a grammar that describes a CLI

Ran Eilam wrote to me: Under the category of "stuff you can generate from grammars", http://kaptain.sourceforge.net/ make a GUI dialog from a grammar that describes a command-line.

I guess it may be useful for really complex command lines.

From the description on the tool's site itself:
"Kaptain is a universal graphical front-end for command line programs. Someone writes a simple script (so called grammar) which describes the possible arguments for a command line program and Kaptain brings up a friendly dialog to the user to set up the command line."

Saturday, April 7, 2007

Noa and Yuval (and parents) visiting





Nadel family: my sister, Ruth, my brother in law, Shai, and the kids: Yuval and Noa came for a visit.

Friday, April 6, 2007

We spent the morning in Alexander stream (נחל אלכסנדר)



We spent the morning in Alexander stream (נחל אלכסנדר). The kids had fun.
The reservation looks great and we only saw very little of it by the time the kids got tired.

The location is very close to our home and we intend to visit there more in the future.

New Meltzer Catalog

I bought the new Meltzer catalog. This is a new revision to the catalog that they published a few years ago. There are a lot more new plants listed, more information, and more indices.

Tuesday, April 3, 2007

A day at פארק לכיש in Ashdod






We though of visiting a buffalo diary but the place was closed. Wishing for a good time with the kids we drove to the nearby Ashdod and spent the day in Lachish Park (Park Laki$ -- פארק לכיש).

The place was indeed fun for the kids. Here are a few photos from our day there:

Passover 2007





The dinner of Passover evening was held this year at my parents in law's house. It was a happy event, and the kids had fun.