Mac Adressbuch für AVM Fritzbox – Version 2 – Os X – IpyFritz

Für die Fritzbox 7270 und 7390 arbeitet AVM gerade im Labor an neuen Features für das Adressbuch der Fritzbox. Die neueste Version meines iPyFritz-Programms könnt Ihr euch hier downloaden:

iPyFritz_v1.1_Beta

Die neue Beta ist jetzt objektorientiert geschrieben und hat folgende Features dazubekommen:

  • Wichtige Kontakte sind solche mit Niknames/Spitznamen
  • Bilder für das Fritzphone der wichtigen Kontakte / es muss das Verzeichnis “pics” existieren in dem Pfad wo auch die Datei liegt.
    Die Bilder müssen dann per FTP o.ä. auf die Fritzbox in das Verzeichnis /InternerSpeicher/Bilder/ geschoben werden. Alternativ geht auch USB-Stick. dann muss der Pfad im Script angepasst werden. Die kryptische Benamung der Bilder ist aus dem Problem enstanden das keine Umlaute und Sonderzeichen in den Dateinamen rein sollten. Für das phone ist es relativ egal – wie die files heißen.
  • Wichtige bekommen zwecks Sortierung eine Nummer vor den Namen – damit tauchen sie im Fritzphone oben auf.
  • Kontakte ohne Telefonnummer werden nicht exportiert
  • Email-Adressen werden mit exportiert
  • Es  kann alternativ pro “Gruppe” eine Datei exportiert werden. Hierzu muss die Zeile ipyfritz.all_groups() aktiviert und die Zeile ipyfritz.general_addressbook() gelöscht werden.

Viel Spass -

Posted in Allgemein, Joes Daylies | Tagged , , , , , , , , , | Leave a comment

SAP-BI: Delete Transformation on productive system

Belongs to the category: Good 2 know

Class CL_RSTRAN_STAT
Method DELETE_VERSION_FROM_DB
Parameters:
I_TRANID: "techn. name of tranformation"
I_OBJVERS: 'A' for active; 'M' for inactive transformations
Posted in Allgemein, Joes Tests | Tagged , , , , | Leave a comment

SAP-BI: Starting Process-Chain via Programm RSPC_API_CHAIN_START and wait for result

Sometimes you want to start a Processchain via programm and wait for it to end. This is a bit tricky as a Processchain starts normaly in Background and doesn’t give you a result if it is ended correctly.
SAP provides for !!!small!!! Processchain the Function

RSPC_API_CHAIN_START

This can be called synchonous with the following example:

call function 'RSPC_API_CHAIN_START'
exporting
i_chain = 'ZMYPROCCESSCHAIN
* I_T_VARIABLES =
i_synchronous = '
X'
* I_SIMULATE =
* I_NOPLAN =
* I_DONT_WAIT =
* IMPORTING
* E_LOGID =
exceptions
failed = 1
others = 2
.

What you have to know is – the result of this function is given on the !!!first!!! finished step – and !!!not!!! for the whole chain. To wait you have to use a little trick:

While using a one-step-chain with a Sub-Processchain this little problem is solved.

Posted in Allgemein, Joes Daylies, Joes Tests | Tagged , , , , | Leave a comment

My 2 Cents: € oder $ – in alter Tradition

Der Euro fällt – nun ja – nur gegenüber dem Dollar. Und das – ist erstmal nicht die Bohne tragisch. Außer man hat als Amerikaner in Euro-Land investiert. Dann kann man schon mal die Krise bekommen.

Für einen Euro bekommen wir aktuell 1,23 USD. Das ist innerhalb von ein paar Monaten – schon ein böser verfall.

So – ich werfe aus alter Tradition – mal einen Blick in meine Kristall-Kugel.

Amerikaner: Immer wieder für eine Überraschung gut. Blöd nur – das Krieg führen so viel Geld kostet. Mal schauen ob die Chinesen die US-Schatzbriefe für einen eine Wiederholung des Korea-Kriegs kaufen  satire. Der Amerikaner an sich, ist Spar-Mässig, weit hinter den Europäern.
Die Keyen-Ianer (das sind Anhänger einer Wirtschaftstheorie im Angelsächsischen und in abgewandelter Form bei uns) haben ja aktuell das Zepter in der Hand.
Vorteil gegenüber Europa: Zentrale, handlungsfähige Regierung – Aussicht: ohne neue Kriege – gut.

Europa: Die Geschichte wiederholt sich (Deutscher Zollverein) im Europäischen Stil. Es gilt die egoistischen nationalen Interessen einem größeren nationalem Europäischen Interesse unterzuordnen. Wenn dies gelingt – und die Geschichte zeigt – es hängt zuviel Geld von allen daran – dann wird alles gut. Ob das dieses Jahr gelingt  - wohl eher nicht.
Wirtschaftlich: Ich sehe eine latente Erholung und leichtes Wachstum.

Vorsichtiger Optimismus bei leichtem Sarkasmus – ich prognostiziere hmmm: 1,15 USD pro EUR. Also noch etwas leicht unter dem heutigen Kurs.

Euer Joe

Posted in Allgemein, Deep Thoughts, Just Thoughts, Thoughts about News | Tagged , , , , , | Leave a comment

Iphone als USB-Laufwerk in VMware unter Mac OSx einbinden

Der folgende Heise-Artikel führte mich in Versuchung. Unter VMware kann man USB-Geräte seperat “einschalten”. Im Gegensatz zur Artikel-Darstellung funktioniert dies in der VMware-Umgebung völlig ohne Neustart des Iphones.

Iphone-USB-Verbindung an VMware

Nach dem Einschalten verbindet der “Auto-Mounter” unter Kubuntu das Iphone als “Kamera”.

Auto-Mount des Iphone unter Kubuntu/VMware

Hier sieht man dann die Verzeichnisse die er findet.

Dateiverzeichnis Iphone

Mich würde der Algorithmus interessieren mit dem die Musik-Datenbank verwaltet wird und insbesondere die Benamung der MP3s in die Verzeichnisse kopiert.

Iphone unter VMware als Kamera identifziert

Das Symbol das die VMware Instanz für das Iphone auswählt ist der Kopfhörer (*wunder*).

Posted in Allgemein, Joes Daylies, Joes Tests | Tagged , , , , , , | 1 Comment

SAP BI: Read Masterdata with compounded keys / RSAU_READ_MASTER_DATA

Hi SAP-BI-Folks,

this little template gives you the possibility to read on InfoObjects with compounded keys : I am normaly more a friend of my own Masterdata-Read-Routines – but i think it’s usefull to know:
released as usual under BSD-Licence:

TYPE-POOLS rsd.
DATA:
l_chavl        TYPE rsd_chavl           ,
t_dep_m        TYPE rrsv_t_dep          ,
s_dep_m        TYPE rrsv_s_dep          ,
l_chavl_m      TYPE rschavl             ,
wa_zmy_infoobject   TYPE /bic/mzmy_infoobject.

CLEAR l_chavl.
l_chavl = result_fields-/bic/zmy_infoobject .

CLEAR t_dep_m[].
s_dep_m-chanm     = 'ZCOMPOUND1' .
s_dep_m-chavl_int = result_fields-/bic/zcompound1 .
APPEND s_dep_m TO t_dep_m.
s_dep_m-chanm     = 'ZCOMPOUND2' .
s_dep_m-chavl_int = result_fields-comp_code .
APPEND s_dep_m TO t_dep_m.
s_dep_m-chanm     = 'ZMY_INFOOBJECT' .
s_dep_m-chavl_int = l_chavl .
APPEND s_dep_m TO t_dep_m.

CALL FUNCTION 'RRSV_CHA_VALUE_CONCATENATE'
EXPORTING
i_chanm        = 'ZMY_INFOOBJECT'
i_chavl_int    = l_chavl
IMPORTING
e_chavl_int    = l_chavl_m
CHANGING
c_t_dep        = t_dep_m
EXCEPTIONS
unknown_chanm  = 1
invalid_format = 2
no_input_given = 3
OTHERS         = 4.

REPLACE ALL OCCURRENCES OF '#' IN l_chavl_m WITH ` `.

CALL FUNCTION 'RSAU_READ_MASTER_DATA'
EXPORTING
i_iobjnm                = 'ZMY_INFOOBJECT'
i_chavl                 = l_chavl_m
IMPORTING
e_structure             = wa_zmy_infoobject
EXCEPTIONS
read_error              = 1
no_such_attribute       = 2
wrong_import_parameters = 3
chavl_not_found         = 4.
Posted in Allgemein, Joes Daylies, Joes Tests | Tagged , , , , | Leave a comment

Mac OSx export Adressbook/Adressbuch für AVM Fritzbox

Für uns iPhone- und Mac-Jünger ist die Mac OS X Adressverwaltung wunderbar integriert. Leider fehlte mir bisher eine Möglichkeit zum abgleich des Adressbuchs mit der Fritzbox. Das folgende Python-Programm schrieb ich, um dem abhilfe zu verschaffen. Ich suche noch immer nach einer Möglichkeit, das Programm per automatischen job einzuplanen – Hilfe wäre mir hier sehr willkommen!?

Das Python-Script zum ausführen und
Download: iPyFritz

Der Aufruf erfolgt nach dem entpacken per Doppelklick oder im Terminal mithilfe folgenden Befehls:

Python iPyFritz.py

Dies erzeugt die Datei: myfritz.adressbuch.xml  – welche in der Fritzbox unter “Telefonbuch – Wiederherstellen” eingespielt werden kann. VORSICHT – ALLE ALTEN EINTRÄGE WERDEN GELÖSCHT!!!

Für alle die ein paar Euro ausgeben möchten und können, könnte das hier interessanter sein: fritz.mac Suite. Wobei es in meinen Tests nicht die gleichen Ziele wie mein Adressbuch-exporter hat und die Fax-Anbindung an der 7370 zu abbrüchen führte…

Und hier das Coding / Thx a lot to programmish ); for releasing his snippet under public domain.

Update 11.04.2010
Nur Nickname-Fehler korrigiert

Mazo-Kategorie Update 17.04.2010
Das Script setzt das “Wichtig”-Flag für Personen die einen Nickname gepflegt haben im Adressbuch.

Update 23.04.2010
weitere Alternativen: Fakes Blog

Update 12.05.2010
Suche immer noch nach einer Möglichkeit per launchd (cron alternative) das Adressbuch automatisch zu syncen… Über einen Tipp würde ich mich sehr freuen.

from AddressBook import *
import re
from xml.dom.minidom import *

def addressBookToList():
        """
Copyright (c) 2010, J.Rumpf, www.web-dreamer.de / BSD Licence
All rights reserved.

original found on: http://www.programmish.com/?p=26 released under public domain

Read the current user's AddressBook database, converting each person
in the address book into a Dictionary of values. Some values (addresses,
phone numbers, email, etc) can have multiple values, in which case a
list of all of those values is stored. The result of this method is
a List of Dictionaries, with each person represented by a single record
in the list.

Redistribution and use in source and binary forms, with or without modification
are permitted provided that the following conditions are met:

Redistributions of source code must retain the above copyright notice, th
is list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
Neither the name of the owner nor the names of its contributors may be used
to endorse or promote products derived from this software without specific
prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

        Read the current user's AddressBook database, converting each person
        in the address book into a Dictionary of values. Some values (addresses,
        phone numbers, email, etc) can have multiple values, in which case a
        list of all of those values is stored. The result of this method is
        a List of Dictionaries, with each person represented by a single recordq
        in the list.
        """

        # get the shared addressbook and the list of
        # people from the book.
        ab = ABAddressBook.sharedAddressBook()
        people = ab.people()
        peopleList = []

        # convert the ABPerson to a hash
        for person in people:
                thisPerson = {}
                props = person.allProperties()
                for prop in props:

                        # skip some properties
                        if prop == "com.apple.ABPersonMeProperty":
                            continue
                        elif prop == "com.apple.ABImageData":
                            continue

                        # How we convert the value depends on the ObjC
                        # class used to represent it
                        val = person.valueForProperty_(prop)
                        if (type(val) == objc.pyobjc_unicode) and val != None:
                            if val.canBeConvertedToEncoding_(NSISOLatin1StringEncoding): #NSUTF8StringEncoding
                                thisPerson[prop.lower()] = val.cStringUsingEncoding_(NSISOLatin1StringEncoding)
                            else:
                 # Unicode String
                                    thisPerson[prop.lower()] = '* '
                    thisPerson[prop.lower()] += val.cStringUsingEncoding_(NSUTF8StringEncoding)
                             #   thisPerson[prop.lower()] = thisPerson[prop.lower()].encode('iso-8859-1', 'xmlcharrefreplace')
                        elif issubclass(val.__class__, NSDate):
                                # NSDate
                                thisPerson[prop.lower()] = val.description()
                        elif type(val) == ABMultiValueCoreDataWrapper:
                                # List -- convert each item in the list
                                # into the proper format
                                thisPerson[prop.lower()] = {} #[]                                  
                                for valIndex in range(0, val.count()):
                                        indexedValue = val.valueAtIndex_(valIndex)
                                        indexedKey = val.labelAtIndex_(valIndex)
                                        if indexedKey == val.primaryIdentifier:
                                            indexedKey += '+'
                                        if type(indexedValue) == objc.pyobjc_unicode:
                                                # Unicode string
                                                thisPerson[prop.lower()].update({indexedKey.cStringUsingEncoding_(4): indexedValue.cStringUsingEncoding_(4)})
                                        elif issubclass(indexedValue.__class__, NSDate):
                                                # Date
                                                thisPerson[prop.lower()].update({prop.lower(): indexedValue.description()})
                                        elif type(indexedValue) == NSCFDictionary:
                                                # NSDictionary -- convert to a Python Dictionary
                                                propDict = {}
                                                for propKey in indexedValue.keys():
                                                        propValue = indexedValue[propKey]
                                                        propDict[propKey.lower()] = propValue
                                                thisPerson[prop.lower()].update(propDict)
                peopleList.append(thisPerson)
        return peopleList

format = re.compile('[ -()-]')
m49 = re.compile('\+49')
mlist = addressBookToList()
#print kABPhoneHomeLabel
#print kABPhoneMobileLabel
#print kABPhoneWorkLabel
#print kABOtherLabel
#print mlist[25]

"""
<phonebooks>
<phonebook>
    <contact>
        <category>0</category>
        <person><realName></realName></person>
        <telephony>
            <number type="home" vanity="" prio="1" quickdial="4"></number>
            <number type="mobile" vanity="" prio="0"></number>
            <number type="work" vanity="" prio="0"></number>
        </telephony>
        <services />
        <setup />
    </contact>
"""

# Create the minidom document
doc = Document()

phonebooks = doc.createElement("phonebooks")
doc.appendChild(phonebooks)

phonebook = doc.createElement("phonebook")
phonebooks.appendChild(phonebook)


for pers in mlist:
    name = pers.get(kABLastNameProperty.lower(),'') + ', ' + pers.get(kABFirstNameProperty.lower(),'')
    if name == ', ':
        name = pers.get(kABOrganizationProperty.lower())
   
    if name == None:
        name = pers.get(kABNicknameProperty.lower())
#       print name
       
    if name == None:
        name = "NoName?"
       
    contact = doc.createElement("contact")
    phonebook.appendChild(contact)
   
    category = doc.createElement("category")
    contact.appendChild(category)
    # person with nik is important >:
    nikname = pers.get(kABNicknameProperty.lower())
    if nikname == None:
        cat = "0"
    else:
        cat = "1"
       
    cat_0 = doc.createTextNode(cat)
    category.appendChild(cat_0)
   
    person = doc.createElement("person")
    contact.appendChild(person)
   
    realname = doc.createElement("realName")
    person.appendChild(realname)
   
    p_inhalt = doc.createTextNode(name)
    realname.appendChild(p_inhalt)
   
    pers_phone = pers.get(kABPhoneProperty.lower())
    if pers_phone != None:
        telephony = doc.createElement("telephony")
        contact.appendChild(telephony)
       
#       quickdial = format.sub('' ,pers_phone.get( "Quickdial", '' ), 0)
        prio = 1
        home = format.sub('' ,pers_phone.get(kABPhoneHomeLabel,''), 0)
        home = m49.sub('0', home)
        if home != '':
            number = None
            number = doc.createElement("number")
            telephony.appendChild(number)      
            number.setAttribute("type", "home")
            number.setAttribute("vanity", "")
            number.setAttribute("prio", '%d' % prio)
            prio += 1
            #number.setAttribute("quickdial", "")
            num_home = doc.createTextNode(home)
            number.appendChild(num_home)


        mobile = format.sub('', pers_phone.get( kABPhoneMobileLabel, '' ), 0)
        mobile = m49.sub('0', mobile )
        if mobile != '':
            number = None
            number = doc.createElement("number")
            telephony.appendChild(number)
            number.setAttribute("type", "mobile")
            number.setAttribute("vanity", "")
            number.setAttribute("prio", '%d' % prio )
            prio += 1
            #number.setAttribute("quickdial", "")
            num_home = doc.createTextNode(mobile)
            number.appendChild(num_home)
       
        work = format.sub('' ,pers_phone.get( kABPhoneWorkLabel, ''), 0)
        work = m49.sub('0', work )
        if work != '':
            number = None
            number = doc.createElement("number")
            telephony.appendChild(number)
            number.setAttribute("type", "work")
            number.setAttribute("vanity", "")
            number.setAttribute("prio", '%d' % prio)
            prio += 1
            #number.setAttribute("quickdial", "")
            num_home = doc.createTextNode(work)
            number.appendChild(num_home)
       
        if ((home == '') and (mobile == '') and ( work == '')):
            other = format.sub('' ,pers_phone.get( kABOtherLabel, '' ), 0)
            other = m49.sub('0', other )
            number = doc.createElement("number")
            telephony.appendChild(number    )
            number.setAttribute("type", "home")
            number.setAttribute("vanity", "")
            number.setAttribute("prio", '%d' % prio)
            prio += 1
            #number.setAttribute("quickdial", "")
            num_home = doc.createTextNode(other)
            number.appendChild(num_home)


f = open('myfritz.adressbuch.xml', 'w')
doc.writexml(f, '', '', '' , 'iso-8859-1')
Posted in Allgemein, Joes Daylies, Joes Tests | Tagged , , , , , , | 24 Comments