<?php //open the current directory $directory = opendir('.'); while ($file = readdir($directory)) { $filenames[] = $file; } foreach ($filenames as $file) { echo "$file<br>"; } ?>
Code
PHP function calculate the distance between two coordinates (latitude, longitude)
function distance($lat1, $lng1, $lat2, $lng2, $miles = true) { $pi80 = M_PI / 180; $lat1 *= $pi80; $lng1 *= $pi80; $lat2 *= $pi80; $lng2 *= $pi80; $r = 6372.797; // mean radius of Earth in km $dlat = $lat2 - $lat1; $dlng = $lng2 - $lng1; $a = sin($dlat / 2) * sin($dlat / 2) + cos($lat1) * cos($lat2) * sin($dlng / 2) * sin($dlng / 2); $c = 2 * atan2(sqrt($a), sqrt(1 - $a)); $km = $r * $c; return ($miles ? ($km * 0.621371192) : $km); }
Dreamweaver Help / Server behaviors, databases, and bindings in Dreamweaver CC
This document addresses queries around server behaviors, the Bindings panel, and databases in Dreamweaver CC released on June 18 2013.
In Dreamweaver CC, server behaviors are available as an extension, Deprecated_ServerBehaviorsPanel_Support.zxp. After you install the extension, the server behaviors feature is enabled and extensions dependent on it work as they did previously.
In the CC release, based on your OS, you can find the extension at the locations below.
- Vista/Windows 7: C:/Program Files (x86)/Adobe/Adobe Dreamweaver CC/Configuration/DisabledFeatures
- Mac OS X: /Applications/Adobe Dreamweaver CC/Configuration/DisabledFeatures
Note:
MXP type extensions are not supported in Extension Manager CC. The MXP format has been replaced with the ZXP extension format.
An MXP extension can be converted to a ZXP extension using the “Convert MXP Extension To ZXP” tool. This tool can be found in the Tools menu in Extension Manager for CS6.
source: http://helpx.adobe.com/x-productkb/policy-pricing/dreamweaver-cc-server-extensions.html
Get(FoundCount) – Filemaker functions
Get(FoundCount)
Purpose
Returns a number that represents the number of records in the current found set.
Format
Get(FoundCount)
Parameters
None
Data type returned
number
Description
If there are multiple windows open in the current database file, each window can have its own found count value, but results are returned for only the foreground window.
If you specify the context for the current calculation, this function will be evaluated based on that context; otherwise, it will be evaluated based on the context of the current window.
Note For information on how functions evaluate differently on the host versus the client, search the FileMaker Knowledge Base available at www.filemaker.com/kb.
Examples
Returns 7 when there are 7 records in the current found set.
Issue report
http://forums.filemaker.com/posts/279a1a7a76
After – FileMaker pro custom functions
NAME
After — extracts text after search string
SYNOPSIS
After ( text ; searchString ; occurrence ; include_1 )
DESCRIPTION
extracts text after search string
Sending ssh connection with Applescript and Terminal.app
tell application "Terminal" activate do script "ssh -2 root@192.168.1.130" -- // write user's password -- // write some linux commands to remote server end tell
CLI essential Linux commands
Find file name
find / -type f -name RRDs.pm
Find folder name
find / -type d -name ‘folder name’
Find text
find /into/this/dir -name ‘*.php’ -print0 | xargs -r -0 grep -l texttofind
Sort file size in reverse order
ls -lSr
Show last rows of file
tail -f filename
Display active process
ps -w | grep spamd
info processor architecture
cat /proc/cpuinfo | grep model
Zip compress
zip -rv file.zip folder_to_zip
unzip -v filename.zip
To extract all members of letters.zip into the current directory only:
unzip -j letters
To test letters.zip, printing only a summary message indicating whether the archive is OK or not:
unzip -tq letters
To test all zipfiles in the current directory, printing only the summaries:
unzip -tq \*.zip