Saturday, January 31, 2015

Be aware of new Facebook hijacking link

If you see that you are tagged in a post, don't click on it.
For now, facebook no longer has the option to prevent people from tagging you. So the only thing you can do is Enable reviewing tags on Timeline, though you are still tagged and delivered to the news feed of your friends. So an easy way to deal with this is simply unfriend the hijacked accounts, or, deactivate your own facebook account before the flu is over.

Sunday, January 25, 2015

[solved]How to let python detect the line break / endline when reading lines in files

Simple. Use splitlines()
L = open("myFile.txt", "r").read().splitlines();
for line in L: 
    process(line) # this 'line' will not have '\n' character at the end
shareedit

Thursday, January 22, 2015

[Solved已解決] 美國領事館網上簽證申請問題(香港、澳門)

Passport book number?
就是護照末頁側邊的小數字

Telecode representing your name?
中文的telecode碼可以在這裡查到http://apps.chasedream.com/chinese-commercial-code/
查到后請用另外的網上資源核對一下


已經繳納了申請費1000多元,但是系統仍然卡在繳費那一步驟?

在7-11繳費后,等待一天,會收到郵件通知激活,然後登陸網站。
由於網站設計瑕疵,會自動彈出選擇繳費地址香港或澳門。 在此步驟請不要點擊地址!!!! 而是關掉這個彈窗。接下來你會看到系統說明費用已交。 如果點擊了香港/澳門的按鈕,則會卡住。


Tuesday, January 20, 2015

[solved]Resource u'tokenizers/punkt/english.pickle' not found. Please use the NLTK Downloader to obtain the resource: >>> nltk.download()


I had this same problem. Go into a python shell and type:
>>> import nltk
>>> nltk.download()
Then an installation window appears. Go to the 'Models' tab and select 'punkt' from under the 'Identifier' column. Then click Download and it will install the necessary files. Then it should work!

[solved] No module error in python when trying to import nltk package

Try changing the PYTHONPATHenvironment variable. If you are using BASH the below should work. Other Linux shells will be slightly different in how they assign environment variables.
export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages

[Solved]The certificate of ‘bootstrap.pypa.io’ is not trusted when installing pip

You can install it through Homebrew on OS X.
Homebrew is something of a package manager for OS X, more details here:http://mxcl.github.io/homebrew/
If you have Homebrew installed, pip installs with python:
brew install python
Note that this will also install an updated python, default is currently 2.7.5 while brew's python is 2.7.6.

Friday, January 16, 2015

Fake photos of conjoined twins on Chinese website.

Multiples photos of conjoined twins have appeared as a popular post on a website associated with Sohu

The address is here: http://www.qiqu888.com/html/hqsy/yxgw/2015/0106/6185_12.html



undefined


However, this photo is not about conjoined twins, but rather, a failure in using panorama + Photoshop.

The explanation is here: http://www.collegehumor.com/post/6973599/20-panorama-fails-that-may-melt-your-brain


Apparently that Chinese website http://www.qiqu888.com/ is not a responsible one, but in order to survive the era when people like fast short and shocking news whether fake or not, they have to entertain you, sometimes with a "white lie".


(For more entertaining politically biased news, check hk.apple.nextmedia.com  )
(For more non-entertaining politically biased news, check http://www.cntv.cn/)


Monday, January 12, 2015

How to use Caltech VPN (to read journal off campus, or to use facebook in China)

The instructions are here:
https://www.imss.caltech.edu/help/vpn

But to put it short, if you are a Mac user, go to vpn.caltech.edu and install the software specified.
Run the Cisco software you installed(I use the second tunnel, all traffic) and, most importantly, Restart your wifi and Browser.
Then you will be connected to the real world.

Tuesday, January 6, 2015

What is Kernel_task doing on your Mac

"Ultimately there is not much you can do to affect how kernel_task runs" 

reference:
http://www.cnet.com/news/kerneltask-taking-up-ram-in-os-x/


Kernel_task taking up RAM in OS X

In OS X you may find the process "kernel_task" taking up a large amount of RAM. Here is why this is happening and what you can do about it.
If you launch the Activity Monitor utility on your Mac, you will be able to see what processes are running and what system resources they are using. As expected, some processes will take up more RAM and CPU time than others. Seeing this in Activity Monitor can be handy for figuring out which tasks are taking up an unexpected amount of CPU or RAM. One regular culprit for using a lot of RAM is Safari, but in addition you will see another process called "kernel_task" that also will regularly use a few hundred megabytes of real RAM and seem to increase its RAM footprint with system usage.
The kernel in OS X is the software architecture that is responsible for handling resources that processes and programs need. These include the management of multitasking scheduling, virtual memory, system input and output, and various communication routines between processes. In addition, the kernel can be modified and given enhanced functionality by loading kernel extensions (kexts) to supply system-level management of features like Bluetooth and Wi-Fi, graphics processors, third-party hardware, access to peripheral devices, and special filesystem support. In essence, the kernel is responsible for running your hardware and making the hardware resources available to applications and system services.
Activity Monitor
Beside Safari and some other applications, the process "kernel_task" may take up a large amount of system memory (click for larger view).
When the system starts up, even though you may have kernel extensions loaded, not all of the services are active. The system may be ready to use them, but will not load them fully until needed. Therefore, if you initially start up your system and check Activity Monitor, you may see the kernel_task process taking up a relatively small amount of RAM. When you then start using your system and activating features like your iSight camera, Wi-Fi services, switching GPUs, and using external devices, then the kernel_task will make use of the resources for these devices and will grow in size.
For instance, on my MacBook Pro running OS X 10.7 Lion, an initial boot will show the kernel_task process taking up 330-340MB of RAM. The task will idle with this level of RAM until you decide to do something with your system, so if I open a few applications (Word, Pages, iCal, Safari, Preview, etc.) then the amount of RAM used by the kernel_task increases to around 370MB. At this point the system has loaded and interacted with some services these programs need (networking, authentication, firewall, graphics, and user input), so the kernel_task has increased its RAM footprint to accommodate those tasks being active. If the programs are quit, the kernel_task does not relinquish the new RAM it's using, since the system services are still active even though the programs themselves are not. On subsequent launches of these programs; however, the RAM footprint does not increase any further.
As with running applications, general use of the system will also increase kernel_task RAM usage. For instance, enabling Bluetooth and Wi-Fi will bump it up about 3-4MB, browsing the filesystem will boost it around 25-30MB, and enabling the onboard GPU (which uses system memory for video RAM) will initially give around a 20-25MB increase in RAM usage, but this will rise further as you perform tasks like playing 3D games, or watch large movie files when using this GPU.
While some of the kernel_task services will not unload when you quit the processes that have started them, others will, especially if they are managing hardware in the system. For instance, on systems with multiple GPUs, if you use the onboard GPU, then you will see an increase in RAM usage by the kernel_task, but unlike some applications services, if you switch graphics processing back to the dedicated GPU, then the kernel_task will relinquish the RAM it was using for video memory. Likewise, if you have activated your iSight camera with a program like Photo Booth, then the kernel_task will use another 8-10MB of RAM, which will be relinquished when Photo Booth is shut down.
Ultimately there is not much you can do to affect how kernel_task runs and manages the system. If you see the kernel_task process taking up a large amount of RAM on your system, there are a few options to reduce the RAM other than restarting your system. The first is to disable any hardware devices you may have attached to your system, such as external monitors, hard drives, or third-party audio or video interfaces. In addition, you can disable services like Wi-Fi and Bluetooth if you are not using them, and switch to using discrete graphics instead of the onboard GPU. The second thing you can do is quit programs and system services that use kernel extensions, such as the aforementioned Photo Booth, or graphics processing programs and games, especially if you are running with the integrated graphics card.

How to play .flv videos on a Macbook?

Perian component didn't work, sometimes.
What works is Niceplayer,  http://code.google.com/p/niceplayer/    , though a little bit slow

Prevent your Mac terminal from Sleeping

Portable Macs by default are set up so that they will sleep whenever you close the lid, unless they are plugged into an external monitor, keyboard, and mouse. But, sometimes you want your Mac to be doing work while the lid is closed when you are not in this situation. With a simple Terminal command, you can easily make your Mac stay awake so that apps will remain running while you carry your MacBook around.

Caffeinate Your Mac

To begin running the caffeinate command and prevent your Mac from sleeping, open the Terminal located in /Applications/Utilities, then type the following command:
caffeinate
While this command is running, you will be able to close the lid on your Mac and still have OS X and your apps running and performing their tasks just as you would if the lid were to remain open.

Caffeinate Your Mac for a specified length of time

What if you only wish to caffeinate your Mac for a specific number of seconds? The caffeinated command can do your bidding here, as well:
caffeinate -u -t 600
With the command above, replace "600" with the number of seconds that you wish the caffeinated command to run. Running this command as-is will cause your Mac to prevent sleeping for 10 minutes (600 seconds).

Once starting this command, your Mac will be prevented from sleeping for the set amount of time, and will automatically terminate the caffeinate program afterwards, which will cause your Mac to go to sleep soon thereafter.

Cancel the Caffeine

To make the caffeinate command stop running and return your Mac to normal using either of the methods above, simply return to the command line and press the Control + C keyboard combination.

A Warning

You shouldn't keep your Mac running with the lid closed and place it inside of a bag. Doing so will cause heat to build up and could cause damage to your MacBook.

Cory Bohon is a freelance technology writer, indie Mac and iOS developer, and amateur photographer. Follow this article's author on Twitter.

Sunday, January 4, 2015

How to allow google chrome to unblock popup windows

  1. In the top-right corner of the browser window, click the Chrome menu Chrome menu.
  2. Select Settings.
  3. Click Show advanced settings.
  4. Under "Privacy," click the Content settings button.
  5. Under "Pop-ups," select Allow all sites to show pop-ups.