Mnemorable

  • I love those who can smile in trouble, who can gather strength from distress, and grow brave by reflection. 'Tis the business of little minds to shrink, but they whose heart is firm, and whose conscience approves their conduct, will pursue their principles unto death. - [Leonardo da Vinci]
  • Standing on the Shoulder of Giants - One who develops future intellectual pursuits by understanding the research and works created by notable thinkers of the past.
  • A hundred times every day I remind myself that my inner and outer life are based on the labors of other men, living and dead, and that I must exert myself in order to give in the same measure as I have received and am still receiving... - [Albert Einstein]

Tuesday, May 19, 2009

Myers-Briggs Type Indicator, MBTI

[Link] Wiki
迈尔斯-布里格斯性格分类法(Myers-Briggs Type Indicator,MBTI)是性格分类的一种,其基本理论是根据瑞士心理分析家荣格于1921年所出版的书籍心理类型(Psychological Types )。
最先的开发者是美国的心理学家Katherine Cook Briggs及其女儿Isabel Briggs Myers,经过长期观察和研究而完成。
虽然备受学术派的心理学者所批评,但经过五十多年的发展,MBTI现已成为全球著名的性格测试之一。
当中包括教育界、顾员招聘及培训、领袖训练及个人发展等领域均有广泛的应用。
学术派的心理学家常批评MBTI理论缺乏可靠的数据支持,并指出这是巴纳姆效应的例子。


测试元素

这四个问题是:
  • 心理能力的走向:你是「外向」(Extrovert)(E)还是「内向」(Introvert)(I)?
  • 认识外在世界的方法:你是「感觉」(Sensing)(S)还是「直觉」(Intuition)(N)?
  • 倚赖什么方式做决定:你是「理性」(Thinking)(T)还是「情感」(Feeling)(F)?
  • 生活方式和处事态度:你是「判断」(Judging)(J)还是「理解」(Perceiving)(P)?
根据4个问题的不同答案,可将人的性格分为16个种类。


性格动力学

「外向」与「内向」
发泄及获得心灵能量的方向。
外向型(E, Extraverts)偏向专注于外在的人和事,倾向将能量往外释放。
内向型(I, Introverts)则专注于自己的思想、想法及印象,倾向将能量流往内。

「直觉」与「感觉」
是人们认识世界的非理性方法,即外界知觉,所说的是人们如何处理接收到的资料。
感觉型(S, Sensing)喜欢着眼于当前事物,惯于先使用五官来感受世界。
直觉型(N, Intuition)则着眼未来,着重可能性及预感,从潜意识及事物间的关联来理解世界。

「情感」与「思考」
情感及思考是下决定时内心斗争所侧重的方向,并配合以上的能量走向。
情感型(F, Feeling)偏好使用价值观及自我中心的主观评价来作决定。可以说成思考型使用头脑来作决定,而情感型则用内心来作决定。
思考型(T, Thinking)则偏好用「是-非」及「如果...就」的逻辑来作分析结果及影响,或者作决定。

例子:外向的思考型(Te)及情感型(Se)倾向倚赖外在事物及为人接受的规则来作决定;反之,内向的思考型(Ti)及情感型(Fi)则倾向于主观,倚赖自己的想法来构建逻辑组织及评价。

「判断」与「理解」
处世态度及生活模式
判断型(J, Judging)倾向于井然有序及有组织的生活,而且喜欢安顿一切事物。
理解型(P, Perceiving)则倾向于自然发生及弹性的生活,对任何意见都抱开放态度。

要注意的是,判断(Judging)并不等同决断(Judgmental,包含主观及冲动的意思),而理解(Perceiving)亦不解作感知(Perceptive,指对感觉作出反应的程度)。


测验结果分为十六种性格:
01) ESTJ大男人型
02) ESTP挑战型
03) ESFJ主人型
04) ESFP表演型
05) ENTJ将军型
06) ENTP发明家
07) ENFJ教育家
08) ENFP记者型
09) ISTJ公务型
10) ISTP冒险家
11) ISFJ照顾型
12) ISFP艺术家
13) INTJ专家型
14) INTP学者型
15) INFJ作家型
16) INFP哲学家



实际上这16种类型又归于四个大类之中,在此我们将四个大类型筛选,并总结如下:
[参考来源]

SJ型:忠诚的监护人
具有SJ偏爱的人他们的共性是有很强的责任心与事业心,他们忠诚、按时完成任务,推崇安全、礼议、规则和服从,他们被一种服务于社会需要的强烈动机所驱使。他们坚定、尊重权威、等级制度,持保守的价值观。他们充当着保护者、管理员、稳压器、监护人的角色。大约有50%左右SJ偏爱的人为政府部门及军事部门的职务所吸引,并且显现出卓越成就。其中在美国执政过的41位总统中有20位是SJ偏爱的人。

例如:乔治.布什George Bush,女王维多利亚Queen Victoria,女王伊丽莎白.伊伊Queen Elizabeth,乔治.华盛顿George Washington


SP型:天才的艺术家
有SP偏好的人有冒险精神,反应灵敏,在任何要求技巧性强的领域中游刃有余,他们常常被认为是喜欢活在危险边缘寻找刺激的人。他们为行动,冲动和享受现在而活着:约有60%左右sp偏好的人喜欢艺术、娱乐、体育和文学,他们被称赞为天才的艺术家。歌星麦当娜、兰球魔术师约翰逊、音乐大师莫扎特等都是具有SP性格特点的例子。

例如:迈克尔.乔丹Michael Jordan,伊丽莎白.泰勒Elizabet Taylor,玛丽莲.梦露Marilyn Monroe,帕布洛.毕加索Pablo Picasso


NT型:科学家、思想家的摇篮
NT偏爱的人有着天生好奇心,喜欢梦想,有独创性、创造力、洞察力、有兴趣获得新知识,有极强的分析问题、解决问题的能力。他们是独立的、理性的、有能力的人。人们称NT是思想家、科学家的摇篮,大多数NT类型的人喜欢物理、研究、管理、电脑、法律、金融、工程等理论性和技术性强的工作。

例如:比尔·盖茨Bill Gates,乔治·索罗斯George Soros,伯特·爱因斯坦Albert Einstein,玛格丽特·萨切尔Margaret Thatcher


NF型:理想主义者、精神领袖
NF偏爱的人在精神上有极强的哲理性,他们善于言辩、充满活力、有感染力、能影响他人的价值观并鼓舞其激情。他们帮助别人成长和进步,具有煽动性,被称为传播者和催化剂。约有一半的人在教育界、文学界、宗教界、咨询界以及心理学、文学、美术和音乐等行业显示着他们的非凡成就。

例如:夫拉迪默.列宁VLadimir Lenin,奥普拉.温弗尼Oprah Winfrey,夏洛特姐妹Emily Bronte andDickenson,莫汉迪斯.甘地Mohandas Gandhi


There are four temperaments: SJ, SP, NT, and NF.
[Link]

SJ -
Sensing judgers, or traditionalists, are practical people that keep the home fires burning and businesses working. They're always aware of who owns what and which social positions are held by whom. Their quest is to run everything, and they are often good at doing so.

SP -
Sensing perceivers, or experiencers, are adventurous, fun-loving, observant, physically skillful, impatient, easily bored , and good with tools and art. They want to be happy and make others happy too.

NT -
Intuitive thinkers, or conceptualizers, are analytical, impersonal, intellectual, rather unworldly, absent-minded, and are more likely to forget appointments. They continually seek to acquire new skills and pride themselves on their skills, logic, and efficiency.

NF -
Intuitive feelers, or idealists, understand people and tend to be aware of people's feelings. They can be warm, sympathetic friends, but find offense in the smallest careless remark. They tend to be very skillful negotiators and good with words.


做个记录,更了解自己,也许人的性格真的是会变的,让以后有个借鉴。

这一次的测试网址[Link],以下是测试结果,和上一次的测试结果一样是[INTJ]:


分析:您的性格类型是「INTJ」(专家型)

在实现自己的想法和达成自己的目标时有创新的想法和非凡的动力。能很快洞察到外界事物间的规律并形成长期的远景计划。一旦决定做一件事就会开始规划并直到完成为止。多疑、独立,对于自己和他人能力和表现的要求都非常高。 INTJ型的人是完美主义者。他们强烈地要求个人自由和能力,同时在他们独创的思想中,不可动摇的信仰促使他们达到目标。 INTJ型的人思维严谨、有逻辑性、足智多谋,他们能够看到新计划实行后的结果。他们对自己和别人都很苛求,往往几乎同样强硬地逼迫别人和自己。他们并不十分受冷漠与批评的干扰,作为所有性格类型中最独立的,INTJ型的人更喜欢以自己的方式行事。面对相反意见,他们通常持怀疑态度,十分坚定和坚决。权威本身不能强制地们,只有他们认为这些规则对自己的更重要的目标有用时,才会去遵守。 INTJ型的人是天生的谋略家,具有独特的思想、伟大的远见和梦想。他们天生精于理论,对于复杂而综合的概念运转灵活。他们是优秀的战略思想家,通常能清楚地看到任何局势的利处和缺陷。对于感兴趣的问题,他们是出色的、具有远见和见解的组织者。如果是他们自己形成的看法和计划,他们会投入不可思议的注意力、能量和积极性。领先到达或超过自己的高标准的决心和坚忍不拔,使他们获得许多成就。

您适合的领域有:科学研究、科技应用、技术咨询、管理咨询、金融、投资领域、创造性行业

您适合的职业有:

首席财政执行官
知识产权律师
设计工程师
精神分析师
心脏病专家
媒体策划
网络管理员
建筑师
管理顾问
经济学者
国际银行业务职员
金融规划师
综合网络专业人员
各类科学家
研究所研究人员
系统分析员
计算机程序师
研究开发部经理
各类技术顾问
技术专家
投资专家
法律顾问
医学专家
经济学家
投资银行研究员
证券投资和金融分析员
投资银行家
财务计划人员
企业并购专家
各类发明家
建筑师
社论作家
艺术家

Thursday, April 30, 2009

Choosing the Right Backup in SQL Server

[Source]
The article describes four different methods of backin up a SQL Server database; when to use them and why.

by Joe Lax, SQL Server Pro

When I started using SQL Server in version 4.2, backups were relatively simple. There were only two possibilities: a full backup or a transaction log backup. Starting with SQL Server 7, additional choices have proliferated. You now have four ways to back up your database.

If you are responsible for maintaining SQL Server databases, you need to be familiar with these various options and know when to apply each backup type. In this 10-Minute Solution, I show you the commands to execute each different kind of backup and discuss how to choose among the various options you have.

[THE PROBLEM]
How many different ways can you back up your SQL Server database?

[THE SOLUTION]
SQL Server provides four different methods for backing up your database:
  • A full backup makes a complete backup of your database. You will almost always need to start your backup strategy with a full backup of your database.
  • A file backup is useful when your database is so large that a full backup would take too long.
  • A transaction log backup creates a copy of all changes made to the database that are currently stored in the transaction log.
  • A differential backup stores all changes that have occurred to the database since the last full backup.
It all starts with learning the basics of the BACKUP command.


Components of a SQL Server Database
Before exploring each of the various options in backing up a SQL Server database, let's review how information is stored in one.

A SQL Server database stores data in one or more database files. While many databases only use a single file to store data, there are good reasons sometimes to split your data among several files. As an example, if you need the extra performance, you can store tables that are frequently used in their own separate files. By placing those files on separate disks, you avoid contention for disk access. Or your database might be too large to fit on one disk volume of your server and so must use more than one file—a separate file on each disk volume. If many files are being used for the database, the files themselves are sometimes organized into separate file groups, with each group consisting of several individual files.

Each SQL Server database must also have at least one file for the transaction log, which stores all changes that are made to the database. If you are unfamiliar with the use of the SQL Server transaction log, please see my previous 10-Minute Solution, "Using SQL Server Recovery Models", for a more in-depth description.


1. Fully Backing Up the Whole Database:
Regardless of how many files your database uses, you can create a complete backup of your database with one simple command:
BACKUP DATABASE [dbname] to [backup_device]

For example,
BACKUP DATABASE pubs to disk = 'c:\mssql\backup\pubs.bak'

creates a complete backup of the pubs database using the file c:\mssql\backup\pubs.bak.
The database can remain online and accessible to users while this backup is being made. In order to take a consistent snapshot of the database, a copy of the transaction log is also included with the database backup.

In the backup file, SQL Server stores the names and locations of the files actually used in the database. Upon restoring the database, SQL Server recreates all the necessary files, as many as there might be. A database thus restored is equivalent to the point in time that the backup finished.

A complete database backup is very simple to execute and use in recovery. If your data doesn't change often, you might simply schedule a nightly full backup of your database. Even if you need more frequent backups, regularly scheduling a full database backup each hour might be sufficient (if your database is small enough).


2. Backing Up the Database One File at a Time:
A complete database backup is certainly a powerful and simple option. In the case of a very large database, however, a complete backup might simply take too long to be feasible.

Consider a database used in a data warehousing application. The database might easily approach several hundred gigabytes in size and, as such, take too long to back up in one operation. In such a case, SQL Server provides the option of backing up individual files or file groups.

For instance, this command will back up an individual file:
BACKUP DATABASE database_name
FILE = file_name
TO DISK = 'file_for_backup'


This command will back up all files in a particular group:
BACKUP DATABASE database_name
FILEGROUP = file_group_name
TO DISK = 'file_for_backup'


With these commands, you can set up a schedule where a different file or file group is backed up every evening, completing a full cycle in a week.

Besides shortening the length of time it takes to create a backup, a file backup can also make recovery quicker. If only a single file in your database has been lost, a file backup will allow you to simply restore that file. However, it is important to note that a file backup cannot be used by itself. In order for the database to be recovered to a consistent state (where all the files in the database represent the same moment in time), all transaction logs (see next section) made since the file backup was created must also be applied.

Listing 1 creates a test database with two file groups.
Following the CREATE statement are two backup commands.
The first backs up only the test1 file;
the second backs up all files in the primary file group.

create database test
on primary
(name = test1,
filename = 'e:\mssqlserver\mssql$joelax2000_1\data\test1.mdf'),
(name = test2,
filename = 'e:\mssqlserver\mssql$joelax2000_1\data\test2.ndf'),
filegroup group2
(name = test3,
filename = 'e:\mssqlserver\mssql$joelax2000_1\data\test3.ndf'),
(name = test4,
filename = 'e:\mssqlserver\mssql$joelax2000_1\data\test4.ndf')
log on
(name = test_log,
filename = 'e:\mssqlserver\mssql$joelax2000_1\data\test_log.ldf')
First backup command:
backup database test
file = 'test1'
to disk = 'e:\test1.bak'
Second backup command:
backup database test
filegroup = 'primary'
to disk = 'e:\primary.bak'



3. Backing Up Only the Changes to the Database:
In addition to full backups, SQL Server provides two methods for backing up only the changes that have occurred to the database.

Transaction Log Backup:
This command creates a copy of all the transactions in the transaction log at the time the backup was started:
BACKUP TRAN [database_name] to disk = [file_name]

Once the backup is completed, all committed transactions are removed from the log. A typical backup plan utilizing transaction backups might be to make a full backup of the database once a night (or even once a week on larger databases) and back up the transaction logs as often as every ten minutes. To recover the database under this scheme, you would start from the last full backup and apply all the transaction log backups since.

This type of scheme suffers from one problem, however. You need the full backup and every transaction log backup made up to the point when you have to recover. For example, suppose your backup scheme consists of a full database backup every Saturday at midnight and transaction log backups every hour. If your database has a problem on Thursday at midnight, you would need to restore the full database backup, as well as the 120 transaction log backups made from Saturday through Thursday, to get up to date.

For this reason, SQL Server provides yet another method of backing up changes to the database that is used in conjunction with full database and transaction log backups.


4. Differential Backup:
A differential backup creates a copy of all the changes that have taken place in the database since the last full backup. The command is the same for a full database backup, with the addition of one clause:
BACKUP DATABASE [database_name] to disk = 'file_name' with differential

Now you can implement the following backup scheme: a full backup every Saturday, a differential backup every night, and a transaction log backup every hour. Once this scheme is in place, if you go down on Thursday evening, all you need to do is apply the full backup, the last differential backup (which would have been Wednesday evening), and all the transaction logs since—for a total of only 26 files.

This 10-Minute Solution covers the basics of the BACKUP command and the four types of backups that you can create. However, I haven't discussed some other additional features that SQL Server provides with this command, such as creating a backup device or password protection. Before implementing a backup plan, I suggest you perform additional research on these features by reading up on the BACKUP command in the Books Online manual. Additionally, you should remember to test your backup plan thoroughly by performing test restores on a regular basis.


Joe Lax has spent the last 10 years working in various database environments and has been a practicing DBA on all versions of SQL Server from version 4.2 onward. Joe is also a MCSE and an MCT. Recently, he has started to learn Oracle, which affords him no end of fun.


Restore a MSSQL Database
The syntax for using T-SQL commands is as follows:
RESTORE DATABASE { database_name | @database_name_var }
[ FROM <> [ ,...n ] ]
[ WITH
[ RESTRICTED_USER ]
[ [ , ] FILE = { file_number | @file_number } ]
[ [ , ] PASSWORD= { password | @password_variable } ]
[ [ , ] MEDIANAME= { media_name | @media_name_variable } ]
[ [ , ] MEDIAPASSWORD= { mediapassword | @mediapassword_variable } ]
[ [ , ] MOVE 'logical_file_name' TO 'operating_system_file_name' ]
[ ,...n ]
[ [ , ] KEEP_REPLICATION ]
[ [ , ] { NORECOVERY | RECOVERY | STANDBY =undo_file_name } ]
[ [ , ] { NOREWIND | REWIND } ]
[ [ , ] { NOUNLOAD | UNLOAD } ]
[ [ , ] REPLACE ]
[ [ , ] RESTART ]
[ [ , ] STATS [ =percentage ] ]



Example:
ALTER DATABASE MYPAY
SET MULTI_USER WITH ROLLBACK IMMEDIATE;

ALTER DATABASE MYPAY
SET SINGLE_USER WITH ROLLBACK IMMEDIATE;

RESTORE DATABASE MYPAY
FROM disk = 'c:\abc.bak';



Note: to avoid Database in use Problem.
ALTER DATABASE MYPAY
SET MULTI_USER WITH ROLLBACK IMMEDIATE;

ALTER DATABASE MYPAY
SET SINGLE_USER WITH ROLLBACK IMMEDIATE;


Monday, March 30, 2009

【好文】怎样的人生没有白活

[Source]
作者:dengchun2006

读了十几年的书,认了上千的字。也写过数不清的信件和文章,今天提起笔来写自己的第一篇博客文章,语言文字竟跑的无影无踪了......,面对自己经常思索的人生,要说的话好多,却又无从说起。

做人有时很难堪,常常要等到蓦然回首,才会惊觉最渴望与之携手的人已另有怀抱,而自己也早已担着沉甸甸的责任。再怎么惊天动地的寻死觅活终是一场迟到,只徒然灼痛了自己伤害了别人......

及时行乐常常被认为是醉生梦死的颓废,以致于我们有些人总是苛待自己,似乎唯有不谈享乐才是积极的人生,人生多磨难:成长的坚辛,奋斗的不易,加之种种违反天性却又不得不恪守的规矩,构成了生存的严酷与无奈。唯有学会享乐,懂得享乐,才能真正理解人生的情趣与宝贵,才会因此更珍惜自己并珍惜这个世界。不要频频给自己制造痛苦,更不要以为痛苦一定有价值。生命的意义决不在于历尽艰难痛不欲生,而是要尝遍人间的甜蜜并为之甘愿同艰难作战。所以人们蓦然回首人生,发现自己错了,于是呼把希望寄托于渺茫的来世。

我不会愚蠢的对待自己生活,生命对我也许还很长,或许还有四五十年呢!干嘛非要把今生寄托于虚幻的来世呢!除了奋斗之外就是过自己随心所欲的生活,最重要的是心境快乐。

Friday, March 27, 2009

Rounding Mechanism to the nearest multiple of 5 sen

[Link] - Rounding Mechanism
[Link] - Frequently Asked Questions on Rounding Mechanism

The table below illustrates how the Rounding Mechanism works:


Bill ends in sen

Round off to the nearest 5 sen

Total Amount of A Bill

Total amount before rounding (RM)

Total amount after rounding (RM)
1,2 Down 82.01 82.02 82.00
3,4 Up 82.03 82.04 82.05
6,7 Down 82.06 82.07 82.05
8,9 Up 82.08 82.09 82.10

General guidelines of rounding

  1. The total amount of a bill (including goods and services subject to tax) that ends in 1, 2, 6 and 7 sen to be rounded downwards and 3, 4, 8 and 9 sen to be rounded upwards to the nearest multiple of 5 sen.

  2. Applicable to all over-the-counter payments, be it cash or non-cash.

  3. The Rounding Mechanism table must be clearly displayed at the point of sale to ensure customers are appropriately informed.

  4. Receipts / bills / invoices should feature the total amount before and after the rounding adjustment.

  5. The 1 sen coin shall continue to be legal tender.

Sunday, March 22, 2009

Create an Integrated XP Setup Disk with SP3

[Source]
[Other Resource]

How to Slipstream Windows XP Service Pack 3 to Create an Integrated XP Setup Disk with SP 3


This tutorial takes you through the steps of integrating the Windows XP Service Pack 3 into the files from an existing Windows XP setup CD. A new setup disk will be created. This disk will have the full XP installation with SP3 already merged into it. Such a slipstreamed CD has a few advantages over installing your current version of XP and then running SP 3 afterwards:


  • Saves Time
    Installing XP slipstreamed with service pack 3 is considerably faster than installing a previous version of XP and then running SP 3 separately.


  • More Secure
    If your computer is always connected to the network or the Internet, and you do not have Service Pack 3 integrated, it is vulnerable to any malware that targets pre-SP3 XP. Although the window of opportunity for a successful attack of your system is small (the time needed to apply SP 3 and reboot), some people prefer not to take the chance.


  • Uses Less Disk Space
    If you install XP first and then install SP 3, the service pack installer will create backup copies of the previous versions in your Windows directory. System Restore will also make a backup set of files on your computer. These backup files take up space on your computer, to the order of a few hundred megabytes. (Note that this advantage is minimal, since you can manually delete all these backup files yourself later if you are short of space.)

Prerequisites


  1. Windows XP Professional or Home Setup CD
    You will need your existing Windows XP Professional or Home setup CD. This CD can either be the original Windows XP release CD, or one with either SP 1 or Service Pack 2 integrated.

    WARNING: do not attempt to use this guide to slipstream your Windows XP Media Center 2005 disk. Slipstreaming of this version of XP is not supported by Microsoft.


  2. A CD/DVD Burning Software, a blank writeable CD and a CD/DVD Writer
    After creating a new XP Setup CD that has Service Pack 3 integrated, you will need to write it onto a new, blank CD (such as a CD-R or CD-RW). You can also use a DVD+/-R(W) if you want. As such you will need a CD/DVD writer and a program to burn the new CD.

    For the purpose of this tutorial, I will describe the procedure for using the ImgBurn, a free utility listed on the Free CD and DVD Burners and Copying Software page on thefreecountry.com.


  3. XP Service Pack 3
    Windows XP service pack 3 can be downloaded directly from Microsoft.

The Basic Steps to Merging SP3 into the XP Setup CD


  1. Download and Save XP Service Pack 3
    If you have not already downloaded XP service pack 3, get it now, and save it with the filename of "XPSP3.exe" at the top level of drive C:. Actually, you can save it anywhere you want, and leave it at its default name if you wish. However, for the purpose of this tutorial, I will assume that you saved it so that it can be accessed as C:\XPSP3.exe. If you save it as some other name, you will have to change the command lines I supply below yourself to the appropriate one.


  2. Extract or Download the Boot Sector of the XP Setup Disk
    You will also need the boot sector of an existing bootable Windows 2000, XP or 2003 setup CDROM. You can either extract it from your CD yourself, or just download a boot sector already extracted by others. To save myself some time describing the procedure for extracting the boot sector, this tutorial will just use the same method mentioned in my guide to create your own XP setup disk. That is, download the file wxp10.zip from one of the links on [Link] and save it somewhere on your computer.

    When you've got the file, open it by doubleclicking it in Windows explorer. Go into the "cds" folder and into "wxphome" (or "wxppro"; it doesn't matter which) folder, followed finally by the "files" directory. Drag the "w2ksect.bin" file into C:\ (the root directory/folder of drive C:). Don't get creative and place it in some other directory. If you do that, ImgBurn will not be able to find "c:\w2ksect.bin" later.


  3. Create a Working Folder
    Create a temporary folder for the integration to take place. For the purpose of this tutorial, I will assume that you have created a folder called "XPSETUP" at the top level of drive C:.

    To create a folder, open "My Computer", go to drive C:, right click somewhere in the window and select "New" followed by "Folder" in the menu that appears. Then change the default name from "New Folder" to "XPSETUP". If you did this correctly, you will have a new folder, C:\XPSETUP.


  4. Copy the XP Setup Disk intto C:\XPSETUP
    Put your existing XP setup CD into your drive. If the setup wizard appears, dismiss it. Drag all the files and folders on the CD into C:\XPSETUP.


  5. Open a Command Prompt
    Open a command prompt window. You can do this by running the program "Command Prompt", found in the Accessories folder of your Start menu.


  6. Slipstream the Service Pack
    From the command prompt window, which will be a black window with a blinking cursor, type the following, followed by the ENTER key.

    C:\XPSP3 /integrate:C:\XPSETUP
    Note that there is only one space character -- between the "C:\XPSP3" and the rest of the line. If you did not name the service pack "XPSP3.exe" and place it at the top level of C: as I described earlier, you'll have to modify the command line accordingly.

    The process will take some time to complete, so take a coffee break if you wish.

This completes the slipstreaming part of the tutorial. You will now need to burn it to make a bootable CD or DVD.

Create and Burn Your New XP with Service Pack 3 CD


  1. Download ImgBurn
    If you have not downloaded ImgBurn, get it now and install it. You will find it listed on thefreecountry.com's Free CD and DVD Burners and Copying Software page.

    The version of ImgBurn I used to create this guide was 2.4.1.0.


  2. Create the ImgBurn Project Configuration File
    Open up Notepad, and copy the text from below and paste it into a blank Notepad window. Save the file as "xpsp3.ibb" (including the quotes, which you need to prevent Notepad from adding a ".txt" extension to your filename) somewhere on your desktop (or anywhere you like). Do not add or delete anything from the file.


    --------------- [Begin]
    IBB

    [START_BACKUP_OPTIONS]
    BuildMode=1
    Destination=0
    TestMode=0
    Verify=1
    WriteSpeed=0
    Copies=0
    FileSystem=1
    UDFRevision=0
    PreserveFullPathnames=0
    RecurseSubdirectories=1
    IncludeHiddenFiles=1
    IncludeSystemFiles=1
    IncludeArchiveFilesOnly=0
    AddToWriteQueueWhenDone=0
    ClearArchiveAttribute=0
    VolumeLabel_ISO9660=HTHSP3
    VolumeLabel_Joliet=HTHSP3
    VolumeLabel_UDF=
    Identifier_System=
    Identifier_VolumeSet=
    Identifier_Publisher=
    Identifier_Preparer=
    Identifier_Application=
    Dates_FolderFileType=0
    Restrictions_ISO9660_InterchangeLevel=2
    Restrictions_ISO9660_CharacterSet=1
    Restrictions_ISO9660_AllowMoreThan8DirectoryLevels=1
    Restrictions_ISO9660_AllowMoreThan255CharactersInPath=1
    Restrictions_ISO9660_AllowFilesWithoutExtensions=1
    Restrictions_ISO9660_DontAddVersionNumberToFiles=1
    Restrictions_Joliet_InterchangeLevel=1
    Restrictions_Joliet_AllowFilesWithoutExtensions=1
    Restrictions_Joliet_AddVersionNumberToFiles=0
    Restrictions_UDF_DisableUnicodeSupport=0
    Restrictions_UDF_DVDVideoAllowUnicodeVolumeLabel=0
    BootableDisc_MakeImageBootable=1
    BootableDisc_MediaEmulationType=0
    BootableDisc_BootImageFile=C:\w2ksect.bin
    BootableDisc_DeveloperIdentifier=
    BootableDisc_LoadSegment=07C0
    BootableDisc_LoadSectorCount=4
    [END_BACKUP_OPTIONS]

    [START_BACKUP_LIST]
    C:\XPSETUP
    [END_BACKUP_LIST]

    [End] ---------------


  3. Burn the CD
    Put a blank CD or DVD into your drive.

    Start ImgBurn. Select "Mode Build" from the menu. That is, click the "Mode" menu, and select the "Build" item on the menu that appears.

    Then, select "File Load Project". Look for the xpsp3.ibb file you saved in the previous step, select it and click the "Open" button.

    Finally, click the "Build" icon at the bottom of the window. To find out which picture the "Build" button is (there are no visual cues, even as to which picture actually represents a button), hover your mouse over the pictures near the bottom of the window and wait for the tooltip to appear. When you hover your mouse over the correct picture, a tooltip will appear with the text "Build".

    If ImgBurn presents you with a dialog box giving you the statistics of your new CD, such as the number of files it will contain and so forth, just click OK to accept it.

Congratulations. You have successfully created a new XP setup CD. This setup disk will allow you to install Windows XP with Service Pack 3 already integrated in it.

[X1] How to Flash a Custom ROM for Xperia X1

[Source] - xda-developers

About this thread: I will explain how to get a new firmware/ROM on your new X1 :-)
To debrand the phone you just flash a different ROM. You also do the same thing to change from EN to GER, or to flash a customized ROM. So it's the same procedure for all of those actions (making it easier to write this tutorial ;-)).

Step 1 has to be done only once. For every following ROM you might want to flash, Spet 2 is all you need to do. So let's start:

Step 1 (Preparations)

- Download and install .NET Framework 3.5 SP1 [Link]
- If you are using Vista, install the Mobile Device Center 6.1 [Link]
- Set up the ActiveSync (XP) / Mobile Device Center (Vista) connection with your X1
- Charge the battery to at least 50% or more
- (Re)Connect the X1
- Run X1_HardSPL.exe
- Follow the instructions (it should say something like "Image Version: 1.02.111.7" to "1.00.X1")
- If asked, press "Yes" on the X1
- Now a 4-color screen should show up, showing some version Info
- After that, a progressbar screen will be shown and the phone will reboot when finished
- Click "Finish" on the PC
- If you want to check if everything went fine, turn the device off (long power button press), then hold the "volume down" button and turn the device on again, still holding the "volume down" button until the 4-color screen shows up. It should read something like:
KOVS110
SPL-0.72.OliNex
MicroP1-787
MicroP2-707
- Remove and reinsert the battery to exit bootloader mode

You completed the first step and are now able to flash any ROM you want to your X1! (Well, at least any ROM made for the X1 of course ;-))


Step 2 (Flashing ROMs)

Before you start you have to -obviously- download and extract the ROM you want to flash. The file should be named *.image or *.nbh. Before you follow the steps, rename that file to Kovsimg.nbh.

- Format a MicroSD card with FAT32 if not yet done
- Copy the Kovsimg.nbh into the root directory of your MicroSD card and insert the card in your phone
- Turn off the phone (USB cable not attached)
- Remove and reinsert the battery
- Hold the volume down button and turn the device on again, still holding both buttons until the 4-color screen shows up.
- Follow the onscreen instructions

Congratulations. You're done.

[X1] Hard-SPL for Xperia X1

[Source] - xda-developers

What is the SPL? (Second Program Loader)

The SPL is mainly a bootloader which allows a ROM to be flashed onto your device. As has been uncovered recently (or known to the more astute longer) the SPL does more than just load and boot the ROM it sets various flags which can control the operation of the OS on the device. It also controls some operations between the OS and the device's hardware. SPLs come paired with shipped (or leaked) official ROMs and are meant to match the ROMs operation. Therefore, with each new ROM release there is likely to be a new SPL.


What types of SPLs are there?

Basically there are two main types of SPLs. Hard and Soft.

A Hard SPL is one that is permanently flashed in your device memory and will boot up every time your device boots. To get into your SPL or Bootloader on the Kaiser/Tilt you want to hold down the camera button (all the way) and then soft-reset the phone (or turn it on if it was off). You will then see a tri-color screen known as the Bootloader (a.k.a. the SPL). The SPL that is shipped with your device, or upgraded from an official ROM is a Hard SPL. In short, if it is loaded into your device's firmware, and survives a hard-reset it is considered Hard.

A Soft SPL is a stand alone .exe that is run on your device from within the OS. It basically changes your OS from running Windows, to initializing the boot loader. A Soft SPL is only loaded into RAM temporarily and will not survive a hard-reset.


Instructions to flash Hard-SPL:

it's recommended you run the basic package, and don't flash the other attachment (MFG SPL - it is only for hackers).

0a) make sure you have .NET framework installed on your PC! if not, get it from [Here]
0b) if you have vista, WMDC update is recommended. [Link]

1) download Hard-SPL package from attachment, extract to an empty folder.
2) it is recommended you download only the [X1_HardSPL_v1.zip] unless you want to tinker with MFG SPL (MFG SPL 0.52 is a separate attachment).
3) you must Have Phone Synced with PC in Windows Mobile!
4) run X1_HardSPL.exe. (if you want to flash MFG SPL: at this point replace the extracted RUU_Signed.nbh with the MFG version of RUU_Signed.nbh)
5) follow steps in the RUU, and check on the device for prompts after PC shows loading bar.
6) it should go to tricolour screen now and say 0.52.OliNex.MFG (this is SSPL!).
7) Hard-SPL flashes, device automatically reboots, job done.
8 ) to confirm you got it installed, go into bootloader mode (tricolour screen!) and verify the screen shows 0.72.OliNex (or 0.52.OliNex MFG).

NOTE: you will not see the SPL version during normal boot, that is the OS version, not SPL!
to enter bootloader mode to see version: with the device turned OFF, press and hold the volume down button along with the power button, then release the power button, and finally release volume down button when bootloader tricolour screen appears.

NOTE 2: anyone having problems with the device entering SSPL automatically(your device doesn't go to tricolour screen), please copy Xperia-SSPL-Manual.exe from the Xperia-SSPL-Manual.zip attachment to the device and run it. then once the screen is in SSPL (tricolour screen saying 0.52.OliNex), run RUU on the PC (i.e. the rest of the hardspl package) manually.

NOTE 3: this is unsigned Hard-SPL. also, this has overwrite protection, if someone needs to revert to stock SPL for warranty reasons, a stock SPL downgrade package is also available here - scroll down!

NOTE 4: do not use this RUU to flash anything else! this is only intended for flashing the Hard-SPL. use Xperia CustomRUU to flash other ROM images. for example this version: [Link]


***

IMPORTANT: extra Xperia-specific notes: the prerelease roms out there in the X1 ROMs thread are not going to flash on retail devices because the radios they include are only flashable on prerelease devices ("Security unlocked" message in SPL can be seen on these). so what you need to do is repack the NBH without the radio - this will only work with Hard-SPL though, as repacking breaks the HTC sign on the NBH file.
I had a tester upload a repackaged UK image, which will flash fine. you can find it in the x1 roms thread. =)

***

TROUBLESHOOTING TIPS:

- read the instructions.
- read the instructions.
- read the instructions.
- if you get connection error in RUU after the device goes to tricolour screen, then try a different USB port, also do not use USB hub, you can also try rebooting your PC, and can try using another PC. read the thread for even more tips that I don't remember now. also you can try unticking advanced network functionality in start menu / settings / connections / usbtopc applet.
- if hardspl EXE won't run, and you are on vista, try to right click it and use "run as Administrator" option
- if SSPL-Manual.exe or enterbootloader.exe fails to run (says missing component or similar), try a hard reset of the device.

***

Extra how to: how to restore Stock SPL for warranty reasons.

step by step:
- this is ONLY for warranty reasons. i.e. the device needs repair and you have to send it to htc to get it serviced. if you plan to restore hardspl then don't even bother flashing this stock package, unless you are some kind of hacker/dev
- IMPORTANT: be sure to first restore stock OS, and stock radio. stock SPL is always to be done last!!
- now the steps
1. download the stock spl package from this post.
2. download X1_HardSPL_v1 too, from this post.
3. run the hardspl package, but do not press Next button i.e do not go ahead with flash yet.
4. at this point, take the extracted stock SPL, a RUU_Signed.NBH file, and overwrite the other RUU_Signed.NBH in hardspl package.
5. go on with the RUU (or if needed, run SSPL-Manual.exe manually, then run RUU when it goes to tricolour screen with 0.52.OliNex version), it goes to 100%, reboots, done.
+1. to verify, enter bootloader (see description above in this post), and check version number on tricolour screen. it should say 0.72.0000

[X1] How to back up ROM for Xperia X1

[Source] - xda-developers

--- Foreword ---

This guide is designed for those who find it hard to (or are too lazy to) search the forum for information on how to dump a ROM. This is specifically for the X1.
Some common sense and knowledge of computers and pocket pc's is required. I followed below steps myself to dump a ROM and dumping it worked flawlessly.
Update: The ROM I dumped has been tested and reported working perfectly!


--- Special thanks to ---

Fards - Much of the below tutorial.
hungarian - The registry fix in step 2.
m@rco - UK generic ROM link.
Itje - Kovskykitchen.
And the guys who made XDA Utils!


--- Guide ---

1) Download and preparation of files

A good preparation makes it much easier, download the following files:

[XDA Tools/Utils]
[X1 (Kovsky) Kitchen]
[Stock UK ROM]
[Sdkcerts.cab]
[Fdcsoft Taskmanager]

- Extract Kovskykitchen to C:\KovskyKitchen and in Vista make sure that buildos+package_tools is able to run as administrator.
- Extract the XDA tools to an easy to access folder, for instance c:\Xdatools


2) Preparing your phone:

Before your X1 will allow the dumping to be done, the following Sdkcerts.cab file must be installed.

- Copy Sdkcerts.cab to your phone or storage card and install it to the device.

Also, your phone must accept changes that pdocread makes. You can do this with the regedit function of the FdcSoft Taskmanager.

- Set the following registry keys to "1":
* HKLM\Security\Policies\Policies "00001001"
* HKLM\Security\Policies\Policies "0000101a"


- Connect your phone to your pc with activesync.


3) pdocread

- Open up a command line and navigate to the folder where you extracted the XDAtools.
- Enter the following command: "pdocread.exe -l"

You'll get something like this:

| 3.12M (0x31f000) Part00
| 3.50M (0x380000) Part01
| 69.38M (0x4560000) Part02
| 134.38M (0x8660000) Part03


The bits in brackets are the important ones as you need to use what it says on YOUR device in the next step.


4) Extraction

Run the following commands one at a time. Replace the codes (.e.g 0x31f000) with the codes you get in step 3.
Extracting these files can take some time, do not disconnect your device until the command line sais it's done.

pdocread -w -d FLASHDR -b 0x800 -p Part00 0 0x31f000 Part00.raw
pdocread -w -d FLASHDR -b 0x800 -p Part01 0 0x380000 Part01.raw
pdocread -w -d FLASHDR -b 0x800 -p Part02 0 0x4560000 Part02.raw
pdocread -w -d FLASHDR -b 0x800 -p Part03 0 0x8660000 Part03.raw


The files will end up in the XDAtools folder.


5) Kovksy kitchen

- Open your Kovskykitchen folder.
- Copy your 4 raw files to the "baserom" folder.
- From the stock UK ROM extract the RUU_signed.nbh to Baserom folder as well.

There are decent walkthroughs for cooking roms, this kitchen is built on the Kaiser Kitchen.
If you want more info, search for "kaiser kitchen" on XDA.

- Start kovskykitchen.cmd
- Select (e) extract a rom, then (b) and let it work through.

When it's finshed it'll go back to the main menu.

- Now select (c) cook a rom, then (b)

It'll start up the buildOS + Package tools program.

- Select the buildos tab.
- Select "load rom" and navigate to your kovskykitchen folder.
- Press ok.

After a couple of seconds the green "go" arrow will light up press it.
It'll do lots and may come back with an imgfs error, but this doesn't seem to matter.

- When it's done close the window.

Back in the CMD window it'll be waiting for a keypress.
When pressed a lot of files will be processed.
Finally it'll popup with some info for the HTC rom tool.

- Click BUILD!
- Select Kovsky from the dropdown box.
- Press the 3 little dots ... next to the box that says OS.
- Select the OS-NEW.nb in the main kovsky kitchen folder.

Press BUILD! at the bottom, and give the file a sensible name, RUU_signed.nbh if you want to flash it from windows, Kovsimg.nbh if you want to flash it from microSD card.

- Close the htc_rom_tool when it's done.

It'll popup a hexeditor to change the Pagepool.
An error might occur that it can't find the nbh file.

- Close the hexeditor.

The command line will clean up the temporary files and allows you to flash your ROM.
If you just want to back up the rom of your device then close this window.

Enjoy!

Use ClearType to Enhance Screen Fonts in Windows XP/Vista

[Source] - ClearType Tuner


With Windows Vista and Windows XP, ClearType delivers improved font display quality over traditional forms of font smoothing or anti-aliasing. ClearType improves readability on color LCD displays with a digital interface, such as those in laptops and high-quality flat panel displays. Readability on CRT screens can also be somewhat improved.

Thursday, February 26, 2009

Enable Address Bar in Windows XP SP3

[Source]


Getting the Address Bar back requires what I would call a small hack. That being said, if your psyche can’t handle a little backdoor manipulation, you might want to weigh the risks of this technique with the safety of leaving it be.

By the way, I cannot take credit for this trick; I saw these steps posted on a Microsoft Community Forum. I am merely expanding on it with some more detailed instructions and some imagery. I also want to thank and acknowledge Kenneth P. Grush who e-mailed me about the controversy this morning and posted a comment in my previous blog entry about Windows XP SP3.

The file modified by Windows XP SP3 is browseui.dll. The trick, put simply, is to replace the SP3 version of this file with an SP2 version of the file. The older version of browseui.dll can be found in the following directory of a non-SP3 Windows PC:

C:\Windows\System32\
Copy the browseui.dll to the root directory of the SP3 machine or to some other location that the SP3 PC can access.

Okay, here is where its gets a little tricky. The browseui.dll file is a system file and is therefore protected whenever Windows is running. That means you cannot just copy the SP2 version over to the SP3 version. You will have to start the SP3 PC in Safe Mode. In fact, I would suggest starting the SP3 PC in Safe Mode with a command prompt.

Here is how you do that:

Restart the SP3 computer.

When it starts the reboot process and before Windows starts to load, press the F8 key, which will load the Advanced Boot Options Menu.

Choose to start in Safe Mode with a Command Prompt option.

At the Command Prompt, type this copy command:
xcopy C:\browseui.dll C:\Windows\System32\

Reboot the SP3 PC normally.

Monday, February 9, 2009

Getting Only the Date Part of a Date/Time Stamp in SQL Server.

[Source]

I got a question the other about getting the date-only part of date/time stamp in SQL server. In my experience there are two ways to go about doing this. Both require casting data types from one type to another. The first example is how I used to go about performing this task before I understood how dates were represented numerically. The second method is related to my understanding of ColdFusion dates and timespans and fortunately transferred well to SQL.

First, the more verbose method. This requires breaking the date into its year, month, and day parts, putting them together in "yyyy/mm/dd" format, then casting that back to a date. This method involves 7 method calls including the final CAST(), not to mention string concatenation (which we all know is wicked slow).

CAST(
(
STR( YEAR( GETDATE() ) ) + '/' +
STR( MONTH( GETDATE() ) ) + '/' +
STR( DAY( GETDATE() ) )
) AS DATETIME
)


The second method is much much cleaner. It uses only 3 method calls including the final CAST() and performs no string concatenation, which is an automatic plus. Furthermore, there are no huge type casts here. If you can imagine that Date/Time stamps can be represented, then converting from dates to numbers and back to dates is a fairly easy process (hopefully).

CAST(
FLOOR(
CAST( GETDATE() AS FLOAT )
) AS DATETIME
)

In the example above, we are converting the date/time stamp to its float form. So today (when this was posted), this would yield something like 38903.745537114199. Days are not fractional, meaning that decimal places represent fractions of a day (in hours, minutes, seconds). Then, in order to get the days part (trim off the time portion of the date/time stamp) we are FLOOR()'ing the float value. This will give us the numeric representation of the DAY-only date. Then, we simply cast that back to DATETIME format and there you have it, a date-only date/time stamp.

If you want to compare, try running this:

SELECT
-- Get the full date/time stamp as a base.
(
GETDATE()
) AS date_time_part,

-- Trying casting to a string then back to a date.
(
CAST(
(
STR( YEAR( GETDATE() ) ) + '/' +
STR( MONTH( GETDATE() ) ) + '/' +
STR( DAY( GETDATE() ) )
) AS DATETIME
)
) AS date_only_part,

-- Try casting to float, rounding, and back to date.
(
CAST(
FLOOR(
CAST( GETDATE() AS FLOAT )
) AS DATETIME
)
) AS date_only_part2,

-- Try casting just to float to see what it looks like.
(
CAST( GETDATE() AS FLOAT )
) AS float_value,

-- Try flooring to see the intermediary step.
(
FLOOR(
CAST( GETDATE() AS FLOAT ) )
) AS int_value


As far as performance is concerned, there is no big surprise here. The second method has fewer function calls, no string concatenation, and in my opinion is a much more natural casting idea. In my testing on a table with several thousand records, the second method generally executed in a fraction of the time that string concatenation method executed.

On 3,000 rows (based on CFTimer execution time):

Average time of method one: 115ms

Average time of method two: 16ms (HUGE performance increase)

Additionally, in testing, method one has some runs that were all over the place; very large execution times. Method two, on the other hand, consisently performed at the same speed, give or take a few ms.

Activating and deactivating the built-in main Administrator account in Vista.

[Source]


The following post gives details on activating and deactivating the built-in main Administrator account in Vista. Please note that I recommend that you only activate and use this account if you have problems which cannot be solved by using your other accounts and that when you have finished using it you should deactivate it again. Please also note that this method works for activating the hidden Administrator account in Windows Vista Home Premium (32-bit) and should work for all other 32-bit versions. This may also work for the 64-bit versions, but as I do not have a 64-bit version, I cannot say one way or the other.

Procedure for adding and removing the Administrator account.

Step 1. Bring up the start menu by clicking the logo button on the taskbar or by pressing the 'Windows Start' key on the keyboard.

Step 2. In the search box, type 'cmd'. Do not press 'Enter/Return'.

Step 3. Instead, press and hold down 'Ctrl', 'Shift' and 'Enter/Return'.

Step 4. In the user accounts dialog box that appears, select the name and enter the password of the administrator account that you created when first installing Vista and click 'OK'.

Step 5. You should now be at the command prompt. Note that if you do not follow Steps 2 and 3 as above, you will arrive at the command prompt but it will be the incorrect one. The prompt should be 'C:\Windows\System32>'. If not, Steps 6 and 7 will give you these error messages: 'System error 5 has occurred' and 'Access is denied'.

Step 6. To turn on the account, type 'net user administrator /active:yes'. Continue on to Step 8.

Step 7. To turn off the account, type 'net user administrator /active:no'.

Step 8. Close the command console.

Step 9. Open the Control Panel.

Step 10. Click 'User Accounts and Family Safety' then 'User Accounts' then 'Manage another account'.

Step 11. In the user accounts dialog box that appears, select the name and enter the password of the administrator account that you created when first installing Vista and click 'OK'.

Step 12. If the Administrator account is currently active, you should see the account displayed. If not, and you wish to make the account active, then repeat this procedure from Step 1, making sure to use Step 6 and not Step 7.

Step 13. Select the Administrator account by clicking on it.

Step 14. The account will be password protected, so in the list of options that appears click 'Remove the password'.

Step 15. After accepting the warning and removing the password, you will be returned to the list of options.

Step 16. Select 'Create a password' and follow the instructions to create a new Administrator password.

Step 17. Close the Control Panel.

Step 18. You will now be able to select the Administrator on startup. Note that if the password has expired, you may reset it by beginning at Step 9.

Step 19. If you wish to remove the Administrator account, the repeat the procedure from Step 1, omitting Step 6 and finishing at Step 8.