w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Find the root directory without full path in C#
If the subfolder is under the same root as you application you can use Directory.GetDirectoryRoot See: http://msdn.microsoft.com/en-us/library/system.io.directory.getdirectoryroot.aspx

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

Linux skip /root/.gvfs when executing df command with non-root user
I got the solution for my own question :) In df command you can pass the file system types which you would like to exclude, in this case it is 'fuse.gvfs-fuse-daemon'. So when I execute the below the command I no more get this message "df: `/root/.gvfs': Permission denied" df -x fuse.gvfs-fuse-daemon For more details one can look into df --help option.

Categories : Linux

Is sudo-ing tomcat's startup with a non-root user the same as running it as root?
Do be aware that the recommended solution to run tomcat on port 80 is to use mod-jk with the Apache web server, not to have tomcat listen on port 80 directly.

Categories : Unix

Root immediate child nodes icons not visible when hiding root
JTree#setShowsRootHandles(boolean newValue) controls the state of the handles for root elements. Normally, this is false. Try changing to true

Categories : Java

Reset MAMP Pro username and password to root/root
Assuming you still know the password, you can change the password back to root using /Applications/MAMP/Library/bin/mysqladmin -u root -p password root It'll prompt you to enter a password again, after which it'll be reset to root

Categories : Mysql

Read and Write root folder wihout root
You can use run-as on some devices to execute commands as a particular package. Google have fixed this on Jelly Bean so it no longer works: adb shell run-as app.package.name cp /data/data/package.name/file.txt /sdcard/ exit adb pull /sdcard/file.txt ~/ Here is a good article explaining file access in Android without root permissions, including a one-liner for the above script. It details how to use the new backup command: backup -f ~/data.ab -noapk app.package.name And how to extract the contents of the resulting .ab file: dd if=data.ab bs=1 skip=24 | openssl zlib -d | tar -xvf - You will most likely need the android.permission.BACKUP permission.

Categories : Android

SVN (svnserve) virtual root --root= not recognized
svn+ssh handles the whole transaction including writing and reading the files so it ignores the --root parameter in svnserve. Here is how to fix it over at serverfault -- Basically you just make svnserve into a script that calls svnserve with the proper variables.

Categories : Svn

Document root element "hibernate-configuration", must match DOCTYPE root "hibernate-mapping"
DOCTYPE for <hibernate-configuration> should be: <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

Categories : Hibernate

is there any method to draw a tree with a root , the root's previous nodes and successor nodes?
Couple of ideas you might find useful: You can use the tree layout to place the nodes in the canvas, create link objects pointing back and forth, then bind the link objects to a diagonal. http://www.durablejs.org/examples/flowchart/1/admin.html You can also use place the nodes using a pack layout, create the link objects pointing back and forth, and bind the links to a Bezier curve. http://www.durablejs.org/examples/statechart/1/admin.html You can find the code for the graphs above: https://github.com/jruizgit/durable/tree/master/lib/durabjevisual.js

Categories : D3 Js

How can I remove the root node and make the first child the new root node with XSLT?
Add a rule to the identity transform that adds nothing to the result tree for your document element other than the processing of its children: <?xml version="1.0" encoding="US-ASCII"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/*"> <xsl:apply-templates select="*[1]"/> </xsl:template> <xsl:template match="@*|node()"><!--identity for all other nodes--> <xsl:copy> <xsl:apply-templates select="@*|node()"/> </xsl:copy> </xsl:template> </xsl:stylesheet> (edited to be agnostic to the name of the document element) (edited again to only preserve the first child element of the document element)

Categories : Xml

Including from child theme root or else include from parent theme root
To answer your question directly based on your sample, i would not check to see if the file has been placed in the child theme. If a child-theme developer has customized the file, they can simply declare the function and include their own file (wherever they place it). There is no risk of code duplication because your sample function is simple enough. Even if you simplified your code for the purposes of placing it here....you can always keep includes wrapped in a very simple function that can be declared by a child theme. This will keep PHP running efficient and not having to check for files all the time.

Categories : Wordpress

Node.js` "http.get" doesn't return full response body to a browser but just a piece of tag. How to get full response?
Your data event is firing multiple times, but you can only "end" your output once... you should probably refactor your handler as follows... // In /myapppath http.get("http://stackoverflow.com/", function(result) { var responseParts = []; result.setEncoding('utf8'); result.on("data", function(chunk) { //add this chunk to the output to send responseParts.push(chunk); }); result.on("end", function(){ //now send your complete response res.end(responseParts.join('')); }); });

Categories : Node Js

Defining root of HTML in a folder within the site root folder
You need to set the base tag. If you add the tag in your page <head> like this: <base href="http://yoursite.tld/folder/"> it should display images and with sources relative to this base path.

Categories : HTML

I want to set authenticated users' root to a nested resource, their dashboard, instead of the home#index page non-authenticated users use as root
Option 1: In your dashboards controller, change to: @user = current_user @dashboard = current_user.dashboard This will also prevent users from seeing other user's dashboards. Option 2: Now, if users can see other user's dashboard fine, then change your route: root :to => "dashboards#find", as: :authenticated_root and in your dashboards controller: def find redirect_to user_dashboard_path(current_user, current_user.dashboard) end

Categories : Ruby On Rails

wrong child root name in rabl and can't set child root name
I've encountered the same exact bug, the problem seems to be setting the object_root to false. Following the comment of Bigxiang I have experimented a bit and found that this works fantastically: child( {:rsvp => :rsvp}, {:object_root => false} ) do extends "users/index" end Note both the round parentheses "()" and braces "{}".

Categories : Ruby On Rails

Reference another Aggregate Root inside another Aggregate root?
By the sounds of it you have an Installation AR. When requiring an AR in another you should model the contained AR as a only the ID in the container or a VO if required. You need to have hard edges around your ARs. Back to the Order / OrderLine example :) An OrderLine seems to 'require' a Product but you shouldn't ever give a Product instance tot eh OrderLine. Instead only model, say, the ProductName and ProductId as a VO in the OrderLine. Now you have a distinct edge to your Order AR. Hope that helps somewhat.

Categories : Entity Framework

Is it webapp-root/META-INF or webapp-root/WEB-INF/classes/META-INF (Tomcat 7)
I guess it is all right. They both might have slightly different purposes. webapp-root/META-INF is directory for metadata of the web application, which you can access via servletContext.getResource("/META-INF/foo"). webapp-root/WEB-INF/classes/META-INF is directory for metadata of java classes, which you can read via getContextClassLoader().getResource("/META-INF/foo").

Categories : Spring

Where is Doc Root
You can not say in advance if $_SERVER['DOCUMENT_ROOT'] contains a slash at the end or not. It varies according to the environment. In most cases, it doesn't have the trailing /, but in Windows, a trailing slash will cause issues. The solution here, as Dave suggested, would be to append the trailing slash if it doesn't exist. $_SERVER['DOCUMENT_ROOT'] = sprintf('%s/', rtrim($_SERVER['DOCUMENT_ROOT'], '/')); An alternative solution: $_SERVER['DOCUMENT_ROOT'] .= (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/')?'':'/'; Hope this helps!

Categories : PHP

How to use root privileges in my app
This is what I have found you must specify android.permission.FACTORY_TEST permission. docs here For accessing root permission you can use p = Runtime.getRuntime().exec("su"); Source : Here

Categories : Android

How to get root dir in Symfony2
I want to make everyone aware that this is the Service Locator, which is an anti-pattern. Any developer should be able to see what a class, or controller, requires to function from the method signature only. Injecting a whole "container" is very generic, hard to debug and isn't the best way of doing things. You should use a Dependency Injection Container that allows you to inject specifically what you want anywhere in your application. Be specific. Check out a seriously awesome recursively instantiating dependency injection container called Auryn. Where your framework resolves your controller / action, place it there and use the container to create the controller and run the method instead. Boom! Instant SOLID code. You're correct, the service container is accessed using $this->ge

Categories : PHP

Difference between root to and get
root_to: is used to show the home page. i.e., page which is user landed into site. To solve your problem: First provide route to static_pages/home using get "static_pages/home" and then add root to: "static_pages#home"

Categories : Ruby On Rails

How to get the root directory
Use Path.GetPathRoot method provided by the framework Gets the root directory information of the specified path For your case you can use: string rootPath = Path.GetPathRoot(filename);

Categories : C#

Getting root of expression
I have found the complete solution to my answer which has two parts: Why the DisplayClass and what it means can be found in the answer to this question: What does “DisplayClass” name mean when calling lambda? How to get the actual root of the expression (which is possible by the way) can be found in this questions answer: Getting the object out of a MemberExpression.

Categories : C#

How do I get the root url of the site?
$root = (!empty($_SERVER['HTTPS']) ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'] . '/'; If you're interested in the current script's scheme and host. Otherwise, parse_url(), as already suggested. e.g. $parsedUrl = parse_url('http://localhost/some/folder/containing/something/here/or/there'); $root = $parsedUrl['scheme'] . '://' . $parsedUrl['host'] . '/'; If you're also interested in other URL components prior to the path (e.g. credentials), you could also use strstr() on the full URL, with the "path" as the needle, e.g. $url = 'http://user:pass@localhost:80/some/folder/containing/something/here/or/there'; $parsedUrl = parse_url($url); $root = strstr($url, $parsedUrl['path'], true) . '/';//gives 'http://user:pass@localhost:80/'

Categories : PHP

Root log all level
This appears to be the way log4net works. When your config file is processed it behaves as if it has been configured like: <logger name="IBatisNet.DataMapper.Commands.DefaultPreparedCommand" additivity="false"> <level value="DEBUG" /> <appender-ref ref="SpecificAppender"/> <appender-ref ref="ConsoleAppender" /> <appender-ref ref="LogBufferingAppender" /> </logger> Fortunately there is a workaround and that is to set a level filter on your appenders, e.g. for the ConsoleAppender: <appender name="ConsoleAppender" type="log4net.Appender.ConsoleAppender"> <layout type="log4net.Layout.PatternLayout"> <param name="ConversionPattern" value="%d{HH:mm:ss,fff} [%t] %-5p %c{1} - %m%n" /> </layout> <filter ty

Categories : C#

Can't run systrace as root
The adb sources do this: property_get("ro.debuggable", value, ""); if (strcmp(value, "1") != 0) { snprintf(buf, sizeof(buf), "adbd cannot run as root in production builds "); In other words, if it doesn't see ro.debuggable set to 1 it won't let you run adb root. Check the contents of your /default.prop.

Categories : Android

C# find Nth Root
static double NthRoot(double A, int N) { return Math.Pow(A, 1.0 / N); } From Wikipedia: In calculus, roots are treated as special cases of exponentiation, where the exponent is a fraction: sqrt[n]{x} ,=, x^{1/n}

Categories : C#

XML::LibXML: doc - root
Any prefixes defined in the topic node are adopted by the xpc, so the two are different if there are prefixes defined on the root node. use warnings; use strict; use feature qw( say ); use XML::LibXML qw( ); my $xml = <<'__EOI__'; <root xmlns:foo="uri:xxx"> <foo:bar/> </root> __EOI__ my $doc = XML::LibXML->load_xml( string => $xml ); my $root = $doc->documentElement(); { my $xpc = XML::LibXML::XPathContext->new($doc); say "doc:"; say $_->nodeName for $xpc->findnodes('foo:bar'); } say ""; { my $xpc = XML::LibXML::XPathContext->new($root); say "root:"; say $_->nodeName for $xpc->findnodes('foo:bar'); } doc: root: foo:bar

Categories : Xml

C# XML 'colon' in root name possible?
The "site:" bit with the colon in is actually your XML Namespace, set this property instead. Look at this question: How to create XmlElement attributes with prefix?

Categories : C#

zip with php in root directory
Use the second parameter of ZipArchive::addFile() to specify under which file name the file appears in the archive. basename($file) is a good candidate for that.

Categories : PHP

How to npm install global not as root?
That's pretty much all you need to do if you are installing binary utilities (which I gather you are as you updated your PATH). NODE_PATH will only need to be set you have installed a module that you want to require() from unrelated node scripts, but you shouldn't really do this anyway. Modules that are required as dependencies for other modules/scripts should be installed locally (i.e. specified in a package.json) as that way you keep strict control over versions. Edit: The accepted answer here explains it much better than I was able to: How do I install a module globally using npm?

Categories : Node Js

Redirect to root not working
When you make an AJAX request (i.e. a JavaScript XMLHTTPRequest), your JavaScript code is entirely responsible for handling the response returned by the server. The browser won't load a new URL if the server returns a redirect response to your AJAX request, or indeed take any action on its own. Your handler function that deals with the response from the AJAX request could look at the status code of the response, and set window.location to the provided URL if the response is a redirect. If you post your AJAX code, we could advise on that.

Categories : Django

How to Remove Root Element in C#/
The simplest way to do this is with LINQ to XML - something like this: XDocument input = XDocument.Load("input.xml"); XElement firstChild = input.Root.Elements().First(); XDocument output = new XDocument(new XDeclaration("1.0", "utf-8", "yes"), firstChild); output.Save("output.xml"); Or if you don't need the XML declaration: XDocument input = XDocument.Load("input.xml"); XElement firstChild = input.Root.Elements().First(); firstChild.Save("output.xml");

Categories : C#

Root access to cloudcontrol
To install ioncube, you have to provide the ioncube extension as part of your repository and use the buildpacks custom PHP.ini feature to load the extension. Check the README for instructions how to do this. https://github.com/cloudControl/buildpack-php/blob/master/README.md

Categories : Misc

Problems with ROOT and libbz2
Oook, the problem is rootcint cannot interprate extern "C". The solution is to replace the following code in bzlib.h #ifndef BZ_IMPORT #define BZ_EXPORT #endif #ifndef BZ_NO_STDIO /* Need a definitition for FILE */ #include <stdio.h> #endif #ifdef _WIN32 # include <windows.h> # ifdef small /* windows.h define small to char */ #

Categories : C++

How to get root element tag only once under for each loop?
At the moment, you are outputting an Endorsement element (or LText element) for each InfoMsg element you have, and so you get the repeated elements as you show. What you need to be doing is just outputting the Endorsement element just once, and then selecting the relevant InfoMsg elements within this. <Endorsement> <xsl:for-each select="InfoMsg[MsgType='01' or MsgType='1']"> <TL> <xsl:value-of select="Text"/> </TL> </xsl:for-each> </Endorsement> And similarly for Ltext. Note there is no real need to use xsl:element here, just output the element directly. In fact, you should probably be using template matching here, to allow you to re-use code. Try this XSLT instead: <xsl:stylesheet version="1.0" xmlns:xsl="htt

Categories : Xml

Get root domain from request
In HttpServletRequest, you can get individual parts of the URI using the methods below. You could also use them to reconstruct the URL piece by piece (to help debugging, or other tasks), like this: // Example: http://myhost:8080/people?lastname=Fox&age=30 String uri = request.getScheme() + "://" + // "http" + ":// request.getServerName() + // "myhost" ":" + request.getServerPort() + // ":" + "8080" request.getRequestURI() + // "/people" (request.getQueryString() != null ? "?" + request.getQueryString() : ""); // "?" + "lastname=Fox&age=30" So request.getServerName() is the closest we got to you need. The "root domain": For the "root domain", you'll have to work through the String returned from getSe

Categories : Java

Login as root with trying different passwords in php
$passwords = array('pass1', 'pass2', 'pass3'); if (!$ssh->login('ntsysadm', 'ABCD123')) { echo "Login failed."; return; } //No need to use else foreach($pass in $passwords) { $ssh->write("su root "); $ssh->write(sprintf("%s ", $pass); if(strstr($ssh->HowIsThisFunctionCalled, 'Logged in')) echo sprintf('Password %s is correct.', $pass); else echo sprintf('Password %s is not correct.', $pass); } Replace 'HowIsThisFunctionCalled' with the function, that reads out the whole terminal text or last message, pretty sure this exists in PHPSECLIB.

Categories : PHP

PHP warning from root directory
Either: Include relative the the file: __DIR__.'/../somefile';/__DIR__.'/somepath/somefile'; Include relative to a known dir: $_SERVER['DOCUMENT_ROOT'] is often used, as is a PROJECT_DIR-like define() in your bootstrap code. Change the working directory to a known/static dir chdir('/some/dir');. Not recommended as calling code may not expect this.

Categories : PHP



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