w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
UIBezier path not responding to stroke
There's a lot of weird stuff going on in your code, but it runs, the problem is here [imgView setNeedsDisplay]; As I see in your code, you want it to work on drawRect, but drawRect will only get called on setNeedsDisplay on the current view, not on imgView, switch it for [self setNeedsDisplay]; And it will work. You'd probably need to subclass UIImageView to handle drawRect inside of it. Also, I'm guessing that you want to actually modify the image, hence the attempt to draw within in, try reading on working with CoreGraphics in an image context. About the other issues The main problem as I see it, is that you're confusing CALayers and CoreGraphics, as it stands right now, the CALayer you're adding to the imageView is completely unused. Just with the drawRect and setting the Bezier

Categories : IOS

Why can I run this file packaged by Maven by specifying the path as argument but not by setting the path permanently in my path variable?
You'll need to add the storm dependencies to your classpath - it's currently not included because it is marked as 'provided' in the m2-pom.xml, change it to 'compile': <dependency> <groupId>storm</groupId> <artifactId>storm</artifactId> <version>0.8.2</version> <scope>compile</scope> </dependency>

Categories : Java

Hadoop get relative path from absolute path and base path
How about building a String while recursing with getParent() until the current path is equal to the base path? Here is a helper function that might do what you want. (I haven't tested it yet, but the idea might help) private static String absolutePathToRelativeString(final Path path, final Path base) { final StringBuilder builder = new StringBuilder(path.toString().length()); Path curPath = new Path(path); while (curPath != null && curPath.depth() != 0 && !curPath.equals(base)) { if (!curPath.equals(path)) { builder.append('/'); } builder.insert(0, curPath.getName()); curPath = curPath.getParent(); } return builder.toString(); }

Categories : Java

I want to do animation of an object along a particular path
If you're gonna use the built-in bezier curves of the canvas, you would still need to do the math yourself. You can use this implementation of a cardinal spline and have all the points returned for you pre-calculated (by yours sincerly): http://www.codeproject.com/Tips/562175/Draw-Smooth-Lines-on-HTML5-Canvas An example of usage is this little sausage-mobile moving along the slope (generated with the above cardinal spline): Full demo here (cut-and-copy as you please): http://jsfiddle.net/AbdiasSoftware/zupjZ/ The main things you need is when you have the point array is to find two points you want to use for the object. This will give us the angle of the object: cPoints = quantX(pointsFromCardinalSpline); //see below //get points from array (dx = current array position) x1 = cPoint

Categories : Javascript

Three.js Curve Path Animation
http://mrdoob.github.io/three.js/examples/#webgl_geometry_extrude_splines See this example and how the camera is made to follow the spline path. I think this is quite the thing you are looking for, just for a sphere instead of the camera.

Categories : Javascript

Spiral path animation using CGMutablePathRef
If you want a more smooth spiral, you could use the following function. It' s possible to adjust the code to have an opening spiral also. -(void)addEnteringSpiralOnPath: (CGMutablePathRef) path size: (CGSize)size turns: (int)turns { CGPathMoveToPoint(path, NULL, size.width/2, 0); //To begining: Right for (int turn = turns; turn >= 1; turn--) { CGSize largeSize = CGSizeMake(size.width * turn/turns, size.height * turn/turns); CGSize smallSize = CGSizeMake(size.width * (turn-1) / turns, size.height * (turn-1) / turns); NSLog(@"Large: %@; Small: %@", NSStringFromCGSize(largeSize), NSStringFromCGSize(smallSize)); CGFloat wStep = (largeSize.width/2 - smallSize.width/2 ) / 360; CGFloat hStep =

Categories : IOS

Revolving animation, that follows finger, of uibuttons that follows outer path of circle
(Sample code on GitHub) It's not really that difficult, there's just a lot of trigonometry involved. Now, what I'm going to describe now, is not an animation, since you requested for it to track the position of your finger in the title. An animation would involve its own timing function, but since you're using the touch gesture, we can use the inherent timing that this event has and just rotate the view accordingly. (TL;DR: The user keeps the time of the movement, not an implicit timer). Keeping track of the finger First of all, let's define a convenient class that keeps track of the angle, I'm gonna call it DialView. It's really just a subclass of UIView, that has the following property: DialView.h @interface DialView : UIView @property (nonatomic,assign) CGFloat angle; @end Di

Categories : IOS

var di = new DirectoryInfo(path) throws exception until I use Windows Explorer to open the path for a first time
Since you said it's happening on network folders, my first inclination is that the windows process that this app is running under doesn't have security access to read the directory info. When the user browses to this folder, the security is authenticated, and so your app can now read it. Does the app work if Root is a local folder?

Categories : C#

PHP: fopen path for `include`d script using Apache Document Root when full path is specified?
If the Path starts with / It will point to the root Filesystem which is fine with CLI but CGI would understand it this way: /home/jweinberger/com.example/logs/script1.log//home/jweinberger/logs/script1.log You should use the index 'DOCUMENT_ROOT' from the $_SERVER array. fopen($_SERVER['DOCUMENT_ROOT'].'/home/jweinberger/logs/script1.log')

Categories : PHP

path smooth algorithm for astar path planning based on quad tree
haha,I find the method for the difference size path smooth. Just use the funnel algorithm too, but there is a difference: when add left and right point for two quads, find one intersection side, and sort the four points(a0, a1, b0, b1) like ([x, y0], [x, y1], [x, y2], [x, y3], and y0 <= y1 <= y2 <= y3) , and use the two points [x, y1], [x, y2].

Categories : Misc

The Widest Path Challenge - the most efficient way for finding path in Maximal Spanning Tree
Use the set to construct a Subgraph object. Subclass DepthFirstIterator so that encounterVertex puts an entry with key v and value (whatever the other endpoint of e is) into a map p. Search depth-first from the sink. Recover the path by initializing v to be the source and looking up v, p[v], p[p[v]], etc., until there is no entry. This is a pain, but the library authors baked FibonacciHeap into ClosestFirstIterator, which otherwise would be the class you want. (Heck, if you don't care about another n log n time operation, you could just run Dijkstra on the subgraph.) Kruskal's algorithm functions fine with disconnected graphs. It returns a minimum-weight spanning forest, i.e., for each connected component, a minimum-weight spanning tree. I can't vouch for this particular implementation.

Categories : Algorithm

Need help creating reg-ex expression to rewrite path and filename using information in original path and file name
Enable mod_rewrite and .htaccess through httpd.conf and then put this code in your .htaccess under DOCUMENT_ROOT directory: Options +FollowSymLinks -MultiViews # Turn mod_rewrite on RewriteEngine On RewriteBase / RewriteRule ^(ImageFolio4_files)/1/([^/]+)/((?!AM|tn_)[^.]+.jpg)$ /$1/cache/images/~$2~$3 [L,R=302,NC] Once you verify it is working fine, replace R=302 to R=301. Avoid using R=301 (Permanent Redirect) while testing your mod_rewrite rules.

Categories : Regex

StreamReader Server.MapPath - Physical path given, virtual path expected
MapPath translates paths starting from ~ to full local path. Does not look like you need it in your code. If the file is supposed to be at fixed place all the time, open in directly by full path. If it is relative to site root, then use something like Server.MapPath("~/status.txt")

Categories : C#

phantomJS : Absolute path working, but Relative path giving problems
Maybe there is an issue in page.render but I don't think so. The most common case of hangs is unhandled exception. I will suggest you 4 things to investigate the issue : add an handler to phantom.onError and/or to page.OnError encapsulate your code in try/catch blocks (such as for page.render) Once the page is loaded, there is no test on callback status. It's better to check the status ('success' or 'fail') seems to freeze when calling page.render. Have you tried a simpler filename in the current directory? Maybe the freeze is because of the security or invalid filename (invalid characters?) Hope this will help you

Categories : PHP

Replace part of a path which has multiple occurrences into full path name by a string
1st solution: change batch code and call file #: @echo off &setlocal enabledelayedexpansion set mypath="D:android-sdkandroid-sdk-windows#workspace" SET "mypath=!mypath:%~1=*!" echo %mypath% "D:android-sdkandroid-sdk-windows*workspace" 2nd solution: use sed @echo off &setlocal set "mypath=D:android-sdkandroid-sdk-windowsKworkspace" for /f %%i in ('echo(%mypath%^|sed s/%~1/*/') do set "mypath=%%i" echo %mypath% "D:android-sdkandroid-sdk-windows*workspace"

Categories : Batch File

How to resolve a relative directory path to canonical path in MATLAB/Octave
The simplest way I know to convert a path to its canonical form is using cd command: oPath = cd(cd(iPath)); Note that this would fail if the path does not exist on your file system.

Categories : Matlab

os.path.join() and os.path.normpath() both add double backwards slash on windows
'static\css\reset.css' is the representation of the string r'staticcss eset.css'. The double backsalsh indicates escaping of the backslash - in string literals it has a meaning of "do something special with the next character", which you don't want here. >>> print('static\css\reset.css') staticcss eset.css

Categories : Python

Java - replace all instances of path separators with system path separator
It is documented in the Javadoc: Note that backslashes () and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string; see Matcher.replaceAll. Use Matcher.quoteReplacement(java.lang.String) to suppress the special meaning of these characters, if desired. So you can try this: String replaced = path.replaceAll("[/\\]+", Matcher.quoteReplacement(System. getProperty("file.separator")));

Categories : Java

Is it possible to ui:include files from an absolute file path rather than relative webapp path?
On a mac (for example) the path look like this: <ui:include src="file:///Users/Julian/Documents/.../WEB-INF/templates/footer.xhtml" /> On Windows the path looks like this: <ui:include src="file:///C:/Users/.../footer.xhtml" />

Categories : JSF

included dbconfig.php file failes when using a direct path instead of relative path
You are trying to include file over HTTP. That is not right, you should include files with passing your local filesystem path to include or require. Your root should probably look like so: $root = '/var/www/mywebsite/testing-folder/';

Categories : PHP

How to make $_SERVER['DOCUMENT_ROOT'] reference to alias directory path and NOT wamp default path?
I think you would be better creating a Virtual host for each of your projects. HowTo setup Virtual Hosts

Categories : Apache

Java Mac create new File(path) - path with german umlauts
I don't know how Mac OS will treat umlauts in the file system. But if the directory could be handled correctly out of the JVM it has to work in it, too. So try to list the name of the directory trough a listFiles() one level above: File d = new File("/Volume/dir1/dir2/"); for( File f : d.listFiles()) System.out.println(f.getName()); So you will see how the String has to look like for opening the file (also it really exists and is accessible from the VM); SOLUTION: File.listFiles() mangles unicode names with JDK 6 (Unicode Normalization issues)

Categories : Java

How do I convert a double slashed path to a path that open() accepts?
The double slashes are not the problem here. It is the carriage return character at the end that is causing you problems. String it from the path: fp = open(path.strip(), 'rb') Python is merely showing a string literal representation of your path string, for ease of debugging. Any character with special meaning, outside of the printable ASCII range, is escaped, including backslashes. The value itself does not have doubled backslashes: >>> path = 'F:\Music\v flac\1-06 No Quarter.flac ' >>> path 'F:\Music\v flac\1-06 No Quarter.flac ' >>> print path F:Musicv flac1-06 No Quarter.flac >>> path[:3] 'F:\' >>> len(path[:3]) 3 Note how printing path shows the path value having only single backslashes and how the first 3 characters of the path a

Categories : Python

Regular expressions for Windows based file path and UNC path
Why no simply use Test-Path with -IsValid parameter? Adding to davor's suggestion...here is a link to some examples: http://technet.microsoft.com/en-us/library/ff730955.aspx

Categories : C#

binding with path doesn't work when first item on path is null
There are small differences between the binding paths/calculation for MvvmCross versus Xaml. In particular, we know FallbackValue is interpreted and used differently. This different behaviour: occurs on line MvxFullBinding.cs#L109 is logged in https://github.com/slodge/MvvmCross/issues/297. If you have additional test cases to add to that list, then please upload them as GitHub repos and link them to that case. (But don't expect 'very quick' changes/fixes to that binding code - as changing it could break a lot of apps that now rely on it and as MvxValueConverters are often built to be much more type specific than traditional Microsoft IValueConverter ones) In the meantime, for this particular case: a FallbackValue may work for you as a workaround (but may be an enum fallback va

Categories : Android

do relative path in wordpress plugin point to wp-admin path?
I use the following in the main plugin file to define its URL and Path: $this->plugin_url = plugins_url( '/', __FILE__ ); $this->plugin_path = plugin_dir_path( __FILE__ ); Then, print the image like: echo '<img src = "' . $this->plugin_url . 'images-uploads/image.jpg">';

Categories : PHP

vim autocompletes wrong path when executing external script in a different path
Try executing: export PATH="~/Dropbox/Work/Scripts:$PATH" which will add it as the first place to look for the script. Then you'll see if the "k/Scripts/PythonTidy.py" is in the PATH prior, and thus found first by vim.

Categories : Vim

POSIX path in applescript from list not opening. Raw path works
Not sure what is going on there, i agree it's confusing. An alternate is to use the shell 'open' command instead. repeat with filePath in FilesList do shell script "open " & quoted form of filePath end repeat The shell seems more happy with POSIX paths, the trick is to send in the 'quoted form' of your POSIX paths. -- EDIT: Putting into a var first works too. repeat with theFiles in FilesList set f to POSIX file theFiles tell application "Finder" to open f end repeat It seems the Finder is causing the coercion to POSIX file problem.

Categories : String

Match last path element using JaxRS @Path annotation in Jersey
The best solution I've found is to manually detect when the second method is matching the last path element and manually delegate to the first. @Path("{name}") public Object getNamedResource(@Context UriInfo uriInfo) { boolean lastElement = uriInfo.getMatchedURIs() .iterator().next().equals(uriInfo.getPath()); if (lastElement && "data".equals(name)) { return getDataResource(uriInfo); } ... } Not a bad solution to my particular problem, but I'm still frustrated that Jersey is escaping my pattern without asking me first.

Categories : Java

Expand a relative path but not follow any symlink in the path in Python
Not sure that's what you're looking for, but... you can write a function that generate the "logical" full path from the relative path and current working directory then check that the generated path really exists on the system. That function could look like: import os def absolute_path(path): wd = os.getcwd() full = os.path.join(wd, path) parts = full.split(os.sep) kept = [] skip = 0 for part in reversed(parts): if part == '..': skip += 1 elif skip == 0: kept.insert(0, part) else: skip -= 1 return os.sep + os.path.join(*kept)

Categories : Python

404 redirect works but changes rewritten URL path in browser to full URL path
You need to add conditions before each of your rewrites to ensure you're not blindly rewriting into a file that doesn't exist. Mainly, the 4 rules at the end need to have some conditions: RewriteCond %{REQUEST_URI} ^/([A-Za-z0-9_-]+)/?$ RewriteCond %{DOCUMENT_ROOT}/pages/%1/%1.php -f RewriteRule ^ pages/%1/%1.php [NC,L] The first condition creates a grouping which is backreferenced using %1. The second condition creates a path that you are trying to rewrite to and checks if that file exists using -f. Same thing for the others: RewriteCond %{REQUEST_URI} ^/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/?$ RewriteCond %{DOCUMENT_ROOT}/pages/%1/%2/%2.php -f RewriteRule ^ pages/%1/%2/%2.php [NC,L] RewriteCond %{REQUEST_URI} ^/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/([A-Za-z0-9_-]+)/?$ RewriteCond %{DOCUMENT

Categories : Htaccess

How do i open a file from different path(not the server default path) using file_put_content in php
When placing files on your computer you can either use relative or absolute path like this: // absolute path $file = "C:/temp/test.txt"; // relative path from C:/Program Files/wamp/htdocs/index.php $file = "../../temp/test.txt"; Both of those files point to the same place

Categories : PHP

PHP: Does file_exists($path) check sub directory of $path ? how computationally intensive it is?
I'm not sure if you mean does file_exists($path) check subdirectories of path or if it checks subdirectories of the current working directory for path. In either case the answer is no. $path is taken simply as a path and the method confirms whether or not that file/directory exists.

Categories : PHP

Getting error: PKIX path building failed: unable to find valid certification path to requested target
There are two possible sources for this error: either the opposite side is using genuinely untrusted certificate (self-signed or signed by untrusted CA), or the opposite side is not sending certificate validation chain (e.g. there is intermediate signing certificate along the way to your trusted CA, but this ceriticate is not present in the SSL handshake). Solution for the first case is to add the untrusted CA (or the ceriticate itself) to your JRE truststore (${java.home}/lib/security/cacerts) or better - create your own truststore (which will not get removed when upgrading Java) and provide that to your application via javax.net.ssl.trustStore JVM property. Solution for the second case is either to go with the first case solution or better - convince the opposite side to send correc

Categories : Java

mysql hostname with path "localhost:/some/path/ms.sock"
The /some/path/ms.sock refers to the Unix domain socket through wich PHP will connect to MySQL (this is one of the three connection protocols supported by MySQL, besides the usual TCP/IP). This path must be provided to the mysql* clients with the --socket (or -S) option: mysqldump -h localhost -S /some/path/ms.sock -u ...

Categories : Mysql

Getting reources path creates weird path (in jar works)
All the files are packed together in your jnlp file. They don't to exist as individual files on filesystem when you port your package. That said, they are available on the classpath. You can access the content of your package using the appropriate classloader. getClass().getClassLoader().getResourceAsStream(...) This may help you

Categories : Java

compare path and get relative path between two files with javascript
Unfortunately, JavaScript has no native method for doing this. But the path module in node.js has! This code has been taken from the node.js path module source code function relative(from, to) { function trim(arr) { var start = 0; for (; start < arr.length; start++) { if (arr[start] !== '') break; } var end = arr.length - 1; for (; end >= 0; end--) { if (arr[end] !== '') break; } if (start > end) return []; return arr.slice(start, end - start + 1); } var fromParts = trim(from.split('/')); var toParts = trim(to.split('/')); var length = Math.min(fromParts.length, toParts.length); var samePartsLength = length; for (var i = 0; i < length; i++) { if (fromParts[i] !== toParts[i]) {

Categories : Javascript

Regex to transform SVG path to raphael.js path format
Description I would do this in two steps. First gather each of the paths in the string. Second remove the text from each of the strings you don't want retained. First Regex This captures all the attributes from the path without regard for their order in the tag. It also skips over some problematic issues where attribute values may contain strings which look like actual tags. <paths (?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^s>]*)*?sd=('[^']*'|"[^"]*"|[^'"][^s>]*)) (?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^s>]*)*?sid=('[^']*'|"[^"]*"|[^'"][^s>]*)) (?=(?:[^>=]|='[^']*'|="[^"]*"|=[^'"][^s>]*)*?sinkscape:label=('[^']*'|"[^"]*"|[^'"][^s>]*)) Second Regex This will only be applied to the d attribute, and it basically replaces all the spaces decimal portion of each di

Categories : Regex

Add Path / Auto Load Path For Grape API Not Working
If you split api into many files you need mount that parts. See documentation for modules These don't have to be different versions, but may be components of the same API. class APP::API < Grape::API mount APP::Groups mount APP::Users end

Categories : Ruby On Rails

Load image from an UNC path in network and hide the path
I think that your best (and simplest) approach might to be to map a virtual directory using the UNC-type paths you have shown. Then you can address the files in your html in a more 'normal' way (effectively hiding the UNC server name as you've requested). You could, for instance, map UNC \192.168.84.52DistriAffiche to virtual folder images and then reference the image file names from folder images in your html. The following doc describes setting up virtual folders, please note the special instructions for UNC mappings. http://msdn.microsoft.com/en-us/library/bb763173(v=vs.100).aspx

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.