scandir
(PHP 5, PHP 7)
scandir — 列出指定路径中的文件和目录
说明
array scandir ( string $directory [, int $sorting_order [, resource $context ]]
)
返回一个 array，包含有 directory 中的文件和目录。
参数
directory
要被浏览的目录
sorting_order
默认的排序顺序是按字母升序排列。如果使用了可选参数 sorting_order（设为 1）
，则排序顺序是按字母降序排列。
context
context 参数的说明见手册中的 Streams API 一章。
返回值
成功则返回包含有文件名的 array，如果失败则返回 FALSE。如果 directory 不是个目录
，则返回布尔值 FALSE 并生成一条 E_WARNING 级的错误。
更新日志
版本 说明
5.4.0 sorting_order now accepts constants. Any nonzero value caused descending
order in previous versions.
范例
Example #1 一个简单的 scandir() 例子
以上例程的输出类似于：
Array
(
[0] => .
[1] => ..
[2] => bar.php
[3] => foo.txt
[4] => somedir
)
Array
(
[0] => somedir
[1] => foo.txt
[2] => bar.php
[3] => ..
[4] => .
)
Example #2 scandir() 在 PHP 4 中的实现
以上例程的输出类似于：
Array
(
[0] => .
[1] => ..
[2] => bar.php
[3] => foo.txt
[4] => somedir
)
Array
(
[0] => somedir
[1] => foo.txt
[2] => bar.php
[3] => ..
[4] => .
)
注释
Tip
如已启用fopen 包装器，在此函数中， URL 可作为文件名。关于如何指定文件名详见
fopen()。各种 wapper 的不同功能请参见支持的协议和封装协议，注意其用法及其可提供
的预定义变量。
参见
• opendir() - 打开目录句柄
• readdir() - 从目录句柄中读取条目
• glob() - 寻找与模式匹配的文件路径
• is_dir() - 判断给定文件名是否是一个目录
• sort() - 对数组排序
User Contributed Notes 52 notes
===============================================================================
Easy way to get rid of the dots that scandir() picks up in Linux environments:
===============================================================================
Here is my 2 cents. I wanted to create an array of my directory structure
recursively. I wanted to easely access data in a certain directory using
foreach. I came up with the following:
$value)
{
if (!in_array($value,array(".","..")))
{
if (is_dir($dir . DIRECTORY_SEPARATOR . $value))
{
$result[$value] = dirToArray($dir . DIRECTORY_SEPARATOR . $value);
}
else
{
$result[] = $value;
}
}
}
return $result;
}
?>
Output
Array
(
[subdir1] => Array
(
[0] => file1.txt
[subsubdir] => Array
(
[0] => file2.txt
[1] => file3.txt
)
)
[subdir2] => Array
(
[0] => file4.txt
}
)
===============================================================================
Back in the saddle of scandir I wrote this function for a function that I
needed to seperate directories from files. Since I am still learning from my
last example way below I would figure I would add it so it can be criticized.
$v){
if(($direct($truedir.$dir[$k])) || $dir[$k] == '.' || $dir[$k] == '..' ){
unset($dir[$k]);
}
}
$dir = array_values($dir);
return $dir;
}
?>
===============================================================================
Fastest way to get a list of files without dots.
";
die(var_dump($path_errors));}
}
// This is how we scan directories
static private function find_contents($dir){
$result = array();
$root = scandir($dir);
foreach($root as $value){
if($value === '.' || $value === '..') {continue;}
if(is_file($dir.DIRECTORY_SEPARATOR.$value)){
if(!self::$ext_filter || in_array(strtolower(pathinfo($dir.
DIRECTORY_SEPARATOR.$value, PATHINFO_EXTENSION)), self::$ext_filter)){
self::$files[] = $result[] = $dir.DIRECTORY_SEPARATOR.
$value;
}
continue;
}
if(self::$recursive){
foreach(self::find_contents($dir.DIRECTORY_SEPARATOR.$value) as
$value) {
self::$files[] = $result[] = $value;
}
}
}
// Return required for recursive search
return $result;
}
}
?>
Usage:
scanDir::scan(path(s):string|array, [file_extensions:string|array],
[subfolders?:true|false]);
===============================================================================
===============================================================================
I needed to find a way to get the full path of all files in the directory and
all subdirectories of a directory.
Here's my solution: Recursive functions!
===============================================================================
Hello all,
I just added a extension filter to the getDirectoryTree function, so it can
filter an extension for files in the folders/subfolders:
===============================================================================
How a ninja may retrieve a list of files, files filtered by extension, or
directories:
>>>>>>>>>>>>>>>>>>>>>>>>>>>> TRANSLATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<
file_list("/home"); //return list of files (no directories)
file_list("/home", ".jpg"); //return only .jpg file list
\********************************************************************/
//(note: one slash (/) below and you enable all your test functions, guess
where ;-))
/********************************************************************\
// TEST FUNCTIONS... IF THESE WORK, THIS FUNCTION WORKS ON THIS PLATFORM
echo "
File List:
";
$n = file_list(getcwd());
if($n) foreach($n as $f) echo "$f
"; //current files
echo "
Files with extension .php:
";
$n = file_list(getcwd(),".php");
if($n) foreach($n as $f) echo "$f
"; //files with .php
extensions
echo "
Directories:
";
$d = dir_list(getcwd());
if($d) foreach($d as $f) echo "$f
"; //directories
/********************************************************************/
/************\
RUNTIME NOTES:
file_list($arg1); // php issues a warning that there is no second parameter,
but we know that, izz ok
\************/
/*******************************\
TESTED AND WORKING ON 2009.04.30:
OS: Linux 2.6.9-78.0.17.ELsmp
APACHE: 2.2.9
PHP: 5.2.5
\*******************************/
?>
===============================================================================
This is a modification of scanDirectories function that generates a list of all
files in the chosen directory and all subdirectories of specific extentions
$allowext
$content) {
$path = $rootDir.'/'.$content;
$ext = substr($content, strrpos($content, '.') + 1);
if(in_array($ext, $allowext)) {
if(is_file($path) && is_readable($path)) {
$allData[] = $path;
}elseif(is_dir($path) && is_readable($path)) {
// recursive callback to open new directory
$allData = scanDirectories($path, $allData);
}
}
}
return $allData;
}
$rootDir = "www";
$allowext = array("zip","rar","html");
$files_array = scanDirectories($rootDir,$allowext);
print_r($files_array);
?>
===============================================================================
Here is my recursive function, placing directories into new array keys and its
contents within.
/* find_files( string, &array )
** Recursive function to return a multidimensional array of folders and files
** that are contained within the directory given
*/
function find_files($dir, &$dir_array)
{
// Create array of current directory
$files = scandir($dir);
if(is_array($files))
{
foreach($files as $val)
{
// Skip home and previous listings
if($val == '.' || $val == '..')
continue;
// If directory then dive deeper, else add file to directory key
if(is_dir($dir.'/'.$val))
{
// Add value to current array, dir or file
$dir_array[$dir][] = $val;
find_files($dir.'/'.$val, $dir_array);
}
else
{
$dir_array[$dir][] = $val;
}
}
}
ksort($dir_array);
}
// Example
$folder_list = array();
find_files('/path', $folder_list)
var_dump($folder_list);
array(3) {
["directory_01"]=>
array(4) {
[0]=>
string(12) "directory_02"
[1]=>
string(12) "directory_03"
[2]=>
string(11) "file_01.txt"
[3]=>
string(11) "file_02.txt"
}
["directory_01/directory_02"]=>
array(2) {
[0]=>
string(11) "file_03.txt"
[1]=>
string(11) "file_04.txt"
}
["directory_01/directory_03"]=>
array(2) {
[0]=>
string(11) "file_05.txt"
[1]=>
string(11) "file_06.txt"
}
}
===============================================================================
This is a simple and versatile function that returns an array tree of files,
matching wildcards:
===============================================================================
Just was curious to count files and lines in a project
false,
'files_count' => false, 'lines_count' => false ), $complete_table = true )
{
$file_read = array( 'php', 'html', 'js', 'css' );
$dir_ignore = array();
$scan_result = scandir( $dir );
foreach ( $scan_result as $key => $value ) {
if ( !in_array( $value, array( '.', '..' ) ) ) {
if ( is_dir( $dir . DIRECTORY_SEPARATOR . $value ) ) {
if ( in_array( $value, $dir_ignore ) ) {
continue;
}
$result = DirLineCounter( $dir . DIRECTORY_SEPARATOR . $value
, $result, false );
}
else {
$type = explode( '.', $value );
$type = array_reverse( $type );
if( !in_array( $type[0], $file_read ) ) {
continue;
}
$lines = 0;
$handle = fopen( $dir . DIRECTORY_SEPARATOR . $value, 'r' );
while ( !feof( $handle ) ) {
if ( is_bool( $handle ) ) {
break;
}
$line = fgets( $handle );
$lines++;
}
fclose( $handle );
$result['lines_html'][] = '| ' . $dir . ' | ' .
$value . ' | ' . $lines . ' |
';
$result['lines_count'] = $result['lines_count'] + $lines;
$result['files_count'] = $result['files_count'] + 1;
}
}
}
if ( $complete_table ) {
$lines_html = implode('', $result['lines_html']) . ' | Files Total: ' . $result['files_count'] . ' |
Lines Total: ' . $result['lines_count'] . '
|
';
return '| Dir
td> | File | Lines |
' . $lines_html . '
';
}
else {
return $result;
}
}
echo DirLineCounter( '.' );
?>
===============================================================================
I was looking for an easy way to get only files from a certain directory. I
came up with the following line of code that will result in an array listing
only files. the samen can be done for directories ofcourse.
===============================================================================
Care needed going from PHP 5.3 to 5.4, as the constant SCANDIR_SORT_DESCENDING
is only defined from 5.4.
I had previously been using literal, i.e. scandir($targetDir,2) in 5.3, but
this did not give desired result in 5.4 (Ascending is default). However when I
used SCANDIR_SORT_DESCENDING which is not defined in 5.3, on my web host
(still on 5.3) I got error - second argument assumed to be a string.
My solution (very primitive):
$sort_desc = defined('SCANDIR_SORT_DESCENDING') ?
SCANDIR_SORT_DESCENDING : 2;
$infiles = scandir($targetDir, $sort_desc);
===============================================================================
# Hacer hash de estructura de directorio
$print_dir = "SOME DIR TO EXPLORE";
$parentDir=array();
myScandir($parentDir,$print_dir);
print_r ($parentDir);
function myScandir(&$parentDir,$actual_dir){
$scanDir = scandir($actual_dir);
for ($i=0;$i
===============================================================================
Was looking for a simple way to search for a file/directory using a mask. Here
is such a function.
By default, this function will keep in memory the scandir() result, to avoid
scaning multiple time for the same directory.
Requires at least PHP5.
$entry) {
if ($entry!='.' && $entry!='..' && fnmatch($mask, $entry) ) {
$sdir[] = $entry;
}
}
return ($sdir);
}
?>
===============================================================================
If you have a folder with many files and/or subfolders, doing a recursive
scandir will likely either slow down your application, or cause a high rise in
RAM consumption due to the large size of the generated array.
To help with this, as well as to make processing of files in a folder easier, I
wrote a function that reads a folder and its subfolders recursively, and calls
a function upon each match.
Of course, because it is recursive, a folder with many levels of folders could
potentially consume lots of memory, but then again, so can every other
recursive scandir implementation here.
BTW, there's also the RecursiveDirectoryIterator SPL class:
http://bg.php.net/manual/en/class.recursivedirectoryiterator.php
which, even if using the same approach, will most likely be faster and hold
down deeper levels (because it works on the C level), but this one will always
work, regardless of settings... even on PHP4.
Point is, avoid recursive scandir implementations.
===============================================================================
Here's a simple little scandir() function that can pick a random photo (jpg
only so far) and dislpay it. This also goes through an exclusion list and
doesn't store anything you don't want to display. Use as you wish
";
echo "";
echo "";
?>
===============================================================================
If I'm remembering my CS classes right... this would be the 'bare bones'
recursive method to extract directories and files...
===============================================================================
Here is a function that parses your website's directory tree, similar to the
scanDirectories function provided by fatpratmatt. However, this allows you to
filter out all files except for those with specific extensions, in addition to
allowing you to ignore entire directories, and also has a list of specific
files to ignore. One last addition is that it allows you to use a regular
expression to ignore another set of files.
I use this to walk the directory structure of my website, and to generate a
sitemap.xml for Google sitemaps to index my site. This allows me to skip dev,
data, library, etc. folders, and files that are not front end files.
The way it's written means you don't need to worry about excluding specific
files at all unless they have the extension you are looking for (i.e. html or
php files).
Enjoy.
$content)
{
$path = $root_dir.'/'.$content;
if(is_file($path) && is_readable($path))
{
// skip ignored files
if(!in_array($content, $ignore_files))
{
if (preg_match($ignore_regex,$content) == 0)
{
$content_chunks = explode(".",$content);
$ext = $content_chunks[count($content_chunks) - 1];
// only include files with desired extensions
if (in_array($ext, $allow_extensions))
{
// save file name with path
$all_data[] = $path;
}
}
}
}
// if content is a directory and readable, add path and name
elseif(is_dir($path) && is_readable($path))
{
// skip any ignored dirs
if(!in_array($content, $ignore_dirs))
{
// recursive callback to open new directory
$all_data = get_files($path, $all_data);
}
}
} // end foreach
return $all_data;
} // end get_files()
?>
===============================================================================
This function generates a list of all files in the chosen directory and all
subdirectories, throws them into a NON-multidimentional array and returns them.
Most of the recursive functions on this page only return a multi-dimensional
array.
This is actually a modification of some one else's function (thanks mail at
bartrail dot de ;])
$content) {
// filter all files not accessible
$path = $rootDir.'/'.$content;
if(!in_array($content, $invisibleFileNames)) {
// if content is file & readable, add to array
if(is_file($path) && is_readable($path)) {
// save file name with path
$allData[] = $path;
// if content is a directory and readable, add path and name
}elseif(is_dir($path) && is_readable($path)) {
// recursive callback to open new directory
$allData = scanDirectories($path, $allData);
}
}
}
return $allData;
}
?>
Example output:
print_r(scanDirectories("www"));
---
Array
(
[0] => www/index.php
[1] => www/admin.php
[3] => www/css/css.css
[4] => www/articles/2007/article1.txt
[4] => www/articles/2006/article1.txt
[8] => www/img/img1.png
)
===============================================================================
'; var_export(rscandir(dirname(__FILE__).'/')); echo '';
/*
Output:
array (
0 => '/path/to/web/.htaccess',
1 => '/path/to/web/foo/',
2 => '/path/to/web/foo/file.txt'
)
*/
?>
===============================================================================
Since scandir() returns and array, here is a more concise method of dealing
with the '.' and '..' problem when listing directories:
';
}
}
?>
===============================================================================
Bear in mind that sorting is *always* performed when scandir() is called.
String sorting takes O(|s|n log n) runtime, and this adds to the burden of the
server's memory and processing power.
Therefore, whenever the alphabetical order of the directory content is
unimportant, especially if sorting is to be performed by another order, or the
natural order of the files on the filesystem is to be utilized, the use of
opendir(), readdir() and closedir() combined is always preferred to scandir().
===============================================================================
Saw banzai monkeys code and tweaked it a little. I don't have scandir. So I had
to play with the suggested use for php4.
Pretty new to PHP so beer with me. This will show your current directory as a
link called "Back" and will list all of your files in a menu. I wanted this
because I have a lot of static pages and needed a menu that would auto update
every time I added a file.
');
print('Back
li>');
foreach($t as $key => $value){
$phpkill=str_replace('.php', '', $value);
$htmlkill=str_replace('.html', '', $phpkill);
$dashkill=str_replace('-',' ',$htmlkill);
$uppercasewords=ucwords($dashkill);
print('");
}
print('');
closedir($dh);
?>
I basically made all the variables so they could explain themselves, Regular
expression is not my strong point right now, just becoming familiar with php
functions is more of a priority, I hope this is usefull to someone.
===============================================================================
I would like to share a couple of functions I've made to get an Array of files
of a certain extension inside a Directory.
= '5') return scandir($dir, $sort);
$dirmap = array();
if(!is_dir($dir))
{
trigger_error("lib::scandir($dir): failed to open dir: Invalid
argument", E_USER_WARNING);
return false;
}
$dir = opendir($dir);
while (false !== ($file = readdir($dir)))
$dirmap[] = $file;
closedir($dir);
($sort == 1) ? rsort($dirmap) : sort($dirmap);
return $dirmap;
}
/*
Then, this one converts directory files into array items.
It also can filter by file extension.
*/
function dir2arr($dir, $ext = null)
{
$arr = array();
if(PHP_VERSION >= '4.3.0')
{
# PHP 4.3.0 code
if ($dir = glob("$dir*".(!$ext ? '.*' : '{'.$ext.', '.strtoupper($ext).
'}'), GLOB_NOSORT + GLOB_BRACE))
foreach ($dir as $file)
$arr[] = preg_replace("#(?:.+\/{1})*([^\.]+)\.(.+)#i", '$1',
$file);
}
else
{
# PHP 4.2.x code
$dir = php4_scandir($dir); // See code snippet above
if(!$ext) $ext = '\.[a-z]+';
$pattern = "#([^\.|\.\.$]+)$ext#i";
foreach ($dir as $file)
if (preg_match($pattern, $file, $filename))
$arr[] = $filename[1];
}
return (empty($arr) ? false : $arr);
}
?>
===============================================================================
I wrote this function to read a folder and place all the folders and sub
folders it contains into an array.
$folders now contains an array with the full paths to each subfolder. E.g.:
Array
(
[0] => /path/to/folder/dir1
[1] => /path/to/folder/dir1/subdir
[2] => /path/to/folder/dir1/subdir/subsubdir
[3] => /path/to/dolfer/dir2
)
This function has only been tested on Linux.
===============================================================================
This function is similar to scandir, but works in PHP4. It uses readdir to get
directory info.
===============================================================================
===============================================================================
I made this to represent a directory tree in an array that uses the file or
directory names as keys and full paths as the value for files. Directories are
nested arrays.
The function will return something like this:
Array
(
[index.php] => /usr/local/www/index.php
[js] => Array
(
[async.js] => /usr/local/www/js/async.js
[dom.js] => /usr/local/www/js/dom.js
[effects.js] => /usr/local/www/js/effects.js
[prototype.js] => /usr/local/www/js/prototype.js
)
[logo.png] => /usr/local/www/logo.png
[server.php] => /usr/local/www/server.php
[test.js] => /usr/local/www/test.js
)
===============================================================================
For directory containing files like (for example) -.jpg the results of scandir
are a little "weird" ;)
Array
(
[0] => -.jpg
[1] => .
[2] => ..
[3] => foo.txt
[4] => somedir
)
Beware - sorting is in ASCII order :)
===============================================================================
using sort of scandir() that returns the content sorted by
Filemodificationtime.
returns false if an error occured
otherwise it returns an array like this.
Array
(
[20040813231320] => DSC00023.JPG
[20040813231456] => DSC00024.JPG
[20040814003728] => MOV00055.MPG
[20040814003804] => DSC00056.JPG
[20040814003946] => DSC00057.JPG
[20040814004030] => DSC00058.JPG
[20040814014516] => DSC00083.JPG
[20050401161718] => album.txt
)
===============================================================================
Scandir on steroids:
For when you want to filter your file list, or only want to list so many levels
of subdirectories...
files; 1 => directories; 3 => both;
// $levels: 1 => look in the $path only; 2 => $path and all children;
// 3 => $path, children, grandchildren; 0 => $path and all
subdirectories;
// less than 0 => complement of -$levels, OR everything starting
-$levels down
// e.g. -1 => everthing except $path; -2 => all descendants
except $path + children
// Remaining argument(s) is(are) a filter array(list) of regular expressions
which operate on the full path.
// First character (before the '/' of the regExp) '-' => NOT.
// First character (after a possible '-') 'd' => apply to directory name
// The filters may be passed in as an array of strings or as a list of
strings
// Note that output directories are prefixed with a '*' (done in the line
above the return)
$dS = DIRECTORY_SEPARATOR;
if (!($path = realpath($path?$path:getcwd()))) return array(); // bad
path
// next line rids terminating \ on drives (works since c: == c:\ on PHP).
OK in *nix?
if (substr($path,-1)==$dS) $path = substr($path,0,-1);
if (is_null($types)) $types = 2;
if (is_null($levels)) $levels = 1;
if (is_null($aFilter)) $aFilter=array();
// last argument may be passed as a list or as an array
$aFilter = array_slice(func_get_args(),3);
if ($aFilter && gettype($aFilter[0])=="array") $aFilter=$aFilter[0];
$adFilter = array();
// now move directory filters to separate array:
foreach ($aFilter as $i=>$filter) // for each directory
filter...
if (($pos=stripos(" $filter","d")) && $pos<3) { // next line eliminates
the 'd'
$adFilter[] = substr($filter,0,$pos-1) . substr($filter,$pos);
unset($aFilter[$i]); }
$aFilter = array_merge($aFilter); // reset indeces
$aRes = array(); // results, $aAcc is an Accumulator
$aDir = array($path); // dirs to check
for ($i=$levels>0?$levels++:-1;($aAcc=array())||$i--&&$aDir;$aDir=$aAcc)
while ($dir = array_shift($aDir))
foreach (scandir ($dir) as $fileOrDir)
if ($fileOrDir!="." && $fileOrDir!="..") {
if ($dirP = is_dir ($rp="$dir$dS$fileOrDir"))
if (pathFilter("$rp$dS", $adFilter))
$aAcc[] = $rp;
if ($i<$levels-1 && ($types & (2-$dirP)))
if (pathFilter($rp, $aFilter))
$aRes[] = ($dirP?"*":"") . $rp; }
return $aRes;
}
?>
example usage:
Note that this function will consume a lot of time if scanning large
directory structures (which is the reason for the '[-]d/.../' filters).
Csaba Gabor from Vienna
===============================================================================
A nice way to filter the files/directories you get back from scandir:
passes if $path has a c or if $path has an
a but no b
// array("/a/", "/c/", "-/b/") => passes if $path has an a or c, but no b
// array("-/b/", "/a/", "/c/") => passes if $path has no b, or if $path has
an a or c
if (!$aFilter) return true; // automatic inclusion (pass) if no
filters
foreach ($aFilter as $filter) break; // we don't know how it's indexed
$in = $filter[0]=="-"; // initial in/exclusion based on first
filter
foreach ($aFilter as $filter) // walk the filters
if ($in==$not=($filter[0]=="-")) // testing only when necessary
$in ^= preg_match(substr($filter,$not),$path); // flip in/exclusion
upon a match
return $in;
}
?>
Csaba Gabor from Vienna
===============================================================================
Since I needed to scan dirs and subdirs and wanted to have files and dirs not
in the same var without having to explode it, I did this little function:
This one seems to work properly and use multidimensional array.
To show your files, just use:
"; //Complete path of the file with key 0 (dir +
filename)
echo $yourvar["directory"][0]."
"; //Directory of the file with key 0
echo $yourvar["filename"][0]."
"; //Filename of the file with key 0
?>
Note that the parameter of the function is not necessary. If you don't give
any, it will scan from the returned value of getcwd() function.
===============================================================================
For non php5-users here you are this function...
It isn't set the wrapper, but I think it's enough :P.
If no pararameter is set, the scandir() function will scan the local file
directory.
Set the optional parameter "$sort" to 1 to reverse the alphabetical-sorting.
===============================================================================
scandir() with regexp matching on file name and sorting options based on stat
().
files can be sorted on name and stat() attributes, ascending and descending:
name file name
dev device number
ino inode number
mode inode protection mode
nlink number of links
uid userid of owner
gid groupid of owner
rdev device type, if inode device *
size size in bytes
atime time of last access (Unix timestamp)
mtime time of last modification (Unix timestamp)
ctime time of last inode change (Unix timestamp)
blksize blocksize of filesystem IO *
blocks number of blocks allocated
===============================================================================
This functionality is now implemented in the PEAR package PHP_Compat.
More information about using this function without upgrading your version of
PHP can be found on the below link:
http://pear.php.net/package/PHP_Compat
===============================================================================
This function create a HTML view of a directory. It also look for
subdirectory. I use some icon to differ from folders or files. It's also
possible to get specific icon for specific file type.
Each entrey is clickable so you can use it to populate a form field.
Have fun!
". substr($currentfile, strrpos($currentfile, '/')) . "
";
echo $last_dir;
ls_recursive2($currentfile);
}
}
else
{
$last_dir .= " ". substr($currentfile, strrpos($currentfile, '/')) . "
";
echo $last_dir;
}
}
}
}
?>
===============================================================================
";
foreach($directories as $entry) {
if(is_dir($dir_path.$entry)) {
echo "[`] ".$entry."";
}
}
echo "";
//-- separator
echo "";
foreach($directories as $entry) {
if(is_file($dir_path.$entry)) {
echo "- [ ] ".$entry."
";
}
}
echo "
";
}
dir_nav();
//-- optional placement
if (isset($_GET["file"])) {
echo "";
highlight_file($dir_path.$_GET['file']);
echo "
";
}
//-- until here
//--
//-- Because I love php.net
?>
===============================================================================
\" {$dir} \" Not Found" ); }
// Optional
chmod( $dir, "0777" );
// Print
print_r( scandir( $dir . "/" ) );
?>
===============================================================================
// Extreme minimal version recursive scan:
function rscandir($dir){
$dirs = array_fill_keys( array_diff( scandir( $dir ), array( '.', '..' ) ),
array());
foreach( $dirs as $d => $v )
if( is_dir($dir."/".$d) )
$dirs[$d] = rscandir($dir."/".$d);
return $dirs;
}
===============================================================================
/**
* This function will scan all files recursively in the sub-folder and folder.
*
* @author Fazle Elahee
*
*/
function scanFileNameRecursivly($path = '', &$name = array() )
{
$path = $path == ''? dirname(__FILE__) : $path;
$lists = @scandir($path);
if(!empty($lists))
{
foreach($lists as $f)
{
if(is_dir($path.DIRECTORY_SEPARATOR.$f) && $f != ".." && $f != ".")
{
scanFileNameRecursivly($path.DIRECTORY_SEPARATOR.$f, &$name);
}
else
{
$name[] = $path.DIRECTORY_SEPARATOR.$f;
}
}
}
return $name;
}
$path = "/var/www/SimplejQueryDropdowns";
$file_names = scanFileNameRecursivly($path);
echo "";
var_dump($file_names);
echo "
";
===============================================================================
If you wish to sort by folders first then files, you could use something like
this:
NB.: This approach *might* be suboptimal for high performance situations.
- Gerard
===============================================================================
Note that scandir() will enforce alphanumerical sorting on the array it
returns. If you wish to reduce CPU overhead by avoiding the sorting, or if you
wish to obtain "natural filesystem order" - that is, the order in which the
files are found while traversing the filesystem (usually the order in which
they were written to the disk) - you need to go back to the PHP4 equivalent of
opendir() + readdir().
===============================================================================
Just noticed a minor difference between scandir and readdir.
When opening a directory and using readdir(), each file appears to be accessed
in the process. This resets the "Last Accessed" time that you would get with
fileatime().
With scandir(), the list is created and none of the files are accessed.
Therefore the access times remain unchanged.
I encountered this while writing a script to scan a directory and delete any
file that hadn't been accessed in x time. Kind of defeated the purpose when
the directory listing accessed every file...
===============================================================================
Non-recursive way (red: FASTER & less memory consumption) to list all directory
content :
===============================================================================
This method would leave the file system vulnerable using ../ for the ?dir= A
person could navigate any readable file system simply by adding ../ enough
times to get back to the root of the drive.
On a proper secure system this might not matter, however for less secure file
systems where the web user(apache user) can at least read most files, or on
multi-user web servers this could lead to potential security risks.
Adding a check to see if ../ is in the $_GET["dir"] is one way to prevent
this.
===============================================================================
If you would like to use scandir on the root directory of your server, you
would imagine the command to be either scandir("") or scandir("/"), but neither
work. However, scandir(".") works perfectly. Use scandir("/") and scandir
("..") to poke around the Linuxy areas of your webhost. At least, these are
the observations I've made with my own webhost when it comes to root directory
scandir.


Robartics Project
Objective:
The goal of this project was to collect and obtain a biopotential signal, and use it accomplish a meaningful task using the given robotic arm.
Our team chose to use the Electroocculagraphic potentials to draw with the robot arm.
Project Contraints:
- Allowed to make use of only one biopotential signal
- Must use the given lynx robot arm (http://www.lynxmotion.com/c-126-al5b.aspx)
- Only the end effector of the given robot arm can be modified.
-
Material Constraints:
-
Acrylic Sheets (with laser cutter).
-
Acrylonitrile butadiene styrene (with FDM).
Project Progression:
The project was first divided into three major modules:
- End effector
- Amplifier and filters
- Microcontroller programming
Individuals in our group was given charge over each of the modules above. However, all members of the team were aware of the progress and the technical details of each module.
End Effector
For our purpose of drawing, our end effector needed to be able to hold a drawing utensil. For our prototype it was a pen. Due to our future plan to implement a way for the arm to automatically switch out writing utensils, we designed the end effector so that it takes advantage of the original claw mechanism of the robot arm.
Below are images of the end effector assembly before the attachement to the robot arm:
Each piece of the end effector is attached to each side of the arm's claw so that when the claw closes, the two halves of the tubing will close, provding grip for the pen.
The pieces gets attached to the claw through the use of two screws and the screw sockets already present on the claws.
Amplifier and filters
We were provided an EKG for this project. However, we soon discovered that the provided EKG was a differentiated differential amplifier, which did not fit our overall desired design.
The overall concept can be described as follows:
- The canvas's center is placed at the user's eye-level
- The user keeps his eye focused at the tip of the drawing utensil as normal drawer would.
- The user tilts head up to draw upwards, down to draw downards, left to draw left, right to draw right. All the while the eyes are focused on the tip of the utensil.
- This results in the eyes rotating (in respect of the user's face) causing change in potential across the eye.
- This potential values will be filtered, amplified, then sent to the microcontroller in order to determine whether looking up(left) or down(right) using simple threshold testing.
Above mentioned concept requires the "raw-potentials" of the eye, which the provided EKG did not provide. The EKG provided the amplification of the change in amplitude of the potential. In other words, it differentiated the "raw-potential signal"
Furthermore, the EKG provided very low signal for "looking down" in relative to the signal acquired for "looking up". The amplitude of the "looking down" signal was so small that it was often impossible to detect "looking down" eye-motion of the user.
Due to all these reasons, we decided to build our own instrumental amplifier using the INA125.
Below is a simple flow chart that summarizes the Amplifier and Filter circuitry:
The potentiometer was used to adjust gain of every stage of the circuit, due to the simple fact that each time the electrodes are reattached, the signal shifts in great ranges, especially the DC offset.
Microcontroller Programming
Major Contraints:
- The ADC of the microcontroller ranges only from 0-5V.
- The robot arm's lynx board takes in string commands sent through RS232 serial communication protocol.
- Must translate 2 dimensional movement on the canvas into joint angle positions of the arms.
The first contraint was addressed by summing variable DC offset withtin the amplifier circuitry.
The second contraint was sddressed by selectring a microcontroller that already contained RS232 protocol ability. The microcontroller chip that we chose provided two TX pins (serial transmission pin), which allowed us to send messages to the robot arm board and as well to the LCD display screen.
The third constraint was addressed by applying trignometry and geometry with the assumption that the canvas will be held square to the base of the robot arm.
Below is the flow diagram that describes the overall operation of the microcontroller program:


Welcome to this website!
This website is using laobubu’s theme: EasyBook
One sentence introducing yourself.
Email


Clock.Mod should wrap host system clock for use by a more general purpose DateTime.Mod.
Refactor CharsTest.Mod to test Strings compatible procedures
Tests module for easily writing tests of modules
Reals.Mod should provide easy conversion to/from String for Real with exponential or fixed notations without reliance on extConvert.
Chars should provide a more modern approach to text processing that the Oakwood Strings module
Chars module should work as a drop in replacement for Oakwood Strings
DStrings module for dynamic strings, compatible with Chars and Strings where it makes sense, it should include Rider suppport since we lack index notation for working in the string object
JSON module for working with JSON data
Document coding conventions on when to use snake, camel case in variables and procedure names.
Requested Ports from Native Oberon
Files.Mod (Confirm Can I use OBNC’s implementation, confirm PO 2013 Files.Mod works as replacement)
Objects.Mod (Port needed for POSIX, port needed for PO 2013)
Display.Mod (Port needed for POSIX, confirm PO 2013 Display.Mod works as replacement)
Fonts.Mod (Port needed for POSIX, confirm PO 2013 Fonts.Mod works as replacement)
Reals.Mod (Port needed for POSIX and for PO 2013)
Texts.Mod, see https://en.wikibooks.org/wiki/Oberon/ETH_Oberon/2003-01-05/Texts.Mod
Depends on: Files, Objects, Display, Fonts, and Reals
Figure out if the other Native Oberon modules like Kernel, Modules, Displays.Display.Mod, etc. need to be ported or we can use PO 2013 modules
Someday, maybe
Reals.Mod
EBNF.Mod and ebnfc.Mod
Scanner.Mod implementing a Texts like Scanner
RISC5 emulator (based on Compiler Construction RISC0 emulator)
Create a Ofront/V4 like dev environment with direct access to host file system
Re-implement Fonts.Mod so Oberon System can use ADA friendly fonts like Open Dyslexia and Atikson Hyperledgable
Rename String.Init() to something that both suggests both initialization AND assignment. NOTE: Set/Get/Put are taken by the Rider procedures to remain signature compatible with Files.Rider
Refactor StringDesc record for holding CHAR to hold INTEGER to allow support for difference character sets (e.g. UTF-8/UTF-32)
Portable Convert module, look at V4 and OBNC implementations as well as Oxford compiler and VOC
RegExp module is needed
CSV module for working with CSV data
XML module for working with XML data
HTML review A2 and Native Oberon-7, evaluate a port to Oberon-7
OBNC ext modules used need to be re-implemented as pure Oberon-7 to allow Artemis to be Oberon-7 compiler agnostic.
Need to test under Oberon Project 2013 in DeWachter’s emulator as well as Extended Oberon and IO Core
Cli modules (e.g. OCat) need to be clearly marked as non-portable between Oberon Systems and POSIX
Makefile needs to handle compile Cli modules to sensible lowercase names based on Oberon-7 compiler used


Description
We need to send email (with custom email) from travis to specified users when the build fails.
- NOTE: As of now, Travis-ci does not allow custom messages for email notification.
End Goal
notifications:
email:
on_success: never
on_failure: always
recipients:
-<EMAIL_ADDRESS>-<EMAIL_ADDRESS>Step by step
- Specify when to send email - only when build/test failed
on_success: never # do not send anything if build succeeds
on_failure: always # if there is a fail
# other options are [always|never|change]
- Specify email addresses
recipients:
-<EMAIL_ADDRESS>-<EMAIL_ADDRESS>- Complete travis config file
---
language: node_js
node_js:
- "4.5.0"
sudo: false
notifications:
email:
on_success: change # only if status change from fail to success
on_failure: always # if there is a fail
recipients:
-<EMAIL_ADDRESS>-<EMAIL_ADDRESS>cache:
directories:
- node_modules
before_install:
- export PATH=/usr/local/phantomjs-2.0.0/bin:$PATH
- "npm config set spin false"
- "npm install -g npm@^2"
install:
- npm install -g bower
- npm install
- bower install
script:
- ember test
before_deploy:
- ember test -f 'Acceptance |'
deploy:
skip_cleanup: true
provider: script
script: ember deploy testing --verbose
on:
branch: deployment
Now you can do this!


USD/JPY bounces from 200-day MA after Chinese Vice Premier Liu He's remark on trade
by Omkar Godbole- USD/JPY has bounced up from the 200-day MA support of 108.96.
- China's Vice Premier Liu He is cautiously optimistic about the prospects of the US-China trade deal.
- Related markets, however, are not buying Liu He's optimism.
USD/JPY eked out moderate recovery from the 200-day moving average support after China's Vice Premier and trade negotiator Liu He noted that he is "cautiously optimistic" about reaching a phase one trade deal.
The currency pair is currently trading at 108.49, representing a 0.13% drop on the day, having bounced from the 200-day moving average support of 108.96 in the last one hour.
With Liu He expressing cautious optimism on trade, some traders likely squared off long JPY trades, helping the pair chart a minor recovery. The futures on the S&P 500, however, are still reporting a 0.22% drop. Further, the Asian equities are down with Japan's Nikkei reporting a 1% drop.
Further, the US 10-year treasury yield is showing no sign of life. The yield is currently trading at two-week lows near 1.73%.
Put simply, the equity and bond markets are not impressed by Vice Premier Liu He's comments and continue to worry about the waning trade optimism amid escalating political tensions.
The USD/JPY pair, therefore, may fall back to the 200-day average at 108.96. However, if the equities recover, the pair will likely move into the positive territory above 108.60.
Technical levels
USD/JPY
| Overview | |
|---|---|
| Today last price | 108.49 |
| Today Daily Change | -0.08 |
| Today Daily Change % | -0.07 |
| Today daily open | 108.57 |
| Trends | |
|---|---|
| Daily SMA20 | 108.76 |
| Daily SMA50 | 108.27 |
| Daily SMA100 | 107.71 |
| Daily SMA200 | 108.98 |
| Levels | |
|---|---|
| Previous Daily High | 108.74 |
| Previous Daily Low | 108.35 |
| Previous Weekly High | 109.3 |
| Previous Weekly Low | 108.23 |
| Previous Monthly High | 109.29 |
| Previous Monthly Low | 106.48 |
| Daily Fibonacci 38.2% | 108.59 |
| Daily Fibonacci 61.8% | 108.5 |
| Daily Pivot Point S1 | 108.36 |
| Daily Pivot Point S2 | 108.16 |
| Daily Pivot Point S3 | 107.96 |
| Daily Pivot Point R1 | 108.76 |
| Daily Pivot Point R2 | 108.95 |
| Daily Pivot Point R3 | 109.16 |


Shapes |
Look at the shapes below. They have different number of sides and corners. How do they differ from one another?
|
A circle is round. It has no sides and corners. |
|
A triangle has 3 sides and 3 corners. |
|
A square has 4 sides and 4 corners. |
|
A rectangle has 4 sides and 4 corners. |
|
A pentagon has 5 sides and 5 corners. |
|
A hexagon has 6 sides and 6 corners. |
|
A heptagon has 7 sides and 7 corners. |
|
An octagon has 8 sides and 8 corners. |
|
A nonagon has 9 sides and 9 corners. |
|
A star has 5 or more sides and corners. |
|
A decagon has 10 sides and 10 corners. |
|
A diamond has 4 slanting sides and 4 corners. |
Draw a line to connect each shape to its name.
| • | • | triangle | ||
| • | • | square | ||
| • | • | circle | ||
| • | • | rectangle | ||
| • | • | diamond | ||
| • | • | star |
Color the box with the correct shape shown on the left.


A MATLAB/Simulink model can be created based on the Simulink model template.
Using the GT.GenericTarget MATLAB class, the Simulink model can be brought to the target computer.
Generic C/C++ code is generated from the Simulink model.
The generated code essentially contains a class with the methods initialize(), step(), and terminate().
The name of the generated class is based on the name of the Simulink model.
Besides the generated code, the codeInfo.mat file is created during the model code generation.
This file contains additional information such as sample rates, thread priorities, and function names.
Based on this information and the settings of the GT.GenericTarget class object, the source code for the Simulink interface class class is generated.
The programming interface from the actual generic target software to this Simulink interface class is always the same.
The source code for the generic target software comes with the MATLAB package and is copied once to the target computer (see target preparation).
On the other hand, the source code for the Simulink interface class and the source code for the actual model is generated and copied to the target computer at each deploy procedure.
The software is then compiled on the target computer.
Use the MATLAB class GT.GenericTarget
For an automatic deployment mechanism, it is useful to write a MATLAB script or function.
The target computer should already be prepared using the Setup() method (see here).
First, a GT.GenericTarget instance must be created.
gt = GT.GenericTarget('username','hostname');
The IP address of the target computer can be specified as host name.
Afterwards the attributes of the class can be adjusted if necessary.
Using the Deploy() method, a Simulink model can then be transferred to the target computer:


Hello static HTML page
This is a static page (html, under web-app), without a Grails Layout.
AngularJS, Data Binding sample
{{data.message + " world"}}
AngularJS, Client Templates sample
view1
view2


--- layout: base title: Hi, I'm Jatin Gupta subtitle: M.Tech. Student in IISc, Bangalore use-site-title: true ---
Coming Soon


{% load static %}
{{app_text}} | Ausimin
AUSIMIN PTY. LTD.
Gypsum Products and Solutions
Company
Applications
Products
Certifications
Contact Us
{% block content %} {% endblock %}


SweetFreeStuff.com
///////////////////////////////////////////
Free Colgate Extra Clean Toothbrush at Meijer
Posted: 31 Aug 2015 10:12 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Get a FREE Colgate Extra Clean Toothbrush at Meijer mPerks now thru
Saturday 9/4, while supplies last! CLIP TODAY and TOMORROW ONLY. Free
Colgate Extra Clean Toothbrush at Meijer
The post Free Colgate Extra Clean Toothbrush at Meijer appeared first on
SweetFreeStuff.com.
///////////////////////////////////////////
Free Vsis Vinnle Pills and Probita Chews Sample
Posted: 31 Aug 2015 10:06 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Free Vísi’s Vinnle Pills and Probita Chews Sample
The post Free Vísi’s Vinnle Pills and Probita Chews Sample appeared first
on SweetFreeStuff.com.
///////////////////////////////////////////
Free Heinz Ketchup Pin
Posted: 31 Aug 2015 09:00 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Select Americas, then United States. Then select Ketchup Pin for question
13 on the form. Free Heinz Ketchup Pin
The post Free Heinz Ketchup Pin appeared first on SweetFreeStuff.com.
///////////////////////////////////////////
15 Free Pampers Gifts to Grow Points
Posted: 31 Aug 2015 01:00 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
To login please click here and enter the codes: FBH73RD8AWAHH15
and TWITWO4CD3RGA15 for 15 more points. (If you need to register, click
here to sign up and receive 100 points!) The Pampers Gifts to Grow Rewards
Program rewards you for choosing Pampers diapers, training pants and wipes
for your growing baby. To start, simply collect the Continue reading 15
Free Pampers Gifts to Grow Points
The post 15 Free Pampers Gifts to Grow Points appeared first on
SweetFreeStuff.com.
///////////////////////////////////////////
Free Smokin Barrel Peanuts or Trail Mix at Stripes Stores
Posted: 31 Aug 2015 12:23 AM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
Free Smokin Barrel Peanuts or Trail Mix at Stripes Stores. Expires 9/1.
They are located in Texas, Oklahoma and New Mexico.
The post Free Smokin Barrel Peanuts or Trail Mix at Stripes Stores appeared
first on SweetFreeStuff.com.
///////////////////////////////////////////
FREE Medium Two-Topping Handmade Pan Pizza at Dominos (8/31 @ 3PM ET!)
Posted: 30 Aug 2015 11:00 PM PDT
http://feedproxy.google.com/&edburner&utm_medium=email
*Update: A no hitter has been thrown and this offer goes live Monday,
August 31st at 3pm ET! When a pitcher throws a no-hitter this season, visit
MLB.com/Dominono and enter your mlb.com account. after Each of the first 2
no-hitters, THE FIRST 20,000 MLB.COM USERS TO ENTER THEIR MLB.COM ACCOUNTS
will receive a code valid Continue reading FREE Medium Two-Topping
Handmade Pan Pizza at Dominos (8/31 @ 3PM ET!)
The post FREE Medium Two-Topping Handmade Pan Pizza at Dominos (8/31 @ 3PM
ET!) appeared first on SweetFreeStuff.com.


Brainhack Resources
There are a variety of resources available to help maximize your time spent at Brainhack EDT.
Inter-Brainhack Communication Channels
we have established several means for you to communicate with the attendees of all of Brainhack EDT as a whole:
-
Twitter: Use #brainhackEDT to tag your twitter posts. You can monitor Brainhack EDT related tweets using http://tweetchat.com/room/brainhackEDT.
-
Google+: Tag pictures and other posts to google+ with #brainhackEDT
-
Code: http://github.com + http://nitrc.org
Videocasts
Ignite talks, unconference sessions, and wrap-up presentations for most regional events will be broadcast and archived on google Hangouts on Air. You can tune into a broadcast using links located on the events’ web page and periodically sent out over the other communication channels listed above as new broadcasts are beginning. Creating your own broadcast requires a webcam, a microphone, and a free google+ account. You can start the broadcast by going to https://plus.google.com/hangouts/onair, logging in, and then clicking the blue “Start a Hangout on Air” button. Please do not forget to tell us about it by sending the link using one of the communication channels listed above.


In this project, you will demonstrate proficiency by writing unit tests for an existing React application. Your tests should verify the behavior listed in the Minimum Viable Product section.
Some of the topics covered were:
react-testing-library
testing framework.
Read these requirements carefully. Understand exactly what is expected before starting.
You are allowed, and encouraged, to collaborate with your peers while working on this assignment. Remember to follow the twenty-minute rule and post questions to your cohort’s help channel before seeking support from your PM and Instructor.
Please push your code often and use descriptive commit messages, this helps you and your project manager.
In this project, you will write unit tests for an existing React application that controls a gate and shows two LEDs that portrait the status of the gate.
The requirements are listed under the Minimum Viable Product section below.
Follow these steps to setup your git fork and branch.
git checkout -b <firstName-lastName>
.
<firstName-lastName>
branch.
git push origin <firstName-lastName>
.
Follow these steps for completing your project.
<firstName-lastName>
branch into the master branch on your fork. Please don’t merge your own pull request
After a set of interviews with the potential users of the solution, we gathered the following information about the desired functionality. Not all the information provided by our clients is relevant to the design of the solution, but it’s included to help understand the requirements.
Your job is to write unit tests to ensure that the application behaves as expected.
The expected/assumed behavior of the application is listed below.
unlocked
and open
closed
prop is true
and ‘Open’ if otherwise
locked
prop is true
and ‘Unlocked’ if otherwise
locked
or closed
use the red-led
class
unlocked
or open
use the green-led
class
closed
and locked
states.
This section is optional and not counted towards MVP. Start working on it after you’re done with the main assignment.
Redux
and read this example in the docs to learn how to write tests for it.


The European Central Bank’s Governing Council has agreed it is comfortable with taking future… 09/05/14 19:37 CET
Apple is said to be negotiating to buy ==Beats Electronics==, the headphone maker that also… 09/05/14 15:27 CET
Omnicom and Publicis have given up on their merger dream. Last July the bosses of the US and… 09/05/14 14:46 CET
The small town of Guissona in the interior of Catalonia has more foreigners than Spaniards, a first… 09/05/14 12:00 CET


LOSER (Columbia) Starring: Jason Biggs, Mena Suvari, Greg Kinnear, Zak Orth, Tom Sadoski, Jimmi Simpson. Screenplay: Amy Heckerling. Producers: Amy Heckerling and Twink Caplan. Director: Amy Heckerling. MPAA Rating: PG-13 (profanity, adult themes, drug use) Running Time: 98 minutes. Reviewed by Scott Renshaw.
While watching LOSER, it occurred to me that Amy Heckerling's true genius as a film-maker is casting. In FAST TIMES AT RIDGEMONT HIGH, she gave us Sean Penn's Jeff Spicoli; in LOOK WHO'S TALKING, she turned Bruce Willis into a wise-cracking baby and provided John Travolta with is first career revival; in CLUELESS, she found a star vehicle for the adorableness that is (or was) Alicia Silverstone. She seems to understand instinctively how to find performers the audience will like in spite of their flaws. Unfortunately, she may also be starting to understand that she understands. Giving appealing actors an appealing script creates likeable movies. Giving appealing actors a script in which their appeal _is_ the movie makes for unexpectedly awful films like LOSER.
Naturally, Heckerling makes her protagonist an all-around swell guy. Paul Tannek (Jason Biggs) is a small-town boy who gets a scholarship to NYU, then instantly finds himself an island of compassion and diligence in the cold-hearted big city. Paul is the kind of guy who gives up his seat on the subway to an elderly woman; his roommates Adam (Zak Orth), Chris (Tom Sadoski) and Noah (Jimmi Simpson) are the kind of guys who blast their music and let their waterbeds leak all over Paul. Paul is also the kind of guy who adores girls from afar, in this case the lovely Dora Diamond (Mena Suvari). Dora has problems of her own, including a shortage of funds to pay her tuition and a relationship with a professor, Edward Alcott (Greg Kinnear), that's more than slightly one-sided. They're two conscientious kids who love animals and homeless people, so clearly they belong together, even if Paul is a loser.
I must confess that, for a while, I was suckered in by Heckerling's casting. Jason Biggs is an engaging performer whose unconventional looks make him even easier to embrace; Suvari is a coquette with an undercurrent of intelligence. They're pleasant enough to watch, and Heckerling gives us plenty of scenes establishing how nice they are and how nice their respective antagonists aren't. Then it gradually becomes clear that there's virtually nothing to LOSER but scenes of that sort.  Instead of taking any time to make the characters' situations funny, Heckerling spends 98 minutes making her characters' situations pathetic. She shows none of the ear for quirky dialogue that sparked CLUELESS, nor any of that film's interest in lively plotting (not surprisingly, since CLUELESS's plot came via Jane Austen's EMMA). She simply turns the film into a pity party.
Since LOSER is a film composed almost entirely of establishing character, you might think that those characters would be interesting, or at least slightly complicated. Instead, you have people either so perfect or so unredeemable that there's no reason to watch them. Paul isn't just a nice guy, he's flawless; consequently, he's a central character who does absolutely no growing. His roommates aren't just inconsiderate, they're actively evil-blackmailing Professor Alcott, drugging women with Rohypnol and generally giving humanity a bad name. And Professor Alcott isn't just manipulative, he turns Dora into his house slave. Dora's unthinking devotion to Alcott is the only whiff of basic human frailty to be found in LOSER, and even that isn't explored in sufficient detail. There's more ambiguity in the 30-second snippet from Alan Cumming's Broadway performance as the Emcee in CABARET then there is in the rest of LOSER It's one thing to turn supporting characters into comic exaggerations; it's another to flatten your leads into easily digestible mush. And it would help if those comic exaggerations were somehow ... I don't know ... comic.
Still, I spent much of the film holding out the ridiculous hope that Heckerling would somehow salvage LOSER from its tedium and justify my desire to like Paul and Dora. That hope dissolved the moment Heckerling underscored a sequence of Paul in the throes of unrequited love to Simon and Garfunkel's "Scarborough Fair/Canticle." Instead of giving the sequence a knowing wink-a reference to THE GRADUATE, a hint that Paul is becoming an overly-sensitive clich-Heckerling plays it deadly straight. Even in the scenes that scream for a light comic touch and a bit of a poke at her protagonist's foibles, she finds it impossible to stray from the Gospel of Paul as Saint. CLUELESS's Cher had her self-absorption and manipulative tendencies to balance her cuteness. In LOSER, Amy Heckerling shows a leaden hand with material that demands friskiness (her one show of wit involves naming Paul's dorm "Hunt's Hall" after erstwhile Bowery Boy Huntz Hall). Her gift with casting proved to be her curse. LOSER may be a crashing bore, but gee, aren't those two kids swell?
On the Renshaw scale of 0 to 10 plastic casts: 4.
Visit Scott Renshaw's Screening Room http://www.inconnect.com/~renshaw/ *** Subscribe to receive new reviews directly by email! See the Screening Room for details, or reply to this message with subject "Subscribe".
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


Writing is a way of thinking
Coding with my left hand, while writing with the right.
Follow me on
GitHub


Test dragging elements in the GridContainer. Then click To Delete Me Then try to drag elements in the GridContainer again


Scripting Sculptor 02 - Analysing model fits with SpecAnalysis
The next step after successfully fitting a model to the astronomical spectrum is the analysis of the model fit. The Sculptor SpecAnalysis module is designed to make this task easy with your Sculptor fit. While fitting a single function (e.g., a Gaussian) to an emission or absorption feature may be easy to analyze, deriving important quantities, such as the width, peak flux or equivalent width from multi-component line fits can be more tedious. Luckily, the SpecAnalysis module includes all of this functionality already.
However, before we begin, we need to import the most important python packages. We will use numpy and the astropy.units and astropy.cosmology packages as well as the three sculptor modules SpecOneD, SpecFit, and - the topic of this notebook - SpecAnalysis.
DISCLAIMER: At the moment the SpecAnalysis functions are written for model spectra in WAVELENGTH units. If you are working with a science spectrum in FREQUENCY units, please convert all model spectra to wavelength before using the SpecAnalysis functionality.
Note: A lot of the functionality of the SpecAnalysis module presented here can also be used without using Sculptor to generate your model fits. You only need your model spectrum in a file. Then you can read it in as a SpecOneD object and analyse it using this module.
[1]:
import numpy as np
import pandas as pd
from sculptor import speconed as scspec
from sculptor import specfit as scfit
from sculptor import specanalysis as scana
from astropy import units
from astropy.cosmology import FlatLambdaCDM
[INFO] Import "sculptor_extensions" package: my_extension
[INFO] Import "sculptor_extensions" package: qso
[INFO] SWIRE library found.
[INFO] FeII iron template of Vestergaard & Wilkes 2001 found. If you will be using these templates in your model fit and publication, please add the citation to the original work, ADS bibcode: 2001ApJS..134....1V
[INFO] FeII iron template of Tsuzuki et al. 2006 found. If you will be using these templates in your model fit and publication, please add the citation to the original work, ADS bibcode: 2006ApJ...650...57T
[INFO] FeII iron template of Boroson & Green 1992 found. If you will be using these templates in your model fit and publication, please add the citation to the original work, ADS bibcode: 1992ApJS...80..109B
As before, importing the SpecFit package prompts a few status messages of Sculptor to appear.
For extragalactic sources it is important to specify the cosmology, to allow derivation of luminosities or absolute magnitudes.
[2]:
# Define Cosmology for cosmological conversions
cosmo = FlatLambdaCDM(H0=70, Om0=0.3, Tcmb0=2.725)
In the next step we import the saved Sculptor model fit.
[3]:
# Instantiate an empty SpecFit object
fit = scfit.SpecFit()
# Load the Sculptor model fit from its folder
fit.load('../example_spectrum_fit')
Now, we begin with building model spectra (SpecOneD objects) from the models in our fit. To do this you need to know the model prefixes you have chosen to uniquely identify your model functions. It does not matter if the model functions are in separate SpecModel instances in your model fit (SpecFit object) or not. The SpecAnalysis function .build_model_flux will go through all SpecModels to look for them. The first argument of the function will be the SpecFit object and the second one will be a list of strings denoting the model functions prefixes to choose.
Our goal is to analyze the CIV emission line (model prefixes ‘CIV_A_’, ‘CIV_B_’) and the quasar continuum (‘PL_’). However, to illustrate the point above, we will first build the model spectrum of both continuum and CIV line and display it.
[4]:
# Building the model flux from the CIV emission line and power law continuum model
# This is done to illustrate how the .build_model_flux function finds model functions
# independent of their SpecModel association in the SpecFit object.
example_model_spec = scana.build_model_flux(fit, ['CIV_A_', 'CIV_B_', 'PL_'])
example_model_spec.plot()
As you can see above the .build_model_flux function used both the power law continuum and the emission line Gaussians from two different SpecModels in the SpecFit object to construct the model spectrum. However, in most cases one would want to choose to analyze the continuum independent of the emission lines. Therefore, we build two model spectra below.
[5]:
# Build the continuum model spectrum
cont_spec = scana.build_model_flux(fit, ['PL_'])
# Build the CIV emission line model spectrum
civ_spec = scana.build_model_flux(fit, ['CIV_A_', 'CIV_B_'])
Sculptor offers some very high level functions for the analysis of both continuum and emission line features. However, we will first illustrate below how to derive important properties by hand using the lower level SpecAnalysis functionality.
Analyzing continuum properties
We begin by analyzing the continuum. In the case of quasar spectroscopy, an important quantity is the flux/luminosity/magnitude at 1450A (rest-frame).
Calculating the average continuum flux density
To calculate the flux density at a specific point in the model spectrum we use the SpecAnalysis function .get_average_fluxden. It calculates the average flux density of a spectrum (SpecOneD object, first argument) in a window centered at the specified dispersion (second argument) and with a given width (keyword argument, width=10 default). The dispersion and the width need to be in the same quantity as the dispersion axis, i.e. the unit in which the dispersion axis is plotted if you would plot your model spectrum. A redshift keyword argument (redshift=0, default) can be specified, which automatically translates the rest-frame central dispersion value and the rest-frame width to the observed frame.
Note: Of course you can take your observed spectrum, import it as a SpecOneD object, and calculate the average continuum flux density directly from the science spectrum in regions unaffected by emission or absorption features with this function.
[6]:
# Calculate the average flux density at 1445-1455A rest-frame
fluxden_1450 = scana.get_average_fluxden(cont_spec, 1450,
redshift=fit.redshift)
print('Average flux density at 1450A: ',fluxden_1450)
Average flux density at 1450A: 2.2770917934343433e-16 erg / (Angstrom cm2 s)
Note how the function automatically returns the physical value of the flux density including the unit. All of the SpecAnalysis functions are designed to work with the astropy.units package to automatically return results with units. This allows for easy conversions into different unit system and for double checking the that the returned values are actually reasonable.
Calculating the monochromatic continuum luminosity
In the next step we will convert the average flux density to an average monochromatic luminosity using the cosmology (astropy.Cosmology object) defined above.
[7]:
lum_mono = scana.calc_lwav_from_fwav(fluxden_1450,
redshift=fit.redshift,
cosmology=cosmo)
print('Monochromatic luminosity at 1450A: ', lum_mono)
Monochromatic luminosity at 1450A: 8.864701317998224e+43 erg / (Angstrom s)
Calculating the apparent monochromatic AB magnitude
We calculate the apparent magnitude from the averaged flux density. To do this we use the SpecAnalsysis function calc_apparent_mag_from_fluxden. It takes the averaged flux density as the first argument and the central observed dispersion (wavelength or frequency) of the flux density as arguments. Note that the dispersion value should be a quantity (astropy.Quantity).
[8]:
abmag = scana.calc_apparent_mag_from_fluxden(
fluxden_1450,
1450*(1.+fit.redshift)*units.AA)
print('Apparent AB magnitude at 1450A: ', abmag)
Apparent AB magnitude at 1450A: 17.761599161710915 mag
Calculating the absolute monochromatic AB magnitude
From here we can calculate the sources AB magnitude at 1450A in three different ways: 1. Calculate the absolute magnitude from the the apparent magnitude 2. Calculate the absolute magnitude from the flux density 3. Calculate the absolute magnitude from the monochromatic luminosity
Let’s briefly go through all three possibilities.
Calculate the absolute magnitude from the the apparent magnitude
We calculated the apparent magnitude above. Now we only need to convert it to the absolute magnitude. In this step we need to specify the cosmology as well as to indicate how the flux should be corrected due to the change of the filter bandpass - the K-correction. For monochromatic magnitudes this is simply a scaling factor of (1+z) in flux.
We use the SpecAnalysis function calc_absolute_mag_from_apparent_mag, which takes the apparent magnitude as the first argument, the cosmology (astropy.Cosmology) as the second argument and the redshift as the third argument. At present the function only allows to add the kcorrection for spectra with a power-law type continuum (power law index a_nu).
Note:In the case of monochromatic magnitudes, the K-correction is specified by setting the kcorrection keyword argument to True and the power law slope to a_nu=0, independent of the source’s continuum shape. (Incidentally these are the default values.)
(For apparent to absolute magnitude conversions for bandpass magnitudes and non-power law continua, you can still use this function setting kcorrection=False and then apply the appropriate K-correction factor in magnitudes yourself.)
[9]:
abs_abmag = scana.calc_absolute_mag_from_apparent_mag(abmag, cosmo,
fit.redshift,
kcorrection=True,
a_nu=0)
print('Absolute magnitude at 1450 (from apparent magnitude): ', abs_abmag)
Absolute magnitude at 1450 (from apparent magnitude): -27.889171135994392 mag
Calculate the absolute magnitude from the monochromatic luminosity
We do not need to calculate the apparent monochromatic magnitude to get to the absolute monochromatic magnitude. We can directly compute this from the flux density at 1450A using the SpecAnalysis.calc_absolute_mag_from_fluxden function.
However, the function goes through the same steps as we did above. Therefore, we also need to specify the K-correction and power law slope keywords on top of the monochromatic flux density (first argument), the observed dispersion (second argument), the cosmology (third argument), and the redshift (fourth argument).
[10]:
abs_abmag2 = scana.calc_absolute_mag_from_fluxden(
fluxden_1450, 1450*(1.+fit.redshift) * units.AA,
cosmo, fit.redshift, kcorrection=True, a_nu=0)
print('Absolute magnitude at 1450 (from monochr. flux density): ', abs_abmag2)
Absolute magnitude at 1450 (from monochr. flux density): -27.889171135994392 mag
Calculate the absolute magnitude from the monochromatic luminosity
We already calculated the monochromatic luminosity above. Of course we can directly calculate the absolute magnitude from the monochromatic luminosity. In the SpecAnalysis module the function calc_absolute_mag_from_monochromatic_luminosity does that for you. You specify the monochromatic luminosity and the corresponding rest-frame wavelength value as the first and second arguments. The cosmological corrections were already applied, when calculating the monochromatic luminosity above.
[11]:
abs_abmag3 = scana.calc_absolute_mag_from_monochromatic_luminosity(lum_mono, 1450*units.AA)
print('Absolute magnitude at 1450 (from monochr. luminosity): ', abs_abmag3)
Absolute magnitude at 1450 (from monochr. luminosity): -27.88917113599439 mag
As you can see all three functions to calculate the absolute magnitude lead to the same value of ~-27.9 mag.
Analyzing line properties
We now turn to calculate line properties. In our example, we will focus on the CIV emission line of the example quasar spectrum. We modeled the CIV line with two Gaussian components and stored the model flux in a SpecOneD object, called civ_spec. Let’s first check if the model flux looks reasonable.
[12]:
# Plot the CIV model flux spectrum, adjusting the y-axis limits
civ_spec.plot(ymin=0, ymax=20)
The model flux specturm look reasonable, so we can continue!
The peak flux density
In order to calculate the peak flux density, we can rely on the numpy package:
[13]:
civ_peak_fluxden = np.max(civ_spec.fluxden)*civ_spec.fluxden_unit
print('CIV peak flux density: {:.2e}'.format(civ_peak_fluxden))
CIV peak flux density: 1.69e-16 erg / (Angstrom cm2 s)
The peak redshift
Although this calculation is quite simply, we have decided to add this functionality to the SpecAnalysis module with the get_peak_redshift function. It requires the line model spectrum and the rest-frame wavelength of the feature.
[14]:
civ_z = scana.get_peak_redshift(civ_spec, 1549.06)
print('CIV peak redshift: {:.3f}'.format(civ_z))
CIV peak redshift: 3.210
The line Full Width at Half Maximum (FWHM)
For line models with a single Gaussian component, the FWHM can be directly retrieved from the model function. However, for composite lines it is more difficult to define and then calculate a FWHM. The SpecAnalysis implementation for calculating the FWHM get_fwhm, follows the simplest definition of the FWHM:
It calculates the peak flux density and then sets up a spline interpolation subtracting half of the peak flux density from the model spectrum. If the line model flux is well defined the resulting spline should have exactly two roots (model flux = 0). The function returns the dispersion difference between the two roots. If the line feature has multiple components more or less than two roots can be found in which case a np.NaN value will be returned.
Correction for spectral resolution: The keyword argument resolution allows to specify the spectral resolution in R = Lambda/Delta Lambda. If the resolution value is not None, the spectral resolution will be subtracted from the FWHM of the line feature (assuming FWHM_corr^2 = FWHM^2 - Resolution_km_s^2). If you specify the resolution, an info message will let you know that the function has corrected the FWHM for it.
[15]:
# Calculate the CIV FWHM
civ_fwhm = scana.get_fwhm(civ_spec)
print('CIV FWHM: {:.2f}'.format(civ_fwhm))
# Calculate the CIV FWHM, taking into account a spectral resolution of R=1000
civ_fwhm = scana.get_fwhm(civ_spec, resolution=1000)
print('CIV FWHM (accounting for spectral resolution): {:.2f}'.format(civ_fwhm))
CIV FWHM: 6351.97 km / s
[INFO] FWHM is corrected for the provided resolution of R=1000
CIV FWHM (accounting for spectral resolution): 6344.89 km / s
Additionally, there are two different methods for calculating the FWHM from the model spectrum. The default method ‘spline’ uses a spline to interpolate the original spectrum and find the zero points using a root finding algorithm on the spline. The second method ‘sign’ finds sign changes in the half peak flux subtracted spectrum. Their results may differ depending on the dispersion resolution. From an initial test it seems that the computational cost of both methods is similar.
[16]:
civ_fwhm = scana.get_fwhm(civ_spec)
print('CIV FWHM ("sign" method): {:.2f}'.format(civ_fwhm))
civ_fwhm = scana.get_fwhm(civ_spec, method='sign')
print('CIV FWHM ("spline" method): {:.2f}'.format(civ_fwhm))
CIV FWHM ("sign" method): 6351.97 km / s
CIV FWHM ("spline" method): 6350.92 km / s
The integrated line flux
The integrated line flux is easily calculated by the get_integrated_flux function of the SpecAnalysis module. By default the line model spectrum will be integrated over its full length. However, you can specify the disp_range keyword argument, setting the integration boundaries in units of the dispersion axis manually.
[17]:
civ_flux = scana.get_integrated_flux(civ_spec)
print('CIV integrated flux: {:.2e}'.format(civ_flux))
CIV integrated flux: 2.97e-14 erg / (cm2 s)
The integrated line luminosity
In a similar fashion you can calculate the integrated line luminosity. In addition to the line model spectrum, the function takes the source redshift and the cosmology as the second and third argument.
[18]:
civ_line_lum = scana.calc_integrated_luminosity(civ_spec,
fit.redshift,
cosmo)
print('CIV integrated line luminosity: {:.2e} '.format(civ_line_lum))
CIV integrated line luminosity: 2.74e+45 erg / s
The line equivalent width (observed-frame/rest-frame)
An important property of an emission or absorption feature is its equivalent width. For this calculation we need both the continuum model flux (cont_spec) and the line model flux (civ_spec). In order to calculate the rest-frame equivalent width for extragalactic sources the redshift keyword also needs to be specified. In the SpecAnalysis module the get_equivalent_width function calculates the equivalent width. For our example we use the CIV redshift that we determined above in this calculation. If we don’t specify the redshift, the function returns the observed-frame equivalent width.
[19]:
# Calculate the rest-frame equivalent width
civ_ew = scana.get_equivalent_width(cont_spec, civ_spec, redshift=civ_z)
print('CIV EW (rest-frame): {:.2f}'.format(civ_ew))
# Calculate the observed-frame equivalent width
civ_ew = scana.get_equivalent_width(cont_spec, civ_spec)
print('CIV EW (observed-frame): {:.2f}'.format(civ_ew))
CIV EW (rest-frame): 33.38 Angstrom
CIV EW (observed-frame): 140.51 Angstrom
Non-parametric measurements
Furthermore we provide a range of non-parametric measurements for emission line features. These are measurements of the fraction of cumulative flux in velocity space. The redshift and rest-frame wavelength of the emission line define the velocity zero point. Negative velocities indicate flux blueward of the line and positive velocities indicate flux redward of the line.
In the current implementation the velocities at 5%, 10%, 50%, 90% and 95% of the cumulative flux fraction are calculated. The calculation also returns the mean resolution at 50% of the cumulative flux fraction as an indication for the uncertainty introduced by the spectral resolution.
From the median velocity (velocity at 50% of the cumulative flux fraction) we can derive its frequency, wavelength and redshift, which are all included in this analysis function.
The dispersion range keyword argument can be used to supply the physical dispersion limits in which the analysis should be executed.
The non-parametric measurements are NOT included in the default line measurements (scana.emfeat_measures_default) for the high-level analysis function (see below). Specifically for the analysis of resampled results or MCMC chains the non-parametric measurements are more computationally expensive.
[20]:
# Use the emission feature analysis function to analyze the CIV line
civ_result = scana.analyze_emission_feature(
fit, 'CIV', ['CIV_A_', 'CIV_B_'], 1549.06, cont_model_names=['PL_'],
redshift=fit.redshift, emfeat_meas=['nonparam'], cosmology=cosmo)
# Print the results from the dictionary
for key in civ_result.keys():
print('{} = {:.2e}'.format(key, civ_result[key]))
CIV_v50 = -1.24e+03 km / s
CIV_v05 = -8.37e+03 km / s
CIV_v10 = -6.35e+03 km / s
CIV_v90 = 3.89e+03 km / s
CIV_v95 = 5.92e+03 km / s
CIV_vres_at_line = 6.88e+01 km / s
CIV_freq_v50 = 4.60e+14 Hz
CIV_wave_v50 = 6.52e+03 Angstrom
CIV_redsh_v50 = 3.21e+00
High-level SpecAnalysis routines
We have written high-level SpecAnalysis routines that automatically calculate a range of continuum and line properties for you using the functions described above.
SpecAnalysis.analyze_continuum
The analyze_continuum routine allows for automatic continuum analysis. It takes four important arguments: * the SpecFit object * a list of model prefix names that make up the continuum model * a list of rest-frame wavelengths (float) for which fluxes, luminosities and magnitudes should be calculated * the cosmology (astropy.Cosmology)
The most important keyword argument is cont_meas, which stands for continuum measurements. The full list of continuum measurements available in the SpecAnalysis module is:
[21]:
print(scana.cont_measures_default)
['fluxden_avg', 'Lwav', 'appmag', 'absmag']
By default all of these will be calculated. For the full list of keyword arguments, please directly consult the documentation.
The function returns a dictionary with the results.
In the following example, we will analyze the continuum of the example spectrum at rest-frame wavelengths of 1450A (as above) and 1280A.
[22]:
# Define Cosmology for cosmological conversions
cosmo = FlatLambdaCDM(H0=70, Om0=0.3, Tcmb0=2.725)
# Import the saved example spectrum
fit = scfit.SpecFit()
fit.load('../example_spectrum_fit')
# Use the continuum analysis function
cont_result = scana.analyze_continuum(fit, ['PL_'],
[1450, 1280],
cosmo, width=10)
# Print the results from the dictionary
for key in cont_result.keys():
print('{} = {:.2e}'.format(key, cont_result[key]))
1450_fluxden_avg = 2.28e-16 erg / (Angstrom cm2 s)
1450_Lwav = 8.86e+43 erg / (Angstrom s)
1450_appmag = 1.78e+01 mag
1450_absmag = -2.79e+01 mag
1280_fluxden_avg = 2.64e-16 erg / (Angstrom cm2 s)
1280_Lwav = 1.03e+44 erg / (Angstrom s)
1280_appmag = 1.79e+01 mag
1280_absmag = -2.78e+01 mag
SpecAnalysis.analyze_emission_feature
Disclaimer:At this point we have only implemented an automatic high-level analysis for emission features. A more general function for both absorption and emission lines or, alternatively, a separate function for absorption lines is on our To-Do list.
In similar fashion to the analyze_continuum function above, analyze_emission_feature takes four important arguments: * the SpecFit object * the name of the emission feature, which will be used to name the resulting measurements in the output dictionary * a list of model names to create the emission feature flux from * the rest-frame wavelength of the emission feature
The cosmology is a keyword argument for this function (cosmology, astropy.Cosmology). Another important keyword argument is emfeat_meas, which stands for emission feature measurements and is a list of strings. The full list of possible emission feature measurements (and the default value) is:
[23]:
print(scana.emfeat_measures_default)
['peak_fluxden', 'peak_redsh', 'EW', 'FWHM', 'flux', 'lum']
For a full list of all available keyword arguments, please directly consult the documentation of the SpecAnalysis module.
In the following example we will repeat our analysis of the CIV line from above. Note, that in order to calculate the equvialent width we also need to specify the cont_model_names to generate the continuum model flux.
[24]:
# Use the emission feature analysis function to analyze the CIV line
civ_result = scana.analyze_emission_feature(
fit, 'CIV', ['CIV_A_', 'CIV_B_'], 1549.06, cont_model_names=['PL_'],
redshift=fit.redshift, emfeat_meas=None, cosmology=cosmo)
# Print the results from the dictionary
for key in civ_result.keys():
print('{} = {:.2e}'.format(key, civ_result[key]))
CIV_peak_fluxden = 1.69e-16 erg / (Angstrom cm2 s)
CIV_peak_redsh = 3.21e+00
CIV_EW = 3.32e+01 Angstrom
CIV_FWHM = 6.35e+03 km / s
CIV_flux = 2.97e-14 erg / (cm2 s)
CIV_lum = 2.74e+45 erg / s


Demonstrates an Ext JS store and model with a WAMP proxy. Create, update and delete operations are broadcasted to all connected clients.
This is the sample application from portal-java.
Copy of the Smoothie Charts Server Load Example. In this example the server generates the random data every second and sends it to the connected clients.
Server sends periodically coordinates to the connected clients that moves two car icons on a google maps.
Port of the WebSocket snake demo included in the Tomcat (7 and 8) distribution.
Shows received and sent bytes of this server network interface. Port of the pesarkhobeee/Realtime-Bandwidth-Grapher project.
This is a port from a Ext JS/Sencha Touch/Node.js sample application published on this blog: http://www.bryntum.com/blog/under-the-hood-of-the-socket-io-express-example/.
Translates ip addresses from the Apache access log from this server to latitude/longitude with the help of GeoCityIP and visualizes them on a world map. This example is based on maptail and mape's wargames.
Gauges from the ECharts library that are updated from the server.
Port of a Haskell websocket sample application with AngularJS and D3.js. https://github.com/eigengo/hwsexp
Reading and displaying data from the Earthquake Hazards Program. Simplified port of the si-spring-websockets application. This demo does not use Spring Integration and RabbitMQ. Instead the polling to earthquake.usgs.gov is done with a simple scheduled spring bean method and the last result is stored in memory.


★ On Github Demo
With Vex, you can customize everything:
All options can be configured for all dialogsor on a per-dialog basis.
This dialog is using the "Wireframe" theme by simply passing the option cssClass: "vex-theme-wireframe".
cssClass: "vex-theme-wireframe"
Click the arrow to see the "Operating System" theme.
This theme is great when using vex to replace alert, confirm, and prompt.
alert
confirm
prompt
Alert Confirm Prompt Login
Help us spread the word:


| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| contracts/ | 98.84% | 170/172 | 83.33% | 55/66 | 97.14% | 34/35 | 98.84% | 171/173 | |
| contracts/bancorx/ | 95.12% | 78/82 | 85% | 34/40 | 96% | 24/25 | 95.4% | 83/87 | |
| contracts/bancorx/interfaces/ | 100% | 0/0 | 100% | 0/0 | 100% | 0/0 | 100% | 0/0 | |
| contracts/converter/ | 94.72% | 700/739 | 86.26% | 157/182 | 75.19% | 100/133 | 93.61% | 571/610 | |
| contracts/converter/interfaces/ | 100% | 0/0 | 100% | 0/0 | 0% | 0/4 | 100% | 0/0 | |
| contracts/crowdsale/ | 92.31% | 24/26 | 81.25% | 13/16 | 86.67% | 13/15 | 90.91% | 30/33 | |
| contracts/helpers/ | 96.3% | 52/54 | 60% | 6/10 | 94.29% | 33/35 | 96.77% | 60/62 | |
| contracts/token/ | 100% | 61/61 | 81.82% | 18/22 | 100% | 27/27 | 100% | 64/64 | |
| contracts/token/interfaces/ | 100% | 0/0 | 100% | 0/0 | 0% | 0/13 | 100% | 0/0 | |
| contracts/utility/ | 98.85% | 86/87 | 90% | 45/50 | 100% | 36/36 | 98.94% | 93/94 | |
| contracts/utility/interfaces/ | 100% | 0/0 | 100% | 0/0 | 0% | 0/1 | 100% | 0/0 |


System Architect Picture "Classification System"
Parent Diagram:
Knowledge Concept
(OMT Object Model)


2 Chronicles 13:15
Then the men of Judah gave a shout: and as the men of Judah shouted, it came to pass, that God smote Jeroboam and all Israel before Abijah and Judah.


FUNDING FOR ORGANISATION
First Name
Middle Name
Last Name
Amount you want to invest
Card Details
CVV
Expiry Date
Reason you want to invest
Designation
Currently working in
Email
Password
Sign in


Public Bio-Database
Welcome to BioDB, where we store biometric data for the public
Login
Register
About
Contact


11.2.18 Program State
current_atom(
?A)
- backtrack through all atoms
current_module(
?M)
- M is the name of a current module
current_module(
?M,
?F)
- F is the name of the file in which M's module
declaration appears
current_predicate(
:A/
?N)
ISOcurrent_predicate(
?A,
:P)
- A is the name of a predicate with most general goal P
and arity N
current_prolog_flag(
?F,
?V)
ISO- V is the current value of Prolog flag F
listing
- list all dynamic procedures in the type-in module
listing(
:P)
- list the dynamic procedure(s) specified by P
predicate_property(
:P,
?Prop)
- Prop is a property of the loaded predicate P
prolog_flag(
?F,
?V)
- V is the current value of Prolog flag F
prolog_flag(
+F,
=O,
+N)
- O is the old value of Prolog flag F; N is the new
value
prolog_load_context(
?K,
?V)
- find out the context of the current load
set_module(
+M)
- make M the type-in module
set_prolog_flag(
+F,
+N)
ISO- N is the new value of Prolog flag F
source_file(
?F)
- F is a source file that has been loaded into the database
source_file(
:P,
?F)
- P is a predicate defined in the loaded file F
unknown(
-O,
+N)
development- Changes action on undefined predicates from O to N.
Send feedback on this subject.


Coding for fun - AT&T signal levels on route from DC to Snowshoe, WV
We go the Snowshoe ski resort almost every weekend when there is snow. Driving there takes up to 5 hours. As long as you drive off the interstate you loose your cell signal.
Last year we had to learn how to drive and communicate in a disconnected world. We now know the route by heart, we know stops, we know which restaurants or gas stations have Wi-Fi. We also got some low-power FRS radios to have more flexibility during our trips.
Honestly, I was always wondering why T-Mobile was so bad in this area. This spring I switched to AT&T to compare the coverage on Outer Banks (where T-Mobile is also failing to get you even basic coverage). Now it`s winter and it’s time to check out AT&T coverage in our favorite skiing area.
Let’s see how we do that and what we find
Why
As the article says, point is get some code just for fun. And see, if switching from T-Mobile to AT&T makes any sense. And see, maybe there is a reason why we have almost no coverage off the interstates.
Technical details
So, I had macbook with OS X and Windows 10, iPhone 6 and Lumia 950 and Lumia 925. First idea was to have Lumia 950 with AT&T and Lumia 925 with T-Mobile run same app along the route and then compare results. Unfortunately, I forgot my USB C cable so 950 died on the way there. So plan changed and I got an iOS app and did a AT&T cellular network signal level log on the way back.
Interesting that iOS has no public API to get cellular service signal level. There was some way in iOS 4.2 days VAFieldTest. Doesn’t work now. However, there is a way to get a signal level on iOS 9 devices. Kind gentleman shared the idea on Stack Overflow: Measuring cellular signal strength
That was enough for the first version.
You can get the app from github - github.com/alexsorokoletov/SignalLogger. App tracks GPS and signal level every 10 seconds, while tracking screen stays active, all results are exported to CSV and emailed to you after you stop tracking. Keep it simple.
Results
Gist with raw CSV data: DC to Snowshoe ATT signal strength data.csv
Using QGIS I was able to get the results on the map:
This is a complete route from DC to Snowshoe, WV with AT&T signal level. Green - available, red - unavailable. I have no idea yet how to make the route colorful with orange where the signal is low and green where it is good.
Part of the route where the service is available.
Part of the route where the service is not available.
And also a terrain based part of the map where the AT&T service is interrupted.
Looks like the rule for the AT&T service is simple. Inside park areas (forests, national and state parks - green on the terrain map) service is absent. Otherwise AT&T gives some coverage.
I was surprised to find out that the coverage is not actually related to the US NRQZ area or distance to the Green Bank Radio Observatory. One can get some details about that in the NPR article Enter The Quiet Zone: Where Cell Service, Wi-Fi Are Banned
Next steps
Next time we go to the Snowshoe resort, I’m going to get T-Mobile coverage results and then compare and see if it makes sense to have one or another.
Thoughts
-
What is wrong with Apple not providing API for cellular service signal strength?
I guess it would benefit if Apple would be more open in terms of APIs available.
-
There are interesting ways of getting data through private Apple APIs and from private UIView classes Get an object properties list in Objective-C and CoreTelephony.h file
These ways will stop your app from being published in the App Store, but for experiments like this are good alternative.
-
Let’s see if Microsoft is more open with cellular
Probably, there are different ways to access this data just because MS had different API sets for WP7, WP8, WinRT (WPA81) and Windows 10 UWP. Let’s see who is the winner.
-
I want to render same data in the Microsoft Power BI. Presumably, this is the kind of tasks to be handled by the Power BI.
If you liked this post, you can share it with your followers or follow me on Twitter!


The sample shows how to implement setTimeOut() function in Jint and is my first step at building a layer around Jint, to execute JavaScript program in background in relation with a UI (Windows WinForm and iOS UI).
The purpose of class AsyncronousEngine is to * Wait script in a background thread * Allow communication with the UI and UI Controls * Execute __setTimeout__ call back
Frederic Torres 2014
MIT


Before Change
This method resolves the index to the actions name.
if domain.num_actions <= index or index < 0:
raise IndexError(
"Cannot access action at index {}. "
"Domain has {} actions."
"".format(index, domain.num_actions)
)
return action_for_name(domain.action_names[index], domain, action_endpoint)
After Change
index.
if domain.num_actions <= index or index < 0:
raise IndexError(
f"Cannot access action at index {index}. "
f"Domain has {domain.num_actions} actions."
)
return action_for_name(domain.action_names[index], domain, action_endpoint)