w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
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

For a Ruby CLI, what is the most reliable way to change directory to users root/home directory?
To summarize Avdi Grimm's screencast on the same subject, If you're using a Ruby version greater than 1.9, the Dir module provides a method #home. However, this depends on the environment variable HOME set on the user's shell session. To reliably get the home dir, you should pass in the login name of the current user to the Dir.home command. Or, in code: # Works if HOME is set in the environment i.e., if "echo $HOME" returns the home directory # when that command is run on the command-line Dir.home # => /Users/<username>, Works if HOME is set # If the HOME environment variable is not set, you should explicitly pass in the username # of the currently logged-in user Dir.home(username) # => /Users/<username> # The current username can be obtained using username

Categories : Ruby

How to set up local repo to have different root directory than remote "upstream" directory of an open source project?
Broadly speaking, No. Git does not allow you to have two different view of the same repository that have different directory structures. Solution 1: Ignore git altogether for uploading That said, I think you don't need this anyway. If your webhost provides public_html, why not just scp the files you want to the location you want? You could make this a task in a Makefile/Rakefile/whatever and then run it from your local machine when you want to upload, for example, a makefile task could look like: upload: scp -r ./upload/* me@myhost:/home/me/public_html/ .PHONY: upload Solution 2: link into your git directory on your webhost Instead of manually uploading your files, simply link your public_html directory to your upload directory in your git repository on your server. For example:

Categories : GIT

upload image to root directory from sub directory php
As far as I know there is no problem with accessing other directories, as long as your user has sufficient file access permissions. Maybe try using a full file path $_SERVER["SCRIPT_FILENAME"] and save your file with an absolute path?

Categories : PHP

Find the value on wheel for wheel of fortune
var wheelValue = wheelValues[Math.floor(Math.ceil(dataRotation % 360) / 15)]; switch (wheelValue) { I changed this line from round to ceil and got 14 out of 14 correct results..

Categories : Javascript

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 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#

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

Download to root directory
Try something like this: Dim baseDir As String = AppDomain.CurrentDomain.BaseDirectory Dim launcherDir As String = Path.Combine(baseDir, "Launcher") If Not Directory.Exists(launcherDir) Then Directory.CreateDirectory(launcherDir) End If Dim targetFile = Path.Combine(launcherDir, Path.GetFileName(fileUrl)) Me.downloader.DownloadFileAsync(New Uri(fileUrl), targetFile, Stopwatch.StartNew)

Categories : Vb.Net

Travis CI with Rails Not In Root Directory
I'll try and address what you should change one error at a time. With the first error: The command "psql -c 'create database test-postgres_production;' -U test-postgres" failed and exited with 2 during before_script. Let's add the following to get a postgres database going on Travis CI: env: - DB=postgresql script: - bundle exec rake db:migrate - bundle exec rake db:test:prepare - bundle exec rake spec before_script: - bundle exec rake db:create RAILS_ENV=test Now that we're running a rake tast to create the database you should be able to remove what you currently had in before_script: Now for the second error: -mongodb: unrecognized service I think you just need a space before the mongodb like so: services: - mongodb And with the third and last error: rake abor

Categories : Ruby On Rails

How do I get the root directory of my ASP.NET server application?
Server.MapPath("~"); Will get you the root directory of the current application, as a path on the disk. E.g., C:inetpub... Note that the ~ character can be used as part of web paths in ASP.NET controls as well, it'll fill in the URL to your application.

Categories : Asp Net

Getting Revisions ONLY in my directory and not in root Repository
I figured out my issue this morning, to answer my own question, when working with subfolders out of a checked out repository, every time a svn update -r PREV command is called, it updates to the previous revisions in me directory. However, running svnversion on at that point will give you the previous revision in ../../repos/users to solve this issue, I called svn info . in the me directory and noted that the Last Changed Rev: had the number that I needed. To get this I called svn info (this is in php btw): exec('svn info .', $info); Then I used a regular expression to grab the key: $versionKey = array_keys(preg_grep('/Last Changed Rev/', $info)); And then set the version to that revision number using substr with an offset of 18: $version = substr($info[$versionKey[0]], 18);

Categories : PHP

Split-Path with Root UNC Directory
By using the System.Uri class and querying its host property: $uri = new-object System.Uri("\serverfolder") $uri.host # add "\" in front to get exactly what you asked Note: For a UNC path, the root directory is the servername plus the share name part.

Categories : String

what would be the path for the file in the root directory?
When you say "root directory" that usually means the root directory of a filesystem. On most *nix (Linux, FreeBSD, Unix) installs, that means your filesystem path is simply "/". That is, if your config file is there, your PHP file should look like this: <?php include('/config.php'); ?> However, it would generally be both a bad idea and would require superuser privileges to actually put a file at the filesystem root of "/". So it's likely (but we have to guess), that you mean the DOCUMENT ROOT for your web server. Most web servers running PHP make that value available via the super-global $_SERVER['DOCUMENT_ROOT'] as mentioned by Kai Qing in his comment. If that is where your file is, then you could put this in your PHP file: <?php include($_SERVER['DOCUMENT_ROOT']

Categories : PHP

Get user root directory from windows service
I found this under Win7 registry. XP looks to have the same registry keys, but the values have "All Users" profile within it. [HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionExplorerShell Folders] "Common Desktop"="C:\Users\Public\Desktop" "Common Start Menu"="C:\ProgramData\Microsoft\Windows\Start Menu" "CommonVideo"="C:\Users\Public\Videos" "CommonPictures"="C:\Users\Public\Pictures" "Common Programs"="C:\ProgramData\Microsoft\Windows\Start Menu\Programs" "CommonMusic"="C:\Users\Public\Music" "Common Administrative Tools"="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Administrative Tools" "Common Startup"="C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup" "Common Documents"="C:\Users\Public\Documents" "OEM Links"="C:\ProgramData\OEM Links" "Common Template

Categories : C#

phonegap set the root directory for asset files
Maybe a solution is to use the base tag witch allow you to set a default base to all yours relatives links. So for android it will be: <base href="file:///android_asset/www/" target="_blank"> And all yours link will be: <img src="img/logo.png">

Categories : Cordova

IIS 7 virtual directory not targeting website root?
To troubleshot 500 errors on IIS, you need to get the substatus (for example 500.19), then check the error code, in the case of 500.19 errors (the more common), you can start here: http://blogs.iis.net/webtopics/archive/2010/03/08/troubleshooting-http-500-19-errors-in-iis-7.aspx. If you're not getting the substatus and/or error code, then you should access the site in the server using localhost.

Categories : HTML

Upload file into Server Root directory
Use Apache's FTP library to browse and retrieve files from your servers filesystem. You can list out all the files in the root directory by using: .listFiles() Example: String hostname = properties.getProperty("FTP_SERVER"); String user = properties.getProperty("FTP_USER"); String passwd = properties.getProperty("FTP_PASSWD"); FTPClient client = new FTPClient(); client.connect(hostname); client.login(user, passwd); String reply = client.getStatus(); System.out.println(reply); client.enterRemotePassiveMode(); client.changeWorkingDirectory("/"); FTPFile[] files = client.listFiles();

Categories : Java

How to run the powershell code against each subfolder that is in the IIS root directory?
You need to separate folder-traversal (recursive) from file processing (non-recursive), e.g. like this: $basedir = 'c:inetpubwwwroot' $exp = [regex]::Escape($basedir) $server = 'http://172.16.x.x' function Create-HtmlList($fldr) { Get-ChildItem $fldr -Force | ? { -not $_.PSIsContainer } | select ... ... } | Set-Content "$fldr.htm" } # list files in $basedir: Create-HtmlList $basedir # list files in all subfolders of $basedir: Get-ChildItem $basedir -Recurse -Force | ? { $_.PSIsContainer } | % { Create-HtmlList $_.FullName } The output files will be put into the respective folder (named after the folder with the extension .htm appended). If you want a different name or location for the output files, you need to adjust the Set-Content line in the function

Categories : Powershell

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 root folder directory - include_once and echo
First you need to declare your root variable like so: $baseURL = "../.."; // or whatever it is Then you can use the variable in the include like so: include_once("{$baseURL}/asset/header.php"); // means include_once("../../asset/header.php"); Just make sure when you put the path inside of include_once, you use DOUBLE quotes and not single quotes, or else you can't incorporate variables like above. Edit: One thing to remember, $baseURL must be in the scope of your include. As in, if it's a global and you're using it inside of a function, make sure you declare it as a global. More on scopes: http://php.net/manual/en/language.variables.scope.php

Categories : PHP

Phonegap Build - Get application root directory?
In my case after asking the guys at phonegap, they say that you dont really need to do any of this can just use location.hostname so am looking at using that approach for now, the main reason for asking this is because in trigger.io I would be using tools.getUrl. So I assumed in Phonegap I would need to do something similar. http://legacy-docs.trigger.io/en/v1.4/modules/tools.html

Categories : Javascript

Unable to write file to android root
System is mounted ro, if you want to try to write something inside system/etc you should first remount it rw . Edit: from the mount documentation All files accessible in a Unix system are arranged in one big tree, the file hierarchy, rooted at /. These files can be spread out over several devices. The mount command serves to attach the filesystem found on some device to the big file tree. That`s the output on my device: shell@android:/ $ mount rootfs / rootfs ro,relatime 0 0 as you can see / is mounted as read-only

Categories : Android

How to ignore subfolders and redirect to the root directory with .htaccess
Remove the second RewriteCond which checks if directory doesn't exist !-d <IfModule mod_rewrite.c> RewriteEngine On RewriteBase /demo/ RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteRule . /demo/index.php [L] </IfModule>

Categories : Htaccess

How to create a folder and a file in my project root directory
If you want the directory of the executable or dll of your running application then: Dim spath As String spath = System.IO.Path.GetDirectoryName( _ System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase) If (Not System.IO.Directory.Exists(Path.Combine(spath, "test"))) Then System.IO.Directory.CreateDirectory(Path.Combine(spath, "test")) If (Not System.IO.File.Exists(Path.Combine(spath, "testoutput.txt"))) Then System.IO.File.Create(Path.Combine(spath, "testoutput.txt")) End If End If If you want the solution/project directory then: Dim spath As String = Directory.GetCurrentDirectory If (Not System.IO.Directory.Exists(Path.Combine(spath, "test"))) Then

Categories : Vb.Net

Need to show static directory located in root of WP install
Move the WordPress/MobileApp directory out of WordPress to your Web Root folder (say, /public_html or /www). Then try accessing it as http://dawsondental.ca/mobileapp/.

Categories : Htaccess

effects of initializing git repository on linux root directory 3:)
Instead of using git you could use a filesystem that support snapshots, like ZFS or BTRFS it will be more efficient and it's usage will be transparent to you.

Categories : GIT

how to show the image in root directory file(wampserver)
Make sure the folder upload exists in the same directory as the file register.php" and has correct permissions (try 777 for instance). Check if the move_uploaded_file() is actually called or not. Make sure that move_uploaded_file() returns TRUE, try: echo move_uploaded_files($file_tmp, "upload/" . $file_name);

Categories : PHP

How to get relative path of files from defined root directory?
That would be os.path.relpath(): >>> import os >>> filename = "C:/test/media/blog_images/2013/06/15/yay.gif" >>> blog_images = "C:/test/media/blog_images/" >>> os.path.relpath(filename, blog_images) '2013\06\15\yay.gif'

Categories : Python

root directory IOError: [Errno 13] Permission denied:
You already answered your own question: You do not have the permission to do so. No matter if you use sh, bash, python, C, erlang or a rubber-hose attack. Either run your script with a user owning the necessary permissions or grant yourself access to the file.

Categories : Python

Configure Nginx to serve "/" from a directory already inside root
server{ root /var/www; location = / { root /var/www/home; } location / { } } Reference: http://nginx.org/r/root http://nginx.org/r/location How nginx processes a request Understanding the Nginx Configuration Inheritance Model

Categories : Nginx

rewrite rule for dynamic subfolders using .htaccess in the root directory
Assuming you need ../index.php?product=bike to be rewritten as ../product/bike/ RewriteCond %{QUERY_STRING} (^|&)product=(.*)(&|$) RewriteRule ^(.*)/index.php$ $1/product/%1? [NC,L]

Categories : Htaccess

Point main domain to a directory other then root using httpd.conf
You means that now your website is running as www.mysite.com/mysite and you want the content of mysite only as www.mysite.com, have you tried moving data from mysite to your document root directory. Might be it will work for you

Categories : Apache

Intellij IDEA 12 with GWT: working directory is not equal to your web application root
I think the simplest way to remove this warning is not use -war parameter in Dev Mode Parameters of Idea's Run/Debug Configuration for your buid configuration. Explanation: Idea honestly tells you the truth. It runs the server with the working directory defined to your_home_folder/.IntelliJIdea12/system/gwt/XXXX.xxxx/run/www So if in the Run/Debug Configurations you have defined Before launch: Make it will build the project and copy everything required to this directory. But you're defining -war for the Dev Mode Parameters that doesn't change the fact that idea builds the project to own directory because your parameter will be used only during run time. So Idea detects that fact late and warn you but Idea doesn't know that you're actually referring to the correct directory from your bu

Categories : Java

URL Rewriting domain to use subdirectory as root; still shows that directory in URL in Analytics?
Your rules do nothing to prevent people from directly accessing /c/whatever. If you want to prevent that, you need to add an extra rule: RewriteCond %{THE_REQUEST} /c/ RewriteRule ^c/(.*)$ /$1 [L,R=301]

Categories : PHP

DirectoryInfo[] SearchOption.AllDirectories doesn't include root directory?
You could add it with Concat: DirectoryInfo[] directories = new[]{Dinfo} .Concat(Dinfo.EnumerateDirectories("*.*", SearchOption.AllDirectories)) .ToArray();

Categories : C#

How to make apache2 user to access the file in /root directory?
First, it is generally a bad idea to give apache access to root. If you insist ... Install ACL (Access Control List) Installing ACL Then, assuming your apache server runs with 'apache2' for it's user and group, give the apache2 user and group access to directories/files: setfacl -m "group:apache2:r-x" /root/whatever.file setfacl -m "user:apache2:r-x" /root/whatever.file # *** only need the next two lines if you plan on writing new files in the specified directory. It sets the default file permissions that will be used when the new file is created. setfacl -d -m "group:apache2:r-x" /root setfacl -d -m "user:apache2:r-x" /root Change the r-x permissions to whatever you need Edit - potential solution without ACL The following is untested and may require tweaking but should get you

Categories : PHP

Wordpress Custom Post Type Permalink Below Root Directory
If WordPress is handling both the blog and the pages for the products and peoples, you may want to rethink your folder structure. You can still keep most of WordPress where it is (the /blog/ subdirectory), and move its index.php and .htaccess files up to the root. See Giving WordPress Its Own Directory: Using a pre-existing subdirectory install. That being said, if you really don't want to move anything, then you need a more complicated programmatic solution. For that, you need to use the WordPress Rewrite API. The trick is to use its various functions (add_rewrite_rule, add_rewrite_tag, etc.) to create a set of rules WordPress will recognize but then write your own .htaccess file in the root of your website, above the WordPress root folder. So, if you did something like this… <?ph

Categories : Wordpress

Batch Script to Delete Files with Unique Root Stem in Directory
The way i'd go about this is as follows, i will explain the logic and i'll leave you to do the coding. You will parse all the file names into variables, while increasing each time. Then you will set a limit to the number of loops to go through. Then you will search the first 13 characters of the file name and if the number of lines is equal to 1 then delete it. After you will increase the variable by 1 and go through the loop, at the end of each loop it will check if it has reached the limit aka the number of files in the directory, if it has reached the limit, end the loop, otherwise continue. hah, i finally decided to do it after a guy decided to use my idea i described into actual code, anyway this is way shorter and a lot faster than his, tested+verified to work: @echo off & setl

Categories : Batch File

How do you write an XElement to file asnychronously without hitting the "multiple root nodes" issue?
My guess would be that you're catching an IOException, after you've started to write the file, and starting to write your document all over again. Try trapping that exception and logging it. And it's generally not a good sign when code traps an exception and ignores it.

Categories : C#



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