手机浏览 RSS 2.0 订阅 膘叔的简单人生 , 腾讯云RDS购买 | 超便宜的Vultr , 注册 | 登陆
浏览模式: 标准 | 列表Tag:dbanotes

删除多行注释的正则

一个小正则,可以删除 多行注释:/\*[\S\s]+?(?=\*/)\*/

很简单,就这么一个正则,自己做一个备份。

Tags: 正则

HTML5 <wbr> Tag

一直不是做前端的料,所以看到wbr标签的时候,下意识的以为这个标签是br标签的代名词,所以想当然的认为这种标签是无效的。或者是其他人伪造的标签。
直到有一天google的时候才发现,原来wbr的意思居然是word-break的意思。即,主动将单词用wbr格开,这样,如果遇到一些超长单词的时候将单词切断。
The <wbr> tag is very useful but unfortunately too little known. I use it liberally in the great compatibility tables on my site.
比如这样的例子:

XML/HTML代码
  1. <div class="name">getElements<wbr>ByTagName()</div>  

当这个div宽度过小的时候,它就会按照getElements先断行,然后再显示ByTagName,这样的方式更易于浏览。

先记录一下

参考资料:

1、http://www.w3schools.com/html5/tag_wbr.asp

2、http://www.quirksmode.org/oddsandends/wbr.html#t01

Tags: wbr

转:Tiger: Disabling Spotlight

嗯,到现在为止,我也没有办法搜索我的电脑、mail、甚至 spotlight,真是纠结。
于是这篇disabing spotlight就成了我搜索中的目标。我想,既然能够disable spotlight,那肯定能够enable吧?
所以,上原文吧:http://www.theconsultant.net/2005/06/tiger-disabling-spotlight/

Spotlight introduces a fairely large performance hit on to the system, especially if the files you are working with are both large and have the Spotlight plugin, and thus can be indexed. Performance hit might be less noticable on the desktop system with fast drives, however on my laptop with 4200 rpm drive, and constantly dealing with megabytes of source code and compilations spotlight introduced less of a benefit and more of a hindrance.

So, without further ado, in order to disable spotlight, one has to edit /private/etc/hostconfig, find the line that reads SPOTLIGHT=-YES-, change it to SPOTLIGHT=-NO-, and rebooot.

This will prevent MetaData Service, / System / Library / Frameworks / CoreServices.framework / Versions / A / Frameworks / Metadata.framework / Versions / A / Support / mds from starting on boot time.

Note that this will not disable file change notifications in the kernel, as can be checked using Amit Singh’s fslogger. On the same page there is some more in depth information on the kernel notification service that Spotlight (and fslogger) subscribe to.

A perty GUI called Spotless was written by someone, but I am not sure I’d trust a GUI to parse and edit a text file.

If you want to get rid of the looking glass icon in the top right hand corner as well, you might want to either remove (perferably just move out of place) or chmod -R 0000 /System/Library/CoreServices/Search.bundle (Key file. Actual parts of Spotlight are: /Library/Spotlight /System/Library/Spotlight /System/Library/CoreServices/Search.bundle /System/Library/PreferencePanes/Spotlight.prefPane /System/Library/Services/Spotlight.service /System/Library/Contextual Menu Items/SpotlightCM.plugin /System/Library/StartupItems/Metadata plus /usr/bin/md*, although I’d argue that metadata tools in /usr/bin/md* are actually useful.)
Changing permissions means that if at some point you want to undo the changes, you can always repair permissions. In any case, little looking glass in the corner doesn’t bother me much.

Technically one can probably selectively start and stop Spotlight by killing or startng mds and mdimport, however a way Apple recommends is using mdutil -i off / to turn off indexing of the boot volume (ie existing databases would be preserved and accessible through spotlight).

If you ever want to blow away your Spotlight database, and force reindexing (assuming mds/mdimport run), you can do mdutil -i off /, mdutil -E / , mdutil -i on /

Note: Apprently killing spotlight interferes with find in Finder and in Mail.app. As I never use either (locate or find . -name “*foo*” -print on the command line is much more powerful, plus gives me an -exec stuff {} \; option), it doesn’t bother me, however ocdinsomniac has some nice additional information and a script that purports reverting Finder’s find to the Panther style behavior.

Tags: spotlight