Posted by & filed under DATABASE, ORACLE, SQLSERVER.

Without going into a dissertation on data modeling(itself a subject of many full-length treatises), tables should follow basic rules of normalization:

Avoid duplicate data, avoid repeating groups in tables, and only put data in tables where the information is directly

Posted by & filed under SQLSERVER.

CREATE TABLE Loans (
 loan_nbr INT NOT NULL ,
 customer_nbr INT NOT NULL,
 loan_date DATETIME NOT NULL,�
 loan_amount DECIMAL(15, 2) NOT NULL,
 loan_type CHAR(1) NOT NULL,
 CONSTRAINT ck_loan_type
 CHECK (loan_type IN(‘P’,’B’)), — P = Personal; –B=Business
 CONSTRAINT pk_loans
 PRIMARY KEY(loan_nbr));…

Posted by & filed under SQLSERVER.

PIVOT用于将列值旋转为列名(即行转列),在SQL Server 2000可以用聚合函数配合CASE语句实现

PIVOT的一般语法是:PIVOT(聚合函数(列) FOR 列 in (…) )AS P

完整语法:

table_source

PIVOT(

聚合函数(value_column)

FOR pivot_column

IN(<column_list>)

)

 

UNPIVOT用于将列明转为列值(即列转行),在SQL Server 2000可以用UNION来实现

完整语法:

table_source

UNPIVOT(

value_column

FOR pivot_column

IN(<column_list>)

)

 

注意:PIVOT、UNPIVOT是SQL Server 2005 的语法,使用需修改数据库兼容级别
 在数据库属性->选项->兼容级别改为   90

 

典型实例

一、行转列

Posted by & filed under Visual Studio.

我在使用BOOK: Professional Crystal Reports for VS.NET 的时候,经常出错:
…..Assembles不能用。。。。

这里最好的解决办法是,1.重新安装.Net FrameWork,2. Select the Compile tab and click on the “Advanced Compile Options…” button. Find “Target CPU” and set it to x86. Next find “Target Framework” and set it to .NET Framework …

Posted by & filed under JavaScript.

不少时候在页面中为了布局的需要,下拉列表<select>的宽度需要设成比较小的值,这时如果恰巧它包含的选择项<option>的内容比较长,那么超出select宽度的部分将会被截断,如果option显示的内容又比较重要,必须完整地展现出来,或者你是个完美主义者,那这就成了一个不大不小的问题了。

在IE7+、Firefox中,由于支持了<option>的title属性,我们可以想办法给option标记设置title属性(内容可以与显示的值相同或者不同)。如果是已经做好的页面,不想再做太多改动,可以用下面的脚本,自动遍历页面上的所有<select>,给所有的option加上与text相同的title。

function SetOptionTitle()
{
    var selects = document.getElementsByTagName(“select”);
    if (selects.length > 0)
    {
        for (var i = 0; i < selects.length; i++)
        {
            var options = selects[i].options;
            if (selects[i].options.length > 0)
            {
                for (var j = 0; j < 

Posted by & filed under Android.

反编译APK文件需要dex2jar和jd-gui这两个工具,我已经打包了,可以本文底部下载。
第一步、下载我提供的工具后解压。
第二步、把目标APK文件扩展名改为zip,用WINRAR或者其他压缩软件打开,解压其中的classes.dex,并放到上面第一步解压出来的工具目录里
如图:

第三步、双击执行目录中的First.bat,会在当前目录生成一个classes.dex.dex2jar.jar文件
第四步、打开jd-gui.exe,File-Open File找到刚才生成的classes.dex.dex2jar.jar文件
OK,现在你可以看到Java源代码了.
如果需要查看APK中的XML文件以及图片,可以用apktool,这里也一并附上,已经放进压缩包里了,上面的截图没有,使用方法:

apktool.bat d apk名 解压目录

工具下载:
apkdecode (35)

or ApkDecode

From:http://www.pocketdigi.com/20110905/459.html

Posted by & filed under Android.

1.Android 四大天王:Activity(程序的界面),Intent(数据传输),Service(服务),Content Provider(数据存放)

2.产生APK安装包:Android Manifest里的Export

3.Activity的生命周期:onCreate->onStart->onResume->onPause->Other Activity’s onCreate,onStart,onResume-> onStop()(完全不可见后,才会调用,如第二个ACtivity是Dialog,则不发生),再按Back后,Other Activity’s onPause ->First Activity’s onStart->onResume, Other Activity’s onStop() , onDestroy()(再起来时一定要再有onCreate)

4. A task is a stack of Activities.…

Posted by & filed under SQLSERVER.

How To Change SQL Server 2008/2005 Object Schema?

Problem

It is not easy to change SQL Server 2008/2005 object schema (tables, stored procedures and views) to “dbo”. Here is a solution.

Solution

a. Execute the following SQL script in SQL