Many people complains about Windows 7 and its Bluetooth support on AADP (A2DP).
If your Wi-Fi & Bluetooth Dongle is from Intel, you can follow the following steps.
1) Install Intel Bluetooth Driver
Currently I cannot find this on Intel website. This will provide you the Bluetooth driver.
Windows 7: http://www.dell.com/support/home/us/en/04/Drivers/DriversDetails?driverId=K59N9
Windows 8.1: http://www.dell.com/support/home/us/en/04/Drivers/DriversDetails?driverId=75M5W
Windows 10: http://www.dell.com/support/home/us/en/04/Drivers/DriversDetails?driverId=N7VN8
You may need to consult your PC manufacturer for this driver.
2) Install Intel Bluetooth Profile
This will provide you some of the Bluetooth profile that Windows 7 fails to support natively.
(Intel calling it Intel Bluetooth Software.) Including AADP (A2DP, Advanced Audio Distribution Profile), AVRCP (Audio/Video Remote Control Profile), Hands-Free Profile.
https://downloadcenter.intel.com/download/26421/Intel-Wireless-Bluetooth-Software-for-Windows-7-?v=t
DO choose the version that is corresponding to previous Bluetooth driver!
For example, I choose 19.0.1603.630 Bluetooth Driver, and 19.0.1603 Bluetooth Profile!
After installing above two driver, you can find two installed programs in your control pannel.
For example, there are:
1) Intel Wireless Bluetooth 18.1.1607.3129
2) Intel Wireless Bluetooth (patch version 19.11.1639.649) 19.0.1607.0648
1607 indicates the release date of the driver. AND THESE TWO DRIVERS MUST BE RELEASED THE SAME DATE TO AVOID BUGS.
Power on your Bluetooth headset, leave it on paring mode.
On your PC, open Bluetooth device panel, add device, choose your headphone.
After adding your headphone, double click the device icon, in the action bar, click listen to music.
2016年12月19日星期一
2015年11月15日星期日
Good to know: XPS13 9350 comply with USB-PD standard!
Good to know: XPS13 9350 comply with USB-PD standard!
So you can charge your laptop with a USB-PD compativle USB-C charger.
Like Google Universal 60W USB-C charger (which is quite enough), or future 3rd charger.
But a regular 5V USB charger won't charge XPS13 9350 at all.
Becuase both voltage and amp are too low.
Reference:
https://www.reddit.com/r/Dell/comments/3rrs8x/usb_typec_charging_xps_13_9350/
Quote:
Q:
A:
Alright, so I made an account finally just so I can answer this question for you and help anyone else out who has been researching about this. I just received my new Dell XPS 13 about 2 weeks ago and before that and up til today I am still doing a lot of research on charging with USB C. It looks like the charger for the Dell XPS 13 is a 45W 19.45V/2.31A charger. That means the charger you use for USB C charging has to be +/- 1V than the standard 19.45V. The amps has to be 2.31A or higher, just as long as it is the proper voltage (and polarity but that's another story and USB does bother with polarity from what I've heard). So in this case, you and me both have to look for a USB TYPE C charger that supports at least 19.45V/2.31A. There is one charger that I know does this...it is the Chromebook Pixel 2 charger. It is 60W at 20V/12V/5V/3A. I ordered one and it will be here on Monday, I wanted to have a universal charger for my laptop and phone (Nexus 6P). Since it supports both outputs for my 6P and XPS 13 I bought it. I got the same issue "plugged in, not charging" when I tried using my Nexus 6P charger on the XPS. I knew it wouldn't work because the charger is 15W at 5V/3A but I just wanted to see what it would say.
I have literally been researching this for weeks, and I think the Pixel 2 charger will work (I do not see why not since it can support 20V/3A charging). I also heard about a MacBook charger being out there but I did not bother to look into it, all I know is that it is less watts but do not know about the volts or amps. I am only worried about issues arising from using USB charging rather than the standard charger, companies usually create their chargers to be the best and most exceptional for the device. Wondering if it'll hurt battery life in the long run.
A little knowledge about Watts, Volts, and Amps: So after much research I found that watts = volts x amps. Volts are the power pushing out of the charger. It is OK to use any wattage as a charger but you have to make sure that the voltage is +/- 1V around the standard for the device requirements. In this case, 19.45V (XPS 13) will be safe with a 20.45V or 18.45V charger. Amps are the amount of power the device actually draws in. In this case we need AT LEAST 2.31A to receive a standard charge for the XPS 13, anything less will cause a slow charge. Same goes with our phones, some chargers output a standard 1A but there are some quick chargers that put out 2.1A, these double the charging speed (I do not know if this is bad for a battery though, nothing ever happened to my Nexus 5). I think the amps are regulated by the XPS so even using a 10A charger would only work at 2.31A being pulled by the XPS.
I won't be sure about this stuff until I receive my Google charger and test it out this week, if it works I may even buy another one. Hope this helps out!
UPDATE: Ok, I just received my Chromebook Pixel 2 charger that I ordered from Google and I can confirm that it does charge my Nexus 6P "rapidly" and it also charges my Dell XPS 13. I plugged in both chargers separately to compare the "time left to charge" and both read the same time so I am assuming the charger is working similar to the Dell charger.
UPDATE 2: I just ran a battery software (batteryinfoview) and I can confirm that the voltage running through the chargers is the same and the estimated full charge time is the same as well. So, the Google Chromebook Pixel 2 charger WILL work to charge the new Dell XPS 13. Hope this helps other people! If you have a new Nexus device or new TYPE C device and also have an XPS 13 get this charger. (20V/12V/5V/3A)
UPDATE 3: Ok so it's been about a week since I have been using my new charger. While it works great on the DELL XPS 13 I am starting to notice some weird stuff when plugging in the pixel charger into my Nexus 6P. The charger registers perfectly on the XPS with a 10 second delay (this is usual). But sometimes when I plug it into my phone it doesn't always display "charging rapidly" sometimes it shows just "charging." I do not want to say I have a faulty charger but I am going to see if Google will send me a replacement just to make sure it is the regulator in the charger and not my phone. I am assuming that since the charger can provide three different outputs of power, the charger gets confused when switching it into my phone sometimes (which is weird because they're both Google products). I even used an app to monitor the amps being pulled from the charger, when it just says "charging" it is pulling about 500mah-1000mah. When it is "charging rapidly" it is pulling 2000mah-2500mah. The rapid charging is ALWAYS supposed to be on because of the 5V/3A output in the Pixel 2 charger (by the way, both the Pixel 2 charger and the Nexus 6P charger provide 5V/3A). I never have this issue while using the charger that came from my phone, considering it only provides 5V/3A compared to the Pixel 2 charger that outputs 20V/12V/5V/3A. I am either going to assume the charger is faulty, or this is just how the chargers are made (not designed well for other devices other than the Chromebook Pixel 2).
So you can charge your laptop with a USB-PD compativle USB-C charger.
Like Google Universal 60W USB-C charger (which is quite enough), or future 3rd charger.
But a regular 5V USB charger won't charge XPS13 9350 at all.
Becuase both voltage and amp are too low.
Reference:
https://www.reddit.com/r/Dell/comments/3rrs8x/usb_typec_charging_xps_13_9350/
Quote:
Q:
I just got my new XPS 13. A Dell sales rep told me I would be able to charge the laptop through the USB-C, so I got this cable http://www.amazon.com/gp/product/B010VFFSL4
When I plug it into a USB charger, I get a "plugged in, not charging" message.
I have used the cable with this http://www.amazon.com/gp/product/B00OQ19QYA , the wall charger that came with the LG G4 and an external battery pack, all with the same message.
Has anyone had any luck charging with USB-C?
A:
Alright, so I made an account finally just so I can answer this question for you and help anyone else out who has been researching about this. I just received my new Dell XPS 13 about 2 weeks ago and before that and up til today I am still doing a lot of research on charging with USB C. It looks like the charger for the Dell XPS 13 is a 45W 19.45V/2.31A charger. That means the charger you use for USB C charging has to be +/- 1V than the standard 19.45V. The amps has to be 2.31A or higher, just as long as it is the proper voltage (and polarity but that's another story and USB does bother with polarity from what I've heard). So in this case, you and me both have to look for a USB TYPE C charger that supports at least 19.45V/2.31A. There is one charger that I know does this...it is the Chromebook Pixel 2 charger. It is 60W at 20V/12V/5V/3A. I ordered one and it will be here on Monday, I wanted to have a universal charger for my laptop and phone (Nexus 6P). Since it supports both outputs for my 6P and XPS 13 I bought it. I got the same issue "plugged in, not charging" when I tried using my Nexus 6P charger on the XPS. I knew it wouldn't work because the charger is 15W at 5V/3A but I just wanted to see what it would say.
I have literally been researching this for weeks, and I think the Pixel 2 charger will work (I do not see why not since it can support 20V/3A charging). I also heard about a MacBook charger being out there but I did not bother to look into it, all I know is that it is less watts but do not know about the volts or amps. I am only worried about issues arising from using USB charging rather than the standard charger, companies usually create their chargers to be the best and most exceptional for the device. Wondering if it'll hurt battery life in the long run.
A little knowledge about Watts, Volts, and Amps: So after much research I found that watts = volts x amps. Volts are the power pushing out of the charger. It is OK to use any wattage as a charger but you have to make sure that the voltage is +/- 1V around the standard for the device requirements. In this case, 19.45V (XPS 13) will be safe with a 20.45V or 18.45V charger. Amps are the amount of power the device actually draws in. In this case we need AT LEAST 2.31A to receive a standard charge for the XPS 13, anything less will cause a slow charge. Same goes with our phones, some chargers output a standard 1A but there are some quick chargers that put out 2.1A, these double the charging speed (I do not know if this is bad for a battery though, nothing ever happened to my Nexus 5). I think the amps are regulated by the XPS so even using a 10A charger would only work at 2.31A being pulled by the XPS.
I won't be sure about this stuff until I receive my Google charger and test it out this week, if it works I may even buy another one. Hope this helps out!
UPDATE: Ok, I just received my Chromebook Pixel 2 charger that I ordered from Google and I can confirm that it does charge my Nexus 6P "rapidly" and it also charges my Dell XPS 13. I plugged in both chargers separately to compare the "time left to charge" and both read the same time so I am assuming the charger is working similar to the Dell charger.
UPDATE 2: I just ran a battery software (batteryinfoview) and I can confirm that the voltage running through the chargers is the same and the estimated full charge time is the same as well. So, the Google Chromebook Pixel 2 charger WILL work to charge the new Dell XPS 13. Hope this helps other people! If you have a new Nexus device or new TYPE C device and also have an XPS 13 get this charger. (20V/12V/5V/3A)
UPDATE 3: Ok so it's been about a week since I have been using my new charger. While it works great on the DELL XPS 13 I am starting to notice some weird stuff when plugging in the pixel charger into my Nexus 6P. The charger registers perfectly on the XPS with a 10 second delay (this is usual). But sometimes when I plug it into my phone it doesn't always display "charging rapidly" sometimes it shows just "charging." I do not want to say I have a faulty charger but I am going to see if Google will send me a replacement just to make sure it is the regulator in the charger and not my phone. I am assuming that since the charger can provide three different outputs of power, the charger gets confused when switching it into my phone sometimes (which is weird because they're both Google products). I even used an app to monitor the amps being pulled from the charger, when it just says "charging" it is pulling about 500mah-1000mah. When it is "charging rapidly" it is pulling 2000mah-2500mah. The rapid charging is ALWAYS supposed to be on because of the 5V/3A output in the Pixel 2 charger (by the way, both the Pixel 2 charger and the Nexus 6P charger provide 5V/3A). I never have this issue while using the charger that came from my phone, considering it only provides 5V/3A compared to the Pixel 2 charger that outputs 20V/12V/5V/3A. I am either going to assume the charger is faulty, or this is just how the chargers are made (not designed well for other devices other than the Chromebook Pixel 2).
2015年11月9日星期一
5 things you need to do after you purchase XPS13 9350/9343
First, Using Dell Update to update Dell Utility, if you would like. Register your PC in order to have 1 year warranty.
Second, right click Start button, choose Manage, navigate to Device Manager, update the driver of Intel Iris Display Adapter, Firmware, Realtek SD Card Reader, Integrated Camera, and maybe any other component you can find updated driver using Device Manager.
Note: Updating firmware and Iris Display driver will resolve issues about screen flickering, hang-up when wake it from Sleep, noisy fan and other potential issue.
Third, Choose a short non-standard TF to SD adapter, to extend you storage. Otherwise, standard SD card cannot fully stuck into the body of XPS13. Suitable TF to SD adapter is about 9mm shorter than standard SD card.
Fourth, get a Bluetooth Mouse to easy your daily use.
Fifth, get a enclouse. A enclouse for iPad Air 2 may (or may out) swallow XPS13 inside but with a fraction out of the mouth. While a regular enclouse for other laptop may be too large. Maybe you can get a official leather suit for your XPS13.
Second, right click Start button, choose Manage, navigate to Device Manager, update the driver of Intel Iris Display Adapter, Firmware, Realtek SD Card Reader, Integrated Camera, and maybe any other component you can find updated driver using Device Manager.
Note: Updating firmware and Iris Display driver will resolve issues about screen flickering, hang-up when wake it from Sleep, noisy fan and other potential issue.
Third, Choose a short non-standard TF to SD adapter, to extend you storage. Otherwise, standard SD card cannot fully stuck into the body of XPS13. Suitable TF to SD adapter is about 9mm shorter than standard SD card.
Fifth, get a enclouse. A enclouse for iPad Air 2 may (or may out) swallow XPS13 inside but with a fraction out of the mouth. While a regular enclouse for other laptop may be too large. Maybe you can get a official leather suit for your XPS13.
2015年10月23日星期五
你或许不知的秘密,普通USB充电器也可以为MacBook Retina 12"充电
英文版本请点击这里。English version click here.
最近我很好奇一件事情。那就是,既然2015年新款Macbook Retina 12英寸(以下简称MB12)除了音频接口之外,就只有一个USB-C接口,而且兼容USB-PD协议。其标配充电器的输出标识为14.5V 2A (USB-PD) or 5.2V 2.4A (显然电压是有线补的,所以比标准电压略高)。苹果也在其官方网站确认,你可以使用第三方USB-PD兼容充电器为MB12充电 (传送门)。不过显然我关心的不止这一点。
考虑到USB无论怎么发展,其总是要照顾到兼容性的。那么如果使用一个完全普通的USB充电器,搭配USB-A到USB-C的转接线,可否给MB12充电呢?
苹果一贯的风格是隐去具体的技术细节(默认情况下这是好事,用户不用想太多)。然而对电子爱好者来说,却没有办法得知具体细节,除非亲自实验。幸运的是,总会有敢于第一个吃螃蟹的人,为我们进行了相关的测试。以下测试来自互联网。
你可以使用苹果USB-C 29W充电器为谷歌Chromebook充电,代价是较低的充电速度,因为充电器只能输出29W的功率。
左边是: Google Universal USB-C 60W Charger compatile with USB-PD.右边是: Apple USB-C 29W Charger compatile with USB-PD.
有趣的是,MB12在标准充电和慢速充电时,显示的充电指示图案不同。
结果证明,能充!当然了,速度会有大大的牺牲,同时仅应在应急情况下使用此办法。
最近我很好奇一件事情。那就是,既然2015年新款Macbook Retina 12英寸(以下简称MB12)除了音频接口之外,就只有一个USB-C接口,而且兼容USB-PD协议。其标配充电器的输出标识为14.5V 2A (USB-PD) or 5.2V 2.4A (显然电压是有线补的,所以比标准电压略高)。苹果也在其官方网站确认,你可以使用第三方USB-PD兼容充电器为MB12充电 (传送门)。不过显然我关心的不止这一点。
考虑到USB无论怎么发展,其总是要照顾到兼容性的。那么如果使用一个完全普通的USB充电器,搭配USB-A到USB-C的转接线,可否给MB12充电呢?
Apple USB-C 29W 电源适配器. 额定输出: 14.5V@2A(USB-PD) or 5.2V@2.4A
图片来源:ChongDianTou.com
图片来源:ChongDianTou.com
苹果一贯的风格是隐去具体的技术细节(默认情况下这是好事,用户不用想太多)。然而对电子爱好者来说,却没有办法得知具体细节,除非亲自实验。幸运的是,总会有敢于第一个吃螃蟹的人,为我们进行了相关的测试。以下测试来自互联网。
结论先行:你可以用第三方USB充电器为MB12充电,但建议使用USB-PD兼容的充电器。
警告:能充,并不意味着可靠或是安全。你应使用一个USB-PD兼容的,且输出功率足够的充电器 (例如Google的USB-C 60W通用电源适配器)。使用低额定输出功率的电源适配器为MB12充电可能导致电源适配器过热乃至起火。使用假冒伪劣的、不符合国家标准的充电器可能对MB12造成不可挽回的伤害,甚至有电击、起火乃至人身伤害。无论何种情况导致的伤害,我均不承担任何责任。虽然尽力校正和审阅文本,但我并不保证内容全部正确无误。任何测试,自负责任。测试一:来自 notquitemainstream.com (英文)
你可以使用谷歌的USB-C 60W通用电源适配器为MB12充电,但是这并不能充的更快,因为MB12只汲取12W的功率。你可以使用苹果USB-C 29W充电器为谷歌Chromebook充电,代价是较低的充电速度,因为充电器只能输出29W的功率。
左边是: Google Universal USB-C 60W Charger compatile with USB-PD.右边是: Apple USB-C 29W Charger compatile with USB-PD.
测试二:来自 ChongDianTou.com (中文)
你可以使用第三方标准5V USB充电器为MB12充电,但代价是较低的充电速度。有趣的是,MB12在标准充电和慢速充电时,显示的充电指示图案不同。
使用苹果官方USB-C 29W充电器(兼容USB-PD)充电.
额定输出功率29W,鉴于能量转换效率低于100%,输入功率为31.8W。
使用第三方5V 2.1A USB充电器为MB12充电。(此充电器虽然带USB-C接口但不兼容USB-PD)
Macbook判断其不兼容USB-PD,仅汲取5Vx1A=5W的功率。这有利于保障安全。
鉴于能量转换效率低于100%,输入功率为6.58W。
不同充电模式下,MB12的屏幕指示不同。上:正常充电;下:慢速充电。
(鉴于慢速充电功率不足,在开机状态下电池电量可能不增反降。)
测试三:来自 bbs.feng.com (中文)
这位勇敢的家伙,尝试使用苹果自家的iPhone电源适配器和iPad电源适配器为MB12充电。结果证明,能充!当然了,速度会有大大的牺牲,同时仅应在应急情况下使用此办法。
使用iPad 5.1V 2.1A电源适配器为MB12充电。
鉴于能量转换效率低于100%,输入功率为13.8W。
使用iPhone 5.1V 1A电源适配器为MB12充电。鉴于能量转换效率低于100%,输入功率为3.2W。
奇怪的是MB12只汲取了5V 500mA的功率,这是最最最保守的充电方案。
奇怪的是MB12只汲取了5V 500mA的功率,这是最最最保守的充电方案。
由于充电功率太小,恐怕这并不能为一个正在运行的MB12提供有效的充电。
结论:无论如何,USB总是会兼容5V
无论未来USB会多么的先进,为了安全和向后兼容的考虑,USB总还是会兼容5V的。要知道,如果USB电源适配器提供超过5V或者超过1A的输出,电源适配器和用电器一定需要与某种充电协议兼容才行,例如USB BC协议,例如USB PD协议,例如高通快充。电源适配器提供的初始默认输出,一定是5V的。(因为如果不是这么设计的话,很有可能的是你一不小心就把你的设备给烧了。)
当然了,老旧的充电器,其输出功率往往较低,也不兼容什么高级的协议。虽然不推荐在正常情况下,使用输出功率不足的电源适配器为用电器充电,但应急总还是可以的。设想一下此情此景,你出门游玩,却忘记携带你的标配充电器,没电了很着急对不对?没关系,随便找一个通用USB充电器,应急着充一下还是OK的。是不是很酷?
当然了,你也可以购买一个全新的,高额定输出功率,兼容高级充电协议的USB充电器,这样一来,你就可以使用一个充电器,为各种设备充电了呢。
当然了,老旧的充电器,其输出功率往往较低,也不兼容什么高级的协议。虽然不推荐在正常情况下,使用输出功率不足的电源适配器为用电器充电,但应急总还是可以的。设想一下此情此景,你出门游玩,却忘记携带你的标配充电器,没电了很着急对不对?没关系,随便找一个通用USB充电器,应急着充一下还是OK的。是不是很酷?
当然了,你也可以购买一个全新的,高额定输出功率,兼容高级充电协议的USB充电器,这样一来,你就可以使用一个充电器,为各种设备充电了呢。
当然了,在可能的情况下,建议使用官方标配的电源适配器。
如果你希望使用其他第三方电源适配器,你最好知道你在做什么。
虽然USB-C接口很小,但我相信这是科技界的一大步!一个接口走天下有木有?!
我想在不远的未来,你出门只需要携带一个全功能USB充电器,就可以为你的任何设备充电了!无论是笔记本电脑、智能手机、平板电脑,或是其他各种电子设备。
我想在不远的未来,你出门只需要携带一个全功能USB充电器,就可以为你的任何设备充电了!无论是笔记本电脑、智能手机、平板电脑,或是其他各种电子设备。
MacBook Retina 12" can be charged using normal USB charger!
Chinese version click here. 中文版本(点我 传送门 )。
Recently I was curious about this. Since Macbook Retina 12" use USB Typc-C interface to charge, and the rated supply voltage is 14.5V 2A (USB-PD) or 5.2V 2.4A (clearly output voltage is a little higher for cable compensation),and Apple claims "Your MacBook will charge from USB-C power adapters not manufactured by Apple if they adhere to the USB Power Delivery specification." on this page. So I wondered, whether I can use a normal USB charger plus USB Type-A to USB Type-C adapter to charge MacBook Retina 12" or not.
Since Apple won't tell you the technical detail of Mac, so there must be some brave guys to test for us. Luckily I found some tests on the Internet.
You can use Apple USB-C 29W charger to charge Google Chromebook Pixel, but you WILL suffer a lower charing speed, since charger can only output 29W of power.
Left: Google Universal USB-C 60W Charger compatile with USB-PD.
Right: Apple USB-C 29W Charger compatile with USB-PD.
An intersting fact was showed. While your Mac is in NORMAL CHARGE mode, the charge icon is different from that while charging in SLOW MODE.
Recently I was curious about this. Since Macbook Retina 12" use USB Typc-C interface to charge, and the rated supply voltage is 14.5V 2A (USB-PD) or 5.2V 2.4A (clearly output voltage is a little higher for cable compensation),and Apple claims "Your MacBook will charge from USB-C power adapters not manufactured by Apple if they adhere to the USB Power Delivery specification." on this page. So I wondered, whether I can use a normal USB charger plus USB Type-A to USB Type-C adapter to charge MacBook Retina 12" or not.
Apple USB-C 29W charger. Output: 14.5V@2A(USB-PD) or 5.2V@2.4A
Image Source: ChongDianTou.com
Image Source: ChongDianTou.com
Since Apple won't tell you the technical detail of Mac, so there must be some brave guys to test for us. Luckily I found some tests on the Internet.
TL;DR: You can charge Macbook using normal USB charger.
WARNING: Compatible does NOT mean reliable or safety. You should use a USB-PD compatible charger with enough rated output power to charge your Macbook Retina 12" (e.g. Google Universal USB-C 60W Charger). Charging Macbook Retina 12" using a low power-output charger may result in over-heat in the charger, even fire. Charging Macbook Retina 12" using a fake/conterfeit or low-quality charger may result in danger of electric shock or fire or permanent damage to your MAC. I TAKE NO RESPONSIBILITY OF ANY POTENTIAL DAMAGE OR ANY INCORRECT IMFORMATION IN ANY CASE. TRY IT AT YOUR OWN RISK.TEST ONE from notquitemainstream.com (English)
You can use Google Universal USB-C 60W charger to charge your Macbook, but you will NOT benefit from a larger rated power (60W), since Macbook only takes 29W.You can use Apple USB-C 29W charger to charge Google Chromebook Pixel, but you WILL suffer a lower charing speed, since charger can only output 29W of power.
Left: Google Universal USB-C 60W Charger compatile with USB-PD.
Right: Apple USB-C 29W Charger compatile with USB-PD.
TEST TWO from ChongDianTou.com (Chinese)
You can use a 3rd party Standard 5V USB charger to charge your Macbook Retina 12", but you WILL suffer a lower charing speed.An intersting fact was showed. While your Mac is in NORMAL CHARGE mode, the charge icon is different from that while charging in SLOW MODE.
Charging using offical USB-PD compatible USB-C 29W charger.
Since power conversion efficiency is lower than 100%, so input power is 31.8W.
Charging using a 3rd party USB 5V 2.1A charger with USB-A & USB-C ports.
(USB-PD not compatible, JUST normal charger plus a USB-C port)
Macbook cannot determine this 3rd charger, so it take only 5Vx1A=5W.
5V 1A is kind of standard spec, in order to insure your safety.
The power efficiency is lower than 100%, so input power is 6.58W.
Here is Mac icon for NORMAL CHARGING and SLOW CHARGING.
TEST THREE from bbs.feng.com (Chinese)
This brave man try using iPhone or iPad charger to charge his/her Macbook Retina 12". It turns out that you can charge Macbook Retina 12" with a normal USB charger which is not compatible with USB-PD.
Charge Macbook 12" using iPad 5.1V 2.1A charger.
Since power conversion efficiency is lower than 100%, so input power is 13.8W.
Charge Macbook 12" using iPhone 5.1V 1A charger.
Strange enough Macbook only take 5V 500mA. Maybe the iPhone charger is too old for her to recognize.
Since power conversion efficiency is lower than 100%, so input power is 3.2W.
Anyway this power is too low, and dfinitely will not effectively charge Macbook while OS X is still running.
CONCLUSION: USB WILL ALWAYS COMPATIBLE WITH 5V FOR BACKWARD COMPATIBILITY
No matter what USB will advance in the future, for safety, for backward compatibility, USB will always compatible with 5V. Remember if USB output a voltage other than 5V or a current higher than 1A, the host and client must comply with some sort of standard, like USB Battery Charging, or USB Power Delivery, or Qualcomm Quick charge 1.0/2.0/3.0. THE INITIAL AND DEFAULT PROFILE WILL ALWAYS BE 5V. If it is not designed like that, you can easily burn your device into fire. Of course, old charger rated with lower outut power, and you should not use a low-power charger to charge a power-demanding device in the normal case. But imagine, that you didn't bring your charger along with you, and don't worry, you can charge it using a normal USB charger to help you out. That's wonderful. Also, you can buy a new full-spec high-output-power universal USB charger for any USB devices.
Of course you are recommended to use official charger.
If you want use any other charger, you should know what you are doing.
IT IS A BIG STEP, THAT ONE PORT WILL SUPPORT ANYTHING!
Not far in the future, you will need just a single full-spec USB charger to charge your notebooks, mobile phones, tablets, power banks, and more.
2015年4月7日星期二
Solution for Tower Cube (3x3x4) and Rex (8-axis) Cube
The solutions herein come from Internet, and their copyright belongs to respective (original) author(s).
Solution for Tower Cube (3x3x4):
Re-blog from http://solutions.spacebrew.com/tower/ (Original URL is invalid now.)Phase 1: Solve the top and bottom layer corners.
- First put the corners in their correct layer. To correct the final corners, hold the puzzle so that the incorrect cubies are at UFR and DFL, then perform:R D R
- Now examine the side colors of the top layer corners to see which cubies need to be swapped to make the sides match. At most one pair needs to be swapped.
- To swap adjacent corners, put the corners at the UFL and UFR, and perform:F U' F U F · R U R U' R
- To swap diagonal corners, put the corners at the UFR and UBL, and perform:R U2 F U R U2 · F U' R U2 F
- The top layer corners should now be solved. Turn over the puzzle and repeat.
Phase 2: Solve the top and bottom layer edges.
- First put the edges in their correct layer. Put unsolved cubies in UFM and DFM, and perform:U2 R F R U2 R F R
- Repeat step 1 until all the edges are in their correct layers.
- Now examine the side colors of the top layer edges to see which cubies need to be swapped to make the sides match the corners.
- To swap adjacent edges, put the edges at the front and the right, and perform:R D B · R U2 R U2 R U2 · B D' R
- To swap opposite edges, put the edges at the front and the back, and perform:R U2 R U2 R
- Repeat until the top layer edges are be solved.
- Turn over the puzzle and repeat.
Phase 3: Solve the middle layer edges.
- First put the edges in their correct layer. Put bad u edge at FR and bad d edge at FL, and then perform:R d R
- Repeat step 1 until all the edges are in their correct layers.
- Turn u to put at least two of its edges correct. At most one pair needs to be swapped.
- To swap adjacent edges, put the bad edges at FR and FL and perform:u' R u R · d' R d R · F d F
- To swap diagonal edges, put the bad edges at FR and BL and perform:R u2 F u' R · u d R d' F u2 R u'
- The u layer edges should now be solved. Turn over the puzzle and repeat for the d layer.
Phase 4: Solve the middle layer centers.
- Perform one of the following to swap two cubies:
- To swap Bu and Lu, perform: R F L d L F R u
- To swap Bd and Ld, perform: R F L u L F R d
- To swap Bd and Lu, perform: u R F L d L F R
- To swap Bu and Ld, perform: d R F L u L F R
- To swap Bu and Fu, perform: R F L d2 L F R u2
- To swap Bd and Fd, perform: R F L u2 L F R d2
- To swap Bd and Fu, perform: u2 R F L d2 L F R
- To swap Bu and Fd, perform: d2 R F L u2 L F R
- Repeat until the centers are all solved.
Solution for Rex Cube (Video):
First, Solve Dino Cude
https://www.youtube.com/watch?v=noAQfWqlMbkSecond, Solve Rex Cude
https://www.youtube.com/watch?v=noAQfWqlMbk2015年4月5日星期日
How to perform a TCP ping
Normal ping using ICMP, not TCP nor UDP.
But sometimes we want to check whether a port is open or not.
For example I establish a new service on my server but find out client cannot get access.
That's time when we should use TCP ping.
So how can we perform TCP ping?
If you are using Windows, you can use tcping, a simple CLI tool brought to you by Eli Fulkerson, which can be downloaded here.
If you are using Linux, then you have multiple useful choices.
The first is nmap.You can use it like this
There are some other tool can perform TCP ping too, e.g. Hping, Paping.
If you'd prefer web application, there are many websites that offer a bunch of Network tesing tool such as ping, tcping, tracert, etc. Just Google it.
But sometimes we want to check whether a port is open or not.
For example I establish a new service on my server but find out client cannot get access.
That's time when we should use TCP ping.
So how can we perform TCP ping?
If you are using Windows, you can use tcping, a simple CLI tool brought to you by Eli Fulkerson, which can be downloaded here.
If you are using Linux, then you have multiple useful choices.
The first is nmap.You can use it like this
nmap -p 80 onofri.org
The second is tcpping brought to you by Richard. Click here for tutorial.There are some other tool can perform TCP ping too, e.g. Hping, Paping.
If you'd prefer web application, there are many websites that offer a bunch of Network tesing tool such as ping, tcping, tracert, etc. Just Google it.
2015年3月28日星期六
Baidu Analytics' JavaScript was "hijacked" to fire-up DDoS attack against Github
Github claimed on Twitter, that Github.com/ny-times and Github.com/greatfire are under massive DDoS attack. It is found that the attack source is from everywhere around the globe. And many netizens pointed out that the attack is becaused of a malicious JS, which is hosted on Baidu.
Why?
Because so many websites in Chinese use Baidu Analytics or Baidu Adsense (substitution of Google Analytics and Google Adsense), then those websites all contains JavaScript from Baidu in order to funtions properly. And then the javascript was hi-jacked. I don't know whether is hi-jacked or not. I mean, I don't know the malicious JS is deployed by either a hacker or actually Baidu itself. Anyway, since the JS is malicious, when a user open such a webpage, and load the JS background automatically, then the user's PC is fire up a DDoS attack against Github.
It is not the first time Github's the victim. Github has been under DDoS attack originated from China for many times, and Github has been under MITM Attack for at least one time. The reason is that, there are projects and webpages hosted on Github, either to help Chinese netizens get aware of China Internet Censorship, or reveal news which is banned in China, or teach them how to bypass the censorship firewall (called GFW).
Github is kind of like Wikipedia. They consider freedom of speech as a basic human right. And they don't want to modify the Terms of Use to forbit these usage, even these projects are only cared by Chinese netizens or actually irrelevant for software development, even these projects and webpages result in A LOT OF attack against Github.
And it is not the first time Baidu was used as attack source. Back in 2005, the same trick, malicious JS, which is used by numerous websites using Baidu Analytics/Adsense, and DDoS, against 8848.com .Of course, Baidu denied the accusation, they said they did not envolved in the attack.
Just several days before, Google posted a blog that they've caught CNNIC generating fake digital certificate which can be used for MITM attack. And according to Wikipedia, CNNIC is a NGO. But who will buy it? Obviously CNNIC is not NGO, it is under administrartion of Internet Security and Informatization Leading Group Office of CPC and National Internet & Information Technology Office. And this so called NGO, as the Internet Authority of China, is responsible for the Notorious Malware Chinese Web Browsing Helper, which is usually installed on PC's without awareness of user and is very hard to uninstall. Even CNNIC claims himself as NGO and its Root CA is pre-installed on most Operating Systems and Browsers, I WILL NEVER EVER BUY IT. I DO NOT TRUST CNNIC.
At last, I recommend a website, which can allow netizens to observe the DDoS attack war all around the globe. That is http://www.digitalattackmap.com/
Below is a living demo showing the war record of Sep.15th,2014. (Maybe 14th because of timezone.) BTW, China is acting more as attack source than as attack victim.
Below is a living demo showing the war record of Sep.15th,2014. (Maybe 14th because of timezone.) BTW, China is acting more as attack source than as attack victim.
2015年3月18日星期三
New Domain for my Blog: joeyao.chou.space
Today I register a domain called chou.space.
So from now on, joeyao.chou.space becomes new home for my blog.
Of course, the blog is still hosted on Blogger.
So kind is Google, as a free user of Blogger, I can add HTML/Java Widget, use my own domain name. But since Google Reader and Google Code are all shut down, I'm a little afraid that one day, Blogger will be shut down. If that comes true, we will lose a wonderful free blog hosting service.
Go go go, Google!
今天新注册了域名 chou.space
然后呢,joeyao.chou.space 成为目前此Blogger博客的地址。
话说Google真也大方,Blogger允许添加Java组件,允许使用自己的域名,而且这一切都是免费的。考虑到Google Reader和Google Code都被关闭了,我还真是担心万一有一天Google也要关闭Blogger呢。那样的话恐怕天底下再找不到一个这个好的免费博客站点了。
为什么我说Blogger好?
1、免费
2、可以添加Java组件,免费
3、可以使用自己的域名,免费
当然了缺点也是有的,模板太少,不好看。写文章不如Wordpress。
Wordpress.com提供免费博客空间,但使用自己的域名是要收费的,而且不支持Java组件。
目前域名只是一时脑热买下来的。
暂时没什么好想法把网站做成什么样子。
所以目前只是作为博客的个性域名。
So from now on, joeyao.chou.space becomes new home for my blog.
Of course, the blog is still hosted on Blogger.
So kind is Google, as a free user of Blogger, I can add HTML/Java Widget, use my own domain name. But since Google Reader and Google Code are all shut down, I'm a little afraid that one day, Blogger will be shut down. If that comes true, we will lose a wonderful free blog hosting service.
Go go go, Google!
今天新注册了域名 chou.space
然后呢,joeyao.chou.space 成为目前此Blogger博客的地址。
话说Google真也大方,Blogger允许添加Java组件,允许使用自己的域名,而且这一切都是免费的。考虑到Google Reader和Google Code都被关闭了,我还真是担心万一有一天Google也要关闭Blogger呢。那样的话恐怕天底下再找不到一个这个好的免费博客站点了。
为什么我说Blogger好?
1、免费
2、可以添加Java组件,免费
3、可以使用自己的域名,免费
当然了缺点也是有的,模板太少,不好看。写文章不如Wordpress。
Wordpress.com提供免费博客空间,但使用自己的域名是要收费的,而且不支持Java组件。
目前域名只是一时脑热买下来的。
暂时没什么好想法把网站做成什么样子。
所以目前只是作为博客的个性域名。
2015年1月24日星期六
我是一块硬盘,我是一根内存
转载自互联网,原作者不详,特此感谢。
我是一个硬盘
在一个普普通通的台式机里工作。别人总认为我们是高科技白领,工作又干净又体面,似乎风光得很。也许他们是因为看到洁白漂亮的机箱才有这样的错觉吧。其实象我们这样的小台式机,工作环境狭迫,里面的灰尘吓得死人。每天生活死水一潭,工作机械重复。跑跑文字处理看看电影还凑活,真要遇到什么大软件和游戏上上下下就要忙的团团转,最后还常常要死机。
我们这一行技术变化快,差不多每过两三年就要升级换代,所以人人都很有压力而且没有安全感。每个新板卡来的时候都神采飞扬踌躇满志,几年光阴一过,就变得灰头土脸意志消沉。机箱里的人都很羡慕能去别的机器工作。特别是去那些笔记本,经常可以出差飞来飞去,住五星级的酒店,还不用干重活,运行运行word,上网聊聊天就行了。
但我更喜欢去那些大服务器,在特别干净明亮的机房里工作。虽然工作时间长点,但是福利好,24小时不间断电ups,而且还有阵列,热插拔,几个人做一个人的事情,多轻松啊。而且也很有面子,只运行关键应用,不象我们这里,什么乱七八糟的事情都要做。不过我知道,那些硬盘都很厉害,不是SCSI,就是 SCSIII Fibrechannel,象我这样IDE的,能混到工作站就算很不错了。
我常常想,当年在工厂里,如果我努力一下会不会也成了一个SCSI?或者至少做个笔记本硬盘。但我又会想,也许这些都是命运,不过我从不抱怨。内存就常常抱怨,抱怨他们主板部门的复杂,抱怨他如何跟新来的杂牌内存不兼容,网卡和电视卡又是如何的冲突。
我的朋友不多,内存算一个。 他很瘦的而我很胖,他动作很快,而我总是很慢。我们是一起来这台机器的,他总是不停地说,而我只是听,我从来不说。
内存的头脑很简单,虽然英文名字叫Memory,可是他什么Memory都不会有,天大事睡一觉就能忘个精光。我不说,但我会记得所有的细节。他说我这样忧郁的人不适合作技术活,迟早要精神分裂。我笑笑,因为我相信自己的容量。
有时候我也很喜欢这份工作,简单,既不用象显示器那样一天到晚被老板盯着,也不用象光驱那样对付外面的光碟。只要和文件打交道就行了,无非是读读写写,很单纯安静的生活。直到有一天……
我至今还记得那渐渐掀起的机箱的盖子,从缺口伸进来的光柱越来越宽,也越来越亮。空气里弥漫着跳动的颗粒。那个时候,我看到了她。她是那么的纤细瘦弱,银 白的外壳一闪一闪的。浑身上下的做工都很精致光洁,让我不禁惭愧自己的粗笨等到数据线把我们连在一起,我才缓过神来。开机的那一刹那,我感到了电流和平时的不同。后来内存曾经笑话我,说我们这里只要有新人来,电流都会不同的,上次新内存来也是这样。我觉得他是胡扯。我尽量的保持镇定,显出一副很专业的样子,只是淡淡的向她问好并介绍工作环境。
慢慢的,我知道了,她,IBM-DJSA220,是一个笔记本硬盘,在老板朋友的笔记本里做事。这次来是为了复制一些文件。我们聊得很开心。她告诉我很多旅行的趣闻,告诉我坐飞机是怎么样的 坐汽车的颠簸又是如何的不同,给我看很多漂亮的照片、游记,还有一次她从桌子上掉下来的历险故事。而我则卖弄各种网上下载来的故事和笑话。
她笑得很开心。
而我很惊讶自己可以说个不停。
而我很惊讶自己可以说个不停。
一个早晨,开机后我看到数据线上空荡荡的插口。她一共呆了7天。后来,我再也没有见过她。我有点后悔没有交换电子邮件,也没能和她道别。不忙的时候,我会 一个人怀念伸进机箱的那股阳光
我不知道记忆这个词是什么意思,我有的只是她留下的许多文件。我把它们排的整整齐齐,放在我最常经过的地方。每次磁头从它们身上掠过,我都会感到一丝淡淡的惬意。
但我没有想到老板会要我删除这些文件。我想争辩还有足够的空间,但毫无用处。于是,平生第一次违背命令,我偷偷修改了文件分配表。然后把他们都藏到了一个秘密的地方,再把那里标志成坏扇区。不会有人来过问坏扇区。而那里,就成了我唯一的秘密,我常常去看他们,虽然从不作停留。
日子一天一天的重复,读取写入,读取写入……我以为永远都会这样继续下去,直到一天,老板要装xp却发现没有足够的空间。他发现了问题,想去修复那些坏扇区。我拒绝了。很快,我接到了新命令∶格式化。
我犹豫了很久 ……………………
track 0 bad,disk unusable
我犹豫了很久 ……………………
track 0 bad,disk unusable
我是一条内存
我在一台台式电脑里工作,但是我记不得我是从哪里来的,是什么牌子,因为我健忘。我的上司是cpu大哥,他是我们的老大。都说他是电脑的脑子,可是我看他的脑子实在是太小了,比我还要健忘。每天他总是不停的问我,某某页某某地址存的是什么?我总是不厌其烦的告诉他,可是不出一秒钟他又忘记了,又要问一遍,一次我说大哥你烦不烦,你就不能记住点有用的东西?他说“内存兄弟,我有苦衷啊,每天都在不停地做题,头晕眼花的,我也难啊。”
其实我不愿意跟他计较,因为他脑子小,思维也很简单。虽然说他是我的上司,可是每次睡觉醒来,他连要干什么都不记得了,总是急急忙忙地找BIOS兄弟,“嘿,哥们,今天干什么来着”。bios总是很不耐烦地把每天必做的工作说一遍,然后就去睡觉了。接下来就轮到我和C哥瞎忙了。
在机箱里的兄弟中,我最喜欢硬盘。他脑子大,记得东西多,而且记得牢。他说话的速度很慢,而且很少说错,这说明他很有深度,我这么感觉。CPU也这么想,不过他很笨,每次都忘了硬盘是谁。开机自检的时候总要问∶“嘿,那家伙是谁?”
在机箱里的兄弟中,我最喜欢硬盘。他脑子大,记得东西多,而且记得牢。他说话的速度很慢,而且很少说错,这说明他很有深度,我这么感觉。CPU也这么想,不过他很笨,每次都忘了硬盘是谁。开机自检的时候总要问∶“嘿,那家伙是谁?”
“ST!”我总要重复一遍。
硬盘很喜欢忧郁,我觉得象他这样忧郁的人不适合做技术活,迟早会精神分裂的,但是他不信。
其实睡着的时候我总是把几乎所有的东西都忘记掉,但是我从来都不会忘记朋友。有一块地方叫做CMOS,那是我记忆的最深处,保存着硬盘、光驱的名字。有些东西应该很快忘掉,而有些东西应该永远记得。我在梦中总是这么想着。
BIOS是一个很奇怪的家伙,他老是睡觉,但是却总是第一个醒过来。让我们自检,启动,然后接着睡觉。我知道如果我在CMOS里头把BIOS Shadow选项去掉,他就睡不成了,但是看着他晕晕乎乎的样子,也就不忍心这么做了。他对人总是爱搭不理,没有什么人了解他。但是这次硬盘恋爱的事,却使我重新认识了他。
那是很久以前的事了,机箱里似乎来过一块笔记本硬盘,很可爱,说实话我也喜欢她。不过现在除了记得他可爱,别的都忘记了。这就是我比硬盘幸运的地方,我把所有应该忘记的都忘记了,但是他却什么都记得。
自从笔记本硬盘走了之后,硬盘就变得很不正常。每次他的磁头经过一些地方的时候,我们都能感觉到电流很不正常。</D
自从笔记本硬盘走了之后,硬盘就变得很不正常。每次他的磁头经过一些地方的时候,我们都能感觉到电流很不正常。</D
“硬盘这是怎么了?”我问CPU。
“谁是硬盘?”
“谁是硬盘?”
我就知道和CPU没有办法交流,倒是bios没好气地说∶“那个傻瓜恋爱了”。我不知道什么是恋爱,因为我记不住东西,似乎有一些人或者事在我生命中留下过痕迹,但是我都轻率地把他们忘记了。
BIOS对我说∶“对你来说记忆太容易了,所以你遗忘得更快,生命中能够永刻的记忆都带着痛楚。”我不懂,但是我知道BIOS曾经被刷写过,那时他很痛,象要死了一样。我的记忆是轻浮的,不象他们……我很羡慕他们,因为他们拥有回忆,而我们有,从此我也学会了忧郁,因为我在CMOS里面写下了“忧郁”两个字。
硬盘一天比一天不对劲,终于有一天,CPU对问说∶“下条指令是什么来着?” 我一看,吓了一跳∶“FORMAT”
“是什么?”CPU很兴奋,这个没脑子的家伙。
我还是告诉了他。我不知为什么这么做。
硬盘犹豫了很久,终于说了一句 Track 0 bad,Disk unusable。
我还是告诉了他。我不知为什么这么做。
硬盘犹豫了很久,终于说了一句 Track 0 bad,Disk unusable。
电停了,很久很久,我在黑暗中数着时钟……
一个月后硬盘回来了,也许最后的挣扎也没有使他摆残酷的命运,他被低格了。他什么也不记得了,如同一个婴儿,我们很难过,但是这未必不是一件好事,他以后不用痛苦了。
为了恢复数据,笔记本硬盘回来了。“Hi,ST”,她说,“你不认识我了?”硬盘没有说话,似乎低格对他的伤害很大。过了一会,他说∶“对不起,好象我们没有见吧……”。
笔记本硬盘显得很伤心,我能感觉到她带泪的电流。“想不到连你也这么健忘”。
“哦……”。硬盘没有回答。
我很难过,笔记本硬盘的心里依然记着他,他却把一切都忘了,而那正是他最不希望忘却的。究竟是幸运,还是痛苦,我说不上来,只是觉得造化弄人,有一种淡淡的悲凉。
这时从BIOS传来一阵奇怪的电流,我感觉到硬盘的表情在变化,由漠然到兴奋,由兴奋到哀伤,由哀伤到狂喜……“IBM,你回来了……”。
……
后来BIOS对我说,其实他并没有睡觉,自从硬盘把那些文件藏起来以后,他就猜到会有这样的结局,于是偷偷地把其中一些文件放到了备份里。“幸好我是DUAL BIOS,虽然藏得不多,还足够让他想起来……”。
我想BIOS保存这些东西的时候一定很疼,当我问他“为什么这么做”时,BIOS轻描淡写的说∶“呵呵,我们是朋友嘛”。
嗯,朋友,永远的朋友
一个月后硬盘回来了,也许最后的挣扎也没有使他摆残酷的命运,他被低格了。他什么也不记得了,如同一个婴儿,我们很难过,但是这未必不是一件好事,他以后不用痛苦了。
为了恢复数据,笔记本硬盘回来了。“Hi,ST”,她说,“你不认识我了?”硬盘没有说话,似乎低格对他的伤害很大。过了一会,他说∶“对不起,好象我们没有见吧……”。
笔记本硬盘显得很伤心,我能感觉到她带泪的电流。“想不到连你也这么健忘”。
“哦……”。硬盘没有回答。
我很难过,笔记本硬盘的心里依然记着他,他却把一切都忘了,而那正是他最不希望忘却的。究竟是幸运,还是痛苦,我说不上来,只是觉得造化弄人,有一种淡淡的悲凉。
这时从BIOS传来一阵奇怪的电流,我感觉到硬盘的表情在变化,由漠然到兴奋,由兴奋到哀伤,由哀伤到狂喜……“IBM,你回来了……”。
……
后来BIOS对我说,其实他并没有睡觉,自从硬盘把那些文件藏起来以后,他就猜到会有这样的结局,于是偷偷地把其中一些文件放到了备份里。“幸好我是DUAL BIOS,虽然藏得不多,还足够让他想起来……”。
我想BIOS保存这些东西的时候一定很疼,当我问他“为什么这么做”时,BIOS轻描淡写的说∶“呵呵,我们是朋友嘛”。
嗯,朋友,永远的朋友
2015年1月21日星期三
C++中读写二进制与ASCII混合文本流测试
Read and Write Binary & Text Hybrid Content Stream using C++
The following code snippet is hosted on Github Gist.
标签:
C++,
Programming
Matlab program for LU Factorization with partial (row) pivoting
上述代码等价的MATLAB内置函数是[L U P]=lu(A),此时满足LU=PA。
上述代码若修改成输出P比较好。即对应MATLAB的[L U P]=lu(A,’vector’)。此时满足LU=A(p,:)。
求解AX=B的时候我们需要交换A的行,对应的也需要对B进行相同的行交换。如果写成矩阵乘法的形式的话,LU分解后满足LU=PA,原方程AX=B变为LUX=PB,注意到求解出来的X的行没有发生交换。
万一需要p行变换的逆变换,那么p_back(p)=1:n即可。也就是说p向量比P矩阵更好用。P矩阵意味着需要进行矩阵乘法。
Reference: http://cis.poly.edu/~mleung/CS3734/s03/ch02/LU_pivot.htm
标签:
MATLAB,
Programming
在Visual Studio 2005/2008/2010下使用MSCOMM32
Using MSCOMM32 under Microsoft Visual Studio 2005/2008/2010
如果你手中有一个老的程序需要改,他当时是用VC++6.0开发的,使用了MSCOMM32 Active-X控件,那么你或许会遇到问题。
当你打开资源文件时显示说:
未在此计算机上注册ActiveX控件"{648A5600-2C6E-101B-82B6-000000000014}"。请注册该控件并重试
该怎么办呢?
新版Visual Studio的串口通信应该是改用.NET FRAMEWORK了,所以没有了MSCOMM控件,如果还是希望使用的话,则
首先需要在安装有VC++6.0的电脑上拷贝或者上网下载三个文件MSCOMM32.OCX, MSCOMM.SRG, MSCOMM32.DEP
下载地址 Download MSCOMM32:http://www.rayfile.com/zh-cn/files/aa702b11-e11a-11e1-9c94-0015c55db73d/
然后新建一个文本文件,内容如下,保存为INSTALL.BAT。注意后缀必须是BAT,也就是批处理文件。
The following batch is hosted on Github Gist.
将此批处理文件与三个MSCOMM文件放在一个文件夹中,然后使用管理员权限运行INSTALL.BAT
可能你会注意到我这里的批处理文件与其他博客上的不同。因为我考虑到了64位Windows系统。
上述脚本可在Windows XP (x86/x64) Windows Vista/7 (x86/x64)上完成安装。
标签:
Visual Studio,
Windows
2015年1月19日星期一
2015年1月18日星期日
NKPC3-1704 Bowling Ball 保龄球
本来这个是早在百度空间就写了的,然而后来百度空间改版,造成很多文章排版出现问题,之前的URL地址也会失效,另外百度发布文章会有敏感词问题,还有插入代码会很蛋疼,所以现在将此篇文章迁移到Blogger。
Bowling
Time Limit: 2 Sec Memory Limit: 64 MB
南开大学ACM协会的一个元老毕业后,开了家保龄球馆。他需要为他的保龄球馆的计算机写一个记分的程序。
一局(GAME)保龄球分为10格,每格里有两次投球机会,如在第一次投球时没能全中,就有需要投第二球。
每一格可能出现三种情况:
1.失球(MISS)
无论何种情况,在一格的两次投球时,未能击倒10个瓶,此格的分数为击倒的瓶数。如果一次击球中未击倒一个瓶,则用一个’-’标记。
2.补中(SPARE)
要一次击倒十个瓶子并非那么容易的!如果在第一次掷球后,你还有一次机会来击倒该格第一球所留下的情致。当第二次投球击倒该格第一球余下的全部瓶子,称为补中,用一个‘/’符号表示。补中的记分是10分加上下一次投球击倒的瓶数。
3.全中(STRIKE)
当每一格的第一次投球击倒全部竖立的十个瓶时,称为全中,用一个(×)符号表示。全中的记分是10分(击倒的瓶)加该球员下两次投球击倒的瓶数。
在第十格中情况比较特殊:
(1)如第二次投球未补中,则第十格得分为第九格得分加上第十格所击倒瓶数。
(2)如第二次投球补中,则追加一次投球机会,第十格得分为第九格得他加上10加上追加一次投球击倒瓶数。
(3)如第一球为全中,则追上加二次投球机会,第十格得分为第九格得分加上10加追加二次投球击倒的瓶数。因此从第一格到第十格的两次追加投球,都为全中,则为12个全中,得分为满分300分。
Input
输入包括多组测试数据,你应当处理到输入结束为止。
每组输入数据中,都只有一行,包含一局的记分符号,相邻的两个符号之间以一个空格隔开。记分的符号仅包括‘-’(不含引号)、‘/’(不含引号)、’X’(不含引号)及阿拉伯数字1到9。
Output
对于每组输入数据,输出两行。对于第i组输入数据,输出的第一行为”Case i:”,输出的第二行为10个整数,表示每格的累计得分。相邻的两个得分以一个空格隔开。
Sample Input
X X X X X 5 / 7 1 - - X X X X4 4 3 3 2 2 1 7 7 1 2 - 9 / 2 2 6 3 2 / 1
Sample Output
Case 1:
30 60 90 115 135 152 160 160 190 220
Case
2:8 14 18 26 34 36 48 52 61 72
Source
Description
A patriarch of Nankai University ACM Association operates a bowling alley after graduation. Now, he needs a program to keep the score for the bowling.There are ten frames in one game. You have two chances to knock down the ten pins in each frame. There are three possible cases for each frame.
1.MISS
If you fail to knock down all of the ten pins during two delivers in a frame, the score you get from this frame will be the number of the pins that you have knocked down. If your deliver knocks down zero pin, your score board will be marked a "-".
2.SPARE
Getting all ten pins down with a single ball is not as easy as it seems! So, if you leave one or more pins standing after your first delivery, you get a second chance to knock all the pins down. This is your "spare" shot. If you knock all remaining pins down on the second shot you have made your spare. A spare is marked on the scoresheet with a "/".And the score you get will be 10 plus the number of pins you knock down during the next delivery.
3. STRIKE
When the bowler knocks down all ten pins during the first delivery in a frame, it is called a strike. Clearly your score goes up by ten, but like a spare, you get a bonus – the number of pins you knock down during your next two deliveries, which will be added to the score. A strike is on the scoresheet with an "X".
Note that the tenth frame is a little different with others.
(1) If you don't knock down the ten pins, the score will be added by the numbers of pins you knock down.
(2) The tenth frame rewards you with a final bonus ball if you convert your spare. And your score will be added by 10 and the number of pins you knock down during your final bonus delivery.
(3) If you make a strike, you will get two bonus balls. The score will be added by 10 and the number of pins you knock down during your final two bonus deliveries.You can thus throw nine strikes in the first nine frames and, if you get another two in the tenth, the bonus ball means the most strikes you can have in one game is twelve. And the full mark is 300.
Input
Input contains several cases. The input is ended up with the end of file (EOF). Each case includes one line which contains several numbers and signs to record a bowling game. The signs are '-', '/' or 'X'. And the numbers range from 1 to 9. The adjacent signs and numbers are separated by one blank.Output
For each case, please output two lines. The first line for the i-th input case should be "Case i:". The second line should be 10 integers, standing for the 10 accumulative scores of the frames in a bowling game. And each two adjacent integers should be separated by one blank.Sample Input
X X X X X 5 / 7 1 - - X X X X 4 4 3 3 2 2 1 7 7 1 2 - 9 / 2 2 6 3 2 / 1
Sample Output
Case 1: 30 60 90 115 135 152 160 160 190 220 Case 2: 8 14 18 26 34 36 48 52 61 72
HINT
Source
NKPC3本来NKPC3比赛时,我一直没有思路,总是想着要
按照回合数划分数组,
没有做出来,就一直搁置着。
现在突然来了灵感,
用(总计)击球次数划分数,
不论是存储,还是处理运算,都比较简单。
这样一来,回合数没有了实际作用,沦为主计算过程(cal(culate))执行次数的计数器。
{详见PASCAL源代码的"~"以及"~~"处}
以下是本人用GCC做的解答: 以下是本人用PASCAL做的解答: 以下是好友Liuhy用PASCAL做的解答: 原帖发布时间:2007年10月05日
标签:
PASCAL,
Programming
2014年7月20日星期日
Install AHCI Driver for Motherboard with AMD/ATi SB600/700/750/800 without reinstall Windows XP
Computer Characterustic:
Motherboard: ONDA A770S (NB:AMD A770, SB: AMD SB6XX Series)
CPU: AMD Athlon X2 5000+ (Black Edition)
GPU: AMD Radeon HD3850
RAM: Kingston DDR2 800MHz 1GB×2
HDD: ST 250GB SATA 3Gb/s
Date of purchase: Dec. 2007
Problem:
This computer is definitely capable to run Microsoft Windows 7, but you know, parents would always prefer older Operating Systems (OSs) because they don't want to change themselves to get used to a new one. Therefore the computer is running Microsoft Windows XP Professional with Onboard SATA Controllder configured as Native IDE in BIOS in the compromise of compatibility.
But I noticed that SATA HDD running in IDE mode has a significantly performance drop. Therefore I was seeking solution to install AHCI driver and let Windows XP runs without reinstall the OS. This's kind of hard, because Windows XP does NOT support SATA originally, and without SATA driver it even cannot load the system and will lead to the classical blue screen which you may encountered before.
Solution:
I searched the Internet, and I found that AMD official site stop the support for any Motherboard Chipsets. Damn!! They can just offer APU/CPU/GPU drivers now. What the fxxk!!! And luckily I found AHCI driver for AMD/ATi SB700/750/800 Series for Windows XP (32 or 64bit) on Mydrivers.com. Some bloggers said that this driver will also work on SB6XX Series and I think this deserves a try.
I download the driver installer and instead double-clik and just install it, I uncompressed it directly, because officially it does NOT support SB6XX. There after uncompression, enter a folder called RAID7XX, and enter the correct architecture folder (x86 or x64), then you'll find three files. Here I'll take x86 as example. That is
Wait!! I almost forgot you have to modify the ahcix86.inf file before copying it.
Officially, this driver will only support AMD SB700/750/800, and in the ahcix86.inf file there will be only those modules will be in the supported list. So I have to manually add a line.
Note that the red line is newly added. Which is stand for SB6XX. You must use the correct identification code of your SB chipset. The Specific code of your SB chip (Vendor Code and Device Code and CC Code), you can turn SATA Mode to AHCI and load a Live-Linux and use command /sbin/lspci to observe and turn SATA mode back to IDE to enter Windows XP. Please change the file with caution, and you will take the risk for your own. The solution posted here is provided at an "AS IS" basis.
After you copied the above three files to correct folder. You still need to manually change your Register Table. Create a text file like this:
Note that you need to ensure that you use the correct vendor number device number and CC number. Save it as a reg file, and double-click to add those lines to Register Table. This works as described below: when Windows XP boots, it found a PCI device which is identified as VEN_1002&DEV_4380&CC_0106 and according to the register table the OS will start a service called ahcix86 and the file of which is located in "system32\\drivers\\ahcix86.sys", and the OS will them recognized the SATA HDD in AHCI Mode.
Reboot your computer and enter BIOS, change SATA Mode to AHCI, and save and start your computer. If you have done it correctly you will not run into Blue Screen, and boot into Windows Xp successfully. System pop up a bubble indecating system has just found a new PCI device and will install the driver. If the automatic installation fails and OS asks you for the driver, just type in the folder which contains the modified inf and cat files (don't use system32 folder, copy those two files to another newly created folder which contains only these two files, you can use the umcompressed x86/x64 folder when you extract the driver installer if you modified the inf there).
After driver installation Windows need another reboot. After reboot for the second time, you will see in the Device Manager, there will be a AMD SCSI/RAID Controller. That means you has successfully let your Windows Xp supports native SATA HDD in a native way. Congratulations!!
To download the driver, go to the following webpage (Chinese)
http://news.mydrivers.com/1/166/166108.htm
Motherboard: ONDA A770S (NB:AMD A770, SB: AMD SB6XX Series)
CPU: AMD Athlon X2 5000+ (Black Edition)
GPU: AMD Radeon HD3850
RAM: Kingston DDR2 800MHz 1GB×2
HDD: ST 250GB SATA 3Gb/s
Date of purchase: Dec. 2007
Problem:
This computer is definitely capable to run Microsoft Windows 7, but you know, parents would always prefer older Operating Systems (OSs) because they don't want to change themselves to get used to a new one. Therefore the computer is running Microsoft Windows XP Professional with Onboard SATA Controllder configured as Native IDE in BIOS in the compromise of compatibility.
But I noticed that SATA HDD running in IDE mode has a significantly performance drop. Therefore I was seeking solution to install AHCI driver and let Windows XP runs without reinstall the OS. This's kind of hard, because Windows XP does NOT support SATA originally, and without SATA driver it even cannot load the system and will lead to the classical blue screen which you may encountered before.
Solution:
I searched the Internet, and I found that AMD official site stop the support for any Motherboard Chipsets. Damn!! They can just offer APU/CPU/GPU drivers now. What the fxxk!!! And luckily I found AHCI driver for AMD/ATi SB700/750/800 Series for Windows XP (32 or 64bit) on Mydrivers.com. Some bloggers said that this driver will also work on SB6XX Series and I think this deserves a try.
I download the driver installer and instead double-clik and just install it, I uncompressed it directly, because officially it does NOT support SB6XX. There after uncompression, enter a folder called RAID7XX, and enter the correct architecture folder (x86 or x64), then you'll find three files. Here I'll take x86 as example. That is
ahcix86.sysWell, ahcix86.sys is the module that Windows XP will load while booting, ahcix86.inf and ahcix86.cat will be the driver for installation. To begin copy ahcix86.sys to
ahcix86.inf
ahcix86.cat
%SystemDrive%\Windows\system32\driversand copy ahcix86.inf ahcix86.cat two files to a hidden folder
%SystemDrive%\Windows\inf
Wait!! I almost forgot you have to modify the ahcix86.inf file before copying it.
Officially, this driver will only support AMD SB700/750/800, and in the ahcix86.inf file there will be only those modules will be in the supported list. So I have to manually add a line.
[ATI]
%NapaDesc%=Napa_Inst,PCI\VEN_1002&DEV_4392&CC_0104
%NapaDesc%=Napa_Inst,PCI\VEN_1002&DEV_4391&CC_0106
%NapaDesc%=Napa_Inst,PCI\VEN_1002&DEV_4393&CC_0104
%NapaDesc%=Napa_Inst,PCI\VEN_1002&DEV_4380&CC_0106
Note that the red line is newly added. Which is stand for SB6XX. You must use the correct identification code of your SB chipset. The Specific code of your SB chip (Vendor Code and Device Code and CC Code), you can turn SATA Mode to AHCI and load a Live-Linux and use command /sbin/lspci to observe and turn SATA mode back to IDE to enter Windows XP. Please change the file with caution, and you will take the risk for your own. The solution posted here is provided at an "AS IS" basis.
After you copied the above three files to correct folder. You still need to manually change your Register Table. Create a text file like this:
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CriticalDeviceDatabase\PCI#VEN_1002&DEV_4380&CC_0106]
"Service"="ahcix86"
"ClassGUID"="{4D36E96A-E325-11CE-BFC1-08002BE10318}"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\ahcix86]
"Type"=dword:00000001
"Start"=dword:00000000
"Group"="SCSI miniport"
"ErrorControl"=dword:00000001
"ImagePath"="system32\\drivers\\ahcix86.sys"
"tag"=dword:00000019
"DisplayName"="ATI AMD AHCI Controller"
Note that you need to ensure that you use the correct vendor number device number and CC number. Save it as a reg file, and double-click to add those lines to Register Table. This works as described below: when Windows XP boots, it found a PCI device which is identified as VEN_1002&DEV_4380&CC_0106 and according to the register table the OS will start a service called ahcix86 and the file of which is located in "system32\\drivers\\ahcix86.sys", and the OS will them recognized the SATA HDD in AHCI Mode.
Reboot your computer and enter BIOS, change SATA Mode to AHCI, and save and start your computer. If you have done it correctly you will not run into Blue Screen, and boot into Windows Xp successfully. System pop up a bubble indecating system has just found a new PCI device and will install the driver. If the automatic installation fails and OS asks you for the driver, just type in the folder which contains the modified inf and cat files (don't use system32 folder, copy those two files to another newly created folder which contains only these two files, you can use the umcompressed x86/x64 folder when you extract the driver installer if you modified the inf there).
After driver installation Windows need another reboot. After reboot for the second time, you will see in the Device Manager, there will be a AMD SCSI/RAID Controller. That means you has successfully let your Windows Xp supports native SATA HDD in a native way. Congratulations!!
To download the driver, go to the following webpage (Chinese)
http://news.mydrivers.com/1/166/166108.htm
2012年12月9日星期日
有关多系统应用的引导构建与修复(涉及GRUB,NTLDR,BOOTMGR以及SBM)
本文的目的是以我的电脑为案例,简要的说明一下系统启动过程,并介绍几个启动工具。
本文的预期阅读对象是:多系统用户(涉及多重引导)、老旧电脑用户(BIOS不支持优盘或者光驱启动)
开机原理:
1、开机电脑从BIOS开始,进行硬件扫描,如果没有问题,将默认使用BIOS中定义的第一引导设备(一般为第一块硬盘)引导系统。
2、对于每一个引导媒介,其引导信息位于其存储空间的第一个Block,即前512字节。
3、在安装操作系统时,为了兼容可能发生的多系统并存,操作系统通常会将引导信息同时写在引导设备的前512字节和系统分区的前512字节。
4、因此MBR通常指向最后一个安装的操作系统所在的分区,并引导电脑加载该分区的Bootloader。
5、Bootloader可以引导电脑加载操作系统核心并启动操作系统,或者将引导任务转交给其他的Bootloader。
*6、另外MBR的最后64字节与引导无关,是磁盘的分区表。
我的电脑本来是三个系统,Windows XP, Windows 7以及Ubuntu。
最先安装的WinXP到/dev/sda1,然后MBR就指向/dev/sda1,而/dev/sda1的前512字节内容则指导电脑加载NTLDR也就是Windows XP的Bootloader。
然后安装的Win7到/dev/sda2,MBR仍然指向/dev/sda1,而/dev/sda1的前512字节的功能变成了指导电脑加载BOOTMGR也就是Windows 7的Bootloader。
最后安装的Ubuntu到/dev/sda5,MBR指向/dev/sda5,而/dev/sda5的前512字节的内容指导电脑加载GRUB 2也就是Ubuntu的Bootloader。
另外/dev/sda3被作为数据盘用来交换数据,没有安装任何操作系统。
另外/dev/sda4是扩展分区,内建两个逻辑分区/dev/sda5和/dev/sda6,作为Linux系统的根分区和swap分区。
三个系统和平的共存着,直到今天。
今天我突然意识到,我的WinXP,当初作为万一有Win7不兼容的程序的后备系统,在最近一年之中根本没有用到。
而在可预期的未来也不会再用Windows XP这样老的操作系统了,因此我准备把Windows XP完全卸载掉,腾出一个分区用。
然而我意识到,/dev/sda1作为硬盘的第一个分区,格式化第一个分区可能导致MBR改变从而开机无法进入GRUB,进而无法进入任何一个系统。
即使格式化第一个分区没有影响到MBR中的引导信息,除了Windows XP之外,Windows 7的引导文件也在/dev/sda1上(先安装WinXP再安装Win7一般就会这样),所以假设GRUB可以正常启动,可以正常引导Linux系统,却无法进入Win7,因为承载BOOTMGR的分区被我格式化了。
因此我必须保证以下几点:
1、将Win 7的核心引导文件BOOTMGR以及BOOT目录迁移到/dev/sda2
2、保证GRUB在/dev/sda1格式化后可以正常加载
3、修改系统的Bootloader从而让Ubuntu和Win7能够和平共存并且具有鲁棒性,方便以后安装系统。
所以以下是操作步骤:
1、启动到Win7,把/dev/sda1根目录中的bootmgr以及Boot文件夹复制到/dev/sda2也就是Win7系统的根目录。
2、启动到Ubuntu,将/dev/sda1格式化,将/dev/sda1去掉boot标志,将/dev/sda2加上boot标志位。
3、不要关机,趁现在还在Linux下,重新安装Grub到/dev/sda,方法是
以上两行命令的作用分别是:
安装Grub引导管理器,并向MBR写入引导信息
更新Grub操作系统选单。
4、准备一张Windows7系统盘,放进光驱,重启计算机,选择从光盘启动。进入Windows7安装向导,选择修复计算机。
5、取消安装向导可能提示你进行的自动修复,进入命令提示符进行手动修复,执行以下命令:
以上三行命令的作用分别是:
扫描磁盘寻找已安装的Windows系统,
将引导信息写入系统分区的前512字节(而非MBR),
重新构建系统选单,防止BOOTMGR找不到Windows系统。
注意到我并没有使用bootrec /fixmbr命令,因为如果那样的话Grub写入MBR的引导信息会被覆盖。
6、关闭命令提示符,重启计算机并取出光盘,从硬盘启动电脑。
现在你的电脑开机,读取MBR会引导计算机从/dev/sda5启动,并加载位于/dev/sda5的GRUB也就是Ubuntu使用的Bootloader,
然后你可以选择启动Linux系统或者将引导任务转交给/dev/sda2,并加载位于/dev/sda2的BOOTMGR也就是Windows7使用的Bootloader。
那么,目前存在一个小小的缺憾是:
GRUB Bootloader可以将引导任务转交给BOOTMGR,然而BOOTMGR却不能将引导任务交还给GRUB。
所以进阶教程主要研究如何尽量在不更改主硬盘MBR的前提下让Bootloader可以互相转交引导任务,以及介绍更多引导工具。
我选择的是GRUB4DOS,因为他太简单了!完全无需更改MBR。
操作步骤:
1:下载Grub4dos,从中解压缩出来三个文件,grldr,grldr.mbr,以及menu.lst,并将它们放进Windows系统根目录。
严格来说,menu.lst是需要修改一下以适应不同的电脑,不过其初始menu.lst已经写的很不错了,可以寻找并加载磁盘上的Windows系统或者使用Grub Legacy的任何Linux系统,但默认不支持引导使用Grub 2的Linux系统。所以如果你是新手你可以不管menu.lst,老手的话可以自行修改。
2(对Win7用户):
Win7系统其实已经不再使用boot.ini文件了,不过仍然兼容它,所以在Win7系统根目录建立一个boot.ini文件,并写入如下内容
保存退出。
2(对WinXP用户或Win7/XP并存用户):
你的WinXP系统根目录下应该已经存在boot.ini文件,如果没找到,请开启系统文件、隐藏文件的显示。
更改boot.ini的属性,取消勾选只读属性,打开该文件,先将timeout的值修改为0以上的数字,例如5。然后再文件最后追加一行:
保存后不要忘记更改boot.ini的属性,重新勾选其只读属性。
3:重新启动计算机,你可以看到在Windows系统的引导界面,多出了一个叫做START GRUB4DOS的操作系统,选择他就可以进入GRUB4DOS引导了。
GRUB4DOS默认可以寻找并启动电脑上的Windows系统,寻找并启动电脑上使用Grub Legacy的Linux系统,或者选择从软盘启动。
我对Grub4dos的配置文件进行了小小的修改,让他可以从第一块硬盘启动,这样我又可以回到GRUB 2引导管理器了。
只需在menu.lst中新增下面几行:
到这里其实已经很完善了,你的电脑的多个Bootloader将可以互相转交引导任务,对大多数人其实已经完美了。然而……
接下来所要讲的是老旧电脑的支持。
有些同学家里可能有2000年左右的电脑,他们往往已经支持USB设备了,但其BIOS不支持USB启动,除硬盘外,仅支持软盘或光盘启动。
或者还有更老的电脑,除硬盘外,他们仅仅支持软盘引导启动,连光盘都不支持。
可是你又希望能够给这样的电脑安装一个像样的操作系统,不是吗?
于是这时候就需要祭出引导大杀器了,这是国人写的不到30K的软件哦:Smart Boot Manager,简称SBM。
你可以去其官网下载,或者最新版的Ubuntu 12.04系统盘中的install文件夹中就有sbm.bin。
SBM最牛X的特点在于:
1、大小不足30KB,可以轻松的放进一张软盘
2、可以选择从你能想到的各种设备引导计算机开机
3、可以将引导任务转交给多种设备。例如转交给优盘启动,即使你的电脑BIOS本来不支持从优盘启动
不过这里声明SBM本身并不是Bootloader,他更像一个加强版的BIOS,可以让你选择更多的引导启动设备而不受BIOS的限制。
在这里介绍SBM的两种用法:
1、用dd直接烧到软盘里用
2、用Grub的映射功能,将硬盘上的sbm.bin软盘镜像映射成软盘,然后启动SBM
两种办法都很简单,不过第一个要求你必须有真的软盘。
第二个的话Grub4dos默认的系统选单就有,只要你把sbm.bin与grldr放在同一个目录下就可以。
这下你可以强制BIOS中不支持光盘启动或者优盘启动的计算机,从光盘或者优盘引导启动了。
(但前提是你的系统还是支持光盘或者软盘设备的,就是说你在操作系统中无需安装额外的驱动就可以使用)
最终,我的电脑里的几个Bootloader加上SBM的关系是这样的(为了简单起见,因为MBR直接指向/dev/sda5所以没有画出来):
全文完。
哈哈说了这么多,我终于可以在那个老旧、光驱已经坏了的Thinkpad R30上安装一个像样的操作系统了!
注:Thinkpad R30支持内建光驱、内建硬盘启动,以及USB-FDD启动,不支持USB-HDD启动,因此无法用常规的方法优盘安装系统。
注:其实以我家的网速,我是准备直接从互联网给Thinkpad R30安装Debian的,使用SBM其实是PLAN B。
本文的预期阅读对象是:多系统用户(涉及多重引导)、老旧电脑用户(BIOS不支持优盘或者光驱启动)
开机原理:
1、开机电脑从BIOS开始,进行硬件扫描,如果没有问题,将默认使用BIOS中定义的第一引导设备(一般为第一块硬盘)引导系统。
2、对于每一个引导媒介,其引导信息位于其存储空间的第一个Block,即前512字节。
3、在安装操作系统时,为了兼容可能发生的多系统并存,操作系统通常会将引导信息同时写在引导设备的前512字节和系统分区的前512字节。
4、因此MBR通常指向最后一个安装的操作系统所在的分区,并引导电脑加载该分区的Bootloader。
5、Bootloader可以引导电脑加载操作系统核心并启动操作系统,或者将引导任务转交给其他的Bootloader。
*6、另外MBR的最后64字节与引导无关,是磁盘的分区表。
我的电脑本来是三个系统,Windows XP, Windows 7以及Ubuntu。
最先安装的WinXP到/dev/sda1,然后MBR就指向/dev/sda1,而/dev/sda1的前512字节内容则指导电脑加载NTLDR也就是Windows XP的Bootloader。
然后安装的Win7到/dev/sda2,MBR仍然指向/dev/sda1,而/dev/sda1的前512字节的功能变成了指导电脑加载BOOTMGR也就是Windows 7的Bootloader。
最后安装的Ubuntu到/dev/sda5,MBR指向/dev/sda5,而/dev/sda5的前512字节的内容指导电脑加载GRUB 2也就是Ubuntu的Bootloader。
另外/dev/sda3被作为数据盘用来交换数据,没有安装任何操作系统。
另外/dev/sda4是扩展分区,内建两个逻辑分区/dev/sda5和/dev/sda6,作为Linux系统的根分区和swap分区。
三个系统和平的共存着,直到今天。
今天我突然意识到,我的WinXP,当初作为万一有Win7不兼容的程序的后备系统,在最近一年之中根本没有用到。
而在可预期的未来也不会再用Windows XP这样老的操作系统了,因此我准备把Windows XP完全卸载掉,腾出一个分区用。
然而我意识到,/dev/sda1作为硬盘的第一个分区,格式化第一个分区可能导致MBR改变从而开机无法进入GRUB,进而无法进入任何一个系统。
即使格式化第一个分区没有影响到MBR中的引导信息,除了Windows XP之外,Windows 7的引导文件也在/dev/sda1上(先安装WinXP再安装Win7一般就会这样),所以假设GRUB可以正常启动,可以正常引导Linux系统,却无法进入Win7,因为承载BOOTMGR的分区被我格式化了。
因此我必须保证以下几点:
1、将Win 7的核心引导文件BOOTMGR以及BOOT目录迁移到/dev/sda2
2、保证GRUB在/dev/sda1格式化后可以正常加载
3、修改系统的Bootloader从而让Ubuntu和Win7能够和平共存并且具有鲁棒性,方便以后安装系统。
所以以下是操作步骤:
1、启动到Win7,把/dev/sda1根目录中的bootmgr以及Boot文件夹复制到/dev/sda2也就是Win7系统的根目录。
2、启动到Ubuntu,将/dev/sda1格式化,将/dev/sda1去掉boot标志,将/dev/sda2加上boot标志位。
3、不要关机,趁现在还在Linux下,重新安装Grub到/dev/sda,方法是
|
以上两行命令的作用分别是:
安装Grub引导管理器,并向MBR写入引导信息
更新Grub操作系统选单。
4、准备一张Windows7系统盘,放进光驱,重启计算机,选择从光盘启动。进入Windows7安装向导,选择修复计算机。
5、取消安装向导可能提示你进行的自动修复,进入命令提示符进行手动修复,执行以下命令:
|
以上三行命令的作用分别是:
扫描磁盘寻找已安装的Windows系统,
将引导信息写入系统分区的前512字节(而非MBR),
重新构建系统选单,防止BOOTMGR找不到Windows系统。
注意到我并没有使用bootrec /fixmbr命令,因为如果那样的话Grub写入MBR的引导信息会被覆盖。
6、关闭命令提示符,重启计算机并取出光盘,从硬盘启动电脑。
现在你的电脑开机,读取MBR会引导计算机从/dev/sda5启动,并加载位于/dev/sda5的GRUB也就是Ubuntu使用的Bootloader,
然后你可以选择启动Linux系统或者将引导任务转交给/dev/sda2,并加载位于/dev/sda2的BOOTMGR也就是Windows7使用的Bootloader。
那么,目前存在一个小小的缺憾是:
GRUB Bootloader可以将引导任务转交给BOOTMGR,然而BOOTMGR却不能将引导任务交还给GRUB。
所以进阶教程主要研究如何尽量在不更改主硬盘MBR的前提下让Bootloader可以互相转交引导任务,以及介绍更多引导工具。
我选择的是GRUB4DOS,因为他太简单了!完全无需更改MBR。
操作步骤:
1:下载Grub4dos,从中解压缩出来三个文件,grldr,grldr.mbr,以及menu.lst,并将它们放进Windows系统根目录。
严格来说,menu.lst是需要修改一下以适应不同的电脑,不过其初始menu.lst已经写的很不错了,可以寻找并加载磁盘上的Windows系统或者使用Grub Legacy的任何Linux系统,但默认不支持引导使用Grub 2的Linux系统。所以如果你是新手你可以不管menu.lst,老手的话可以自行修改。
2(对Win7用户):
Win7系统其实已经不再使用boot.ini文件了,不过仍然兼容它,所以在Win7系统根目录建立一个boot.ini文件,并写入如下内容
|
保存退出。
2(对WinXP用户或Win7/XP并存用户):
你的WinXP系统根目录下应该已经存在boot.ini文件,如果没找到,请开启系统文件、隐藏文件的显示。
更改boot.ini的属性,取消勾选只读属性,打开该文件,先将timeout的值修改为0以上的数字,例如5。然后再文件最后追加一行:
|
3:重新启动计算机,你可以看到在Windows系统的引导界面,多出了一个叫做START GRUB4DOS的操作系统,选择他就可以进入GRUB4DOS引导了。
GRUB4DOS默认可以寻找并启动电脑上的Windows系统,寻找并启动电脑上使用Grub Legacy的Linux系统,或者选择从软盘启动。
我对Grub4dos的配置文件进行了小小的修改,让他可以从第一块硬盘启动,这样我又可以回到GRUB 2引导管理器了。
只需在menu.lst中新增下面几行:
|
到这里其实已经很完善了,你的电脑的多个Bootloader将可以互相转交引导任务,对大多数人其实已经完美了。然而……
接下来所要讲的是老旧电脑的支持。
有些同学家里可能有2000年左右的电脑,他们往往已经支持USB设备了,但其BIOS不支持USB启动,除硬盘外,仅支持软盘或光盘启动。
或者还有更老的电脑,除硬盘外,他们仅仅支持软盘引导启动,连光盘都不支持。
可是你又希望能够给这样的电脑安装一个像样的操作系统,不是吗?
于是这时候就需要祭出引导大杀器了,这是国人写的不到30K的软件哦:Smart Boot Manager,简称SBM。
你可以去其官网下载,或者最新版的Ubuntu 12.04系统盘中的install文件夹中就有sbm.bin。
SBM最牛X的特点在于:
1、大小不足30KB,可以轻松的放进一张软盘
2、可以选择从你能想到的各种设备引导计算机开机
3、可以将引导任务转交给多种设备。例如转交给优盘启动,即使你的电脑BIOS本来不支持从优盘启动
不过这里声明SBM本身并不是Bootloader,他更像一个加强版的BIOS,可以让你选择更多的引导启动设备而不受BIOS的限制。
在这里介绍SBM的两种用法:
1、用dd直接烧到软盘里用
2、用Grub的映射功能,将硬盘上的sbm.bin软盘镜像映射成软盘,然后启动SBM
两种办法都很简单,不过第一个要求你必须有真的软盘。
第二个的话Grub4dos默认的系统选单就有,只要你把sbm.bin与grldr放在同一个目录下就可以。
这下你可以强制BIOS中不支持光盘启动或者优盘启动的计算机,从光盘或者优盘引导启动了。
(但前提是你的系统还是支持光盘或者软盘设备的,就是说你在操作系统中无需安装额外的驱动就可以使用)
最终,我的电脑里的几个Bootloader加上SBM的关系是这样的(为了简单起见,因为MBR直接指向/dev/sda5所以没有画出来):
全文完。
哈哈说了这么多,我终于可以在那个老旧、光驱已经坏了的Thinkpad R30上安装一个像样的操作系统了!
注:Thinkpad R30支持内建光驱、内建硬盘启动,以及USB-FDD启动,不支持USB-HDD启动,因此无法用常规的方法优盘安装系统。
注:其实以我家的网速,我是准备直接从互联网给Thinkpad R30安装Debian的,使用SBM其实是PLAN B。
订阅:
博文 (Atom)














