Tuesday, August 31, 2010

Optimizing the Slowly Changing Dimension Wizard

http://blogs.msdn.com/b/mattm/archive/2010/08/05/optimizing-the-slowly-changing-dimension-wizard.aspx

As a follow-up to my previous post about SCD processing in SSIS, I thought I’d go deeper into using the built-in Slowly Changing Dimension Wizard. While there are definitely more efficient ways to do SCD processing in SSIS, there are some optimizations you can apply to the components that the wizard outputs that might make it more acceptable for your environment.
First, let’s take a look at the Wizard’s strengths. Besides the advantage of not having to write any SQL by hand, there are two key scenarios the SCD Wizard is optimized for:
  1. Small number of change rows - Most ETL best practices say that you should perform change data capture (CDC) at the source (or as close to the source as possible). The Wizard was not designed to process your entire source table (like the Kimball Method SCD component) – for example, it doesn’t detect “deletes”.
  2. Large dimensions – If you are dealing with large dimensions, SCD approaches that read the entire reference table may not be the best approach. For example, if I have 5-10K change rows coming in, and a 2 Million row dimension, the majority of the data flow time will be spent doing a full scan of your source dimension table.
If your scenario doesn’t match the above, you might want to consider just using one of the alternate approaches directly. If it does, or if you don’t want to use any custom components (or hand craft the SQL required for a MERGE statement, for example), consider making the following optimizations:
SCD Wizard output

Slowly Changing Dimension transform (Red)

The first transform does not cache any lookup results from the reference dimension, so every incoming row results in a query against the database. By default, the wizard will open a new connection to the database on each query. For a performance gain (and less resource usage), you can set the RetainSameConnection property of the wizard’s connection manager to True to re-use the same connection on each query.

OLE DB Command transforms (Green)

The wizard will output three separate OLE DB Command transforms (which perform row-by-row updates). You will get a big performance boost by placing the rows in a staging table, and performing the updates in a single batch once the data flow completes. Another option is to use the Batch Destination component, which is available on Codeplex.

OLE DB Destination (Blue)

The default destination that the Wizard outputs will have Fast Load disabled (to avoid locking issues). In many cases (mostly depending on the number of rows you’re processing), you can enable Fast Load for an immediate performance gain. To avoid potential deadlocking issues, another option is to use a staging table, and move the data over to the final destination table once the data flow is complete using a INSERT INTO … SELECT statement.
Using the above optimizations, I was able to bring down the processing time of a 200k row change set (against a 100k row dimension table) from 60 minutes to 14 minutes. Note however, that processing a similar change set using the SQL MERGE statement took under 3 minutes to complete.
 image
I go into more detail about these optimizations (and the difference between SCD processing approaches) in my Performance Design Patterns talk.

Handling Slowly Changing Dimensions in SSIS

http://blogs.msdn.com/b/mattm/archive/2009/11/13/handling-slowly-changing-dimensions-in-ssis.aspx

I had a great time at PASS last week, and had a chance to talk to a lot of different SSIS users. One of the big topics seemed to be Slowly Changing Dimensions – I had a number of people ask for various improvements to the current Slowly Changing Dimension Transform in SSIS, and also ask for recommended alternatives in the meantime. I thought I’d summarize some of the more popular approaches I’ve seen, and see if anyone else has some alternatives.

Slowly Changing Dimension Wizard

You might have already tried the Slowly Changing Dimension Wizard that comes with SSIS 2005 and 2008 (and there are a number of good tutorials out there if you haven’t).
Outputs from the Slowly Changing Dimension Wizard
The SCD Wizard has a few things going for it - it’s quick and easy to implement, it handles most SCD scenarios out of the box, and its multi-component approach means you can customize it with the functionality you need.
It does have some pretty big limitations, however, which end up being a deal breaker for a lot of people.
A major inhibitor is the performance of the transform. It doesn’t perform that well for a couple of different reasons:
  1. The data lookups are not cached – each row results in a SQL Query
  2. OLE DB Command does row by row updates
  3. OLE DB Destination added by the wizard doesn’t use FastLoad by default (which can be easily changed in the OLE DB Destination editor UI)
Another downside to the transform is the “one way” nature of the wizard – running it again (to change columns, for example) means you’ll lose any customizations you might have made to the other transforms.
I recommend using the wizard for simple dimensions, where you’re not processing a lot of data. If performance is a concern, consider one of the following approaches.

Using MERGE

I came across this tip from the Kimball Group when I was putting together my Merge & CDC talk last year.
Using the SQL MERGE Statement for Slowly Changing Dimension Processing
In this approach, you write all of your incoming data to a staging table, and then use Execute SQL Tasks to run MERGE statements (you actually have to do two passes – one for Type 1 changes, and one for Type 2 – see the details in the tip above). I posted the sample packages and code I used in a previous blog post.
The performance in this approach is very good (although it moves the bulk of the work to the database machine, which might not be what you want). I recommend it if you don’t mind staging the data, writing custom SQL, or can’t use a 3rd party component in your environment.

Kimball Method SSIS Slowly Changing Dimension Component

I’ve heard great things about Todd McDermid’s custom SCD Transform. Instead of doing row by row lookups, this transform takes in the dimension as an input. This makes the comparison much faster than the stock SSIS version. It wraps up all of the functionality into a single transform, which is great if you’re following the Kimball methodology.

Table Difference Component

I had the chance to meet with the SQLBI.EU guys at PASS, and they mentioned their Table Difference component. I haven’t tried it out myself, but I remembered an email from one of the SQL Rangers (Binh Cao) that suggested this component for SCD processing. I’ve included his write-up here:
Table difference is an SSIS custom component designed to simplify the management of slowly changing dimensions and – in general – to check the differences between two tables or data flow with SSIS.
The component receives input from two sorted sources and generates different outputs for unchanged, new, deleted or updated rows.
clip_image001
  • Unchanged rows (are the data rows that are the same in both inputs)
  • Deleted rows (are the data rows that appear in old source but not in new source)
  • New rows (are the data rows that appear in new source but not in old source)
  • Updated rows (are the data rows that appear in both flows but something is changed)
The inputs MUST be sorted and have a collection of fields (keys) that let the component decide when two rows from the inputs represent the same row, but this is easily accomplished by SQL Server with a simple “order by” and a convenient index; moreover the SCD do normally maintain an index by the business key, so the sorting requirement is easily accomplished and do not represent a problem.
Clicking on TableDifference control gives the following window.
clip_image002
TableDifference analyzes all the columns in both inputs and compares their names. If the name of two columns and their corresponding types are identical, TableDifference adds them to the available columns to manage.
If the flows are sorted, their sort columns will be marked as key fields, using the same order in which they appear in the sort.
All other columns are assigned a standard Update ID of 10 and are managed as comparable columns.
Using the component editor, you need to provide the following information for the columns:
Check Option: you can choose the column type between:
  • Key field:  column will be used to detect when two rows from the inputs represent the same row. Beware that the inputs must be sorted by those columns
  • Compare:  column will be compared one by one to detect differences
  • Prefer NEW: columns will be copied from the NEW input directly into the output, no check
  • Prefer OLD: columns will be copied from the OLD input directly into the output, no check
KeyOrder: If a column is of type “Key Field” it is the order under which the field appear under the “order by” clause of your query. Beware that the component do not check for the correct sorting sequence, it is up to you to provide this information.
Update ID: Each different UpdateID creates a different output flow. If you need to detect when a change appears in some column you can use different update ID. Beware that the lowest update ID wins, i.e. if AccountNumber has update id of 10 and AddressLine1 has update id of 20, then Accountnumber will be checked first and if a change is detected, the row will go to update output 10, no matter if AddressLine has a difference.
clip_image003
Outputs Panel gives option to choose which output to enable as well as to name and describe the output.
clip_image004
Output Details allows selection of the columns for each output.  Here columns that are not needed for an output can be disabled.  The picture shows an example of the DELETED output which only have the Customer Key column in its output.  The less columns in the output, the better the performance of the component.
clip_image005
In the Misc Options tab, string comparisons definition can be defined:
  • The culture ID to use to perform the comparison. If not specified TableDifference will use the culture ID of the running task. The default is “empty”.
  • If you want it to ignore casing during string comparisons. The default is unchecked so TableDifference will perform comparison considering case.
In the Warnings panel, it will list any unused column from the input. As you might recall, if two columns are not identical regarding name and type, TableDifference will ignore them. This might be an error but the decision is up to you. By checking the warnings panel you can see if TableDifference is working with all the columns you need it to compare.

BI Study Video

SSIS Performance Design Patterns (video) 

http://blogs.msdn.com/b/mattm/archive/2010/06/29/ssis-performance-design-patterns-video.aspx

Project REAL—Business Intelligence in Practice

https://www.microsoft.com/sqlserver/2005/en/us/project-real.aspx#documentation

Project REAL Documentation

The Project REAL team has provided content to help explain the parameters of the project. The following is a list of the documents available for Project REAL:

Monday, August 30, 2010

How to transfer contacts from iPhone to iPhone

http://www.icopybot.com/blog/how-to-transfer-contacts-from-iphone-to-iphone.htm

If you want transfer contacts from one iPhone to another iPhone, you can do it with iTunes Backup Manager‘s export/import feature.
Here is the steps: (If you lost your iPhone, you can also use these steps to restore contacts from old iPhone’s backup file.)
First we named the iPhone that you want transfer contacts from as source iPhone, another iPhone as target iPhone.
  • 1.Run iTunes, connect source iPhone to computer, right click the iPhone’s name in iTunes left window, select Back Up to let iTunes backup your newest contacts. Then exit iTunes.
  • 2.Run iTunes Backup Manager, click the source iPhone’s name in left window, then check the checkbox at front of these two files in right window:
    Library/AddressBook/AddressBook.sqlitedb
    Library/AddressBook/AddressBookImages.sqlitedb.
  • iphone-iphone-1
  • 3.Then select main menu->File->Export, select Export only checked file(s) then press OK button.
    iphone-iphone-2
    Notes: If you want do next steps on another computer, you can copy these exported files to that computer by USB disk or network, then do next steps on that computer.
  • 4.Run iTunes, connect target iPhone to computer, right click the iPhone’s name in iTunes left window, select Back Up. Then exit iTunes.
  • 5.Run iTunes Backup Manager, click the source iPhone’s name in left window, then select main menu->File->Import and select these two files that you just exported:
    Library/AddressBook/AddressBook.sqlitedb.info
    Library/AddressBook/AddressBookImages.sqlitedb.info
  • 6.Select main menu->File->Restore, then select Restore only modified file(s) and press OK button. After the restore process done, your iPhone may restart automatically. Then you can check contacts on target iPhone:) 
破解下载 : http://bbs.weiphone.com/read-htm-tid-1013650.html

ETL參考及錯誤的處理

ETL參考Project REAL: Business Intelligence ETL Design Practices
http://www.microsoft.com/downloads/en/confirmation.aspx?familyId=705b03f3-1bbf-417f-9e63-92a00a4744e6&displayLang=en
但沒有絕對。
2A.錯誤的處理可以參考這篇討論嘗試看看
http://social.msdn.microsoft.com/Forums/en-US/sqlintegrationservices/thread/fb63df48-297d-48b1-be3d-1fc69711fa8f

Thursday, August 26, 2010

iMON MCE + Logitech remote issue

Some users may experience less than perfect control of their iMON Media Center device using a Harmony remote.

If you are experiencing difficulties controlling your iMON device, please follow the steps below to change your iMON device to a more optimal configuration.



  1. Remove the current device and add the new device as Device: Media Center PC, Manufacturer: Soundgraph, Model: iMon (Media Center Remote)
  2. Add the updated iMON device. On the Add Devices page, select Media Center PC from the Device dropdown, select SoundGraph from the Manufacturer dropdown, and type iMon (Media Center Remote) in the Model field
  3. Update your Harmony Remote
  4. Follow these steps to setup the iMon Manager to use the MCE remote



    Image
    1. Right-click on the iMON button on your desktop
    2. Click on iMON Manager


  5. Image
    1. Click on Settings
    2. From the dropdown list for Remote Controller, select MCE remote
  6. Click OK to save your changes

Antec Veris MicroFusion Remote 350 HTPC Case Review

http://benchmarkreviews.com/index.php?option=com_content&task=view&id=243&Itemid=61

http://www.hardwarecanucks.com/forum/hardware-canucks-reviews/11081-antec-veris-microfusion-remote-350-htpc-case-review.html

Ad server list and comparison

Absolute Banner Manager $229 **** http://www.xigla.com/absolutebmnet/
DART http://www.doubleclick.com/solutions/publishers/index.aspx (***** Free and very easy to use)

Accipiter(now Atlas)
Ad Hosting Solutions (open-source Linux/Apache/PHP/MySQL)
AdBureau https://secure.adserversolutions.com/adserverorder.html (too expensive)
AdJuggler (http://www.adjuggler.com/???)
AdRevolver (Dead?)
AdSpeed http://www.adspeed.com/Plans.html (too expensive)
AdTech http://www.adtechus.com/Home/ (No Pricing, may not for Small Biz)
Advert-pro http://www.advertpro.com/pricing.html (too expensive)
Atlas ???
Burst Ad Conductor http://www.adconductor.com/index.asp (No Pricing, may not for Small Biz)
Buzz (Dead?)
CheckM8 Advantage http://www.checkm8.com/products/advantage (No Pricing, may not for Small Biz)
ColdFusion (no info?)
Falk (Dead?)
Mediaplex http://www.mediaplex.com/ (No Pricing, may not for Small Biz)
OAS (www.247realmedia.com???)
Openads (http://www.openx.org/?? no info)
phpadsnew (no info)
Proprietary Ad Server (no info)
Zedo (http://www.zedo.com/press/20060411-adotas.htm no price info)

Stock Days

Stock Day= OpenQty / RegDMS=Store Onhand Qty/RegDMS
每日最新RegDMS = 前一天SalesQty占10%+前一天RegDMS占90%

Wednesday, August 25, 2010

Cydia Source

www.elpelle6.com/repo/
在cydia里面把上面的链接加上就行了,软件不是很多,但是应该都是作者自购自破的,更新也都很及时。比如wifisync,ifile,safari download manager之类的,很多都是打着灯笼找不到的好货啊!!!!!强力推荐了!

Best CPM Network - Top CPM ad networks -

ere is our list based on over a year running 1,000,000s of impressions (not on this site, but we wish ;)
These are our thoughts based on networks we are part of. If you wondering about one we do not mention, we have not joined them yet.

1. Adsdaq - Been running for several months, filled 50% during holiday season , High CPM, Pick your CPM Rate, Run It first, then Right Media Second, works great! Good reporting, easy to use interface.
Adsdaq
2. Right Media - Direct Media Exchange - Been running for 6 months, Pretty High CPM, Good thing is you can set the CPM you get on other networks and they only fill if they beat the CPM you set. Great because they have many companies in there exchange network including (Xtend, Vizi Direct, Rydium, Revenue Science, Oridian, Directa Networks, Bannerconnect Networks, Active Response Group, Adtegrity, CPX Interactive, and Remix Media). They also have great reporting, and you can use them as a free ad server for any direct sales etc.
Direct Media Exchange
3. Tribal Fusion - Been running almost a year, high CPMs but hard to get into, Great pop-under CPMs, Ok Reporting
Tribal
4. Burst Media - Decent CPMs, Sometimes get direct advertisers, Good Reporting
Burst
5. Casale Media - Good Popunder rates, seems great for few months then CPMs went down. Don’t know if it was seasonal or what, but since they are later fill in our system probably is part of the reason.
6. Value Click Media - Decent Popunder rates, lot of fill, don’t like there reporting and slow interface.
7. Realtech Network - LOW Cpms, bad interface, ok for final fill
Realtech
8. Robert Sherman - Terrible Reporting, LOW CPMs, ok for fill, one good thing they prepay in $25 increments, although you never no how much you going to make because the reporting is so bad.
Robert Sherman

Tuesday, August 24, 2010

程序员怎么选择发展方向(ZT)

程序工作二三年后,基本上都会考虑自己以后怎么发展。发展的路径不外乎程序员-系统分析员-架构师-技术经理-CTO,程序员-项目组长-项目经理-项目总监-CTO,程序员-产品设计师-产品经理-CTO.哪一条发展的路线更加适合你?
程序员职业生涯发展到一定程度都会面临一个选择,是走业务+技术方向,还是选择纯钻研技术。程序员职业生涯 发展的问题,这是所有程序员都在关心的问题,未来究竟要怎么走,30岁之后还能不能再做程序员。
绝大多数程序员最终的职业目标可能都是CTO,做到CEO的人估计会比较少,也有一少部分人自己去创业创业去当老板,也有部分人说我转行去做业务 了,对于当老板的人毕竟是少数,对于转行的人来说,都不在这行做了,自然没什么好说的了。一般来说,程序员的发展基本上都会经历这么几条路径。程序员-系 统分析员-架构师-技术经理-CTO,程序员-项目组长-项目经理-项目总监-CTO,程序员-产品设计师-产品经理-CTO.
当然这只是一个大致的路径,不是所有程序员都必需要这么经历的,有些人可能跳过其中的一些步骤,也可能有些人会把中间的很多职位都做了。而最终做到 CTO的程序员,也是非常少的一部分,原因很简单,这个世界上不许要那么多的CTO和CXO.
也就是说,许多的程序员最终可能是做技术经理、项目经理或者项目总监之类的,那么到底我们职业生涯要选择哪一种呢?我觉得这个问题没有一个统一的答 案,因为每个人的性格不一样,际遇也不一样,就像你从小希望当贪官,可是命运却偏偏让你做了一个程序员。所以应该根据你的兴趣、性格与际遇选择一条道路, 比如说你正好有机会带一个项目,而你又不是很讨厌项目经理这个位置,那么你就可以选择向项目经理方向发展。
实际上很多时候,国内并没 有明确的技术经理、项目经理、产品经理之分,在许多的公司里,他们经常是由一个人承担。在外包公司里,通常会有项目经理和 系统分析员(也可能是技术经理)。在一些非IT公司里,可能会有部门经理,而做自己产品的公司可能会分得比较详细一些。我大致说一下这三个职位的区别,让 正在徘徊的程序员有一个大致的了解。
项目经理是项目的直接负责人,这个角色相当于一个中间接口,不管是团队成员还是需求方(客户), 或者是上级领导,有事都直接找他,所以这个职位着重 于管理与沟通。一般来说,项目经理的工作重点在同客户沟通需求、项目进度的把控、团队的沟通方面,有些公司也会需要项目经理承担团队建设的工作,不过貌似 很多国内公司都忽略了团队建设这个工作了。对于项目经理来说,重点会要求沟通能力、协调能力、危机把控能力、执行力、团队管理能力,着重于沟通、管理与计 划。当然也有些公司还要求项目经历要参与招标谈判,这就要求项目经理有一定的商务谈判能力。
技术经理有时候也可能叫系统分析员,一些 小公司可能会整个公司或者部门有一个技术经理。技术经理承担的角色主要是系统分析、架构搭建、系统构建、代 码走查等工作,如果说项目经理是总统,那么技术经理就是总理。当然不是所有公司都是这样的,有些公司项目经理是不管技术团队的,只做需求、进度和同客户沟 通,那么这个时候的项目经理就好像工厂里的跟单人员了,这种情况在外包公司比较多。对于技术经理来说,着重于技术方面,你需要知道某种功能用哪些技术合 适,需要知道某项功能需要多长的开发时间等。同时,技术经理也应该承担提高团队整体技术水平的工作。
产品经理这个职位一般在有自己产 品(不管是软件还是网站产品)的公司比较常见,产品经理主要会负责产品的设计、产品的改良等工作。需要注意的是,产 品设计与设计师是两个不一样的工作,产品设计主要会从用户体验、业务需要等层面去设计产品,而设计师更多是从用户的视觉上去做。产品经理应该是最懂业务的 人,比如说你在设计一个微博的产品,就要求你对微博这个东西非常熟悉,从用户习惯、用户体验、公司的发展战略上去设计这个产品,还要对比同类产品会有什么 优势等等。
不管是项目经理还是技术经理与产品经理,都要求要熟悉业务,业务是需求的来源,没有不谈业务的技术,所以不管你从哪个方向 发展,都要求对业务熟悉。 产品经理要求对业务最熟悉,项目经理次之,技术经理排最后。对于程序员来说,刚开始工作的前几年可以埋头扎到技术里面,一般这个时间在2-3年的时间,然 后就应该多关注业务了。这个业务不一定是指某个具体的业务,因为具体的业务的范围太少,而且也需要机遇。
我见过许多的程序员,他们是做Web开发的,但对互联网很不熟悉,对于互联网流行的趋势基本上不闻不问。不知道现在大家都在使用微博,也不知道SNS,也 可能从不使用网银。我觉得这样很不好,程序员应该多多去关注互联网的发展,多多去玩一些新的网站。

Domain Registration Check Web Site

http://www.instra.com/
Very good web site to check Domain name availability.

Biz expired Domain Name
https://www.snapnames.com/

How to Snatch an Expiring Domain
http://www.mikeindustries.com/blog/archive/2005/03/how-to-snatch-an-expiring-domain

 网上有这样一群朋友,他们喜欢后缀是拼音的,比如.ai(爱)、.bi(逼)、.de(的)、.la(啦)、.lu(路)、.si(死)、.se(色)等 等。因为这两位之母是汉字的拼音,所以很容易就能想到一些有意思的域名:zuo.ai、niu.bi、shuo.de、lai.la、zou.lu、 yao.si、hao.se等等。只要发挥你的想想,域名组合是无穷的。

网络访问攻防战

在很多大型企业中和有些国家中,为了限制员工或人民访问某些网站或使用某些网络应用程序,通常做了一些访问限制。限制的方法通常有路由器IP过滤和强制使用代理服务器等几种方式。
路由器IP过滤指的是通过在路由器中加入外网或国外的IP黑名单,使得内网或国内无法访问外网或国外的这些IP,达到限制访问的目的。强制使用代理服务 器的过滤方式通常只在大型企业中应用,指的是内网必须通过代理服务器才能访问外网,那么在代理服务器上可以实现更为复杂的过滤机制。本文主要讲述IP过滤 的攻防战,关于代理服务器的攻防战下次讨论。下面依次讲述网络访问攻防战的不断升级过程:
首先,如果要禁止人们访问某些网站,那么路由器管理者可以在路由器中设置IP过滤规则,把这些网站的IP加入黑名单,自然人们就无法访问这些网站了。
之后,人们为了继续访问这些网站,就会用代理服务器绕过限制。代理服务器的IP成千上万,而且不停在变化,使得限制网络访问的工作处于被动局面。
然而,由于代理服务器协议是明文的,通过监听网络数据包并制作自动搜集整理的程序可以知道人们访问了哪些代理服务器并自动把代理服务器的IP加入到IP黑名单中,这样使用普通代理服务器绕过访问限制的方式就失效了,绕过网络访问限制的工作处于相当被动的局面。
所以,为了避免被侦测到代理服务器地址,加密代理软件应运而生。用户和代理服务器之间的通讯协议进行了加密,使得无法简单通过侦听网络数据包分析出代理服务器的IP地址。又一次使得限制网络访问的工作处于被动局面。
但是,加密代理软件也需要和代理服务器进行通讯,也需要知道加密代理服务器的IP地址。所以加密代理软件一般会在启动时去某些发布加密代理服务器IP地 址的地方获得加密代理服务器的IP。那么,只需要单独拿出一台计算机,启动加密代理软件,对这台计算机的网络通讯进行监视,那么即可知道发布加密代理IP 地址的地方,从而对发布点进行IP过滤。而且可以做成程序自动启动加密代理软件,自动监视数据包,自动把加密代理IP的发布地点的IP加入黑名单,这样加 密代理软件无法获得加密代理的IP,加密代理软件失效,绕过网络限制的工作又一次处于十分不利的位置。
加密代理软件为了对付这种情况, 就需要把访问代理IP发布点的流量混杂在访问非代理IP发布点的流量中。比如,加密代理软件启动时,首先访问其它大量网站,在访问其它网站之中的某一次访 问代理IP发布点,这样就把流量进行混杂了,无法通过简单的网络数据包侦听获得代理IP发布点的IP地址。如果把所有侦听到的地址全部加入黑名单,那么将 会误封很多网站。限制网络访问的工作又处于不利的位置。
然后,为了能继续对网络访问进行限制,网络管理员就转而对加密代理的IP(而非 发布点的IP)进行过滤。在加密代理软件启动完毕之后,通过加密代理下载一个大文件,那么流量比较大的IP即为加密代理的IP。通过这种方法,网络管理员 仍旧可以做出自动封锁加密代理软件的程序,绕过网络限制的工作又失败了。
那么,加密代理软件可以采取同样的思路,把访问代理IP的流量 混杂在其它流量中,并使分散的流量平分并不断变换代理IP,使得无法通过网络数据包流量统计获得加密代理的IP。人们又可以重新绕过网络访问限制了。然 而,因为对流量进行了平分,所以网速通常只有几分之一了,大部分流量都耗费在混淆网络管理员的程序上面了。
到了这里,网络访问攻防战似乎走到头了,但是聪明的网络管理员并不是束手无策了。通过对加密代理软件进行逆向工程,还是可以找到代理IP的发布点,从而过滤这个发布点。不过,这样已经不能通过分析网络流量用程序自动找出IP进行过滤了。
最后,加密代理软件为了防止被逆向工程,对加密代理软件本身进行了软件加密处理,使得逆向工程变得十分困难。接下去就是软件加密与破解之间的智力较量了。
总结:如果不进行网络流量混淆,那么能被程序自动找出有用的IP进行过滤。如果不对加密软件进行加密,也比较容易被逆向工程,从而找到有用的IP进行过 滤。加密代理软件作者需要时刻提防软件被破解,一旦被破解,那么需要对升级加密代理软件,使得限制网络访问的工作需要重新破解软件才能继续实施。

通过代理服务器进行网络访问的很多情况,和直接访问网络的情况十分相似。代理服务器能做到不使用代理服务器的所有过滤方式,这些过滤方式在上一篇中 已经有了详细地说明,唯一的区别是网络访问的攻防全部在代理服务器上进行。也就是说,如果你希望应用直接访问网络的访问攻防技术到代理服务器中,那么首先 必须使浏览器或网络应用程序设置了代理服务器。
然而,寻找访问外网的代理服务器地址又是一门学问。有些网络环境是在浏览器中直接设置了代理服务器的地址和端口,这样获得其地址十分容易;而有些网络环境使用了“自动代理配置脚本”的功能,以达到访问不同的网络使用不同的代理服务器的功能,其中著名的AutoProxy插件也使用了这种技术;甚至有些网络环境使用了“自动检测网络代理设置”的功能,以达到计算机在不同的网络环境中都能自动配置代理的功能。不过,在后两种设置的网络环境中寻找访问外网的代理服务器地址就需要了解这些技术了,具体可以参考Proxy auto-configWeb Proxy Autodiscovery Protocol。如果不熟悉这些技术,也可以通过netstat工具或者sniffer工具找出访问外网的代理服务器地址。这些技术和工具不在本篇中展开讨论。
如果你顺利找到了代理服务器的地址,那么接下来我们就可以分析一下代理服务器究竟可以做哪些限制,以及如何突破这些限制的方法了。
我们略过上一篇中已经详细说明的直接访问网络情况下的攻防,来看看代理服务器还能进一步做哪些过滤。在此列举一下通常情况下会碰到的过滤方式:
1、域名过滤。在使用代理服务器访问网络时,会遇到某个域名下的所有网页都是访问被拒绝的情况,这就是域名过滤。然而,通常情况下代理服务器对于域名的过滤只是通过分析访问地址中的域名进行的过滤,而不是通过HTTP代理协议中的Host字段进行的过滤。那么我们可以通过把访问地址中的域名换成域名对应的IP地址,来解决这个问题。
2、IP地址过滤。在访问网络时,有时候访问某个IP地址下面的网页会出现全部拒绝访问的情况。和域名过滤一样,这种过滤方式很多情况下也只是对访问地 址中的IP进行过滤,那么我们可以把IP地址换成对应的域名解决问题。如果这个IP地址没有域名或者暂时找不到其对应的域名,也可以为这个IP注册一个免 费的二级域名,之后就可以把IP换域名了。
3、 端口过滤。由于浏览网页使用的是HTTP和HTTPS协议,这两个协议使用的默认端口分别是80和443,那么为了防止人们使用其他协议,很多时候代理服 务器也会限制访问的外部端口只能是80和443。碰到这种过滤方式,只能使用支持代理服务器级联的软件访问其他端口了。但由于HTTP协议是明文传输的, 所以也有很多代理服务器不对HTTP协议的端口进行过滤,只对HTTPS协议的端口限制为443。如果需要使用其他协议,而其它协议使用的端口正好是 443,那么我们正好可以利用HTTPS的密文传输特性,连接到目标服务器的443端口,代理服务器无法知道我们使用的是HTTPS协议还是其它协议。如 果不碰巧,其它协议使用的端口不是443,那么我们仍旧需要使用支持代理服务器级联的软件访问其他端口了。
4、探测HTTPS协议头。 由于HTTPS协议的初始握手过程仍旧是明文的,那么代理服务器可以检测连接到外部443端口的协议头。如果不是 HTTPS协议,那么就断开连接。碰到这种过滤方式,我们可以先把正常的HTTPS协议头sniff下来,加入到通讯双方,之后再进行其它协议的通讯,就 可以解决问题。
5、NTLM密码认证。有些代理服务器使用了NTLM密码认证,那么IE用户不会感觉到有什么问题,使用了其它内核的浏 览器或者其它应用程序时,就会提时输入访问代理服务器的口令。由于很多代理级联软件并不支持需要经过密码认证的代理服务器,会造成一定麻烦。可以使用一款 名为NTLM Authorization Proxy Server的软件解决问题。
6、URL过滤。有时候代理服务器为了防止用户访问某一类特定的应用——比如bbs——会过滤URL中带bbs的所有访问请求。碰到这种过滤方式,我们也只能使用代理级联的软件了。
上面大致讲述了会经常碰到的代理服务器过滤方式。不过由于代理服务器过滤的方式千奇百怪,本文无法罗列所有的过滤方式。而且除了代理级联软件有现成的之外,其它解决问题的方式都需要代理服务器使用者自己编写网络程序,所以其它方式也主要是供大家进行研究的。
最后,我给出使用了HTTP协议进行级联的软件源代码(下载), 使用方式为java -Dhttp.proxyHost=代理服务器地址 -Dhttp.proxyPort=代理服务器端口 net.tools.web.TunnelClient 本地代理服务器端口 级联的代理服务器URL,然后就可以使用本地代理服务器进行网络访问了。比如我们必须通过代理服务器192.168.0.200:8080进行外部网络访 问,我们可以运行命令java -Dhttp.proxyHost=192.168.0.200 -Dhttp.proxyPort=8080 net.tools.web.TunnelClient 7890 级联的代理服务器URL,之后我们把浏览器的代理服务器设置为127.0.0.1:7890即可使用。我再给出一个级联的代理服务器URL为 http://jinshan.isysjs.com.cn/tunnel/。此URL只供测试使用,请勿滥用。如果碰到NTLM密码认证的情况,请参考 上述第5种代理服务器的过滤方式。

Monday, August 23, 2010

Working with named calculations

http://searchsqlserver.techtarget.com/feature/Working-with-named-calculations

Named calculations are additional virtual columns on the tables in your DSV. This allows you to mine derived information in your data without having to change your source data. Anamed calculation consists of name, a SQL expression containing the calculation, and an optional description. The calculation can be any valid SQL expression. If you are not a SQL expert, here are some types of expressions that are useful in many data mining projects.

Figure 3.5 Completed MovieClick data source view
Arithmetic Operations
Standard SQL supports +, -, * , /, and % (modulo). For example you could create a Profit named calculation with the following formula:
[Sales Price] – [Item Cost]
Mathematical Functions
Mathematical functions are useful, especially when data in a column does not follow a uniform distribution. The SQL functions ABS, LOG, SIGN, and SQRT are particularly useful. Here are two examples:

  • To flatten out an exponentially increasing variable:
    LOG([Sales Quantity])

  • To create a flag for over/under budget quarters:
    SIGN([Actual Expenses] – [Budgeted Expenses]) Compositing Expressions
    Often, the hypothesis you want to test depends on a variable that is a combination of two of the variables you already have. For example, it may not be interesting that a person is married or has children, but the combination of the two may provide valuable information. A composite expression for this situation could look like this:
    [Marital Status] + ' ' + [Has Children]
    CASE Expressions
    CASE expressions are an extremely flexible way to create meaningful variables for data mining. The CASE expression allows you to assign results based on the evaluation of one or more conditions. Useful applications of CASE are to change value labels, manually discretize columns, reduce the number of valid states, and convert an attribute from a nested table to the case level.

  • To change value labels:

  • CASE [Category]
                   WHEN 1 THEN 'Food'
                   WHEN 2 THEN 'Beverage'
                   WHEN 3 THEN 'Goods'
         END CASE
  • Manually discretize a column:

  • CASE
                 WHEN [Age] < 20 THEN 'Under 20'
                 WHEN [Age] <= 30 THEN 'Between 20 and 30'
                 WHEN [Age] <= 40 THEN 'Between 30 and 40'
                 ELSE 'Over 40'
         END
  • To reduce the number of valid states:
    CASE [Marital Status]
                 WHEN 'Married' THEN [Marital Status]
                 WHEN 'Never Married' THEN [Marital Status]
                 ELSE 'Other'
         END

  • To convert an attribute from a nested table to a case table:

  • CASE
               WHEN EXISTS
                      (SELECT [Movie] FROM [Movies]
                             WHERE [Movie]='Star Wars' AND
                                                [Movies].[CustomerID]=[Customers].[CustomerID])
                             THEN 'True'
                 ELSE 'False'
         END
    This would be done, for instance, when you wanted to convert a nested attribute to a case-level attribute. Note that if you still want to use the nested table in the model, you will have to use a named query to filter the attribute from the nested table, as described in the next section.
    Creating a Named Calculation on the Customers Table
    To create a named calculation to discretize and reduce the number of states in the Num Bedrooms column:
    1. Right-click the Customers table and select Create a named calculation.
    2. Enter the calculation name Bedrooms and optionally enter a description.
    3. Enter the following expression:
    CASE
                  WHEN [Num Bedrooms] = 1 THEN 'One'
                  WHEN [Num Bedrooms] <= 3 THEN 'Two or Three'
                  WHEN [Num Bedrooms] >= 4 THEN 'Four or more'
                 ELSE 'None'
          END
    Upon closing the dialog box, the DSV Designer will validate your expression and return any applicable errors. Once you have successfully created your calculation you can see the results by right-clicking the table and selecting Explore Data.

    Extract RDL's from SSRS

    http://www.sqldbatips.com/showarticle.asp?ID=62


    Overview
    Reporting Services Scripter is a .NET Windows Forms application that enables scripting and transfer of all Microsoft SQL Server Reporting Services catalog items to aid in transferring them from one server to another. It can also be used to easily move items on mass from one Reporting Services folder to another on the same server. Depending on the scripting options chosen, Reporting Services Scripter can also transfer all catalog item properties such as Descriptions, History options, Execution options (including report specific and shared schedules), Subscriptions (normal and data driven) and server side report parameters.
    Download Reporting Services Scripter (2.0.0.17)
    View the Readme file


    Key Features

    • Quickly and easily extract all RDL from a Report Server
    • Automatically generates scripts to load reports, datasource's, resources, linked reports and folders with all their associated properties to enable report migration between servers with no manual intervention e.g. avoids having to try and copy execution options between servers manually using Report Manager which is prone to mistakes and not as repeatable or efficient as scripting
    • Automatically generates command files to load scripted items onto a new server
    • Automatically transfer items from one server to another (including from SQL2000 to SQL2005 to SQL2008)
    • Generate scripts for Shared Schedules
    • Generate Scripts for System and Item Level Roles
    • Generate Scripts for Normal and Data Driven Report Subscriptions
    • Easily generate loader scripts to load existing RDL files e.g. if RDL is kept under source control then it can just generate the scripts to load the reports rather than extract the report definition as well
    • Automatically backs up reports before overwriting them
    • Easily generate scripts from the command line
    • Reverse engineer Visual Studio Report Projects from a Report Server

    Tested Environments

    • Windows 2000, XP, Vista
    • Windows Server 2003, 2008
    • SQL ServerReporting Services 2000, 2005, 2008


    Requirements
    In order to run Reporting Services Scripter you need to have the .NET Framework 1.1 installed. In order to be able to run the generated command files or use the Transfer mode of deployment you will need the Reporting Services Management Tools installed, specifically the command line utility RS.EXE (this is version specific and the correct versions for your environment are required for full functionality)

    Deserialization failed: The 'DataType' attribute is not declared. Line 3020, position 20

    http://connect.microsoft.com/VisualStudio/feedback/details/405739/vs-2008-rs-2008-error-deserialization-failed-the-datatype-attribute-is-not-declared

    The workaround
    the bug:
    <-ParameterValues>
             <-ParameterValue>
                <-Value DataType="Integer">1
                <-Label>All
             <-/ParameterValue>
             <-ParameterValue>
                <-Value DataType="Integer">0
                <-Label>T/R
             <-/ParameterValue>
             <-ParameterValue>
                <-Value DataType="Integer">-1
                <-Label>SCD
             <-/ParameterValue>
            <-/ParameterValues>

    solution (remome all : DataType="Integer"):

    <-ParameterValues>
             <-ParameterValue>
                <-Value>1
                <-Label>All
             <-/ParameterValue>
             <-ParameterValue>
                <-Value>0
                <-Label>T/R
             <-/ParameterValue>
             <-ParameterValue>
                <-Value>-1
                <-Label>SCD
             <-/ParameterValue>
            <-/ParameterValues>

    Paypal: How to Delete Administrative eMail address

    you need to go to: https://www.paypal.com/us/cgi-bin/webscr?cmd=_profile-logins-change-admin

    (You may need to log into your PP account). Click on the drop down list of email address (or add a new one) and then click onto continue.
    Note: if you are trying to change your administrative address to an address that is currently your primary address, you will have to change your primary email address first.

    爱,婚姻,性及其他

    1。 创世纪说:女人是男人身上取下的肋骨 夫妻本为一体。 牙齿和舌头还有打架的时候呢 更何况是两个各有思想的人呢?所以当夫妻之间吵架的时候 心中默念他/她是我的骨中骨,肉中肉。。。
    2。 彼此接纳,帮助和相爱的关系。传道书说:两个人总比一个人好,因为二人忙碌同得美好的果效。若是跌倒,这人可以扶起。他的同伴若是孤身跌倒,没有别人扶起他来,这人就有祸了。再者,二人同睡,就都暖和。一人独睡,怎能暖和呢?(早在几千年的圣经就道出了两人在一起的真 谛)
    3。 关于性关系: 从我们左手戴上婚戒的那天起就不要用带着婚戒的手再去碰其他异性,因为性关系是上帝所赐给夫妻二人的生育,享乐和连结的恩典。这种恩典只属于夫妻二人。
    4。 爱是什么?对爱的诠释:  歌林多前书说:爱是恒久忍耐,又有恩慈。爱是不嫉妒。爱是不自夸,不张狂。不作害 羞的事。不求自己的益处。不轻易发怒。不计算人的恶。不喜欢不义。只喜欢真理。凡事包容,凡是相信。凡事盼望。凡事忍耐。爱是永不止息。
    5。 关于离婚: 丈夫对妻子的背叛。他说一个女人给他打电话说,她老公背着她在外面有别的女人不要她了 之后女人痛哭。他说丈夫对妻子的背叛是对妻子最大最大的伤害。从结婚那天起 丈夫对妻子就有了责任 一定要爱妻子。牧师说还没听说哪个男人在外面拼搏是为了街角的妓女,都是为了家庭 为了给妻子 孩子提供更好的生活。 箴言说:要喜悦你幼年所娶的妻

    Temporary Solution to Solve iphone 3G with iOS 4.0x lag issue

    Little trick I have been doing for all my iPhones, and have noticed a small speed increase (more so on 3G) is disabling spot light search. Everyone I have done it for has noticed a difference.

    iOS 3.X: settings > general > home > search results
    iOS 4.X: settings > general > spotlight search

    Uncheck all options, restart your phone. You should notice a bit of a difference.

    Friday, August 20, 2010

    A duplicate attribute key has been found when processing…

    This post is about a common error message during dimension processing I’ve been asked about quite a few times so I thought it would be worth posting about it. The error message says that a duplicate attribute key has been found when processing as shown in the following screenshot for a test cube (I just processed one dimension here):
    image
    Here’s the full error message:
    Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'dbo_Product', Column: 'ProductGroup', Value: ''. The attribute is 'Product Group'.
    When you got to this article because you just ran into this problem you probably don’t want to read much about the background but only want a solution. Unfortunately I found at least three possible reasons for this error message:
    Reason 1 (likely): The most likely reason for that error is that you are having NULL values in your attribute key column.If you simply created the attribute by dragging it from the source view, BIDS only sets the key column (name and value column default to the key column in this case), so for example if you have a column ‘Product Group’ in your source table and drag it to your dimension, the product group (Text field) will automatically become the key for this attribute. The attribute is listed in the error message (in the example above it is ‘Product Group’).
    Solution: Try avoiding those NULL values in your data source (for example by using a DSV query and the T-SQL coalesce-function). When your source data is a data warehouse it’s also a good practice to avoid null values as they complicate the queries to the data warehouse.
    Reason 2 (likely): You defined an attribute relationship between two attributes of the dimension but the data in your source tables violates the relationship. The error message gives you the name of the conflicting attribute (text part ‘The attribute is…’). The attributes has a relationship to another attribute but for the value stated in the error message (‘Value: …’) there are at least two different values in the attribute that the relationship refers to. If you have BIDS Helper installed, you can also see the error details and all violating references when using the ‘Dimension Health Check’ function.
    Solution: You may solve the error by making the key of the attribute unique. For example: Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'DimDate_x0024_', Column: 'Month', Value: 'April'. The attribute is 'Month'. In this example, the Month attribute violates an attribute relationship (maybe Month->Year) for the month April meaning that April appears for more than one year. By adding the year to the key of the month attribute you would make the relationsship unique again.
    Reason 3 (not that likely): You have an attribute with separate key and name source fields. When you check the data, you see that keys are appearing more than once with different entries in their name columns (note that it’s not a problem if the key appears more than once if only the name column is the same). In this case you will usually also see the key value in the error message, for example:
    Errors in the OLAP storage engine: A duplicate attribute key has been found when processing: Table: 'dbo_Product2', Column: 'ProductCode', Value: '1'. The attribute is 'Product Name'.
    This means that the attribute ‘Product Name’ uses the source column ‘ProductCode’ as the key and for the product code 1 there is more than one name.
    Solution: Use a unique key column (unique with respect to the name column)

    Long explanation Reason 1:
    In this case our attribute is only defined by one single source column (acting as key, name and value information) from the data source view. When processing a dimension, SSAS run select distinct queries on the underlying source table, so a duplicated key should be impossible even if the key appears multiple times. Just think of a date dimension like the following one (just for years and months):
    image
    In this case the year (2009) appears in multiple rows. However, defining an attribute year (using the the year column as the key) does not give a conflict as it is queried using a distinct query (so 2009 only appears once). So again, how could we get a duplicate result when using a select distinct query? Here is how my product table looked like:
    image
    As you can see the ProductGroup column has one row with an empty string and another row with a NULL value. When SSAS queries this attribute during processing it runs the following SQL query (that can be captured using the profiler):
    SELECT DISTINCT [dbo_Product].[ProductGroup] AS [dbo_ProductProductGroup0_0]
    FROM [dbo].[Product] AS [dbo_Product]
    The result of the query looks like this:
    image
    Now, with the default NULL processing for our dimension attribute being set to ‘Automatic’ meaning Zero (for numerical values) or Blank (for texts) the NULL value above is converted to an empty string. So the result set has two lines with an empty string and that causes the error.
    image
    So the problem can be avoided if you don’t have null values in your column. This explains the first reason described above.

    Long explanation Reason 2:
    I blogged about attribute relationship before and you may want to read this post about defining the key for attributes in an attribute relationship.

    Long explanation Reason 3:
    Let’s take a look at the following modified product table.
    image
    The ProductID column is unique while the ProductCode is not. If we now define the ProductName attribute as follows we will also get a duplicate key error:
    image
    The reason here is that for the ProductCode 1 two names are found (and therefore the select distinct returns two lines with ProductCode 1), so ProductCode is not a good key here. The problem would disappear if the ProductName for the third line would also be ‘A’ (like for the first line) or the ProductCode for the third line would be other than 1 or 2.
    However, this reason occurs rather seldom because usually if we have a key and a name in our dimension, the source comes from some kind of master data table and therefore it should be unique. But for type 2 slowly changing dimensions you must not use the business key as key column (as there may be many rows with the same business key).
    Another way to “solve” duplicate key errors (although not recommended) is to set the “KeyDuplicate” property for the error processing of the dimension to “IgnoreError” as shown below:
    image
    However, this is definitely not recommended except for prototyping scenarios. This is clearly explained here http://technet.microsoft.com/en-us/library/bb630297.aspx.

    Do not ignore duplicate key errors.

    http://technet.microsoft.com/en-us/library/bb630297.aspx

    Do not ignore duplicate key errors. Change the KeyDuplicate property of the error configuration so that it is not set to IgnoreError

    This rule analyzes the error configuration settings of dimensions to determine whether the KeyDuplicate property is set to IgnoreError.
    Although the default value for KeyDuplicate is IgnoreError, you should not ignore duplicate key errors. If you use the IgnoreError setting, it can be difficult to detect problems with incorrect key columns, incorrectly defined attribute relationships, and data consistency issues. Instead of using the IgnoreError setting, it is typically better to correct your design and clean the data.
    The IgnoreError setting can be useful in prototypes where correctness is less of a concern. However, you should change this setting after prototyping is complete to ensure data consistency.
    For more information about error settings, see Processing Options and Settings in SQL Server Books Online.

    Turning a non-natural hierarchy into a natural hierarchy

    Turning a non-natural hierarchy into a natural hierarchy

    In the last post we had a very simple time dimension with a non-natural hierarchy. In this post I show how to turn this hierarchy into a natural hierarchy.
    The basic idea is to modify the key column for the month attribute. As we still want to keep the original month attribute, I simply create a new one named 'H_Month' ('H' for hierarchy as we only want to use it in the hierarchy).
    image
    H_Month is just a simple copy of the month attribute. Now we edit the key columns of this attribute in the attribute's properties by clicking on the ellipsis:
    image
    In the DataItem Collection editor we choose 'Add' which gives us a new key column:
    image
    Now we can edit the source for the new key column by clicking on the ellipsis in the source field. We choose 'Column binding' as the binding type and take 'Year' as the key column as shown below:
    image
    After clicking 'OK' we rearrange the key columns so that the Year-column comes first. The result looks like this:
    image
    Before we can proceed we also have to set the name property of our attribute 'H_Month' because now we have more than one key column and therefor the name cannot be derived from the key. We choose the Month-attribute as the name:
    image
    Since we also want the months to be sorted correctly we set the OrderBy property of our new attribute to "Key":
    image
    Now we can process and check our new attribute H_Month. The dimension browser shows something like this:
    image
    Note that the month number is now repeated for every year. So we're having one member in our attribute for each year now. As this attribute is not what the user expects after selecting a month, we simply set this new attribute to invisible:
    image
    Now we can build our attribute relationship like this:
    image
    This relationship is correct because for each month in the attribute H_Month (defined by the key year/month) we only have one year as a parent. We can check this by using the BIDS Helper dimension health check:
    image

    Now we only have to modify our hierarchy by switching the attribute in the second level:
    image
    image
    After doing so the yellow warning sign disappears and we are finished! Since the Name property for our level remains unchanged, the hierarchy looks the same as before:
    image
    You can check the dimension using the dimension browser in BIDS. Every year now has every month associated with it.
    Of course modeling attribute relationship becomes more complex the more attributes you have to take into account. The dimension lettuce tool in BIDS Helper can be very useful in checking the dimension layout in SQL 2005. And with SQL 2008 the dimension editor shows the attribute relationships in a much more convenient way.

    Thursday, August 19, 2010

    SSAS 2005: Cube Performance Tuning Lessons Learned

    http://weblogs.sqlteam.com/derekc/archive/2008/10/28/60747.aspx

    Intro.
    A recent project has forced me (which is a good thing) to learn both the internals of SSAS 2005 as well as various performance tuning techniques to get maximum performance out of the OLAP server. It goes without saying that the grain of both your underlying data warehouse's Dimensions & Facts will drive how large your cubes are (total cube space). It also should be a given that Processing Time & Query (MDX) Execution Time usually compete with one another. Given the same grain of a model, the more Grain Data, Indexing, and Aggreggations you process upfront should generally result in a more performant end-user experience (but not always). And while ETL & Cube Processing time is of importance, in the real-world it is the end-user experience (capability and performance) which drives the DW/BI solution's adoption!
    Throw-out unused Attributes/Optimizing Attributes/Leverage Member Properties
    The more dimensional attributes you create infers a larger cubespace, which also means more potential aggregations and indexes. Take the time to review with your clients the proposed set of attributes and be sure they all provide value as a 1st class Dimension Attribute. Also, if you find attributes are used primarily for informative purposes only consider leveraging Member Properties instead of creating an entire Dimension Attribute. Also, the surrogate key for your dimensions almost never add business value, delete those attributes and assign the keyColumns of your dimension's grain member (ie it's lowest level) attribute to the surrogate key. If an attribute participates in a natural hierarchy but is not useful as a stand-alone attribute hierarchy you should disable it's hierarchy via the AttributeHierarchyEnabled setting. Finally, be aware that if you have a 'deep' dimension (ie like 19 million members) at its lowest grain, any additional attributes you add will incur much overhead as they have a much higher degree of cardinality.
    Set Partition Slices
    The question of whether or not you must explicitly set a partition's SLICE property is clearly documented incorrectly in SQL Server 2005 Books Online (BOL). For all but the simplest partition designs you should consider setting the SLICE property to match the source property (ie the dataset definitions should match across both properties). For those who do not know, a partition's SLICE is useful for query execution purposes, the SLICE tells the formula|storage engine which partition(s) hold the data that is being requested of it. Please see resources section below for more information on this.
    Optimizing Attribute Relationships
    Attribute relationships are the developer's mechanism to inform the OLAP server of the relation between attributes. Just like Fact Tables (measure groups) relate to dimension in various ways (Regular, Referenced, Fact, Many-to-Many), dimension attributes can relate to one another in various forms (One-to-One or One-to-Many).Also, you can set the RelationshipType to Flexible or Rigid. If you know your member's change over time (ie reclass), make sure to leave this setting as Flexible, otherwise set it to Rigid. Take the time to thoroughly review your attribute relationships and ensure that both represent their natural hierarchy and are optimized!
    Scalable Measure Group Partitioning & Aggregation Strategies
    This is one of the better known techniques but it is still of utmost importance. Make sure to design your measure group's partitions to optimize their performance (both processing and query execution). If your system has a 'rolling window' requirement also account for this in your ETL design/framework. You should almost always partition your measure groups by the DATE_KEY and match the underlying relational data warehouse (RDW) partitioning scheme. The basics of this is your 'hot' (the current period) partition should be optimized for query-execution time via setting a different Aggregation Design as opposed to the 'colder' (older) partitions. Also, if your main storage device (ie SAN usually) cannot hold all of your required data, consider leveraging Remote Partitions to offload the extreme 'cold' partitions to slower storage.
    Continuously Tune Aggregations Based On Usage
    Most documentation in the community clearly states the order of creating effective aggregations is to first leverage the Aggregation Design Wizard, enable the Query Log, and then re-tune the aggregations using the Usage-Based Tuning Wizard. What is not mentioned (near enough anyway) is to continuously retune your aggregations using a refreshed Query Log using the Usage-Based Tuning Wizard. By doing so you are ensuring your aggregations are periodically revised based up recent, real-world usage of your cubes.
    Warming the Cache
    Another well known technique...by issuing real-world MDX queries onStartUp of the MSOLAP service your cube's cache will be pre-optimized.
    Be Mindful of Many-to-Many Dimensions Performance Implications
    While M:M dimensions are a powerful feature of SSAS 2005, that power comes at the cost of query-execution time (performance). There are a few modeling scenarios where you almost have to leverage them but be aware that if you are dealing with large amounts of data this could be a huge performance implication at query-time.
    Control of the Client Application (MDX): That is the Question
    A lesser discussed matter yet still very important is how much control you have over the MDX issued to your cubes. For example, Excel Pivot Tables and other analytical tools allow the user to explore your cubes with freedom pending the security (no Perspectives are not a security measure). If you can write (or control) the MDX being issued by the end-user then obviously you have more control to ensure that actual MDX is optimized.
    Got 64-Bit? Multi-Cores?
    For enterprise-class Microsoft DW/BI engagements forget about x86/single-core, period. Analysis Services can chew through (process) more data, in higher-degrees of parallelization with x64 multi-core CPUs. Storage|Formula engine cache rely on memory...long-story short, Analysis Services has been designed to perform at higher levels of scalability when running on multi-core/x64 CPUs. Also, be sure to set Analysis Service's Min/Max Thread settings properly for both Query & Processing.
    Conclusion
    I am dedicated to life-long learning. I cannot take full credit for my content above as much of this knowledge was the work of others as well as my own testing. The resources section listed below gives credit where it is due accordingly. Take the time to learn and implement highly-performant SSAS 2005 cubes to ensure your project's stakeholder’s first query is a performant one!
    Resources
    Mosha Pasumansky's Blog (MDX 'Father'): http://sqlblog.com/blogs/mosha/default.aspx
    Microsoft SQL Server 2005 Analysis Services (best SSAS 2005 OLAP internals book out!) by SAMS Publishing: http://safari.samspublishing.com/0672327821
    SQL Server Analysis Services 2005 Performance Tuning Whitepaper (a great tuning document): download.microsoft.com/download/8/5/e/85eea4fa-b3bb-4426-97d0-7f7151b2011c/SSAS2005PerfGuide.doc
    HP Solutions with Microsoft SQL Server: http://h71028.www7.hp.com/enterprise/cache/3887-0-0-0-121.html

    Analysis Services Performance - Quick

    http://www.olapoffice.com/products/mni-product-ms/mni-product-ms-analysis-services-performance

    Analysis Services has always has been very good cube performance and it handles sparsity exceptionally well. However, with writeback there have been some considerations that needed to be taken into account when creating solutions. These are discussed here.
    Below is diagram of how the cube writeback functionality has progressed within SQL Server versions 2000 -> 2005 -> 2008. We would encourage all uses to upgrade to SQL 2008 to take advantage of the performances gain as it opens up a raft of applications and how they are designed. For more information please contact OLAP Office to discuss further.
    analysis_services_olap_writeback

    SQL 2008 Cube Writeback Explanation

    • Values are retrieved directly into the worksheet from the cube.
    • If a change is made to a cube multi-dimensional cell then 
      • the cube is updated with the actual value
      • the incremental change between the old cube net value and new cube net value is reflected in the "writeback" table. This is the audit trail of transactions that tells you who has changed what and when.

    SQL 2000/2005 Cube Writeback Explanation

    • Values are retrieved into the worksheet by summing 
      • the retrieved value from the cube and
      • the retrieved incremental changes to the respective multi-dimensional cells.
    • If a change is made to the cube then the incremental change between the old net value and new value is reflected in the "writeback" table. This is the audit trail of transactions that tells you who has changed what and when.
    Note: To maintain cube performance where writeback is involved with SQL 2000 and 2005 you need to keep the writeback tables at a minimum to optimize performance. This is not the case for 2008.

    Wednesday, August 18, 2010

    野史,纯野史 (zt)

    引英法联军进入圆明园的,就是写“落红不是无情物,化作春泥更护花”的号称清朝最
    伟大诗人的龚自珍的亲儿子龚橙,也叫龚半伦。

    李清照的丈夫是中暑死的。

    一休和尚很风流,80岁了还和妓女厮混。


    中国皇帝貌似有个特别喜欢兽交的,野史里有提到过,没记错的话应该是汉灵帝。

    妲己后来没有被杀死,而是被周武王的弟弟周公旦纳为姬妾。

    英法联军进圆明园时,发现有个库里装满了先进火器火枪,都快霉烂了,都是康熙前后
    外国进贡的,比联军武器好多了……而古时秦国的武器都是标准化生产的,不仅刻有生
    产者名字以便追究质量责任,而且零部件都可以通用,在战场上可以迅速把几件折损的
    武器拼装成……变型金刚。

    东汉有个太监,凭借为皇后诬陷其他嫔妃上位,皇后死后,他立即又傍上了另一个皇后
    ,简直就是个皇后控。这个人政治上的作为不堪入目。他叫蔡伦,发明了造纸术。

    彼得大帝有2米02高,算不算出乎意料。

    茶叶刚到外国的时候,洋人煮好后把茶汁倒掉,然后用盐啊胡椒粉啊之类的把茶渣拌着
    吃,嗯,挺好的一盘老虎菜。

    话说唐中宗李显是历史上最牛X的皇帝。这是为什么呢?因为他自己是皇帝,父亲是皇
    帝,弟弟是皇帝,儿子是皇帝,侄子是皇帝,更要命的是他妈也是皇帝,于是历史给了
    他一个很光耀的名字:六位帝皇丸。

    历史上有一个女人伺候了六个皇帝,包括杨坚(要不就是他儿子),窦建德(他曾经短
    暂称帝,后来被灭了),还有辽国的父子俩,然后她在接近六十岁的时候又嫁给了李世
    民,另外一个皇帝不知道是谁,此女的姓名我也忘了,也百度不到。

    逼死楚霸王的韩信死时被关在笼子里,笼子外面蒙上布,然后一群女人用竹枪捅死了他


    德军在二战前发现一本书(《未来的陆军》),讲述如何以机械化部队进行机动作战,
    德军据此建立了庞大的装甲军团,仅仅用了6个星期就打败了法国,这本书的作者就是
    后来的法国总统——戴高乐。

    罗马城曾被自己的皇帝下令烧毁,原因是他想看着焰火吟诗,这个皇帝叫尼禄。

    陈世美确有其人,但是人家是忠臣,人家夫妻感情好得很呢。陈是湖北人,有个老乡想
    找他开个后门,但被陈正直的拒绝了,于是这个老乡很阴险的写了陈世美抛妻弃子的一
    出戏,还到处演,这样一传十,十传百,硬是把个好人污蔑成了个历史罪人,真冤。

    "存天理灭人欲"那位大学士朱熹喜欢自掘坟墓,曾经把自己儿媳妇的肚子搞大。

    发明交流电的尼古拉·特斯拉,这一位可与达芬奇并称的举世天才一直受到大资本家(
    包括爱迪生的通用公司)的打压,因为他的天才损害了大资本家的利益,去世后大部分
    资料被FBI销毁。

    爱迪生人品极差,道德及其败坏,看来才华与人品无一毛关系。

    隋炀帝是历史上相貌最出众的皇帝。

    隋炀帝在扬州时,励精图治,安一方黎民。当上皇帝后,开凿大运河,是中国历史的创
    举。另外,杨广文学天赋极高,可以搜一下他写的诗,大气非常。历史记载:杨广“善
    属文”。“炀”是李渊给杨广的谥号,改朝换代后,后朝人给前朝的嗜好,是不可信的
    。由于李世民老爸是隋朝的旧臣,夺取了人家的王位有点理亏,所以后来掌握了话语权
    的李世民就在写隋史的时候给隋炀帝彻底颠覆成了现在的形象。

    李煜是狂热的佛教徒,和他那貌美如花的小周后没事就爱躲清凉山拜佛,他俩叩头叩得
    脑门上都起了一层厚厚的老茧。

    白蛇传里的小青是个男的,我们小时候都被新白娘子传奇给忽悠了。

    牛顿在26岁以前就几乎完成了他在物理界的所有发现……剩下的人生都玩命的在黄铜里
    炼金子,还有膜拜上帝。

    中国曾经有外籍太监,有一个韩国(高丽)的,叫朴不花。

    屈原不姓屈,姓芈(mǐ)姓,他的后代也不姓屈,姓熊。之所以管他叫屈原,是因为
    他死的屈,呵呵~

    屈原是gay,他爱的是楚王,失意悲伤是因为楚王变心……第一个提出屈原是gay的不是
    腐女或同志,而是国学家孙次舟,他的观点得到了著名文学家朱自清和闻一多的公开支
    持。

    郑板桥是gay倒是他自己在自传中明目张胆说的。

    补充下郑板桥。这老兄爱帅哥爱得在当县官时,看到帅哥犯人们都心疼的不得了,不得
    不施刑时,他难过得掉泪……以至他提出建议废掉打板子的刑罚,因为实在受不了眼睁
    睁的看着打帅哥PP……

    在性向方面貌似古代是比现代要开放多了,去翻翻《聊斋》《阅微草堂笔记》或《世说
    新语》,那里面“好臀风”三字出现概率不低哟。

    历史上的帝王很多都双的,娈童是个很流行的东东,春哥估计在当时不会太吃香。

    去看西汉史,人家10个皇帝8个是双。

    汉武帝也是男女通吃,至于其男宠,韩嫣韩说俩兄弟和李延年基本上是肯定的了,卫青
    霍去病只能说可能性很大,但汉武帝的墓旁边紧挨着就是卫青的墓,连皇后都靠边站,
    没她的份。还有据说那个金日磾的小儿子也很得刘彻的宠,汉朝啊,天子都爱好男色了
    ,就别指望下面能保持正统。汉哀帝和懂贤都是家喻户晓的……表少见多怪,据说黄帝
    就娈童,大家都有好传统。

    何止帝王和有钱人,过去的书童在伴随主人赶考的路程里,除了要照顾主人的食宿,背
    行李外都要陪寝解决主人的生理问题的,那时的小书童身兼多职,特别是来自福建等地
    的特别抢手(没有说福建人坏话的意思)............

    郭沫若比较开放,跟人道歉的方式很特别,就是亲嘴(胡适被他亲过, 我汗)。

    汪精卫是个大才子,听说还是个大。帅。哥。

    西方妓女的起源是圣女,最早是供奉在庙里面,通过OOXX来启发信徒的神性的。也就是
    说,有人迷惑了,想去接近神,就去跟庙里的圣女OOXX,在high的那一刻接近神,所以
    维纳斯最早是妓女之神,后来演变成为爱与美的女神。西方科学家也说男人high的那几
    秒,大脑空白,最接近神。

    也有人说上面这个观点正好说反了,罗马的维纳斯——从希腊的阿弗洛狄德(Aphrodite
    )演化来,是爱和美的女神。希腊那会,爱和美嘛,代表女性最高最真的自由,是独立
    的追求自己的爱情和生活的化身,于是沿着——自由的爱情——自由的性爱——自由的
    性——自由的妓女…………演化过去了。于是很多没有丈夫保护or不要丈夫的自由女性
    ,生活在神庙周围,并祈求她的保佑,最后,她也变成的妓女的保护神。毕竟那个年代
    ,女人没有父亲和丈夫的保护,想要独立生活,恐怕也只有那啥了……

    提到维纳斯,顺便说一下,中国古代的妓女也供神位,这位大神就是管仲,因为他第一
    个开设官妓,让妓院国有化、规范化。

    非洲的卢旺达在1994年发生胡图族和图西族的种族仇杀,3个月内死亡100万人,大多数
    被切香蕉的大砍刀砍死。这种大砍刀是中国制造,一块钱2把。(不知道货币单位是法
    郎还是美元)。

    列宁死于梅毒并发症。

    据说舒伯特是嫖妓得了梅毒才英年早逝的,得过梅毒的其他名人还有贝多芬,尼采,哥
    伦布,林肯等等。

    莫扎特也很惊恐。首先,他很喜欢大便,他给父亲,情人的信里不断出现“大便 真好
    吃”“再见,保重,要拉屎在床上喔。”之类的话,他在给堂妹的一封信中写道:“哦
    ,我的屁股像火在烧!……也许是有粪便要出来了!……那是什么?—— 也许是……
    哦,天哪!……我怎能相信自己的耳朵呢?是的,的确是这样——多么长,多么另人忧
    伤的一声响!……我把我的尿拉在你的鼻子上,它会往下流,一直流到你的嘴巴里……
    你还爱我吗?” 他的书简集里一共出现了关于大便的字眼100多处……第二,他很喜欢
    梅毒。他得了梅毒之后很兴奋地写日记“我得了梅毒!终于…真的是梅毒!不是不屑一
    顾的淋病、菜花之类的。是梅毒,弗朗西斯一世就是死于梅毒,雄伟的梅毒,纯粹简单
    、优美的梅毒……我得了梅毒,我觉得很骄傲,去他的布尔乔亚,哈利路亚我得了梅毒
    !”

    文成公主是松赞干布的小老婆。

    小乔也不是周瑜的正妻,只是一名妾室。

    张飞其实是帅哥,书法写的好,还擅长画美女图,其书画作品均属上乘,是一位具有文
    士素养和气质的武将。他的两个女儿都当了皇后,史称大小张后,估计这两个姑娘基因
    不错,如果丑的话刘禅会要么。

    据说康熙小时候出过天花,是个麻子,而且他只有一米五几。

    乾隆很操蛋,中华文化在他手里差点毁光了,修四库全书毁书甚于修书,不符合满清统
    治的书籍全部毁掉,还删改剩下书籍里的文字。此人在文物字画上乱扣自己的图章,在
    上面乱写乱画搞破坏,文字狱在他那个时代到达了变态的地步,红楼梦没有完本也跟这
    个有关系。现在的影视剧居然还把这个家伙描述成风流倜傥的明君,开国际玩笑。

    乾隆也是一米五。

    欧洲人有一段时间以得肺结核为时尚,有些人主动去得肺结核。18世纪时,流行大裙撑
    紧身衣,为了美,节食挨冻,就得肺炎,肺结核。那个时候欧洲人的平均寿命 35岁~~~
    还有那彪悍的审美观啊,忘了几世纪的时候,欧洲女人算白了吧,可为了追求更高境界
    的苍白,居然吃起了砒霜,吃过量中毒死翘翘的人都有,可还是挡不住她们为了死人脸
    色继续吃的愿望。非但吃砒霜,她们还在化妆上下功夫,怎么个画法呢,先把脸涂白,
    然后再在脸上画些淡淡的血管,因为只有皮肤白到一定境界的人,才能看出血管来。

     大禹治水的时候三年过家门而不入,但在台桑遇到了涂山氏,俩人一夜情,涂山氏就怀
    孕了,生了一个小孩,就是夏代的创立者启。

    东汉三国时代的孔融,是孔子的嫡传二十世孙。可他居然说过:“亲爹有啥可孝敬的,
    当时他不过是为了解决自己的性欲罢了;亲娘也没啥特别的,不过是个装东西瓶子,东
    西出来了,跟那个瓶子还有啥关系?”——你能想到他就是七岁让梨的那孩子吗?

    大奸臣严嵩一手提拔的张居正,张居正是吃伟哥(海狗肾)吃死的,伟哥是戚继光送的



    杀人狂,排名不分先后
    毛XX(跨省勿追)
    成吉思汗
    秦朝大将白起
    希特勒
    思达林
    朱元璋
    蒋sir
    东条英机
    威廉一世........


    纪晓岚其实挺欣赏和珅的,因为和珅有他年青时的影子,正史里和珅是1750年生,比纪
    晓岚小26岁,比乾隆小39岁。现在的狗血电视剧太糟蹋人,和中堂当年是美男子一枚,
    倒是纪昀,那叫一个……淫荡。有记录,纪晓岚日御女六次……注意,是六个不同的时
    段,早中晚加下午茶宵夜……

    孙国父是革命先驱,但很少有人知道他是黑帮大佬中的大佬。而且他是个罗莉控,专门
    X小MM,快30岁了在日本找罗莉女仆玩……他自己也说,他一生最大的爱好是政治和女
    人。近代史很好查,百度一下就知道了,超惊悚。

    有个古人为抢侄子的一句诗把侄子杀了。这家伙就是唐朝的宋之问,他以五言诗出名,
    想要霸占亲舅侄刘希夷的“年年岁岁花相似,岁岁年年人不同”,强索不成,起了杀心
    ,杀人手法很诡异,好像是把大土坨装袋压在小正太胸口上,压了一晚上给压死了……
    《全唐诗》里记载的,真是极品啊。

    还是这一位宋之问,曾向武则天进言,称自己可以做她的入幕之宾 ,武则天嫌他口臭
    ,顾左言它,没有答应。入幕之宾既是面首,面首既是……呃,男宠。

    罗马教廷里有一位教皇,忘了是Pope Leo IX 还是V了,非常喜欢小男孩。他生日的时
    候会让精心挑选的漂亮正太裸体叠成蛋糕状,为他唱生日赞歌。唱完之后所有的小男孩
    都要跟教皇OOXX,但是不要以为 OOXX之后正太们就可以靠教皇飞黄腾达了,教皇很狠
    的,玩过了就杀死。what a facking bastard……




    按规定教皇必须是男的,但历史上曾经出现过一位女教皇,她一直以男人身份出现,本
    来是不会被发现的。但是一天她外出巡视,路中突然腹痛,当众生下了孩子。秘密终于
    被揭开,可怜那个女的好像当场被乱石砸死了。第一次听到的时候蛮震惊的,据说后来
    为了防止此类事件的产生,教皇的登基仪式上有个程序就是安排某位主教摸一下教皇的
    下身,以辨真伪,汗。




    历史上传说怕老婆的人:伍子胥,隋文帝杨坚,唐中宗李显(就那六味地黄丸),房玄
    龄,戚继光,胡适,常遇春,索额图。


    张作霖每天早上喝一碗虎血。


    陈阿娇是拉拉,这个典故和金屋藏娇一样可信,全部出自《汉武故事》。恐怕还是第一
    对有史可寻的拉拉……

    (【建元六年。太皇太后崩,上始亲政事,好祀鬼神,谋议征伐。长主自伐滋甚,每有
    所求,上不复与,长主怨望,愈出丑言。上怒,欲废皇后,曰:“微长公主弗及此,忘
    德弗祥,且容之。”乃止。然皇后宠送衰,骄妒滋甚。女巫楚服,自言有术能令上意回
    。昼夜祭祀,合药服之。巫著男子衣冠帧带,素与皇后寝居,相爱若夫妇。上闻,穷治
    侍御巫与后。诸妖蛊咒咀,女而男淫,皆伏事。】




    三菱集团的前身——龟山社,其最初的创始资金是坂本龙马靠把小弟丢给女富豪当男宠
    借来的,那个小弟就是后来打败清国废除日本对外不平等条约的名臣陆奥宗光。


    三国后的南北朝时代有个皇帝的书童领兵8000,从现在的南京出发,一路打下长安、洛
    阳70座城池,击败当时北魏的50多万大军,他叫陈庆之 。


    郭沫若是个不折不扣的斯文败类,寻花问柳,到处留精。


    禅让。李白都公开支持:尧幽囚,舜野死。(尧被舜关起来到死,舜被禹流放到九嶷山
    ……)。


    魏晋风范,也不是传说中的那么迷人。这帮文人不穿衣服,是因为他们天天炼丹药,吃
    丹药,体温比常人高、皮肤比常人敏感,当时的纺织物容易磨破皮肤……魏晋上层人物
    都不爱洗澡,在自己身上养虱子,然后捉来吃……这是当时非常时髦的做法。那个时候
    的丹药富含各种有毒物质,所以大多文人长期处在迷幻状态中。所谓魏晋风范,什么裸
    奔、喝酒、大哭……就是一帮古人,天天嗑药磕H了头,跟现在的瘾君子没两样。


    鲁迅曾在一篇《魏晋风度及文章与药及酒之关系》的文章里提过,那些人吃的叫“五石
    散”,是何晏开始吃的。五石散影响了魏晋的衣食住行乃至社会风气。吃了五石散之后
    ,全身发烧,发烧之后又发冷。因为皮肉发烧,不能穿窄衣。为预防皮肤被衣服擦伤,
    就非穿宽大的衣服不可。因皮肤容易磨破。穿鞋不方便,所以不穿鞋袜而穿屐。更因皮
    肤容易破,不适穿新衣而宜于穿旧衣,衣服不能常洗。因不洗,便多有虱子。所以在文
    章上,虱子的地位很高,“扪虱而谈”,当时竟传为美事。


    鲁迅是文豪没有错。不过他很善于理财,不准别人拖欠稿费,锱铢必较。有次林语堂为
    一个出版社说了两句好话,鲁大概表现很冲动, 林语堂就在日记里写:此人已成神经
    病。




    被鲁迅骂过得很多文人在日本人来了之后表现的很刚烈,比如那位女师大校长,而鲁迅
    的很多左翼盟友们都做高官去了。


    大家都知道杨荫郁吧,就是在《纪念刘和珍君》一文中被鲁迅骂的女师大校长,她后来
    为了给被日本兵奸污的中国女学生出头,找日军理论(杨女士日文很好),开始把日兵
    震了,后来知悉她身份,把她打死后推入河中,大冬天哦。(俺看到这段就觉得课本上
    应该替她辩白几句的,这怎么说都是烈士 )。貌似她还是钱钟书老婆杨绛女士的姑妈
    ,杨绛写文章纪念她的时候隐藏的开涮下鲁迅。刘和珍那件事是杨荫瑜的治校观念不合
    左翼胃口,当时很多负责任的教育家也不赞同让学生过多投入政治纠纷去当政治炮灰的
    ,本人也不赞同拉着同学赤手空拳去请愿,杨荫瑜管理是很严厉,可这样就定性为奴化
    教育封建教育了?是不是全校被封或者大家都听课闹革命才合“进步人士”的胃口啊!
    !?在这件事情上李四光倒为杨荫瑜说过公道话,结果有人说李四光和杨荫瑜私交不错
    ,说话作不得数。那鲁迅还与事件另一方当事人之一关系暧昧呢,许广平就是在这件事
    后借机搬入鲁家与他同居的。鲁迅还写过《寡妇主义》挖苦杨荫瑜,拿杨的不幸婚姻经
    历作话柄,最要命的是根据里面“寡妇”或“拟寡妇”的定义,他那个倒霉妻子朱安也
    在其中。真觉得这人失德的可以。



    司马相如后来还是负了卓文君。


    马克思和家里女仆(好像就是他老婆的陪嫁丫头)有个私生子。女仆怀上了之后,老马
    怕老婆发飙,就写信向恩格斯求救,老恩就把这黑锅顶了下来,现在那个啥博物还有这
    封信。这不是最雷的,最天雷的是小时候思想品德课外教材有篇说马克思尊重劳动人民
    ,很听这位女仆的话,当然,没说他俩有一腿。




    嘉庆皇帝是被雷劈死的。




    有人考证说禅让都是假的,下面有个case:
    马王堆三号墓出了一个帛书,上面有汉朝时候黄帝战蚩尤的记载,翻译后是这样的:
    黄帝把蚩尤抓住了,让人剥下蚩尤的皮做成靶子,让大家射;剪下蚩尤的头发挂在
    天上,叫“蚩尤旗”。黄帝又把蚩尤的胃填满干草做成一个球让大家踢,能用脚颠球最
    久的人得奖赏(黄帝说要有足球,足球就出现了)。黄帝还把蚩尤的骨肉做成肉酱,混
    合到苦菜酱里,命令所有的人都来分吃。黄帝颁布禁令,说:禁止触犯我的禁令,禁止
    不吃我分给你们的人肉酱,禁止扰乱我的民心,禁止不按我的路子办。如果触犯禁令,
    如果偷偷倒掉人肉酱,如果扰乱民心,如果不听我的话,如果不收规矩时限,如果知错
    犯错,如果越过界限,如果私自改动制度让自己快活,如果你想怎样就怎样,如果我还
    没颁布命令而擅自用兵,看看蚩尤的下场:他俯首做奴隶,他得吃自己的粪便,他求生
    不得不死不能,在地底下给我做垫脚石!以上,记录下来以示后人。
    因为描写太华丽,这一段文字在历史上抹掉了,我满脑子都是恒河的场面,买糕的。

    中国历史上唯一掉进粪坑呛死的国君是春秋的晋景公姬獳。(这位大叔死的,简直太狗
    血了,哈哈,没想到算卦先生算的如此之准——您老,吃不上今年产的新麦子。景公不
    信,来,把那丫挺的算命先生扔小号里去,老子今年非吃到新麦子不可,靠!…………
    新麦子收割了,给景公做好了饭,景公得意——孙子,看到没,今年的新麦子!我能吃
    着,你丫吃不着啦!!!哇咔咔……哎,我得先上个厕所! 结果,掉厕所里淹死了,
    真没吃到新麦子……)。





    第一个打算用火箭把人送向天空的是咱们国家明朝的一个叫万户的人(把自己送向天空
    的同时也把自己小命送天堂了),但是咱们国内的历史学家竟然没人说??这个说法还
    是人家国外的专家说到人类对太空的探索的时候说到的,会不会是八国联军把我们历史
    文献抢跑,然后自己悄悄研究去了??


    按照史记的记载,嫪毐(???~前238)的JJ相当强大,可以用来转动桐木车轮。如
    此看来,赵姬也是相当的彪悍啊……


    60年代的时候,全地球的青年人都在high,中国青年在闹革命,美国青年在吸大麻流浪
    滥交。法国和日本的青年打出了向中国人学习的旗号也在闹革命。

    革命总是伴随的群P—— 当年从全国各地奔赴延安的青年学生们,在延安大搞思想解放
    ,摒弃传统的道德体系,开放程度你怎么想都不为过。最平常的事情就是“打游击”,
    也就是一个男的碰见一个女的,问一声:“打个游击吧?”女的说:“好吧” 。两人
    就钻枣林了。这一传统流传下来, 就是某些人非常喜欢开舞会。
    一个曾经见证过轰轰烈烈的某事件的大爷说,那时候,聚集在一起的那帮学生们白天喊
    口号,坐着,聊天,晚上就在帐篷里OOXX,大有嬉皮士之风。尤其是有的人会在晚上点
    蜡烛弹吉他,那会儿就听见夜空中琴声和呻吟声齐飞,煞是刺激。敢情枪花那都是学咱
    们的~~~

    《戏梦巴黎》就有这段,华丽丽的老毛头像。





    说一个最近的吧,前几天意大利总理在一个欧盟高层会议上很勤奋地沙沙沙地划着什么
    ,大家都以为他在算计什么,后来那些别的国家的领导人就发现,这孙子竟然在画女人
    的内衣,而且丫不仅画,还传阅给其他领导人看(很无语……)。




    不过我还是最佩服下面这两位:




    第一位就是李白了,

    其诗在唐代,甚至在中国历史上都能排在前几名的主儿,

    结果又是当时武林高手排行榜第二……还手刃数人……我这颗爱怪蜀黍的罗莉心啊,一
    颤一颤的!

    只有那句话能形容他,不要迷恋哥,哥只是个传说


    文武双全的无双人物,除了李白,数百年之后还有一位
    这个人写的东西凡是认字儿的人都听过,但这个人一生的抱负不是去写文章, 而是去
    打仗。他年纪轻轻就参军,跟了一个老大混,因为实在是有本事,当了侍卫队长。后来
    有一次老大派他带了30个人去送信,他回来一看,傻了……
    原来他们队伍出了250,砍了老大的头,投降敌方,整个队伍都已经散了。 
    这人当时哭了一场,然后领着那30个小弟,纵马冲进有5万敌军的大营,一路砍过去,
    不仅抢回了老大头,顺带着还把那个叛徒的头也砍了,30个人毫发无伤的回去了。
    不过有本事的人都是遭嫉的,后来他被闲置,抑郁而死。
    此人名叫辛弃疾。


    那个叛徒名叫张安国,趁辛弃疾前往建康时杀了义军首领,自己带人投降金人。在这次
    为老大报仇的行动中,辛弃疾麻损失没有,反倒策反了一万多士兵跟他回到南宋,这买
    卖做的,值!!

    在这之前,还发生过一件类似的事。一个名叫义端的和尚,被辛弃疾说动投靠义军,不
    久后居然也反了,打算投降金军(怎么尽遇上这样的人),辛弃疾亲自追杀他

    临死前,义端还拍马屁说辛弃疾你是神兽降世啊,请不要杀我,辛弃疾听完立刻砍下他
    的脑袋。你才是神兽,你全家都是神兽。

    辛弃疾真是追杀叛徒专业户........

    BI除了烧钱到底在干啥—失败BI项目困惑

    成功率只有30%,BI你敢不敢部署?
    2010年最为热火当属云计算、物联网以及BI,对于CIO来讲,随着信息系统的逐渐完 善,持续优化、以及信息系统的深化应用成为CIO关注的焦点。对于大部分用户基础的信息系统已经部署应用,从企业管理层的角度来讲,BI已经成为下一步 CIO具体要部署应用的重要方面,但CIO不是“傻瓜”,产品不成型以及各种条件因素的影响在加上超低的失败率,让CIO在做BI时犹如过去ERP项目一 样,更加谨慎小心。笔者结合过去采访中遇到的BI应用真实案例以及第三方的社区ITPUB所结合的案例,真实的反映了BI的现状,并且由专业的技术经理、 BI专家提出了解决办法。更多参与讨论请点击:http://www.itpub.net/thread-1320555-1-1.html
      情景还原:
    天津一家制造业企业CIOBI在经历两年以后,最终以失败而告终!
    据了解到该企业部署BI的情况:
    1、该企业是一家制造业,早期应用了国外的ERP系统,在ERP系统上线后, 准备开始做BI;
    2、考虑到成本的问题,该企业是在上完ERP以后,准备自主开发BI系统,以行业、地区为纬度进行开发一个简单的BI工具;
    3、当自主开发的BI上线以后,发现并不能满足企业的需求 ,该CIO充分选择行业内的BI商,但都觉得该产品不适合;
    求助:该CIO一直比较困惑,如何才能把BI做好。两年BI项目的失败,让该CIO很是灰心,每当提起这事来,该CIO总是叹气,还没有做好。 BI作为辅助的工作或者手段,为什么在国内企业中的失败率比较高?
      解读失败原因
    BI的失败原因有许多,也许每一个细节或者环境没有设计好, 那么就会出现失败的案例,但总体要有一个方向,只有大的方向不变的情况下,才会保证BI项目的正确性。
    针对于上的问题,网友“markgigi ”认为,如果是自主开发BI系统,2-3年时间根本只能算开始,照他这样做的看来,不能满足需求的结果是可以预料的。而且这也是需求调研没有做好导致的。 第二、上了ERP后开始上BI,首先得考虑企业内部的流程是否按照ERP系统进行了有效的流程再造和规范管理,相关数据采集是否达到了预期。匆忙找个BI 厂商,可能连ERP都没完全融合在企业中,没有理念,更枉论新的BI系统了;第三、现在很多做的都是单纯的functions requirements而非business requirements,所以经常会系统上了之后发觉好像七七八八功能多了不少,也能出来很多数据,但并没有达到预期的分析已有业务,为企业未来方向提 供决策的目的。而这也是CIO的重要职能之一。
    而网友“innovate511 ”则表示,显然这是没有分析规划。BI团队应起到古时“谋士”的作用。为什么?因为业务人员局限在自己的小范围业务里,高层人员只管战略方向,只看结果, 那么谁来担负起分析战略的实现过程?业务人员不能,高层也不能,只能BI人做。我在文章中也举了一些实际的例子,反应出如果由业务部门来搞战略实现的具体 需求,那是无厘头的需求,没人用的摆实。所以如果BI团队没有这样的高手,必定只能跟着用户的需求开发,直到被用户淘汰,毫无发展而言。
    网友“markgigi ”补充强调,BI系统作为企业信息分析辅助决策的工具当然是面向能做决策的人的,前期调研都是根据不同行业不同企业具体分析和不同方法,不过可以把握的原则就是:
    1. 核心用户是谁;
    2. 他们最关心的问题是什么,当前或者中期他们的目标是什么;
    3. 这些问题和目标的相关数据源是什么,有什么关联;
    当然,一般制造业来说财务、供应链(库存)是关键 其实什么报表,什么实时分析,仪表盘都是浮云,只要出来的东西能让老板拍脑袋拍的轻松点,就成功了。
      烧钱的BI
    关于BI项目的价值认定,时下很多的CIO都表示出很多的无奈与困惑,网友“lei”表示,对于BI同样困惑,至今对BI还不知道除了烧钱到底是在干啥,很多做BI很久的,感觉说话不是惯性的忽悠,就是在谈缥缈的理想。
    网友“bq_wang”认为,做BI,首先把期望放低一些,先从数据中心开始首先汇聚数据、其次建数据仓库,开始结合ERP业务思考一些数据将来会如何 应用。再次如果CIO和技术部门对业务不熟可以先找个咨询公司诊诊脉,毕竟BI不是一个纯技术工作等完事具备了,再开始上BI项目。
    网友“innovate511”再次指出,数据仓库是基于BI主题需求而建的,而BI需求会随着时代的变化而变化,DW也需要不断改善模型和重建,所以没有一个尽头。 唯一可做的就是不断让BI产生价值。
    BI产生价值,第一阶段是出单纯的报表,如销售量、金额、利润、库存等等,然后是数据质量监控、日常数据查询。第二阶段是根据业务需求进行业务监控、问 题预警,第三阶段是面向业务优化,不但有业务预警,还有相应的业务信息作为辅助,帮助用户进行最佳时机的最佳业务操作,第四阶段应该是未来预测、业务即使 智能指导,这个阶段尚未有大的应用。BI能产生价值,方能长久。
      关于BI:
    BI 商业智能也称作BI是英文单词Business Intelligence的缩写。商业智能通常被理解为将企业中现有的数据转化为知识,帮助企业做出明智的业务经营决策的工具。这里所谈的数据包括来自企 业业务系统的订单、库存、交易账目、客户和供应商等来自企业所处行业和竞争对手的数据以及来自企业所处的其他外部环境中的各种数据。而商业智能能够辅助的 业务经营决策,既可以是操作层的,也可以是战术层和战略层的决策。为了将数据转化为知识,需要利用数据仓库、联机分析处理(OLAP)工具和数据挖掘等技 术。因此,从技术层面上讲,商业智能不是什么新技术,它只是数据仓库、OLAP和数据挖掘等技术的综合运用。
    商业智能的概念最早在 1996年提出。当时将商业智能定义为一类由数据仓库(或数据集市)、查询报表、数据分析、数据挖掘、数据备份和恢复等部分组成的、以帮助企业决策为目的 技术及其应用。目前,商业智能通常被理解为将企业中现有的数据转化为知识,帮助企业做出明智的业务经营决策的工具。这里所谈的数据包括来自企业业务系统的 订单、库存、交易账目、客户和供应商资料及来自企业所处行业和竞争对手的数据,以及来自企业所处的其他外部环境中的各种数据。而商业智能能够辅助的业务经 营决策既可以是操作层的,也可以是战术层和战略层的决策。为了将数据转化为知识,需要利用数据仓库、联机分析处理(OLAP)工具和数据挖掘等技术。因 此,从技术层面上讲,商业智能不是什么新技术,它只是数据仓库、OLAP和数据挖掘等技术的综合运用。

    BI成了“鸡肋”如何破解BI的尴尬处境?

    目前许多国内企业总是希望自己能在企业数据中,象沃尔玛一样能发现像“啤酒和尿布”这样具有关联性的商业规律,为企业创造最大价值。然而尽管像苏宁 电器这样的一线大型零售商业已向BI迈进,但这一切仍只是一个起步,对于大多数本土中小企业来说,甚至都还难言起步,更谈不上基于BI的高级应用了。时至 今日,我国许多企业“大而不强”、“规模不经济”的现象并没得到较好的改变。
      BI何以成了处境尴尬的“鸡肋”?
    当前在国内企业在BI应用中有一个十分突出、比较普通的问题,就是没有明确的价值实现方案。智能分析活动大多“淹没在数据当中”,信息挖掘仅停留在数据 转换、表册生成上,为数据而统计数据,能提供精确决策的信息功能十分有限。有些企业在BI方面进行了大量的软硬件投资及人力投资,却并不能给企业带来预期 的管理效率,BI有时成为“用之无味、弃之可惜”的鸡肋。中小企业面对商业智能,更是时有“水中月、镜中花”的感觉。
      不少企业的BI何以成了处境尴尬的“鸡肋”?
    通用性差,数出多“门”。由于一些历史原因,企业内部各个部门的数据来源不一,各自矛盾,而对于集团企业,特别是对于过去是分散式管理的集团公司,旗下 各个企业的财务统计口径不一,子公司系统五花八门,使得数据难于共享、互通。还有,即使是在同一系统的同一个字段中,格式和命名规范也常定义不清,将容易 导致BI项目的失败。另外,由于“信息孤岛”的存在,造成数据不集中和连续,给联机分析造成障碍,难以做到全面分析。
    人员素质差,基础 薄弱。商业智能的软件功能强大,内容非常复杂,没有专门的培训学习,一般是难于掌握。然而目前许多企业的技术人员比较缺乏,水平不高,对太复杂的软件、技 术往往有一定的抵触情绪。再者,不少企业长期以来领导就不太重视BI运用,把BI当成一种权宜之计,没有建立经营分析信息机制,基础薄弱,对做好经营分 析、提高分析效率也产生不利的影响。
    配置维护费用过高,不堪重负。建立良好的BI系统,不只要购买商业智能软件,企业用户还得购买数据仓库服务器、大型数据库系统,以及配置IT技术人员,中途还有不断加码的升级费,仅仅这些就得投入几十上百万,让规模小、资金弱的中小企业望而兴叹,一些中小企业即上BI,或因承受不了不断加码的资金压力,只好半途而废也是时常有之事。
    数据多是“过去式”,应用价值不高。目前企业BI运用多停留在过去数据和信息的流水帐通报,画一些曲线图、柱形图、饼图等简单的分析上,没有运用一些更 先进的统计分析方法进行深入分析、挖掘,造成经营分析报告质量不高,其价值意义大打折扣。而对目前企业所更急需的用户消费、市场变化趋势、供应商、营销商 和代理商等关联的外部信息,企业的研究、收集和前瞻却做得很不够。不少厂商BI系统也缺少对未来行业走势的预见、把脉的功能,数据功能大多是“过去式”而 不是“进行式”、“将来式”,因此使数据材料缺乏可靠有效的依据,对增强企业竞争能力帮助不大,使领导“爱而不理”。
    系统互为割离,缺 乏整体系统的掌控。如今随着企业陆续越来越多引进从各种IT系统,BI存在被分割、陷入边缘化之虞,BI被更多地当作企业信息化过程中的一个子模块,在时 间和技术等方面存在差异。这种设计中的思维局限,使BI与企业信息化中的其它模块存在一个接入瓶颈,即不论企业 ERP 、CRM、OA 或BI系统是否采用同一家企业产品,其之间都难以自然接入、集成,从而导致企业内部模块化信息传输出现瓶颈,互为割离,数据难有效共享,难于有效提高企业 的管理水平和利润。
      克服BI难关,助力精确管理
    经过近20年的高速发展,目前我国许多行业企业的发展已遭遇新瓶颈了。易观国际指出,中国企业如今面临了新的挑战,企业的信息化解决方案相应僵化,例如管理模式、风险控制手段、数据利用相对落后等,难于赶上形势变化需求,为企业提供更好更快的服务。
    为今之计,国内企业BI应该如何克服瓶颈,突破难关?该如何从浩如大海的数据海洋中,及时分析得出合理有利的决策信息,提高企业快速反应能力?
    完善企业BI信息的基础工作。BI要建立在企业信息化具备一定基础的条件上,如果企业数据库等基础工作没有扎实,BI投资再大,其结果只能是沙滩建房, 摇摇欲坠。只有做好了信息的基础工作,才能使BI有基本的运行平台,也为BI导入后的正常运作奠定了基础。主要是要通过数据标准化项目,建立企业数据字 典,统一字段定义和统计口径,同时对数据质量不好的系统和数据库进行一次性的数据清洗转换,以夯实、提高BI项目成功实施的基石。
    强调 协同,注重与其它业务系统实现无缝集成。大型企业集团并购时常面临诸多挑战,最重大的挑战之一是如何整合企业内部不同信息系统,使之充分融合协同,互为促 进。因此BI应有强大协同功能,首先厂商要从企业需求出发,做好与前后端数据的结合,更重要是内部的协同,与其他业务CRM、ERP、OA、财务等系统更 好地融合、协同,能把企业中已存在的CRM、OA、MIS、ERP、财务系统等存储的企业经营管理业务数据最大集成到工作流系统中,使得系统界面统一、帐 户统一,业务间通过流程进行紧密集成,而不必切换到不同系统进行调用,查阅数据能方便自如、真实管用,为企业提供统一准确有效的管理信息。
    健全BI项目管理体系。项目管理体系,是用来帮助企业顺利完成IT项目的一套科学、系统的方法和策略。一套真正好并且适合自身公司的项目管理体系,能对 项目进行有效管理,并大大提高项目完成的效率。因此企业尤其是大型企业集团在BI建设过程中必须从系统工程和科学管理的角度出发,建立健全完善的IT项目 管理体系和运作机制,才能确保BI项目的成功实施。主要内容包括:提高IT人员基本素质,制订明确、量化的BI应用目标,进行BI等现代管理知识的培训教 育,并引入第三方管理咨询,进行BI项目需求分析,开展企业管理创新,实行业务流程重组,逐步推广、实行BI项目监理制和BI项目评价机制、验收机制等。
    向三个方向转变,创造新的竞争力优势。不管是选型还是今后重点应用内容,企业必须关注、把握BI未来如何演变、应用主方向,才能抓住根本,达到为企业决策服务之目的。BI未来应用方向主要有三个方面:
    ①从数据驱动向业务驱动转变。数据驱动指由数据的深度挖掘来辅助业务,发展到要以业务为驱动,从业务出发,根据商业策略及其所需的分析来很好运用数 据;②从关注技术转向关注应用。BI将不再是一堆技术的集合,而是以应用为导向,来组合这堆技术,更好为改善业务服务;③从关注工具转向关注工具产生的绩 效。BI将再也不是报表工具、OLAP工具的简称,而是有多种工具来保障业绩的提升,主要有七种工具:描述统计工具、报表与界面工具、经营技术与方法、经 济预测方法与模型、OLAP分析、知识发现工具、专家系统以及决策方法与模型。这些工具应较好应用、充分配置。
    对症下药,着重把握BI 的选型关。选型是信息化成功的前提,能否“选对郎”关系今后BI能否顺利推广。对于数量占大多数的中小企业而言,一个优秀适宜的的BI产品必须满足以下条 件:价格不贵,性价比高,短期见效快;使用和管理简易,不需要IT的特别投入;功能上够用就行,支持基本的商务和绩效管理;通用性、易用性好,界面不陌 生;技术上能随着企业的成长而增加功能,十分便于维护、升级。
    总之,国内企业应深刻认识到BI是综合性的企业应用系统,其实施不是简单 的软件安装、调试,也不只是硬件的购买与调试,更不只是管理理念的灌输,BI的实施需要对症下药,用整体规划、分步实施的原则来指导行动,并高效挖掘、发 挥BI应用价值,方能借力BI,让企业时刻领先市场。

    Tuesday, August 17, 2010

    SQLSERVER中统计所有表的记录数

    Create TABLE #temp (TableName VARCHAR (255), RowCnt INT)
    EXEC sp_MSforeachtable 'Insert INTO #temp Select ''?'', COUNT(*) FROM ?'
    Select TableName, RowCnt FROM #temp ORDER BY TableName
    Drop TABLE #temp

    XBMC Global Keyboard

    http://wiki.xbmc.org/index.php?title=Keyboard_and_Mouse#Mac_Keymapping

    Common Platform-Independent Keymapping

    Key Description, Notes
    Any Single character That button on the keyboard, Case INSENSITIVE
    O Displays CPU usage and video diagnostic information
    P Play
    Space Pause
    X Stop
    L Cycle subtitles
    T Toggle subtitles on and off
    F FastForward
    R Rewind
    Left-arrow Left
    Right-arrow Right
    Up-arrow Up
    Down-arrow Down
    Page Up Page Up
    Page Down Page Down
    Return Select
    Backspace Parent Directory
    Q Queue
    W Marked as Watched
    M Activate OSD Player Controls
    S Activate Shutdown Menu
    Esc Home menu (remembering the last menu-position when you return to it)
    I Media Info
    Application key Context Menu
    C Context Menu
    Period Skip Next
    Comma Skip Previous
    Tab Toggles fullscreen modes (either visualisation or video playback)
    Print Screen Screenshot
    Minus (-) Volume Down
    Plus (+) Volume Up
    Zero (0) Number0
    One (1) Number 1
    Two (2) Number 2
    Three (3) Number 3
    Four (4) Number 4
    Five (5) Number 5
    Six (6) Number 6
    Seven (7) Number 7
    Eight (8) Number 8
    Nine (9) Number 9
    Backslash (\) Toggle Application Full Screen / Windowed mode
    End Shutdown XBMC

    Platform Specific Keymapping

    Live and Linux Keymapping

    ?

    Mac Keymapping

    ⌘Q and ⌘W to close
    ⌘H and ⌘M to iconize
    ⌘F to toggle fullscreen
    ⌘S to take screenshots inside XBMC