path

jQuery: Check if image exists

Hi there I'm loading an image path via jQuery $.ajax and before showing the image I'd like to check if it in fact exists. Can I use the image load/ready event or something similar to determine that the file path is valid? Having .myimage set to display: none, I'm hoping to do something like $(".myimage").attr("src", imagePath); $(".m...

Understanding *nix icons' paths

Could someone please explain, why many programs have their icons' paths this way: /usr/share/program/icons/hicolor/16x16/... What I don't understand is why hicolor and why 16x16, 32x32 etc. Are there any functions (e.g. in GTK) that automatically get the proper icon from such kind of paths? Thank you! ...

How to determine the directory in which a running Haskell script or application lives?

I have a Haskell script that runs via a shebang line making use of the runhaskell utility. E.g... #! /usr/bin/env runhaskell module Main where main = do { ... } Now, I'd like to be able to determine the directory in which that script resides from within the script, itself. So, if the script lives in /home/me/my-haskell-app/script.hs...

In a makefile, how to get the relative path from one absolute path to another?

An example to illustrate my question: Top level makefile rootdir = $(realpath .) export includedir = $(rootdir)/include default: @$(MAKE) --directory=$(rootdir)/src/libs/libfoo Makefile for src/libfoo currentdir = $(realpath .) includedir = $(function or magic to make a relative path from $(currentdir) to $(includ...

Migration to new domain

I'm working on a drupal 6 site at mydomain.com/drupalsite, and the designer has put a lot of hardcoded image paths in there, for instance a custom img folder in mydomain.com/drupalsite/img. So a lot of the site uses links to /drupalsite/img/myimg1.png. Here's the problem -- the site is eventually moving to finaldomain.com, via pointing...

PHP: prevent folder hacking - if path has ../ in it?

hey guys, i'm doing a simple thingy in php and i wonder how i can test if the variable $path contains the following structure ../ so i'll simply have a ?path=somepath structure in my url, and if anybody would enter ../ it allows him to go one directory up. I know of course that that's not the best solution, however for my little thingy ...

$PATH variable not properly set in gvim/MacVim when it is opened from the finder

I am using MacVim (basically gvim for the mac). If I open macvim from the command line then my $PATH variable will be properly set. If I open macvim via point and click with the finder, the $PATH variable will NOT be properly set. Can anyone give me some insight? Note: I know at least part of my path is set in ~/.bashrc, but ...

How to achieve 'donut holes' with paths in Raphael

I'd like to draw a shape which has holes in it such that I can fill the shape it and not have the holes filled with that colour (leave them transparent). According to the W3 path spec: Compound paths (i.e., a path with multiple subpaths) are possible to allow effects such as "donut holes" in objects. Can somebody please give a ve...

PHP using dirname(__FILE__) on non-dedicated server?

Hi, What I trying to do is to define a constant variable in a config file: DEFINE("PATH", dirname(__FILE__) . "/"); So that, when I want to "include" or redirect, I could do this: include(PATH . "filename.php"); or header("location: " . PATH . "logout/php"); But when I try doing an echo of PATH, I get this result: /home/myDOMA...

Is there a better way to hold a file path than in a string?

I am making a command line utility. I need to pass around a few file paths in the program. Right now I am just using string. But I was wondering if the .net library had a cool class for passing around file paths. ...

Match a user drawn path to an image

Does anyone know of any tutorials or sample code that could help me achieve the following in an iPhone app (other than the offical Apple developer videos). A user draws a path on screen The path is compared to an already existing path to see if it matches A match is determined not just by shape but also by starting and ending at the co...

JMeter Extracting an attribute from a root element with a namespace

Hi, I'm using JMeter and have the following XML which I need to extract the Id from. <Customer xmlns="http://services.test.test" Id="001"> .... <Customer> I want to extract 001 from the Id. I'm using JMeter XPath Extractor and so far I have tried... /Customer@Id and /Customer/@Id What am I missing?? Thanks ...

calling audio in tableview from core data

i'd like to have the user tap a cell in the tableview and hear audio. the information for the cell is loaded from core data, so i'm assuming i put the path to the audio file in core data as an attribute with type 'string'. i am completely lost as to where to go from here. how do i call the path? after a lengthy search, i haven't found ...

zend framework under document root in subdir

Hi, I developed a application with Zend Framework and now I want to be able to place the app in an subdirectory of a Documentroot. e.g. http://www.example.com/myapp/ I read quite a lot of Docu how this could work, but all in all these solutions don´t fit my needs. Is there a trivial way to do the subdir thing, without adding the concre...

How To Convert a Bitmap to a Collection of Paths in WPF (in code not XAML)

I have an occupancy grid that has 3 states - Occupied, Free, Unknown. Occupancy grid is a simple 2 dimensional array of states. The grid represents a floor plan where Occupied=Wall, Free=Open Floor, Unknown=what's behind the wall or not mapped. This grid is say 800x800 wide with each cell representing 5cm of the real world. I want to...

Why some professional web designers use absolute paths instead of relative paths (e.g for CSS, Javascript, images, etc.)?

I used to think that everyone used relative paths (e.g. /styles/style.css). But I wonder why some popuar web designers (e.g. http://www.getfinch.com and http://31three.com/) use absolute paths (http://example.com/styles/style.css). So basically I'm asking why some professional designers are using absolute paths instead of relative paths...

VirtualPathUtility.ToAbsolute("~/") giving wrong Application Path

Running a site through XENU (a link checker) I noticed it thought some pages on my site were external, so didnt follow them. It turns out the url I had started at was http://localhost/webTest/, however System.Web.VirtualPathUtility.ToAbsolute("~/") returns http://localhost/WebTest/, when I need it to always return http://localhost/webT...

Zend Framework Chained routes - getMatchedPath

I have several chained routes that handle the multi-lingual feature of my site. Sample: $languageRoute = new Zend_Controller_Router_Route_Regex('(de|en|es|fr|it|ja|ko|pt|ru|zh)', array(1 => 'en',), array(1 => 'language'), '%s' ); $defaultRoute = new Zend_Controller_Router_Route('*', array('module' => 'default', 'controller' => 'p...

Why does DistributedCache mangle my file names.

Hi I have a weird problem, DistributedCache appears to change the names of my files, it uses the original name as the parent folder and adds the file as a child. i.e. folder\filename.ext becomes folder\filename.ext\filename.ext Any ideas, my code is below. Thanks Akintayo String paramsLocation="/user/fwang/settings/ecgparams.txt"; D...

How to handle undecodable filenames in Python?

I'd really like to have my Python application deal exclusively with Unicode strings internally. This has been going well for me lately, but I've run into an issue with handling paths. The POSIX API for filesystems isn't Unicode, so it's possible (and actually somewhat common) for files to have "undecodable" names: filenames that aren't e...