path

Fullpath in OS X

I am a few steps before starting my first real programming project and I am preparing my machine. I noticed that my fullpath (what I get when I "echo $PATH" in the terminal) does not look like a "normal" one (as I see "usr/bin" quite a lot of times). What does it mean? How does it affect my use of the terminal? And how, if, can I change ...

How to get the relative directory no matter from where it's included in PHP?

If it's Path_To_DocumentRoot/a/b/c.php,should always be /a/b. I use this: dirname($_SERVER["PHP_SELF"]) But it won't work when it's included by another file in a different directory. EDIT I need a relative path to document root .It's used in web application. I find there is another question with the same problem,but no accepted an...

Building a polymorphic model controller path with has_many

I have a polymorphic model Comment that can be related to many types of commentables. in my routs, for example I have: map.resources :newsitems do |news| news.resources :comments end everything is working fine, the only problem is to generate the paths. I've in my views/controller the @commentable item, that i retrieve from a before...

"which in ruby": Checking if program exists in $PATH from ruby

Hiya, my scripts rely heavily on external programs and scripts. I need to be sure that a program I need to call exists. Manually, I'd check this using 'which' in the commandline. Is there an equivalent to File.exists? for things in $PATH? (yes I guess I could parse %x[which scriptINeedToRun] but that's not super elegant. Thanks! yann...

Name of a path containing the complete file name?

For me, a path was always something that "walks the way to something", but without the "something". Like a chicken following bread crumbs until it hits the target. But the target is not part of the path. That's what I believe. So, example: C:/foo/bar = the path. C:/foo/bar/something.html = Path and the "Target". Can someone tell me wh...

How to get the application path at design time in winforms, .net?

If you use Application.StartupPath in a referenced dll, the path points to the path of the IDE. Is there anyway to get the path of the actual application? Just to be clear, this is at design time. ETA: I've posted the solution below: ETA2: Because it's related, I thought i'd post a snippet of another useful design-time service. Lik...

Python os.path is ntpath, how?

Can someone tell me how Python "aliases" os.path to ntpath? >>> import os.path >>> os.path <module 'ntpath' from 'C:\Python26\lib\ntpath.pyc'> >>> ...

How to parse a folder path with spaces in C code

Hello, I'm using this simple C code: char * command = NULL; sprintf (command, "ls %s", folderpath); system(command); The problem is when the folder name has a space in it... I know that in Unix I need to add a "\", for example ls my\ folder\ name How can I get around this ? Thank you! ...

How to get the fully qualified path for a file in VBScript?

I am using the Shell.Application object, which allows me to script creation of a zip file. But in order for this to work, I need to full path of the zip file. File.zip doesn't work. I need c:\the\full\path\file.zip, even if the script is running within the same directory where the file is found. How can I get the full path of a fil...

matlab search path

Hi, I have some questions regarding the MATLAB Search Path. (1) Current directory is in the search paths, but why it is not in the output of "path"? Where can I find the complete search paths? (2) what are all possible ways to add search paths? (3) Considering all possible ways to add search paths (e.g. pathdef.m, startup.m, MATLABPA...

How can I normalize/collapse paths or URLs in Python in OS independent way?

I tried to use os.normpath in order to convert http://example.com/a/b/c/../ to http://example.com/a/b/ but it doesn't work on Windows because it does convert the slash to backslash. ...

ASP.NET MVC and ApplicationPath

Question is about paths and domains: I have an out-of-the box ASP.NET MVC project (generated by "File->New Project"). On LogOn page it does: return Redirect("~/Account/LogOn");. I have a domain name: mycompany.com, and following file structure on the server: /Root /MyApp (this is where my app goes into) Default.aspx ...

C# using static variable as parameter to DeploymentItem

I want to use a static variable as the parameter to DeploymentItem on an MSTest unit test but it doesn't seem I'm able to do so. There's an XSL file that needs to be copied along with the DLL file when the unit test runs, and I defined the location as private static string _xslPath = Path.Combine("MyProjectDir", "transform.xsl"); How...

path of an image in an eclipse project

I'm trying to display two pictures on my JFrame, the way I found was to use icons and JLabels, this seems pretty straightforward and I'm not having problems with this. But when it comes to locating the image I can't get it to work. I'm on a linux machine thus the forwardslash style. I created a folder called pics in my project which is c...

PHP Include Path Problems

Setting the include path is really confusing me. I must be missing something important. So I have the following scripts in the public_html folder of my server. photoGallery.php header.php I have my htaccess file set to redirect a url with the following structure to photoGallery.php RewriteRule ^gallery/([^/]+)/([0-9]+)-([^/...

How to set up Django development environment without installing?

Hi, I'm a student and the lab staff has set up permissions that won't students install software on the machines (or to our profiles). I'm curious how I can develop Django application in a contained environment. I checked out the Django trunk to my Ubuntu home directory and added the bin path to my .bashrc. But when I try to use django-a...

Reduce strings in python to a specific point

I have strings in my python application that look this way: test1/test2/foo/ Everytime I get such a string, I want to reduce it, beginning from the tail and reduced until the fist "/" is reached. test1/test2/ More examples: foo/foo/foo/foo/foo/ => foo/foo/foo/foo/ test/test/ => test/ how/to/implement/this => how/to/imp...

Moved an app on asp.net and suddenly libs are no longer found

I have moved an asp.net from the c:-drive to d (well, I did not move it, but first created a new virtual directory on d:\ and then copied the files over and finally removed the old dir from c:). And I restarted the machine. This worked partially: I can launch aspx-files on the new location, but dependend libararies are no longer found n...

Path.Combine and the dot notation

I'm looking for something akin to Path.Combine method that will help me correctly combine absolute and relative paths. For example, I want Path.Combine(@"c:\alpha\beta", @"..\gamma"); to yield c:\alpha\gamma instead of c:\alpha\..\gamma as Path.Combine does. Is there any easy way of accomplishing this? Needless to say, I also want to ...

What is the best way to determine the path to the ISV directory?

MSCRM 4.0 Problem: I'm currently storing xml files in the ISV directory along with my web applications. From a plugin (or potentially a seperate app), I need to find an easy way to navigate to the ISV directory to read these xml files. This routine will be called extremely often, so processing minimization should be a strong considerat...