It stands for "no abnormality detected" or "nothing abnormal detected". It's a very common and, unfortunately, fatal and lethal disease. People die of it and there are NO remedy for that :(

2011-07-16

How to count occurrence of Chinese characters with Python

You would need for that Python 3.x ...
from collections import OrderedDict
t = """听同学说,春游很好玩。好不容易,这一天到来了。
一早,我到了学校,看到一排排汽车。
同学们排着整齐的队伍坐上了车,驶向城郊的果园。
一路上我们唱着歌,心情格外愉快,因为我上小学以后今天还是第一次去春游。

到了果园的门口,同学们拍了集体照,就迫不及待地走进果园了。
导游首先带我们品尝果园里的水果。
我吃了橙子、香瓜和一些野果。
然后导游带我们去看杂技表演,还有我特别喜欢的魔术!看完表演,午饭时间到了,我们去果园的餐厅吃饭。那里的菜我都很喜欢吃,和爸爸妈妈做地不一样!之后,导游说带我们去捉泥鳅。
一听说捉泥鳅,同学们都高兴起来了,你脱鞋,我脱袜的。
开始我很怕,在上面捞。
后来,我想,这样我会成为全班捉得最少的一个,所以我就勇敢地跳进水里去捉,捉到了六条,真是很开心。
时间过得可真快,下午四点,我们大家都依依不舍地离开了果园。这次春游真的很好玩!
"""
d = {x:t.count(x) for x in set (t) if x!='\n' }
sorted_d = OrderedDict(sorted(d.items(), key=lambda x: x[1], reverse=True))
for k, v in sorted_d.items():
    print ( "%s: %s" % (k, v) )

2011-03-06

Extracting SAP schema (meta data) using Business Object Data Service Designer

Working with SAP BO on data reconciliation, transferring into MS SQL and building a custom reports as anyone else I was struggling with cryptic German acronyms. In order to get some sense out from the data I have to get across also column description and in general schema data as column data types, constraints, etc both for further analysis and documentation. Regretfully BO DS Designer doesn't provide such a feature. However it is possible to export schema either in XMI 1.1 (albeit not complying to the schema or specification) or ERwin XML document. And that is enough for documenting and cleating a data dictionary. In this post I will outline the whole process and one of the first steps namely generating an HTML overview schema document. The chief reason I - generally a very reluctant blogger - am sharing my experience to demonstrate how efficiently could be used a diverse set of tools that in the first have nothing in common. They are Business Object Data Service Designer, MS XML for XSLT transformation, MS Visual Studio for programming and testing XSLT, JavaScript for interacting with MS XML ActiveX components, sqlite for collecting and storing from XML extracted data, Windows BAT for cluing it all together.

This is how the main all together gluing process_xmi.bat script:

@SET ECHO OFF
REM Get file name w/o extesion
SET FFN=%1
SET FN=%FFN:~0,-4%


SET OUTPUT_DIR=outputIF NOT EXIST %OUTPUT_DIR% MKDIR %OUTPUT_DIR%
SET DB=%OUTPUT_DIR%\model.sqlite

REM Execute trasformations:
REM - Generate an HTML report:

cscript transform.js %1 xmi-html-summary.xslt %OUTPUT_DIR%\%FFN:~0,-4%.html
cscript transform.js %1 xmi-html-summary2.xslt %OUTPUT_DIR%\%FFN:~0,-4%_2.html

REM - Generat DML for model update
cscript transform.js %1 xmi-sql.xslt %OUTPUT_DIR%\create_model.sql

REM Load model data into DB model.sqlite:
sqlite3 %DB% < %OUTPUT_DIR%\create_model.sql

REM Extract table and column list in CSV format:
sqlite3 -header -csv %DB% "SELECT * FROM meta$table;" > %OUTPUT_DIR%\%FN%_tables.csv
sqlite3 -header -csv %DB% "SELECT c.*, t.schema, t.name AS table_name FROM meta$table AS t JOIN meta$column AS c ON c.table_id = t.id;"  > %OUTPUT_DIR%\%FN%



The following flowchart will help to understand it better:






The source code of the project you can find at http://j.mp/bo-xmi-transformer