Archive: 2012

Apple Stuff1 min read

Fix: Boot Camp Assistant stuck on Partitioning

Yesterday, when I was removing Windows partition through Boot Camp Assistant, it got stuck on partitioning:

Status: Partitioning Disk

I'm lucky to fix it manually. There are my steps:

1 Command+Q to quit the Boot Camp Assistant.

2 Open Disk Utility, select the harddisk, go to tab Partition.

3 I see there is some free space after my osx partition. Simply, I extend my osx partition and click Apply.

4 An error message is given to me. Due to some error within my osx partition, this operation cannot be done.

5 Reboot computer with Option key down, and select Recovery.

6 Use Disk Utility to repair the osx partition.

7 Do not try to extend partition here. You cannot make it successfully.

8 Reboot to osx normally.

9 Open Disk Utility again to extend osx partition. It can be done now.

10 Start Boot Camp Assistant if you need to re-install another Windows instance.

 

That's my story.

Environment:

OSX 10.8

Windows to remove: Win7 with single partition, created by Boot Camp Assistant of OSX 10.8.

 

PS, Windows 8 works great. Except there is a bug on current version of Boot Camp. You can only back to OSX by holding Option button down while powering up, not able to do that with the menu command within Boot Camp.

Windows1 min read

[FW] Activating Windows 8 Enterprise RTM – 0x8007007B

The Problem

I came across the following error message when activating Windows 8 Enterprise x64 RTM, downloaded from MSDN:

“Error 0x8007007B  The File name, directory name, or volume label syntax is incorrect.”

The Solution

Using the key provided to you (MSDN etc.) you will need to run the following in an elevated command prompt – if you are new to Windows 8, click Start –> type “cmd” –> right-click on a command prompt and select “Run as administrator” in the bottom of the page.

Next type the following commands:

slmgr.vbs /ipk {YOUR KEY HERE}

slmgr.vbs /ato

The first command will update the key.

The second command will activate Windows.

Hope that helps!

Original Post: http://techblurt.com/2012/08/16/activating-windows-8-enterprise-rtm-0x8007007b/

Change: remove en-gb, coz i found it's necessary for many, maybe all, languages version.

 

Apple Stuff1 min read

OSX: Disable automount on specific partitions (disks)

We know that when a new hard drive inserted to a mac, OSX will mount all partitions in it. In some situation, we may not want to mount some partitions. In that case, we need to adjust fstab manually.

Skills need:
1 OSX simply operations, and
2 vi operations.

Step:
1 mount the partitions / disks in question. If you want to adjust more than one, do them all at the same time or make them into several batches as you wish.
2 Remember the names or Universal Unique Identifiers of partitions. You can see the names as the text of the specific tree nodes within the left panel of Disk Utility. Universal Unique Identifiers can be found in the pop-up window shown after click the Info button. You can choose to remember names or Universal Unique Identifiers. If you choose to use name, all partitions with the same name will be affected in the same way.
3 Unmount the partitions / disks.
4 Open Terminal.
5 sudo -s
6 vi /etc/fstab
add lines one by one like this (choose one format below):

LABEL=name none ntfs ro,noauto 0 0
UUID=51C9C66D-B850-3285-884E-D48B9F616809 none msdos ro,noauto 0 0

You can check http://en.wikipedia.org/wiki/Fstab for more detailed information.
Save that file.

Now these partitions will not be mounted unless you do it manually.

Gossip1 min read

Words Recognition

Aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it deosn't mttaer in waht oredr the ltteers in a wrod are, the olny iprmoetnt tihng is taht the frist and lsat ltteer be at the rghit pclae. The rset can be a toatl mses and you can sitll raed it wouthit porbelm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe.

Gossip3 min read

科普:太空梭的發射程序與降落步驟

太空梭的發射程序:

1.發射時的前幾小時開始對外部燃料槽注入燃料 大約在發射前2分鐘注入完畢
2.在發射倒數12分鐘以內會測試尾翼、主引擎、以及其他儀器等
3.發射前13秒時會對發射台注入大量的水(英文為 Sound Suppression System)
4.發射前10秒會在主引擎的兩側迸出火花(火花的作用為燒掉可能溢出的氫氣,防止其干擾發動機點火)
5.發射前6秒 主引擎啟動 此時主引擎動力為100%
6.發射前3秒 主引擎做最後一次的調整(在T-3倒數3秒時主引擎動一下)
7.倒數零秒時太空梭的固態助推火箭(Solid Rocket Booster)點火(旁邊那兩根)
8.升空後3秒太空梭主引擎動力增加為104.5%(太空梭主引擎動力啟動后可在67%到109%之間調整,其中106%﹣109%用於異常終止模式)
9.升空後9秒 太空梭開始調整航道(尾翼向東邊)
10.升空後約17秒 太空梭進入正確航道
11.升空後35秒 進入MAX Q階段(此時太空梭承受的空氣阻力達到最大
因此主引擎動力降為72%)
12.升空後大約50秒 通過MAX Q階段 主引擎動力回復到104.5%
13.升空1分鐘後 太空梭全速前進(奇怪的是主引擎動力沒變 我是聽無線電才知道全速前進)此時
太空梭速度約為1800km/h
14.升空2分02秒後 太空梭兩側的固體助推火箭脫離 此時太空梭速度為約4200km/h
15.由於固體助推火箭脫離 所以太空梭速度加快(固體助推火箭裝滿燃料重量約500t以上)
16.升空後約5分35秒 太空梭開始轉正(原本是倒立的) 速度約11010km/h
17.升空後6分27秒太空梭已轉正 此時速度為約14420km/h
18.升空後約7分23秒 太空梭進入MECO階段(主引擎關閉)主引擎動力開始降低 此時速度為19300km/h
19.升空後8分35秒 太空梭主引擎『完全』關閉 此時速度約24650km/h
20.升空後約8分40秒 太空梭外部燃料槽脫落(此時外部燃料槽繼續在大氣層飛行18500km後開始往下墜落同時也被燒毀,分解成碎片
21.升空約10分33秒 太空梭開始啟動輔助動力裝置 以抵達地球環繞軌道
22.之後太空梭成功進入地球環繞軌道 此時速度約7.62km/s≒28000km/h

太空梭的降落步驟:

1.太空梭開始調整姿勢 讓輔助動力系統面向前方
2.開始啟動輔助動力系統 使太空梭速度降低
3.太空梭開始微調姿勢 準備進入大氣層
4.太空梭開始以40度仰角進入大氣層 此時的速度變成噴射客機的速度(因為摩擦)
5.太空梭因摩擦而產生的高溫 機頭及機翼尖端約攝氏1500度
其他地方約攝氏800~1400度
6.太空梭打開尾翼的翼片(雖然看起來只有一片 實際上有兩片)
7.太空梭降落到平流層(與噴射客機的高度相同)時 開始做多次的S型飛行(為了減低速度)
8.太空梭降落到地面時速度約345.9km/h
9.太空梭滑行約2750m時停下來
10.太空人下太空梭後 太空梭由NASA改裝的波音747載回甘迺迪太空中心

補充:
固體助推火箭重量:589550kg(兩條白色的)
外部燃料槽重量:762100kg(橙色的,其中包含553358.2L液氧、1497440L液氫,並以電子元件中間層隔開)
太空梭主引擎推力:510300kg
太空梭固體助推火箭的推力:1245000kg
太空梭軌道船(有機翼的)重量:100000kg

dotNet Product2 min read

C#: Split a Distinguished Name of Active Directory into array of string

class DistinguishedNameSplit
{
    static string[] hexCodes = new string[] { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "A", "b", "B", "c", "C", "d", "D", "e", "E", "f", "F" };
 
    public static List<string> Split(string distinguishedName)
    {
        List<string> pool = new List<string>();
        StringBuilder working = new StringBuilder();
        string hexHigh = "";
        MachineStatus status = MachineStatus.A;
        int index = 0;
        int indexMax = distinguishedName.Length - 1;
 
        while (index <= indexMax)
        {
            string value = distinguishedName.Substring(index, 1);
            switch (status)
            {
                case MachineStatus.A:
                    if (value == ",")
                    {
                        pool.Add(working.ToString());
                        working.Clear();
                    }
                    else if (value == "\"")
                    {
                        working.Append("\"");
                        status = MachineStatus.B;
                    }
                    else if (value == "\\")
                    {
                        status = MachineStatus.C;
                    }
                    else
                    {
                        working.Append(value);
                    }
                    break;
                case MachineStatus.B:
                    if (value == "\"")
                    {
                        working.Append("\"");
                        status = MachineStatus.A;
                    }
                    else if (value == "\\")
                    {
                        status = MachineStatus.E;
                    }
                    else
                    {
                        working.Append(value);
                    }
                    break;
                case MachineStatus.C:
                    if (value == "," || value == "\"" || value == "\\")
                    {
                        working.Append(value);
                        status = MachineStatus.A;
                    }
                    else if (hexCodes.Contains(value))
                    {
                        hexHigh = value;
                        status = MachineStatus.D;
                    }
                    else
                    {
                        throw new ArgumentException("The distinguished name specified is not typed legally.");
                    }
                    break;
                case MachineStatus.D:
                    if (hexCodes.Contains(value))
                    {
                        working.Append((char)Convert.ToByte(String.Format("{0}{1}", hexHigh, value), 16));
                        status = MachineStatus.A;
                    }
                    else
                    {
                        throw new ArgumentException("The distinguished name specified is not typed legally.");
                    }
                    break;
                case MachineStatus.E:
                    if (value == "," || value == "\"" || value == "\\")
                    {
                        working.Append(value);
                        status = MachineStatus.B;
                    }
                    else if (hexCodes.Contains(value))
                    {
                        hexHigh = value;
                        status = MachineStatus.F;
                    }
                    else
                    {
                        throw new ArgumentException("The distinguished name specified is not typed legally.");
                    }
                    break;
                case MachineStatus.F:
                    if (hexCodes.Contains(value))
                    {
                        working.Append((char)Convert.ToByte(String.Format("{0}{1}", hexHigh, value), 16));
                        status = MachineStatus.B;
                    }
                    else
                    {
                        throw new ArgumentException("The distinguished name specified is not typed legally.");
                    }
                    break;
            }
            index++;
        }
 
        if (status == MachineStatus.A)
        {
            pool.Add(working.ToString());
            return pool;
        }
        else
        {
            throw new ArgumentException("The distinguished name specified is not ended correctly.");
        }
    }
 
    enum MachineStatus
    {
        A, B, C, D, E, F
    }
}