N.A.D.

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

2009-10-14

Reading Time in Mandarin

Time in Chinese Mandarin. Listen and figure out....
Just listen or download and try to figure out the time a native speaker is reading. There are two parts - 24h clock time reading and the reading of 12h clock with AM/PM indicators.


Or Download...

Or Download...

tā shìbúshì tài kuài la? Then listen for a record with reduced tempo by 30%: Part 1, Part 2

The answers are here Reading Time #1.

Useful vocabulary

Words introduced (Simplified/Traditional):
  • 点/點 [diǎn] - point, dot, hour
  • 钟/鐘 [zhōng] - clock
  • 分/分 [fēn] - piece, section, minute
  • 半/半 [bàn] - half

Morning
  • 早上 [zǎoshàng] 5am~12pm
  • 上午 [shàngwǔ] 10am~12pm

Noon
  • 中午 [zhōngwǔ] 12pm

Afternoon
  • 下午 [xiàwǔ] 1pm~6pm

Evening/Night
  • 晚上 [wǎnshàng] 6pm~12am

Midnight
  • 半夜 [bànyè] 12am~4am (Taiwan)
  • 凌晨 [língchén] 12am~4am (China)

There are excellent tutorials about reading time prepared by HyperLingual:





Once again I'd like to express my gratitude to Joyce from Taiwan for her contribution, help and incredible patience.

2009-10-10

Numbers in Chinese Mandarin. Listen and figure out....

Just listen or download and try to figure out the number a native speaker is reading ...



tā shìbúshì tài kuài la? Then listen for a record with reduced tempo by 30%:



The answers are here Numbers #1.

I'd like to express my gratitude to Joyce from Taiwan for her contribution, help and incredible patience.

PS soon coming Numbers #2

2009-10-09

Seed Price Analysis

I've done FB FarmVille seed price analysis: FarmVille Seed Profitability. Profit evaluation's done assuming that the harvesting takes place 1 hour after the crop is ripen. In conclusion - the most profitable are Raspberries, Aloe Vera and Peppers, and then Rice, but the least profitable are Soybeans and Artichokes:

2009-10-03

Google Translator in Google Spreadsheets

New feature from Google - two functions for Spreadsheets: GoogleTranslate and DetectLanguage:

Self-explanatory examples:

=GoogleTranslate("Hola, ¿cómo estás?","lv","en") gives "方腊和地方似的开了色犯了可靠的死了然后来了哈利两个联合人类色热望人类的?" obviously and

=DetectLanguage("Hola, ¿cómo estás?") would give "ur" as a result.

2009-09-27

View online files using the Google Docs Viewer Released ...

Some time ago Google introduced document file upload into Google Docs. Then they added a feature allowing to upload attachments straight from Gmail into Google Docs. And now they went even further - you can view any PDF, Powerpoint of TIFF document in the Google Docs Viewer. That's great. There will come a day when there'll be only a browser and Google :D

Here is "Cien años de soledad" by Marquez form http://www.eltutordebangkok.com/music/books/Soledad.pdf viewable with the Google Viewer. Enjoy!

Cien años de soledad



For more information:
http://googledocs.blogspot.com/2009/09/view-online-files-using-google-docs.html