Hi
I need a simple function to create a path in Python where the parent may or may not exist.
From python documentation os.makedirs will fail if one of the parents exists.
I have written the below method as which works by makes as many sub directories as necessary.
Does this look efficient?
def create_path(path):
import os.path...
Hello,
Here is my program:
I'm uploading an image(Stream, FileInfo or whatever you like) to a server at this virtual directory: "C:\_Resources\Assets"
But then, I want the server to return the UNC path of that image to display it in an tag, that is to say "http://localhost/Trunk/Assets/image.jpeg"
In fact, I'm trying to do the opposi...
My current document URL is http: //127.0.0.1/foo and I need to change the value of a cookie for http: //127.0.0.1/bar.
document.cookie is empty because document's URL is foo.
For the moment, I just want to read the cookie value.
Any clue?
...
I am using WiX to install a plugin for a software that I am not controlling. To install the plugin, I have to put the target folder in a registry key:
<Directory Id="TARGETDIR" Name="SourceDir">
<Directory Id="LocalAppDataFolder">
<Directory Id="APPROOTFOLDER" Name="Foobar Plugin" />
</Directory>
</Directory>
...
<DirectoryRef...
I am using Python on Mac OSX Leopard.
I am trying to run the program 'dot' (part of Graphviz) from Python:
# -*- coding: utf-8 -*-
import os
print os.environ['PATH']
print os.system("ls >> a.txt")
print os.system("dot -o9.png -Tpng ./6.dot")
The command "ls" is there just to make sure that python is in the correct directory. It is. ...
I searched StackOverflow for the title of this question, but I didn't find anything ... so, how do I join two file paths ?
...
So in Code::Blocks in Ubuntu (latest).
I have a project in which I load a file and read a number from it.
#include <fstream>
using namespace std;
int main(){
ifstream in("data/file.t");
int n;in>>n;
}
now with a cout<<n it shows -1203926 (and other random numbers) though the number in the file is 0.
data is where the binary ...
How can I convert "c:\foo\..\bar" into "c:\bar"?
...
For static code analysis tools, it is necessary to know all effective source paths for a given Delphi project, which are defined on project level and in the global IDE configuration.
Is there a Delphi library which can collect this kind of project information?
As far as I know, the registry settings for the Delphi IDE can be in differ...
Here is the code I have thus far:
import java.io.*;
class JAVAFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
return (name.endsWith(".java"));
}
}
public class tester {
public static void main(String args[])
{
FilenameFilter filter = new JAVAFilter();
File directo...
Hello,
How do I handle cookies with paths other than "/".
An HttpWebRequest object returns these headers:
HTTP/1.1 302 Moved Temporarily
Transfer-Encoding: chunked
Date: Wed, 10 Jun 2009 13:22:53 GMT
Content-Type: text/html; charset=UTF-8
Expires: Wed, 10 Jun 2009 13:22:53 GMT
Cache-Control: no-cache, must-revalidate, max-age=0
Server...
Is there any way of specifying the current directory in a java properties file?
i.e. something like:
fileLocation={currentDir}/fileName.txt
...
When defining a path to a directory as a variable or constant, should it end with a trailing slash? What is the convention?
pwd in unix shows your current directory without a trailing slash, while the tab complete of cd /var/www/apps/ includes the trailing slash, which left me unsure.
...
I'm writing a small read-only FTP-like server. Client says "give me that file" and my server sends it.
Is there any standard way (a library function?!?) to make sure that the file requested is not "../../../../../etc/passwd" or any other bad thing? It would be great if I could limit all queries to a directory (and its subdirectories).
...
Environment: debian 4.0
Python 2.4
My 'project' is installed in:
/usr/lib/python2.4/site-packages/project.
But I want to use my working copy instead of the installed one which is located in:
/home/me/dev/project/src
So what I do is:
export PYTHONPATH=/home/me/dev/project/src
ipython
import foo # which is in s...
Hello everyone,
Suppose I have the following XAML code, my confusions are, (1) I do not know the exact meaning of Data attribute, especially items starts with letter M/C, (2) there is no special configuration for TransformGroup (all using default settings), why put the TransformGroup here?
<Path Height="2.75" Width="2.75" Data="M2.75...
I have a String which provides an absolute path to a file (inlcuding the file name). I want to get just the filename. What is the easiest way to do this.
It needs to be as general as possible as I cannot know in advance what the URL will be. I can't simply create a URL object and use getFile() - all though that would have been ideal if ...
I'm writing Perl t/*.t tests for an existing project. During development, I'd like to use 'prove' to run select tests at arbitrary depths in the module directory hierarchy. I've created some t/ directories at the same depth as the *.pm files I'd like to test. Unfortunately, the lib/ at the base of the project's code is not in @INC.
What...
hi,
I have the Python modules a.py and b.py in the same directory.
How can I reliably import b.py from a.py, given that a.py may have been imported from another directory or executed directly? This module will be distributed so I can't hardcode a single path.
I've been playing around with __file__, sys.path and os.chdir, but it feels m...
Hi
I was just wondering what is the best way to define urls linking to pages within a domain name. For example, for domain www.example.com .. I can have links like
<a href="http://www.domain.com/test.html">test</a>
or
<a href="test.html">test</a>
One of the issues, which I came across was that while using templates .. if I...