w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
While Sending Html Mails from my web application Recieved Mails contains Symbols like &ldquo,&rdquo, ‘
Check with another constructor for htmlView: ContentType mimeType = new System.Net.Mime.ContentType("text/html"); var htmlView = AlternateView.CreateAlternateViewFromString(bodyMessage, mimeType);

Categories : Asp Net Mvc

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

Does storing URL rewrites in a separate file override manual entries?
Well after much consternation and research, I stumbled upon this question and the highest voted answer, and it's working for me now with the rewrite rule still in rewritemaps.config. Changing {REQUEST_URI} to {PATH_INFO}

Categories : Asp Net

How to make an "alias" for a long path?
First, you need the $ to access "myFold"'s value to make the code in the question work: cd "$myFold" To simplify this you create an alias in ~/.bashrc: alias cdmain='cd ~/Files/Scripts/Main' Don't forget to source the .bashrc once to make the alias become available in the current bash session: source ~/.bashrc Now you can change to the folder using: cdmain

Categories : Linux

How to make a path-agnostic alias for zsh?
I'm not sure how to do it in an alias, but you can wrap it in a function: function my-hsenv { # If we want the full path # foo=`pwd`; # If we want only the name of the current dir foo=$(basename $(pwd)) source .hsenv_${foo}/bin/activate } Then run my-hsenv: $ my-hsenv my-hsenv:source:5: no such file or directory: .hsenv_tmp/bin/activate But you get the idea.

Categories : Misc

Yii: resolve Path Alias with short notation from inside a widget
Yii requires path aliases to be absolute, so you cant use timepicker.assets. Solution is to create your own path alias in main component class: <?php Yii::setPathOfAlias('timepicker', dirname(__FILE__)); class ETimepicker { ....

Categories : PHP

Batch scripting printing with a FOR all the entries of the "Path variable"
assuming you don't have a path with ; in it's name try this: @ECHO OFF &SETLOCAL SET "mypath=%path%" SET mypath=%mypath:;=";"% FOR %%a IN ("%mypath%") DO ECHO %%~a

Categories : Batch File

dynamically adding Python sys.path entries that refer to inside a .zip file
I'm not entirely sure I understand your question, but I'll have a crack at answering it anyway ... Unfortunately, while you can import from a zipfile by adding it to sys.path: sys.path contains a list of strings providing search locations for modules and packages. It is initialized from the PYTHONPATH environment variable and various other installation- and implementation-specific defaults. Entries in sys.path can name directories on the file system, zip files, and potentially other “locations” (see the site module) that should be searched for modules, such as URLs, or database queries. Only strings and bytes should be present on sys.path; all other data types are ignored. The encoding of bytes entries is determined by the individual path entry finders. source

Categories : Python

Python: How to check an XML file every x minutes for new entries, but not alert on previously alerted entries
Are the entries associated with a timestamp such that the new entries will always have timestamps later than the old entries each time the file is updated? If so, just keep the timestamp of the last entry you pushed, and as you parse the XML file, push anything newer and discard anything older. If not, Python has pretty decent set manipulation algorithms, so I'd try this: keep a set of entries that have been pushed already. already_pushed = set() Each time your script runs, do this: make another set of the entries from the file from_file = parse_file() "subtract" (set difference) the set of already-pushed entries new_entries = from_file - already_pushed push the new entries push_all(new_entries) go through the original set and prune anything older than 4 hours + 5 minutes cuto

Categories : Python

Can't override method (Flash Builder) - #1065 Variable Override is not defined
I solved it myself, kind of an strange error, but oh well. I had to press the cross icon that says "Remove Launch" and "Remove All Terminated Launches" next to the stop icon in the console tab. I even restarted my PC, tried project>clean, and restarted Flash Builder several times but only that fixed it. I leave this here just in case anyone meets the same error.

Categories : Actionscript

Subtracting alias from another alias?
In you want direct substraction in SQL Server SELECT ( SELECT count(loanflag) FROM Data WHERE declinegroup="XYZ" AND orginalrating="A" AND score="724-747" AND mode="Open" AND delqdays>"0" ) - ( SELECT count(loanflag) FROM Data WHERE declinegroup="XYZ" AND orginalrating="A" AND score="724-747" AND mode="Open" ) ; Alternatively you could assign the values to a variable first then substract them later DECLARE testa int; DECLARE testb int; SET testa = ( SELECT count(loanflag) FROM Data WHERE declinegroup="XYZ" AND orginalrating="A" AND score="724-747" AND mode="Open"

Categories : SQL

How to smooth datatable of 15 entries to 100 entries?
A possible solution for 106 values: int k = 0; double a; double b; double[] coarse; double[] fine; for (int i = 0; i < 15; i++) for (int j = 0; j < 7; j++) { a = 1.0 - j * 1.0/7; b = 1.0 - a; fine[k++] = a * coarse[i] + b * coarse[i+1]; } fine[k] = coarse[14]; This assumes that the 15 original values are stored in array coarse[]. The interpolated values will end in array fine[].

Categories : C#

Unique entries for normal entries?
The DDL command to add a unique constraint on multiple columns: ALTER TABLE `table_name` ADD UNIQUE INDEX (`column1`, `column2`);

Categories : Mysql

why is there a need to override hashcode if I override equals method in java?
Go to this link The hashcode is used to maintain the contract and uniquely identify each object in hashmap or hashtable.

Categories : Java

Select table entries belonging to combinations of entries in another table (mysql)
I assume you have two table: orders (list of your orders) order_items (list of itemd of order) two table are relationed by field fk_order. try this: SELECT o.id, (select count(*) from order_items i where i.status = 'delivered' and i.fk_order = o.id) as item_delivered, (select count(distinct i.status) from order_items i where i.fk_order = o.id) as status_no FROM orders o

Categories : Mysql

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

Override nVidia's 3D settings override
In general: Having user-settings in the driver and letting the apps overide those settings any time would render the user-settings pretty pointless, wouldn't it? Any app would instantly decide what is best on behalf of the user. That said: https://developer.nvidia.com/nvapi Looking at NvApiDriverSettings.h I can spot a lot of AA related things: AA_BEHAVIOR_FLAGS_ID = 0x10ECDB82, AA_MODE_METHOD_ID = 0x10D773D2, From what I have read in the docs you might generate an app-profile on the fly. You might have a problem with overriding things the user has set in the profile, but I don't know if that is the case. I personally would not override any settings done by the user but instead display a warning that the user is running the app wit

Categories : C++

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

Registry keys for context menu entries written, but no context menu entries
Most likely, the people whom it didn't work for have had .gif and/or .jpg associated with a different ProgId than "giffile" or "jpegfile". You can get Inno to add the registration to whatever the current ProgId association is like so: [Registry] Root: HKLM; Subkey: "SOFTWAREClasses{reg:HKLMSOFTWAREClasses.jpg|jpegfile}shellHalve size"; Flags: uninsdeletekey Root: HKLM; Subkey: "SOFTWAREClasses{reg:HKLMSOFTWAREClasses.jpg|jpegfile}shellHalve sizecommand"; ValueType: string; ValueName: ""; ValueData: """{app}himgr.exe"" ""%1""" Root: HKLM; Subkey: "SOFTWAREclasses{reg:HKLMSOFTWAREClasses.png|pngfile}shellHalve size"; Flags: uninsdeletekey Root: HKLM; Subkey: "SOFTWAREclasses{reg:HKLMSOFTWAREClasses.png|pngfile}shellHalve sizecommand"; ValueType: string; ValueName: ""; ValueData: """{app}hi

Categories : C#

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

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

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

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

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

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

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#

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

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

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

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

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

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

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

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

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

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



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