BMTD 's Yard of Fun

Technology, Sports, Music, Chinese Essays

Browsing Posts in Internet and Web

In my last blog post (http://www.smartpeer.net/2013/10/closeable-kiosk-with-firefox-user-styles/) I used user styles to create a “closeable kiosk” with firefox. Google chrome also supports user styles so similar styles can be applied to Chrome too.

Both firefox and Chrome support another “user scripts”, which “Allows you to customize the way a web page displays or behaves, by using small bits of JavaScript.”. it can be applied to selected pages only, or to all the sites/pages. Here is a way to use user scripts to create a “closeable kiosk.”

steps for chrome:
(1) install the chrome extension “TamperMonkey” from https://chrome.google.com/webstore/detail/tampermonkey/dhdgffkkebhmkfjojejmpbldmpobfkfo?hl=en.
(2) compose a new user script with the following code:

/ ==UserScript==
// @name       closeit
// @namespace  http://www.smartpeer.net/
// @version    0.1
// @description  close buton
// @copyright  Jie Li
// ==/UserScript==

var closeButton = document.createElement( 'img' );
closeButton.id = 'myCloseButton';
closeButton.title= 'Close the Window';
closeButton.src= 'http://gbpayment.net/hangout/close.png';
GM_addStyle(
    ' #myCloseButton {            ' +
    '    position: fixed;    ' +
    '    top: 2px; right: 8px;   ' +
    '   z-index:1000;   ' +
    ' } '
);
closeButton.addEventListener( 'click', function () {
    window.open('', '_self', '');
    window.close();
    top.close();
}, true );

document.body.appendChild( closeButton );

and click on “settings” tab on the script editor, choose “yes” for “Run only in top frame”. and then enable the script.

for firefox, it’similar, just replace TamperMonkey with the firfox addon “greaseMonkey”.

now if you open the browser in kiosk mode ( fore chrome it needs to be started from command line option “–kiosk”), there is always a big round red “X” close button at the top right corner. clicking on it will close the browser. see screen shot below:

Recently I got request to create a “closeable browser-based kiosk”– basically a browser in full screen mode, can’t be minimized/resized/moved or returned to non-full screen mode, no browser file menus, no address bar/navigation bar so user have to be stay on the same page, and can’t go to other urls. However user should be able to close it using mouse. This is to be deployed on some real kiosk booths like the ones often seen in a museum. There is no keyboard on the kiosk so short cut key combinations like alt-F4 won’t work.

Browsers like Chrome or Internet Explorer already have the built-in kiosk feature. for IE it’s the -k option; for Chrome there is the –kiosk option. if you start the browser with these options you will see the browser in kiosk mode. for firefox, there is the r-kiosk addon. Problem is that there is no way to close the browser with just a mouse once you are in kiosk mode.

One simple solution is to use firefox ‘s userscripts feature to create my own closeable kiosk mode.

the steps are:

(1) from firefox menu. option “tools”–>”options”–>”privacy”–>history, for “firefox will” dripdown, choose “use custom settings for history”, then choose the option (checkbox) “clear history when forefox closes”, then click OK button.

(2) install the “stylish” firefox extension from https://addons.mozilla.org/en-US/firefox/addon/stylish/

(3) open stylish add on, click “write new style”, an editor will open. enter the following code in the editor, then save the style and enable it.

@namespace url(http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul);
@media not all and (-moz-windows-compositor){

.statuspanel-label {display:none !important;}
#nav-bar {display:none !important;}
#navigator-toolbox {display:none !important;}
#urlbar-container, #openLocation {display:none !important;}
#minimize-button,#restore-button,#close-button {display:none !important;}

#titlebar-max, #titlebar-min {display:none !important;}
}

now if you start firefox you will see a “closeable kiosk”. for example, “firefox https//accounts.google.com/” you will see the following “kiosk” with only the “X” close window icon on the title bar:

There are other ways to do this as well. For example, we can write some UserScripts in firefox or Chrome to inject some “close window” button onto al the web pages. so that user can always close the browser with mouse even in the native browser kiosk mode. Will give an example how that works later.

ASP.NET: by default app pool identity
ASP/CGI: impersonated as authenticated user
FASTCGI ( PHP fastcgi): app pool identity

in order for php fastcgi to impersonate as authenticated user like cgi, need to set the following in php.ini:

fastcgi.impersonate = 1

Looking at cheap storage for hosting backup/archive… driving force: cost.  NetApp is too expensive.

The following can be taken into consideration:

— Amazon S3 web services. Since it’s only used for backup/archive the cost should not be too high. Need to analyze the cost though. Another potential issue is legal/privacy…

     Technically the best way is probably to use a S3 file system driver so the backup/access is transparent to the apps and existing apps doesn’ t need to be modified. the following is a list of  S3 file system drivers, for example:

  •   Fuse over Amazon: http://http://code.google.com/p/s3fs/wiki/FuseOverAmazon

     Note that  the Hadoop project provides two file systems that uses S3:  http://wiki.apache.org/hadoop/AmazonS3 . However seems you have to use the hadoop to access the file systems and they are not accessible by normal apps.

— GFS-like distributed file systems, So that we can use cheap/commodity intel hardware to construct the storage cluster. Currently there are two open source GFS like DFS implementations.:

  • CloudStore ( formerly Kosmos File System / KFS): http://kosmosfs.sourceforge.net/.   quoted form the web site: “Web-scale applications require a scalable storage infrastructure to process vast amounts of data. CloudStore (formerly, Kosmos filesystem) is an open-source high performance distributed filesystem designed to meet such an infrastructure need” It’s written in C++ and can be mounted as a file system via FUSE on linux.
  • Hadoop HDFS File System:  part of the Hadoop Core project. http://hadoop.apache.org/core/docs/current/hdfs_design.html.   Hadoop is developed in Java.  There is also some effort to mount HDFS on linux/systems: http://wiki.apache.org/hadoop/MountableHDFS.

前一段时间做一个中文全文检索的东东需要一个中文的停用词表 (stopwords list), 网上搜索了半天找到了一些但都不是很满意,于是干脆自己根据词性加手工筛选,再加上英文的还有网上找到的, 合在一起作了一个新的stopwords文件。

有需要的朋友可以从这里下载:

http://www.smartpeer.net/files/stopwords-utf8.txt

注意这是utf-8编码的,下载后根据自己的需要转成gbk/big5或其他编码。