path

Uniform discretization of Bezier curve

眉间皱痕 提交于 2019-12-30 07:25:27
问题 I need to discretise a 3rd order Bezier curve with points equally distributed along the curve. The curve is defined by four points p0, p1, p2, p3 and a generic point p(t) with 0 < t < 1 is given by: point_t = (1 - t) * (1 - t) * (1 - t) * p0 + 3 * (1 - t) * (1 - t) * t * p1 + 3 * (1 - t) * t * t * p2 + t * t * t * p3; My first idea was to discretise t = 0, t_1, ... t_n, ..., 1 This doesn't work as, in general, we don't end up with a uniform distance between the discretised points. To sum up,

PHP exec() and spaces in paths

扶醉桌前 提交于 2019-12-30 03:57:07
问题 I'm executing the following in a PHP application: $source = '/home/user/file.ext'; $output_dir = $this->setOutputString(); chdir('/home/ben/xc/phplib/bgwatcher-2011a/a01/'); exec('php bin/createjob.php $source $output_dir', $output); return $output[0]; The problem is this: I have control over $source , but not $output_dir , which is a legacy Windows filesystem, and there are spaces in the path. An example $output_dir is: /home/vol1/district id/store id/this_is_the_file.html When inserting the

Relative paths with fetch in Javascript

倖福魔咒の 提交于 2019-12-30 03:50:07
问题 I was surprised by an experience with relative paths in Javascript today. I’ve boiled down the situation to the following: Suppose you have a directory structure like: app/ | +--app.html +--js/ | +--app.js +--data.json All my app.html does is run js/app.js <!DOCTYPE html> <title>app.html</title> <body> <script src=js/app.js></script> </body> app.js loads the JSON file and sticks it at the beginning of body : // js/app.js fetch('js/data.json') // <-- this path surprises me .then(response =>

paperclip custom :path and :url

你。 提交于 2019-12-30 03:14:55
问题 I have some problems trying to custom the :path and :url options for has_attached_file with paperclip: I have a polymorphic class named "Asset" that have : class Asset < ActiveRecord::Base belongs_to :file_owner, :polymorphic => true has_attached_file :picture, :styles => { ...}, :url => "/attachments/user_:user/dressing_:dressing/garment_:garment/category_:category/:basename_:style.:extension", :path => ":rails_root/public/attachments/user_:user/dressing_:dressing/garment_:garment/category_

casperjs does not find phantomjs

早过忘川 提交于 2019-12-30 02:37:07
问题 I've downloaded the latest version of casperjs (1.03) and phantomjs (1.9.2). So I took this little simple script from the casper page: var casper = require('casper').create({ verbose: true, logLevel: "debug" }); var casper = new require('casper').Casper(); and when I try to run it I get the following error: noname:phantomjs-1.9.2 Tom$ casperjs/bin/casperjs tipico2.js Fatal: [Errno 2] No such file or directory; did you install phantomjs? So, this is my directory structure: phantomjs-1.9.2/ <--

Macros/Environment variable in .sln and .vcproj files for Visual studio

时光毁灭记忆、已成空白 提交于 2019-12-30 02:34:07
问题 I have two similar problems: a) I have a solution which includes several projects and I want to be able easily switch project location by setting some environment variable/macro. As example this project can be located in \SolutionDir\Dir1\ or \SolutionDir\Dir2\ So, I want to specify that it should be located in \SolutionDir\$(Var) and just set the variable. Is there any build in Visual Studio way to do it? I know currently only two solutions - edit .sln file manual/programmatically to find

Invalidating a path from the Django cache recursively

浪子不回头ぞ 提交于 2019-12-29 15:04:50
问题 I am deleting a single path from the Django cache like this: from models import Graph from django.http import HttpRequest from django.utils.cache import get_cache_key from django.db.models.signals import post_save from django.core.cache import cache def expire_page(path): request = HttpRequest() request.path = path key = get_cache_key(request) if cache.has_key(key): cache.delete(key) def invalidate_cache(sender, instance, **kwargs): expire_page(instance.get_absolute_url()) post_save.connect

How to recursively add subdirectories to the PATH?

风格不统一 提交于 2019-12-29 14:16:47
问题 How do you do it? My directory code/ , at work, is organized in folders and subfolders and subsubfolders, all of which (at least in theory) contain scripts or programs I want to run on a regular basis. 回答1: At the end of your script, put the line: PATH=${PATH}:$(find ~/code -type d | tr '\n' ':' | sed 's/:$//') This will append every directory in your ~/code tree to the current path. I don't like the idea myself, preferring to have only a couple of directories holding my own executables and

How to recursively add subdirectories to the PATH?

倾然丶 夕夏残阳落幕 提交于 2019-12-29 14:16:15
问题 How do you do it? My directory code/ , at work, is organized in folders and subfolders and subsubfolders, all of which (at least in theory) contain scripts or programs I want to run on a regular basis. 回答1: At the end of your script, put the line: PATH=${PATH}:$(find ~/code -type d | tr '\n' ':' | sed 's/:$//') This will append every directory in your ~/code tree to the current path. I don't like the idea myself, preferring to have only a couple of directories holding my own executables and

Where is the .emacs file in windows GNU emacs

隐身守侯 提交于 2019-12-29 07:05:11
问题 Where is the .emacs file in windows (I'm using Emacs-23-CvsP091103-EmacsW32-1.58 ) When Emacs starts up, it attempts to load and execute the contents of a file commonly called .emacs (though it may have other names, see Where do I put my init file?) which contains any customizations you have made. You can manually add lisp code to your .emacs, or you can use the Customization interface accessible from the Options menu. If the file does not exist, Emacs will start with the default settings.