Hi. I have part of a model defined like this:
logo_image = models.ImageField(upload_to=lambda i, fn: "logo_%s"%(fn), height_field="logo_image_height", width_field="logo_image_width")
and had a question about the upload_to function.
According to django's documentation for FileField.upload_to, the second paramater, filename is "The fil...
Hi,
I am trying to work on a dev environment but am find problems in that python seems to be using modules from the site-packages directory. I want it to be using the modules from my dev directory.
sys.path returns a bunch of dirs, like this
['', '/usr/lib/python26.zip', '/usr/lib/python2.6', '/usr/lib/python2.6/plat-linux2', '/usr/lib...
Hello I have written a such function under Eclipse:
public static ArrayList<String> getMails(){
ArrayList<String> mails = new ArrayList<String>();
try{
FileInputStream fstream = new FileInputStream("mails.txt");
DataInputStream in = new DataInputStream(fstream);
BufferedReader br = new BufferedRea...
var actual = Path.Combine("c:", "filename");
var expected = @"c:\filename";
Assert.AreEqual(expected, actual);
Result
{Assert.AreEqual failed. Expected:<c:\filename>. Actual:<c:filename>.
Why?
...
In Windows, is there a straightforward way to get the full path of a file, given only the file's handle?
I can't use GetFinalPathNameByHandle() because that's Vista+ only and our product has to work on XP. However, something that simple, or close to it, would be best.
...
The script have some hard-coded relative paths. I would like them to be relative to script position.
The script needs to change current directory as some other program (cmake) needs it.
The script takes some (possibly relative to caller) paths as an argument and it passes them to that program, they should be derelativized.
Questions a...
I have a Python script that I run from a symlinked directory, and I call os.getcwd() in it, expecting to get the symlinked path I ran it from. Instead it gives me the "real" path, and in this case that's not helpful. I need it to actually give me the symlinked version.
Does Python have a command for that?
...
I've written a data collection script for Cacti in Ruby and it runs fine from the command line but Cacti runs the script via "env -i" which strips the environment so Ruby can't find the rubygems library ("in `require': no such file to load -- rubygems (LoadError)"). How might I work around this?
...
Does the .NET Framework have any methods for converting a path (e.g. "C:\whatever.txt") into a file URI (e.g. "file:///C:/whatever.txt")?
The Uri class has the reverse (from a file URI to absolute path), but nothing as far as I can find for converting to a file URI.
Also, this is NOT a ASP.NET application.
Thanks!
...
Hi, I am trying to draw a map annotation in my app - very much like MapKit's MKAnnotationView, but without the mapkit.
I have a problem with the ordering of the path for the view outline that I cant figure out.
Image of results:
http://img504.imageshack.us/img504/5458/screenshot20091010at703.png
Code:
CGFloat minx = CGRectGetMinX(cu...
Not sure where this should be posted...
Anyway, if i run the following command in a windows XP console it gives me a weird error and i have no ideea why.
mplayer "1.mp3" -vc "null" -vo "null" -ao "pcm:file=C:\1.wav"
Could not parse arguments at the position indicated below:
file=C:\1.wav
^
Failed to initialize audio driver 'pcm...
Recently I've been getting more and more into web development and as such have a few questions. I have a few websites that are on a production LAMP server and I've been trying to copy them to my local computer running xampp 1.7.1 on XP Pro. The problem I've been having is mostly path issues. I mainly develop for wordpress, joomla, magent...
How do get the path of a installed Perl module by name,
e.g. Time::HiRes?
I want this just because I have to run my perl script on different nodes of a SGE Grid Engine system. Sometimes, even run as other username.
I can use CPAN.pm to install packages for myself, but it is not so easy to install for other users without chmod 666 on fo...
Simple question here (though perhaps not such a simple answer):
Is it possible to specify a path for an (existing) named pipe that can be used by programs as if they were opening on a normal file?
According to this MSDN page, name pipes on the local computer can be referrenced using the following path syntax: \\.\pipe\PipeName, yet I'm...
Hi,
I'm currently developing an collage application for iPhone and I've now at the point of saving the image and I therefore need the correct path so that the images shows in your image library.
Does anyone know the address to the path?
BR,
drisse
...
I have a graph structure where I am removing edges one by one until some conditions are met. My brain has totally stopped and i can't find an efficient way to detect if removing an edge will result in my graph splitting in two or more graphs.
The bruteforce solution would be to do an bfs until one can reach all the nodes from a random n...
I have a Java application that runs on Mac and Windows, directly off a CD/DVD with no installation. Now, I need to store a file containing per-user data (think favourites etc.) somewhere on the local file system, so that it can be written to.
So, where do you think is a good location for this file? I am thinking something like:
<USER_...
var directory = new DirectoryInfo(
"\image0\Abc"
);
if (!directory.Exists)
{
directory.Create();
}
when I user above asp.net code which unc path, I found the following problem.
How can I solve?
Access to the path '\Image0\Abc' is denied.
Regards,
atk
...
how to map the path to the file easily?
public_html/api/function.php
<?php
function writetologfile($content)
{
$filename = 'logfile/testing_randomstring.txt';
if (!$handle = fopen($filename, 'a'))
{
echo "Cannot open file ($filename)";
exit;
}
fclose($handle);
}
?>
the actual path of the text file i...
Hi All,
I have a WPF app in which I need to programatically manipulate at runtime.
What I thought of doing is having a Path with 4 line segments like so:
Canvas.Left="324"
Canvas.Top="247">
<Path.Data>
<PathGeometry>
<PathFigure IsClosed="True">
<LineSegmen...