path

Is there an easier way to pop off a directory from boost::filesystem::path?

I have a relative path (e.g. "foo/bar/baz/quux.xml") and I want to pop a directory off so that I will have the subdirectory + file (e.g. "bar/baz/quux.xml"). You can do this with path iterators, but I was hoping there was something I was missing from the documentation or something more elegant. Below is the code that I used. #include ...

Php - troubles with files paths

Hello, i can't understand one thing. In code, for example: $filePath = 'http://wwww.server.com/file.flv'; if( file_exist($filePath) ) { echo 'yes'; } else { echo 'no'; } Why does script return 'no', but when i copy that link to the browser it downloads? ...

Django: serving ADMIN media files

Hi all, I've been successfully serving media files for the normal MEDIA files, but when I tried serving admin media files, I failed. please kindly help me locating the problem, as I've tried to troubleshoot the problem for several hours already with no luck (been googling too and read the django doc about serving static files as well). ...

Windows std::ifstream::open() problem

I know there's been a handful of questions regarding std::ifstream::open(), but the answers didn't solve my problem. Most of them were specific to Win32, and I'm using SDL, not touching any OS-specific functionality (...that's not wrapped up into SDL). The problem is: std::ifstream::open() doesn't seem to work anymore since I've switche...

how can I strip the filename from a path in tcsh?

Given this variable in tcsh: set i = ~/foo/bar.c how can I get just the directory part of $i? ~/foo ...

How does os.path map to posixpath.pyc and not os/path.py?

What is the underlying mechanism in Python that handles such "aliases"? >>> import os.path >>> os.path.__file__ '/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/posixpath.pyc' ...

Platform-independent version of /var/lib and ~/.config

We see that programs like apt-get store information in several places: /var/cache/apt <- cache /var/lib/apt <- keyrings, package db, states, locks, mirrors /etc/apt <- configuration file ~/.aptitude/config <- user configuration file So we see four kinds of paths here: Cache path Data path System-wide configur...

Komodo Edit Changes Python sys.path If you "Show in Explorer"

I am using Komodo Edit, a code editor. When I right click on projects and click "Show in Explorer", it will pop up a box just like Windows Explorer at the directory my project is. This is very convenient. However, I noticed an insidious side effect. When you try to run a python file with this window that looks exactly like Windows Expl...

os.path.basename works with URLs, why?

>>> os.path.basename('http://example.com/file.txt') 'file.txt' .. and I thought os.path.* work only on local paths and not URLs? Note that the above example was run on Windows too .. with similar result. ...

(Rails) How do I reference resources from non-restful views...?

Hi All, How do you ensure that your javascript includes get included properly for all files everywhere using a particular layout? Basically I have some non-restful actions that I've added. I haven't added any ROUTES for them, however, using normal text rendering works fine. It's when I start requiring different "swf" and "js" files (...

DRY - Question about paths and urls from a string or model object

I know how to get paths and urls no problem (eg. new_color_path for the Model Color) but what if I am trying to create a partial that can be used for multiple models and I still nee the "new_***_path" or one of the others? Is it possible to generate the url from a model object? ...

How do I tell a Python script (cygwin) to work in current (or relative) directories?

I have lots of directories with text files written using (g)vim, and I have written a handful of utilities that I find useful in Python. I start off the utilities with a pound-bang-/usr/bin/env python line in order to use the Python that is installed under cygwin. I would like to type commands like this: %cd ~/SomeBook %which pythonU...

bash/cygwin/$PATH: Do I really have to reboot to alter $PATH?

I wanted to use the Python installed under cygwin rather than one installed under WinXP directly, so I edited ~/.bashrc and sourced it. Nothing changed. I tried other things, but nothing I did changed $PATH in any way. So I rebooted. Aha; now $PATH has changed to what I wanted. But, can anyone explain WHY this happened? When do cha...

To understand Typeset for PythonPath

One recommends me the following code apparently only in .zshrc without explaining its purpose clearly. typeset -U PYTHONPATH I am interested in how you can use the code in .bashrc. My Bash goes upset about the command. How can you use the command in Bash? ...

Can you disable UNC paths in Windows?

We are trying to lock down a Terminal Server, and want to remove a commercial package's ability to accept UNC file paths, ie. paths in the app can then only be entered using the windows drive letters. Is there any way to do this in Windows? Can we disallow UNC paths for just the app? Can we disallow UNC paths for the entire Terminal S...

WPF Path vs Image png jpg..

Consider a Button composed of many graphical elements (and Path) drawn on Canvas. Why is it better to use the Path and other elements to build an image in that Button than assigning a custom Bitmap to it? I know one advantage, "the path is a vector image". But if I'm not planning to zoom, why should I use it in place of my custom .png,...

How can I get a list of programs in my path from Perl?

How can I list all available UNIX commands from Perl? ...

Stretching a XAML Path to fill its containing element

I have a ControlTemplate with some Paths in it. I would like the Paths to stretch and fill the control they are in, such as a Button. How can I do this? What I have currently looks like this: <ControlTemplate x:Key="SomeTemplate" TargetType="Button"> <Canvas Background="AliceBlue"> <Path Data="M 99.5,50 A 49.5,49.5 0 1 1 0....

php access network path under windows

Hey there! within PHP (XAMPP) installed on a Windows XP Computer Im trying to read a dir which exists on a local network server. Im using is_dir() to check whether it is a dir that I can read. In Windows Explorer I type \\\server\dir and that dir is being shown. When I map a network drive a can access it with z:\dir as well. In PHP I...

Forced to use inconsistent file import paths in Python (/Django)

Hi I've recently been having some problems with my imports in Django (Python)... It's better to explain using a file diagram: - project/ - application/ - file.py - application2/ - file2.py In project/application/file.py I have the following: def test_method(): return "Working" The problem occurs in proj...