Tag Archive for path

Find absolute path of Bash script

abspath="$(cd "${0%/*}" 2>/dev/null; echo "$PWD"/"${0##*/}")"

source

getting current filename physical path

<!--- Get expanded path of the BASE path. --->
<cfset strPath = ExpandPath( "./" ) />

<!--- Get the expanded path of the CURRENT template path. --->
<cfset strPath = GetDirectoryFromPath(	GetCurrentTemplatePath()) />

source

Create a textfile listing all paths to a certain file or wildcard.

Function writeAllPaths([string]$fromFolder,[string]$filter,[string]$printfile) {
Get-ChildItem -Path $fromFolder -Recurse $filter | Select-Object -Property FullName > $printfile
}

source

Set Linux environment variables JAVA_HOME & PATH globally using /etc/profile

export JAVA_HOME=/usr/lib/jvm/default-java/jre
export PATH=$JAVA_HOME/bin:$PATH

source

get absolute server path

$serverPath = dirname(__FILE__);

include($serverPath . "/includes/someFile.php");

source

Filtering the Find command

find . ! -name "*constants.sass" ! -path "*landing_page*" -name "*sass"

source

AS Flash Lite1.1 MCのダイナミックテキストにテキストを送る

// root以下にbox_mcを配置して、その中に変数=numdisplayのダイナミックテキストを配置
tellTarget("/box_mc"){
numdisplay = /:collectionLabel add ": " add /:currentImage;
}

source

Parse html via RegularExpression and place results in Array

using System.Text.RegularExpressions;

//looking for photo paths with REGX-a
string nl = // in this case page html.
MatchCollection mc = null;
string sRegExp = "src=(?:"|')?(?<imgSrc>[^>]*[^/].(?:jpg|bmp|gif|png))(?:"|')?";
mc = Regex.Matches(nl, sRegExp);

string[] path;
for (int j = 0; j < mc.Count; j++)
{
path = mc[j].Value.Split('"');
Response.Write(path[1].ToString().Trim() + "<br />");
}

source

Get the full URL of current document

// Returns the full URL of the current document.
function getCurrentUrl()
{
// Checks scheme.
$url = ($_SERVER['HTTPS'] == 'on') ? 'https://' : 'http://';
// Checks port.
$url .= ($_SERVER['SERVER_PORT'] != '80') ? $_SERVER['SERVER_NAME'].':'.$_SERVER['SERVER_PORT'].$_SERVER['REQUEST_URI'] : $_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];

// Returns full URL.
return $url;
}

source

Getting Full URL/Path with ASP

function GetPath()
query_string = request.ServerVariables("QUERY_STRING")
if query_string <> "" then
query_string = "?" & query_string
end if

GetPath = "http://" & request.ServerVariables("SERVER_NAME") & request.ServerVariables("URL") & query_string
end function

source