Monday, December 31, 2018

Why More Women are Victims of Scams (WSJ)

Bill Francavilla : Women outlive men, so there are more older woman. Studies have found that men fall for investment scams and women fall for lottery (you just won a XYZ car and you just have to pay for title and shipping) scams.

Who would have guessed? A 24 year old Indian dude made $300m by running the IRS scam. Phew.. The Americans know him as Shaggy btw..

Simon Lovell - the British con man who later became a stage magician said : "I love it when someone says they can't be scammed." If you've read Joe Weil's autobiography, you know that even con men are not immune!


Sunday, December 30, 2018

An Authoritative Python Cheat Sheet (WIP)

All plagiarized of course, credits at bottom..

Make the script both a module and an executable :

if __name__ == '__main__'

The __whatever__ is a "dunder" - double-underscore. There are some useful ones you'll pick up - like __init__ , __repr__ , __eq__ (that goes along with decorators), etc.

Enumerate :

for i, var in enumerate( list_name ) :
     some_useful_code using i and var

List comprehension (build a list on the fly ) :

[ x * 3 for x in data if x > 10 ]

Build a dict out of two lists :

d = dict( zip( key_list, val_list ) )

Flatten a list of lists :

>>> l_of_lists = [list(range(10)), list(range(20,30)), list(range(50,60))]
[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9], [20, 21, 22, 23, 24, 25, 26, 27, 28, 29], [50, 51, 52, 53, 54, 55, 56, 57, 58, 59]]
>>> l = [y for x in l_of_lists for y in x]
>>> l
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59]


Count number of elements in your list greater than a certain value :

sum(i > 5 for i in j)

Reverse a list :

list_name[::-1]

Parse JSON data :

import json
import requests
response = requests.get( url, params=paramDict)
parsed_json = response.json()     # then do a pprint (pretty print) to see how to use..

Pandas :

import pandas as pd
df = pd.read_csv( 'somefile.csv')
matching_list = df['field1'][df['fieldN' == 'something_specific']

import matplotlib.pyplot as plt
from matplotlib import style

style.use('classic')
df['some field'].plot()
plt.show()

To convert from JSON to dataframe :

from pandas.io.json import json_normalize
df = json_normalize( parsed_json['key name'] )

Fill out a matrix using a list or dict ( while you count from 0 to 8 generate (0,0),(0,1),(0,2),(1,0)..(2,2) )

from itertools import product

i=0
for t1, t2 in product( sorted_tags, sorted_tags ) :
    row = i // num_tags
    col = i % num_tags
    i += 1
    t_mx[row][col] = transition_counts[ (t1,t2) ]

Actually, more pythonically (maybe) :


from itertools import product

for i,j in product( range( num_tags), range(num_tags) ) :
 t_mx[i,j] = transition_counts[ (sorted_tags[i], sorted_tags[j] ) ]

QEI

http://safehammad.com/downloads/python-idioms-2014-01-16.pdf
https://coderwall.com/p/rcmaea/flatten-a-list-of-lists-in-one-line-in-python


Saturday, December 29, 2018

Installing Your Own Personal Python Module

That is, when you do

import myModule

Python shouldn't barf.

Put your .py file in a reasonable place (i.e., a directory named meaningfully :)

In the same directory, have a setup.py file that looks like

from setuptools import setup

setup (
    name='myModule',
    version='1.0',
    description='A useful personal module',
    author='me',
    author_email='me@memail.com',
    url='me.com',
    py_modules=['myModule'],
)

Then, run :

$ python setup.py sdist

You will see a warning that there is no README file.

Now, to install :

$ pip install /path/to/myModule-1.0.tar.gz

Easy enough?

Spyder++

What *would* be nice is to incorporate some 20+ year old technology such as what NEdit already has - that is, let users record interaction with the GUI and create custom macros that they can then bind keyboard shortcuts to.

For example, based on my mood, I'd like to toggle between the light and dark theme. You listening Pierre Raybaut? Please …

Google "spyder keyboard shortcut toggle between light and dark theme" and see what you get..

Friday, December 28, 2018

Hans Fangohr++ aka A Better Spyder Tutorial

Why not anticipate users' problems - especially when you give them advanced tips?

He says, set IPython Console to do symbolic math (Tools > Preferences) and then you'll see cuter stuff.

He doesn't say :

Start a new console.
What happens if you run into ..

These commands were executed:
from __future__ import division
from sympy import *
x, y, z, t = symbols('x y z t')
k, m, n = symbols('k m n', integer=True)
f, g, h = symbols('f g h', cls=Function)

Warning: pylab (numpy and matplotlib) and symbolic math (sympy) are both
enabled at the same time. Some pylab functions are going to be overrided by
the sympy module (e.g. plot)


expr = (x + y) ** 3
Traceback (most recent call last):

  File "<ipython-input-1-530ade24fb9f>", line 1, in <module>
    expr = (x + y) ** 3

NameError: name 'x' is not defined

In short, what an ass!

Fortunately, we have some online angels :

https://github.com/spyder-ide/spyder/issues/3255
https://stackoverflow.com/questions/43915513/how-to-get-latex-style-output-from-sympy-in-spyder-ipython-console
https://github.com/nteract/hydrogen/issues/1119

I go to Start > Anaconda > Anaconda Prompt and then do

> conda install -c conda-forge miktex

Dat fix it? No!!

What did?

The commands that *IT* (see above) says *were* executed apparently weren't! So, you have to manually do :

x, y, z, t = symbols( 'x y z t') 
only to find that

NameError: name 'symbols' is not defined

And then,

from sympy import symbols

That gets

expr = (x + y)**3
To NOT complain.

Now, when you do expr, you get the Unicode formatted pretty thing with the 3 really looking like a superscript. Not what you want obviously :)

So, what does work :

from sympy import init_printing
init_printing()

Now, when you do

expr

You get




Wednesday, December 26, 2018

Where We Need Alex Skorkin and Stephen Jungels to Deliver

Do a version of ALT-LEFT and ALT-BKSPCE (for bash) that will treat underscore as a word delimiter..

How do you do this?

There are times when I want to treat whole_word as one word and some times, as two.

Yes, I have OCD :)

Tuesday, December 25, 2018

Eugen Sandow : Strength and How to Get It

The man was ahead of his time. He knew that really was about mind over matter :

HUNDREDS of letters reach me daily, asking "Can I become strong?" Yes; you can all become strong if you have the will and use it in the right direction. But, in the first place, you must learn to exercise your mind. This, first of all lessons in physical training is of the utmost importance. For on it the whole of my system depends. If physical exercise alone and unaided could achieve the desired end, then would every one who, like the breaker of stones, has to use his muscles to earn his daily bread, become, in a popular acceptation of the term, "a strong man." The breaker of stones, however, never uses his mind. He has to get through a given amount of work, and his method is purely mechanical. Though he may use his muscles in hard work every day of the year it is unlikely that his strength will ever materially increase.

Exercise, indeed, without using the mind in conjunction with it, is of no use. It is the brain which develops the muscles, Physical exercise must be commenced by degrees, first bringing into play one muscle, then two, then three, and so on, being careful all the time to put the mind into every movement. Let me strongly advise every student to study well the anatomical chart which is published with this book. By its aid you will be able not only to receive a useful lesson in anatomy, but you will also be able to see at a glance the exercise by which each muscle may be developed.

So charming, the last word :

The reader will probably ask if special means were adopted during this and succeeding engagements to maintain my strength. The answer is very simple : The performance itself provides the necessary amount of daily training. I eat, drink, smoke and sleep quite in the ordinary way, taking care to observe in all things that guiding rule of moderation to which reference is made in the preceding chapter. I only practice, in order that grace and perfection may be attained, when some new feat is introduced. Personally, it may be added, I find that the best time for a performance is about three hours after a meal.

Saturday, December 22, 2018

Productivity Manifesto

Commandment What it Really Means
Plan your day the night before Begin with the end in mind :)
Get the big rocks in Don't sweat the small stuff - make a start on the big!
Do the hardest task first If you have three similar blocks to design, design the most complicated one and you've done all three. If you go in ascending order of complexity, you'll be doing three blocks :)
Single-task: For high level work Focus -  with talmudic intensity!
Multi-task: For low level work Fold clothes and talk on the phone - that's ok :)
Ditch the unimportant Don't sweat the small stuff. Watch your portfolio
Use a to-list Mental accounting is the bane of modern existence
Use a do-later list: For unimportant tasks Excel helps to not-lose them
Create your productivity system Know what works for you
First be effective, then be efficient Getting it done more important than how you do it - just ask your boss :)
Quit procrastinating Applies to getting out of bed as well :)
Use productivity tools Know what works for you
Meditate: Clears your mind, increases focus And can improve other functions as well
Get a headstart Move the worry curve in - there's always some bad news lurking out there :)
Practice 80/20 rule Watch your portfolio of goals and targets
Clear your mind: Do a brain dump Mental accounting is the bane of modern existence
Be organized Losing time searching for things is sin :)
Delegate where needed Leverage the network of helpers
Outsource work better done by others Leverage the network of helpers
Eliminate time wasters Don't sweat the small stuff - is it important?
Master your skills Plan / Excecute / Debrief to become the best
Tap into your productivity periods Know when you're at your best. A shower can help :)
Go with the path of peak enjoyment wha?
Just do it Make a start. Editing will follow naturally
Be well rested Know when you're at your best. A shower can help :)
Learn from the best Heredity can only do so much - seek mentors/coaches out
Search and reapply Make it easy to find your own tools
lmprovise on your performance Incremental advances add up
Read productivity materials Know what works for you
Create your life handbook But you have to remember to use the checklist :)
Batch similar tasks Plans are useless but planning is indispensible
Use the best tools You *can* program in assembly language if you want
Reward yourself But practise healthy habits
Learn to say No Watch your portfolio of goals and targets
Quit to win Keep your eye on the ROI - is it important?
Create a conducive environment Know what works for you
Improve your posture Get the adjustable desk unless you're a luddite
Delete limiting thoughts Self awareness is your friend
Cut down on commuting time If you're reading this, you like being in control. When you're commuting, you're NOT!
Time box: Set a fixed amount of time Move on and let the brain process it
Set a target Begin with the end in mind :)
Set a deadline Work always expands to fill the time available for it
Keep your emails in check Check email just a couple times a day - or try to :)
Plan your task And debrief - what? Right? Wrong? Why? Learning?
Be on time Bloomberg - 80% of success if show up - early
Visualization Leave no stone unturned
Practice makes perfect No! Perfect practice makes perfect. Practice makes permanent
Use overwhelming force Leave nothing to chance
Get a coach How?
Time out (Have a vacation/break) Recharge and sharpen them saws

Bill Crawford : Excecution != Excellence

Being stuck in execution is like being the hamster on the treadmill.

Plan, Execute, Debrief, Repeat... if you want to be the best at what you do.

Debrief :
  • What happened?
  • Why?
  • What went right?
  • What went wrong?
  • Why?
  • What can we learn?

Wednesday, December 19, 2018

The Moscow Rules

  1. Assume nothing
  2. Never go against your gut
  3. Everyone is potentially under opposition control (except Iniesta)
  4. Don't look back. You are never completely alone
  5. Go with the flow. Blend in!
  6. Vary your pattern and stay within your cover
  7. Lull them into a sense of complacency
  8. Don't harass the opposition
  9. Pick the time and place for action
  10. Keep your options open
Guess there's something to it - else we couldn't have won the cold war :)



About building rapport :

  1. Don't come across as judgy. Avoid statements like, "I don't get why you would do or think that."
  2. Avoid giving advice. What people want is approval. You want to say something along the lines of, "That was a smart move," rather than, "You should do it this way."
  3. Don't be the person who has to win the argument - let the target win.
  4. Don't be a one-upper. If the target tells you about his biggest sales coup, don't top it with a story about how you actually sold more.
  5. Avoid interrupting the target when they're speaking.
  6. Never downgrade their status or profession.
  7. Never finish their sentences for them.

After Jason Hanson, What?

Survive Like a Spy is Ok. Cute - Like Clint Emerson's work.

Try getting your hands on Spy Combatives. It's good to know how to be able deescalate situations. You know how annoying some immature coworkers can be :) The co-author trained with Chuck Norris for 36 years!

SOE Close Combat Syllabus taught by badass Brits :) : http://www.gunthorp.com/Close%20Combat%20Syllabus.pdf

Get Tough by W. E. Fairbairn

The best of Jason Hanson :

How do you keep your identity private?


Did you use TOR in relation to your work? How can you assure your identity will not be discovered when navigating an open web or deep website using Tor/Tails (say, by an ISP, man in the middle, or an attack from the server designed to reveal your identity)?
Hanson: “I do use a VPN on my computer. I stay out of any places where I’m worried I will be discovered. Truthfully, I’m much more worried about my physical safety and making sure people can’t find me, which is why I have nothing delivered to my house (I use a UPS store as my address) and why my driver’s license and my car registration, etc. all have the UPS store address.

You can use an LLC or a Trust to buy your house. (And have the LLC address be your P.O. Box or UPS store address).”

What John and Hector (code name for the Korean professor who know the Hungarians) accomplished :

https://apps.dtic.mil/dtic/tr/fulltext/u2/a064354.pdf : Army Missile Research and Development Command : Holographic Optics for Missile Guidance Systems. B Guether and C Leonard. Who are these geniuses? The tech material reads like Walter Scott for me! Poetry! On page 1, they misspell the former Duke Professor's name … it is Guenther.. I don't recall watching anything before on YT with an awe-inspired jaw-gape.

BTW, what does spymaster (well, with six kids, how do you choose to be a spy in the first place - don't you want to be there for your kids and NOT put your life on the line?) keep in his bugout bag :

  1. A tomahawk (ensure the bag, fully loaded, is less than 25 lbs he says)
  2. A kukri (dagger)
  3. Collapsible backback (nice, a bag within a bag)
  4. Survival blaze - firestarter ($5)
  5. Survfilter - world's best water filter unless you go look at what the Israelis have ($99)
  6. Tourniquet
  7. First-aid kit
  8. Tube tent
  9. Bic lighters
  10. Paper map
  11. Food (survival food - just add water)
  12. Pancho (deal with rain)
  13. Knives - NOC
  14. Mess kit (pots,pans, silverware) for food prep
  15. Water purification kit (Chlor-flocc)
  16. Versa knife
  17. Multi-tool
  18. Matches (multiple ways to start a fire)
  19. Gun oil
  20. Scalpel. 
  21. Flashlight
  22. Dryer lint
  23. Bandana
  24. Emergency drinking water pouch.
  25. Emergency blanket
  26. Medical tape

Sunday, December 16, 2018

Stephen Jungels is Cool, But..

Why not tell people what to do when you don't have lynx on your Cygwin?

https://github.com/transcode-open/apt-cyg#quick-start

Ans :

$ wget rawgit.com/transcode-open/apt-cyg/master/apt-cyg > apt-cyg

$ install apt-cyg /bin

An NEdit Shortcut for Inserting the Date

You need to execute a unix command (depending of course on the format you want. This applies to 12/16/18 style date ) like

$ date +%m/%d/%y

das große problem : NEdit interprets the "%" :(

So you have to tell it to send unix something that date can then use. That is, the 

"%m/%d/%y" needs to magically appear before the date command is executed.

Enter command substitution and the answer :

$ date +`perl -e 'print "\045m/\045d/\045y";'`

You see how it arbeitet? First, the perl command is executed and the result is placed in the date command. The perl command uses octal codes to put the % in the print statement - so NEdit is clueless. 

So, what do YOU do? Do ALT-x, and enter this, and see that it works. Then, go into record macro mode and record this, and then do the Preferences > Default Settings > Customize Menus .. thing :)

Enjoy!

Now, what if you want something like "Dec 16 2018" :

date "+%b %d %Y"

Phew - how little I know :) If you use backticks for command substitution, this new one will give you grief. Turns out, the professional way to do command substitution is $( )

So, start with (in NEdit ALT-x execute command dialog ) :

date "+$(perl -e 'print "\045b \045d \045Y";')"

And all is well :) Thanks to the maestros :)

Friday, December 14, 2018

Killer Excel Macro : A Button to Toggle Hide/Unhide of Rows

  • Start with a file that's already named .xlsm . Save time later :)
  • Know which rows? Say 10 to 12 (inclusive)
  • Right click on the name of the Sheet on the bottom of the Excel window and choose "View Code"
  • Now, paste :
Sub sbHidingUnHideRows()
    If Rows("10").EntireRow.Hidden Then
    'To unHide Rows 10 to 12
        Rows("10:12").EntireRow.Hidden = False
    Else
    'To Hide Rows 10 to 12
        Rows("10:12").EntireRow.Hidden = True
    End If
End Sub

  • And tweak it to be what you want. Then, do ALT-Q. If you go into Macros, you'll see this one..
  • Then, to create the button, go to Insert (File, Home, Insert, Draw, on the top of the Excel window)
  • Here, choose Shapes and put down something nice. Remember da Vinci : Simplicity is the ultimate sophistication.
  • Edit the Text associated with this shape.
  • Then, right-click on the shape and choose Assign Macro, pick the one you just created. And..
  • You're in business.. 

Autodesk's Beginners PCB Design Tips

(Right click and choose Open in New Tab, and, there, your mouse pointer turns into a magnifying glass)

https://www.autodesk.com/products/eagle/blog/top-10-pcb-component-placement-tips-pcb-beginner/

Sunday, December 02, 2018

Using a File on Your PC as the Background Image in CSS

This one's hard to find online for some reason

body {
         background-image : url("C:\path\to\file");
}

Seems right intuitively, except, it doesn't work. What does work? "file:///C:/path/to/image"

How should you know? Open the file in your browser first - and pay attention :)

Thursday, November 22, 2018

Another Key to Jewish Success

 From the bio of the father of fractals :

During his first two school years, he was tutored privately by an uncle who despised rote learning: "Most of my time was spent playing chess, reading maps and learning how to open my eyes to everything around me."

Saturday, October 13, 2018

They Came to Kill a Killer

 And they did the job.. Kudos to the Israelis for doing what was needed to keep their people safe (FYI, these people are able to exit a hotel room in such a way that the latch and chain are engaged on the inside! Explains why they had to hustle so much "equipment" out of there after the hit), but... after watching the video the Emiratis pieced together, you have to wonder..

For the "victim" (a guy in town to buy weapons to be used to kill people) :

If there was so much at stake, why be *so* dumb - checking into your hotel without ensuring that the front desk is clear so that there's no one around to snoop? Why not have an unknown friendly from your side tail you to watch for surveillance? Why not work with a battle-buddy? And! Biggest of all - why not ask to be in a room *with* a surveillance camera? Here's a gadget this spawns - a second entry prevention device that is formed from the handle of your suitcase. See - wheels on luggage have a new purpose - inspired by self-driving cars. You go out of the room and use the app on your phone to get the suitcase to position itself behind and "lock" it - immobilize the door in some way. And how about this - considering this was a guy who routinely checked doors for tinkering, etc, why not set up a wake-up call for one minute after you enter. And duh! How about just being one the phone with a friendly party when you're getting into your room - the highest risk situation you're going to encounter on such a trip! And duh! why not take a page out of the Mossad playbook - send your guy there one week ahead to scout out the place and figure out which is the safest room to stay in! Gimme a b!

As for the institutions that play host to such events, there are so many giveaways - baseball caps, golf caps - can't you have a system that flags if there are too many instances of these all of a sudden? Years ago, I got to see the security center of a multinational and the security chief bragged that tech was so good that you could use video-analytics to be alerted if two people got out of a car and went in different directions. Really? In that case, why can't an outfit with the $ have something that flags : people working in teams, looking behind them as they walk away from a location in a hurry, too many people going into the same hotel room

Here the Mossad shows you how to do it - how to you put a surveillance team in the middle of a hotel lobby? Easy - a couple that is closed - facing each other, one pretending to be on the phone and the other pretending to be waiting for this couple to finish.

In my opinion, this too is chicken-feed for any video-analytics platform worth its salt - first of all, this guy has been loitering. Now, why can't the system flag a guy intentionally accosting a stranger - obviously to delay him?


Someone should come up with a service you can subscribe to that will give you alerts on the threat level - two burly guys in your immediate vicinity. 


From Wikileaks - what the folks on Stratfor were able to find :

Targeted Killing in Dubai. A Mossad Operation Gone Awry?

http://www.spiegel.de/international/world/0,1518,druck-679764,00.html

The assassination of Hamas functionary Mahmoud al-Mabhouh is widely believed to have been the work of the Mossad. But why would Israel's legendary intelligence service allow the identity of its agents to be compromised? The affair looks set to damage the Mossad's reputation -- and unleash more bloodshed. By SPIEGEL staff.

It could have been Dubai's unofficial entry in the Berlin International Film Festival: A 27-minute reality thriller, edited from footage shot with two dozen surveillance cameras, with constantly shifting settings, close-ups and freeze frames, with subtitles artfully entering the frame from the edge and colorful hand-drawn circles à la Jean-Luc Godard. It was also a film that was significantly more suspenseful than most of the other entries in this year's festival.

What Dhahi Khalfan Tamim, the 58-year-old police chief of Dubai, showed the public on Monday of last week was a previously unknown insight into the practice of "targeted killing," the hit squad-style murder of a political and military enemy. In this case, it was the killing of Mahmoud al-Mabhouh, the presumed chief weapons buyer for the radical Islamist group Hamas, in a Dubai luxury hotel by a team of professional killers.

It was undoubtedly a premiere. Never before has an intelligence operation been documented with such detail and so soon after the act. Documented, that is -- but not cleared up.

'The Trickiest Case of My Career'

On Jan. 20, at 1:30 p.m., hotel employees opened the door to room 230 in the Al Bustan Rotana Hotel. The guest, al-Mabhouh, had not responded to a number of telephone calls. He had been seen walking through the lobby on the previous evening, carrying a bag containing a pair of shoes he had just bought. The door to room 230 was locked from the inside.

The guest was found dead. According to the death certificate issued by a doctor at the Rashid Hospital, al-Mabhouh had died of a brain hemorrhage. But it would soon become clear that the doctor's conclusion was somewhat premature.

Al-Mabhouh was murdered. The coroner, Dr. Fawzi Bin Omran, the head of the forensics department of the Dubai police and a man with 27 years of experience, took nine days to prove that al-Mabhouh's death was a crime. "It was the trickiest case of my career," he says.

Now, four weeks after the killing, the case is becoming really tricky, particularly for the leadership of the country where it now seems highly likely the killers are from. It is an assumption based on circumstantial evidence, although that evidence is very strong. According to SPIEGEL's inquiries in Israel, the elite Kidon unit of Israel's Mossad foreign intelligence agency conducted the operation. Initial reactions in Israel also suggest that this is the case. While the government in Jerusalem, true to form, has neither confirmed nor denied the allegations, the Israeli press celebrated al-Mabhouh's killing. Haaretz called the operation "professional," while a former member of the legendary Mossad called it "super-super professional."

Identity Theft

But now the costs of the consequences of the spectacular operation are becoming apparent, and its impact on domestic and foreign policy is becoming clear. The faces of the 11 killers (out of a total of 18 members of the hit team), which the Dubai police chief presented in his video, are now known to the public. And now the agents, 10 men and one woman, can "not even go shopping without being recognized," says Ronen Bergman, an expert on Israeli intelligence.

At least six of the agents misused the passports and identities of Israeli citizens, who were completely unaware of this abuse. They are shocked and are demanding an investigation. By Wednesday of last week, the celebratory mood in Israel had evaporated. The daily Haaretz even called for the resignation of Mossad chief Meir Dagan.

Because these victims of identity theft are all people with dual Israeli and European citizenship, the governments of Britain, Ireland, France and Germany have also been drawn into the affair. Based on their almost unanimous reactions, it seems clear that they hold Israel responsible for the operation carried out by the "Dubai 11." London summoned the Israeli ambassador to appear at the Foreign Office. Member of Parliament Menzies Campbell said that "the Israeli government has some explaining to do," while Foreign Secretary David Miliband called the Dubai killing an "outrage."

Ireland was next, followed by France and, on Thursday, Germany, where Foreign Minister Guido Westerwelle used unusually frank language when he said: "In light of the information revealed to date, I believe that a thorough investigation into the circumstances of the death of Mahmoud al-Mabhouh is urgently needed."

Germany avoided summoning the Israeli ambassador, but Westerwelle's Middle East envoy, Andreas Michaelis, demanded that Jerusalem's envoy provide him with all information that could help shed light on the circumstances of the killing.

Is Mossad Taking Greater Risks?

Berlin is mainly interested in two questions. First, why did one of the presumed killers travel to Dubai with a German passport, issued in Cologne on June 18, 2009? Second, why was a senior Hamas official murdered at a time when the Bundesnachrichtendienst (BND), Germany's foreign intelligence agency, had been mediating a prisoner exchange deal between Israel and Hamas for months?

It is well known that, when Israel believes its security is threatened, it flaunts international law, ignores its allies and, as in the Dubai case, does not hesitate to offend moderate Arab countries. But there is something else that distinguishes the latest targeted killing from earlier cases. This time, the Mossad was apparently prepared to accept the possibility that the identities of its agents would be revealed. In fact, it was even willing to jeopardize the security of Israel's own citizens, whose very protection it cites as justification for its actions.

This amount of chutzpah raises important questions. Faced with the pressure of a growing conflict with Iran, is the Mossad taking even greater risks than before? Was the exposure of the agents merely a mistake, one that the Israelis were prepared to accept? Or could it be that the operation in Dubai wasn't the work of the Mossad but a false flag operation, as former Mossad agent Rafi Eitan, 83, one of the men who captured Nazi war criminal Adolf Eichmann, speculates? According to Eitan, the only possible explanation for the fiasco is that "a foreign agency, an enemy of Israel, is trying to harm Israel."

But if Israel is behind the attack, as currently seems much more likely, and if the Mossad knowingly accepted the risks, the death of Mahmoud al-Mabhoud must have been very important to Jerusalem.

The Ideal Place to Commit a Crime

On Jan. 19, at 3:15 p.m., the Palestinian entered the United Arab Emirates through the Dubai airport. He arrived on board Emirates flight EK 912 from Damascus. He hadn't come to Dubai just to buy shoes.

Al-Mabhouh was one of the most wanted Hamas leaders. Israel added the 49-year-old's name to a death list in 1989, after al-Mabhouh, disguised as an Orthodox Jew, took part in the killing of two Israeli soldiers. He bragged about the killing in an interview with the Arab television network Al-Jazeera only 10 months ago. Al-Mabhouh was one of the founders of the Izzedine al-Qassam Brigades, the military arm of Hamas, and he is believed to have played a central role in the smuggling of weapons into the Gaza Strip.

On Jan. 19, 18 intelligence agents, disguised as tourists, also landed in Dubai. They too initially gave the appearance of having come to the emirate to visit its shopping malls.

The Al Bustan Rotana Hotel, which calls itself "one of the world's leading hotels," is particularly popular among transit passengers looking for a place to stay after arriving late at night. Travelers are constantly pulling their trolley cases across the polished marble floor in the lobby, where sounds are muffled by fountains and thick carpeting. The rooms on the third floor of the hotel are located along a narrow hallway with only one access point, making them easy to secure -- and an ideal place to commit a crime.

German Passport Was Real

On the same day as al-Mabhouh, two agents arrived in Dubai from Paris under the cover names Kevin Daveron and Gail Folliard, both carrying Irish passports. Daveron checked into the Emirates Towers hotel.

Peter Elvinger, who is believed to have been the head of the hit team, arrived in the early hours of Jan. 19. He was carrying a French passport, entered the country without any problems and took a room at another hotel. But while still at the airport, Elvinger met with a Palestinian living in Dubai, a former security officer with the Fatah movement, Hamas's enemy. The former Fatah officer was one of two Palestinians who would later be extradited from Jordan to Dubai, and he is now in pretrial detention. According to press reports, one of the two men admitted to having provided logistical support for the operation.

Four other teams of two agents apiece landed in Dubai, on flights from Rome and Frankfurt. It was an operation built on stolen and made-up identities. The individual perpetrators adopted the identities of other living individuals to commit the planned murder.

Those individuals include, at least, six uninvolved people with British and Israeli dual citizenship, who saw their pictures in the newspaper on the day after the Dubai film was released.

It does not appear to be the case, however, with a man who went by the name Michael Bodenheimer, born on July 15, 1967, who arrived in Dubai on the day of the assassination carrying a German passport. At first, German authorities assumed that the passport was a professional forgery. But further investigations revealed that the murder had apparently been planned much earlier than investigators initially believed.

A Serious Strain on German-Israeli Relations?

In the early summer of 2009, a man named Michael Bodenheimer went to the local residents' registration office in Cologne, where he applied for a new passport and a new identification card. He claimed that he was a German citizen, unmarried, who had been born in Israel. He invoked Article 116 of the Germany constitution, which permits individuals persecuted by the Nazi regime, as well as family members who were expatriated, to regain German citizenship. He presented the Cologne authorities with the supposed marriage certificate of his parents and an Israeli passport, issued in Tel Aviv in November 2008.

Bodenheimer provided the authorities with an address in Cologne's Eigelstein district. However his name is not listed on the mailbox at the address, a modest beige-colored apartment building. The building is in an area near the train station and has a high turnover of tenants -- the perfect place for someone who doesn't want to be noticed.

Bodenheimer claimed that his Israeli residence was in Herzliya, a city north of Tel Aviv. But the trail ends there, in the city's business district. Although Michael Bodenheimer is listed as the name of a company in the lobby of a modern, four-story office building, a security guard says that the company moved out half a year ago. As coincidence would have it, the Mossad headquarters is only one kilometer away.

Bodenheimer received his German papers on June 18, and it seems very likely that the assassination was completed with the help of an official German government document. Bodenheimer was apparently in charge of communications for the hit team. The Cologne public prosecutor's office launched an investigation on Friday into alleged document falsification. Federal prosecutors are considering initiating an investigation into possible activities by intelligence agents. Because of such investigations, the affair could expand into a serious strain on German-Israeli relations.

'No Problem, Sir'

The hit teams spent the afternoon of Jan. 18 deliberately trying to create confusion. They went shopping in the malls, and checked in and out of various hotels. It was an elaborate, carefully orchestrated way of placing the agents in position. The operation was coordinated through Austria. None of the teams contacted each other by telephone, and all of the agents used numbers provided by Austrian mobile phone provider T-Mobile.

Al-Mabhouh, a stocky man with a moustache, arrived at the Bustan Hotel at 3:25 p.m. He had developed a habit of turning around every few steps. Nevertheless, he didn't seem to notice that two guests carrying tennis rackets and with towels thrown over their shoulders crowded into the elevator with him as he was about to take it to the third floor.

The pretend tennis players noted the number of al-Mabhouh's room, 230. One of them typed it into his mobile phone, as well as the number of the room across the hallway, 237, and sent a text message containing the two numbers.

Elvinger, the presumed head of the operation, called the Bustan 20 minutes later from the business center at the Crowne Plaza Hotel and asked whether room 237 was available. "No problem, sir," the reservation agent replied. Then Elvinger booked his return flight to Munich for that same evening.

Al-Mabhouh spent his last afternoon in one of the city's large shopping malls. He met a few people whose identity has yet to be determined. When he returned to his hotel at 8:24 p.m., he waved a greeting to a man in the lobby.

A Ticket to China

Why was al-Mabhouh in Dubai? "I don't know," Dhahi Khalfan Tamim, the Dubai police chief, later told SPIEGEL. Was he on his way to Iran? "Absolutely not. Why would he do that? There are three direct flights from Damascus to Tehran every day." Hamas leader Khaled Mashaal, who lives in Damascus, always travels directly, Tamim said.

But if he wasn't headed for Iran, where was al-Mabhouh going? "As far as I know," said Tamim, "he had a ticket to China and, from there, to Sudan -- or perhaps the other way around. Maybe he stopped here to relax. Certainly not to be killed."

The Hamas leader was shadowed all afternoon by people wearing the uniform of the typical Dubai tourist: baseball cap, shopping bag and T-shirt.

One of the surveillance cameras filmed Gail Folliard disappearing into an underground garage carrying a large number of shopping bags, only to reemerge without the bags. This may have been the way the group divided up the electroshock devices and electronic door-opening equipment.

Elvinger picked up the keycard for room 237 shortly after Mabhouh had left the hotel. He gave the card to Daveron and then left for the airport. The logistics had been set up, and now the machine was in full swing, prepared for the murder of one of Israel's most bitter enemies.

On the Israeli's Hit List

It can take months, or even years, for a man like al-Mabhouh to be added to the Israelis' hit list. Former Mossad agent Aaron Klein describes the decision-making process in his book "Striking Back," about the killing of the masterminds of the massacre of Israeli athletes at the 1972 Munich Olympics:

First of all, Mossad, acting as a kind of unofficial public prosecutor, gathers information about terrorists who are personally responsible for the deaths of Israeli Jews. If the head of the Mossad believes that there is sufficient evident to justify liquidation, he notifies the prime minister and an informal group, previously known as "Committee X" in intelligence jargon, meets. In addition to the prime minister and the Mossad chief, the group usually includes the defense and foreign ministers, occasionally the interior minister and the head of the domestic intelligence agency Shin Bet, and often the prime minister's adviser on terrorism.

Each case is handled individually and apparently not all cases are simply waved through. In fact, decisions have to be unanimous. Someone who once took part in the procedure likens it to a trial, with the Mossad chief in the role of prosecutor and the others acting, if not as defense attorneys, at least as skeptics.

After the 1972 Munich Olympics massacre, legendary Israeli Prime Minister Golda Meir announced a guideline to the Israel parliament, the Knesset, that would shape the country's future approach. Wherever an attack was being prepared, wherever people were planning the murders of Jews and Israelis, she said, "that is precisely where we must strike." In other words: worldwide, including in Europe. And it was in Europe -- in Rome, Paris and Cyprus -- where many of the Munich attackers were later killed.

Some prime ministers are said to have been very quick to issue death sentences. Others, like Yitzhak Rabin, took their time.

Spectacular Successes and Mistakes

The Mossad thrived on its legend, as long as it was achieving spectacular successes, such as in 1956, when it smuggled a famous secret speech by Soviet party leader Nikita Khrushchev, in which he criticized the crimes of Josef Stalin, out of Russia; in 1966, when it kidnapped a MiG 21 fighter jet out of Iraq; or in 1981, when it did the reconnaissance work for Israel's bombing of the Osirak nuclear reactor in Iraq.

But the Mossad has also made some spectacular mistakes. As far back as the early 1950s, the service disgraced itself with the so-called Lavon Affair, a series of fire-bombings of cinemas and post offices in Egypt. The attacks were intended to destabilize the Egyptian regime, but the operation backfired completely. On July 21, 1973, agents killed a Moroccan waiter in front of his pregnant wife in Lillehammer, Norway. They had believed, erroneously, that he was Ali Hassan Salameh, one of the leaders of the Palestinian organization Black September.

Despite such failures, the Mossad was long able to preserve its standing as the best intelligence agency in the Middle East. The recklessness with which it apparently proceeded in Dubai could thoroughly damage this reputation, however.

The Woman in the Dark Wig

The actual killers entered the hotel at 6:34 p.m. They came in two teams, each consisting of two agents. All four agents were broad-shouldered men wearing baseball caps and backpacks, and carrying shopping bags. The two reconnaissance teams already in the Bustan were pulled out, to avoid raising suspicion, and replaced with two other teams, one disguised as a tourist couple wearing sun hats.

Gail Folliard and Kevin Daveron were supposed to secure the hallway. Both had changed into their disguises earlier, in different hotels in the vicinity. Both were wearing wigs, and Daveron was wearing a fake moustache and the uniform worn by Bustan Hotel employees. At 8 p.m., shortly before the killing, he was approached by a guest who couldn't find his room. Daveron managed to stall the man and warn another team, which was in the process of breaking open the door to Mabhouh's room.

All door locks in the Bustan are secured by a sophisticated card system that records all attempted openings. At exactly 8 p.m., the system recorded an attempted opening by an unknown card that was inserted into the lock of room 230.

At 8:24 p.m., Mabhouh returned to the hotel, entering it through the revolving door in the lobby. He was carrying a plastic bag containing his new shoes, and he took the elevator to the third floor. He failed to notice the man with the moustache, wearing a hotel uniform, or the woman in the dark wig, who had been pacing back and forth across the patterned brown carpet for the last half hour.

Intended to Look Like a Natural Death

No cameras recorded what happened in the next 19 minutes. According to the investigations conducted to date, an electroshock device was apparently used to stun Mabhouh when he entered his room. It is not known whether the four assassins were already waiting for him in the room or attacked from room 237, across the hallway.

It appears that the Hamas leader was then suffocated with a hotel pillow. The killing was supposed to look like a natural death.

By 8:46 p.m., two of the four agents were already standing at the elevator, waiting to take it back downstairs.

The adrenalin-fueled tension in the men is recognizable in the video images. Like boxers, they keep shifting their weight from one foot to the other. One of the two has even forgotten to remove his rubber glove.

The hit squad left the Bustan in teams of two and took taxis to the airport. On the videos, Folliard is shown walking arm-in-arm with another agent, carrying a plastic bag in her left hand.

Daveron secured the retreat. He was the last to leave room 237, talking on his phone and pulling his trolley bag behind him.

Dubai Police Come Out Looking Good

Everything went according to plan. A short time later, Daveron and Folliard were sitting on a flight to Paris and two others were on a plane bound for South Africa, while Mabhouh was still lying undiscovered in room 230.

The commando operation took less than 24 hours. But after it ended, nothing went according to plan.

The agents knew that they had been filmed on surveillance cameras at the airport, at taxi stands, in hotel lobbies and in front of elevators. But they were apparently confident that no one in Dubai would be capable of analyzing, or would even take the trouble to analyze, countless hours of video footage. That was a mistake.

"The big surprise lies in the ability of the Dubai police," says Israeli intelligence expert Ronen Bergman, "to have put together all of this material to assemble a single picture. That's an extremely complicated undertaking." The Dubai police, says Bergmann's colleague Ben Kaspit of the Israeli daily newspaper Maariv, "emerges from this entire situation looking the best."

Those police efforts ended up being detrimental to the Israelis, despite being an initial source of amusement. "Do you recognize them?" Maariv asked its readers on the day after the Dubai police published the photos of the suspected assassins. Israel is a small country, with 7.5 million people living in an area smaller than the US state of West Virginia. In a spirit of amusement rather than concern, Israelis across the country began scrutinizing one another, checking out café patrons in Tel Aviv, neighbors in kibbutzim and parents in kindergartens.

Legal Identity Theft

When Or Kashti saw the photos, he could hardly believe his eyes. Kashti is the education editor at the Israeli daily newspaper Haaretz, and he is a dead ringer for the man with the cover name "Kevin Daveron." Kashti received the first call early in the morning. It was his mother, and she asked him carefully whether he had been abroad recently. Later, while he was standing in a supermarket between the tomato and eggplant shelves, an older woman slapped him on the back and said: "Congratulations, you guys really stuck it to that Arab."

But not everyone was so pleased -- particularly the six Israelis whose names and identities were actually used by the hit squad. "This is horrifying," says Stephen Daniel Hodes, who immigrated to Israel from Britain years ago. "I haven't left Israel in two years, and I've never been to Dubai." Paul John Keeley, who lives on the Nahsholim kibbutz south of Haifa, is also shocked. "Who do you call when someone has stolen your identity?"

It's a good question, one which has no answer. Even if the six Israelis could prove that the Mossad used their identities, a lawsuit would hardly succeed. Under Israeli law, document forgery is not illegal if it is authorized by the government.

For Prime Minister Benjamin Netanyahu, however, this is already the second time a Mossad intelligence operation has gotten him into diplomatic hot water. During his first term, in 1997, he ordered the liquidation of Hamas leader Khaled Mashaal in the Jordanian capital Amman. When the agents sprayed a nerve toxin into Mashaal's ear as they walked past him in broad daylight, they were taken into custody by the Jordanians. To secure their release, Netanyahu had to hand over the antidote and release the co-founder of Hamas, Sheikh Ahmad Yassin.

Looking for New Recruits

In the al-Mabhouh case, the assassination was successful, but keeping it a secret wasn't. Jerusalem has remained officially silent on the Dubai police claims. This "policy of ambiguity," as Foreign Minister Avigdor Lieberman calls it, is meant to protect Israel's own agents, while simultaneously deterring terrorists and sending them the message that they will never be safe anywhere in the world.

But whether this policy of deterrence is working is doubtful. Even if Hamas's supply of weapons in the Gaza Strip is interrupted for some time as a result of the al-Mabhouh killing, others will sooner or later take his place. "It isn't clear that Mahmoud al-Mabhouh was worth the trouble," fears journalist Ben Kaspit.

Few Israelis question the idea that targeted killings are morally justified. "We forgot long ago that a state based on the rule of law doesn't use death squads," says left-leaning journalist Gideon Levy.

The Mossad, which is presumably no longer able to use 11 of its agents, is already searching for new recruits. There is a job application form on the agency's Web site (www.mossad.gov.il), under the keyword "career." The areas where potential intelligence agents are needed, according to the site, include computer technology, logistics and "special projects."

DIETER BEDNARZ, ERICH FOLLATH, CHRISTOPH SCHULT, ALEXANDER SMOLTCZYK,

HOLGER STARK, BERNHARD ZAND

Translated from the German by Christopher Sultan

--

Sean Noonan

ADP- Tactical Intelligence

Mobile: +1 512-758-5967

Strategic Forecasting, Inc.

www.stratfor.com1