w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Recursively adding .org files in a top-level directory for org-agenda-files takes a long time
I also tried "recursive directory listing" at Emacs startup. It simply is way to loooong to be usable. So, try to stick with a limited number of "root" directories where you put your agenda files. Even better is sticking with "~/org", and possibly a few subdirs like "work" and "personal", and that's it. You can put there your agenda files, and have links Inside them to your real project root dirs. I know, this is not optimal, but I don't have anything better right now.

Categories : Emacs

Default landing page of error 404 inside certain directory level
It sounds like what you want is 'routing', telling your web server how to respond to requests based on the URL. The default routing you have is probably set up to look for PHP or HTML files and process and serve those, but depending on what server software you are using you should be able to change this. Assuming you are hosting on an apache server, you should be able to achieve this with mod_rewrite. A search for how to use mod_rewrite gave this article: http://wettone.com/code/clean-urls

Categories : PHP

Can I use applicationDirPath() to access resources at a higher directory level?
Just use ... QApplication::applicationDirPath() + "/../../data/Guide/guide.html" is perfectly valid path! Of course there is another problem. When the application is installed, the relative path will probably be different again. You either need to configure the paths in visual studio so that the relative path works both during development and after deployment, or you need to detect the layout.

Categories : C++

Strange behaviour on method annotations and default access level
This answer is just a "one big maybe" made by a man at 3 a.m. so it will require JLS confrontation, better terminology and more informations. I was planning to post it as comment but unfortunately it is too long :/ Lets take a look at this classes class SomeClass { @TestAnno public void test(){} } class SomeDefaultClass extends SomeClass { } public class SomePublicClass extends SomeClass { } now take a look at this code and its result Method m1 = SomePublicClass.class.getMethod("test"); Method m2 = SomeDefaultClass.class.getMethod("test"); System.out.println(m1 + " > " + m1.getAnnotation(TestAnno.class)); System.out.println(m2 + " > " + m2.getAnnotation(TestAnno.class)); output public void SomePublicClass.test() > null public void SomeClass.test() &g

Categories : Java

What is the default access level for methods in a public abstract class in Java?
The default visibility is known as “package” (though you can't use this keyword), which means the field will be accessible from inside the same package to which the class belongs. uf you declare as public than it will be public for all no matter its abstract or not

Categories : Java

what is the best way to check in C# .NET if a directory has access to list files or a unauthorized access exception would rise
The best way to check the permission, is try to access the direcoty (read/write/list) & catch the UnauthorizedAccessException. However for some reason out there, if you want to check permissions, following code should satisfy your need. You need to read Access Rules for the directory. private bool DirectoryCanListFiles(string folder) { bool hasAccess = false; //Step 1. Get the userName for which, this app domain code has been executing string executingUser = System.Security.Principal.WindowsIdentity.GetCurrent().Name; NTAccount acc = new NTAccount(executingUser); SecurityIdentifier secId = acc.Translate(typeof(SecurityIdentifier)) as SecurityIdentifier; DirectorySecurity dirSec = Directory.GetAccessControl(folder); //Step 2. Get directory permission det

Categories : C#

Batch file to recursively move files to first level directory from deeper subdirectories
try this: @ECHO OFF &SETLOCAL FOR /r "F:" %%a IN (*.rar) DO ( SET "fname=%%~nxa" SET "fpath=%%~fa" FOR /f "tokens=1,2 delims=" %%b IN ("%%~fa") DO SET "targetfolder=%%~b\%%~c" SETLOCAL ENABLEDELAYEDEXPANSION CALL :moveit "!fpath!" "!targetfolder!" "!fname!" ENDLOCAL ) GOTO :eof :moveit SETLOCAL SET "nname=%~3" :loop SET /a fcount+=1 IF EXIST "%~2\%nname%" ( SET "nname=%~n3 (%fcount%)%~x3" GOTO :loop ) ECHO MOVE "%~1" "%~2\%nname%" MOVE "%~1" "%~2\%nname%" ENDLOCAL EXIT /b

Categories : Windows

I'm trying to compress some files from one directory to another but I'm getting access denied on one of the directories why?
It doesn't work because you pass a directory name for the second parameter to CompressDirectory. You should pass a file name like.... string output = Path.Combine(zippedFileDirectory, "MyZipFile.7z"); ..... compressor.CompressDirectory(source, output);

Categories : C#

How to access local directory files using WAMP server?
This is nothing to do with HTML5 it is an Apache configuration issue. From what you say I assume you have been double clicking on the index file from explorer (filemanager) while you develop and test your site. BAD IDEA. Now you are using the browser to server the file via Apache ( it does not do this when you doubleclick on filenames in explorer ) you need to tell Apache that it has access to your video library which you placed on the D: drive. To do this you need to configure Apache ( https.conf ) to know about your video library and be allowed to access it. To do this you need an Alias. Now I have no idea what your setup is but lets assume you have created your site in the wamp folder structure C:wampwww or C:wampwwwsitename You will need to amend your https.conf file adding some

Categories : HTML

Imported class files are shown under default package in Eclipse, how can i access them?
You have to respect the File System Hierarchy in which the class files come from. Let's assume that the class files (For example the class Clazz) have the declaration package ch.charno.xy, they must remain in a folder hierarchy ch/charno/xy/Clazz.class. You have to import the folder in which the subfolder ch resides so that the correct hierarchy is preserved. It's not possible to just import the class files, but you need to import the whole folder hierarchy. (I hope I understood your question)

Categories : Java

Using batch files to copy all files from a directory tree to a single directory
@echo off set "COPY_FROM=C:UsersmeDesktopDisc 1" set "COPY_TO=C:Testing est" md "%copy_to%" 2>nul cd /d "%COPY_FROM%" for /f "delims=" %%a in ('dir /b /s /a-d') do copy "%%a" "%COPY_TO%" pause

Categories : Batch File

Query (2, 2) By default, a year level was expected. No such level was found in the cube.ytd Function In MDX Query Not Work
From the documentation : The Ytd function is a shortcut function for the PeriodsToDate [...] .Note that this function will not work when the Type property is set to FiscalYears. How about using the following instead : Select PeriodsToDate( [Date].[Fiscal].[Fiscal Year], [Date].[Fiscal].[Fiscal Quarter].[Q3 FY 2003] ) on columns From [Adventure Works]

Categories : Sql Server

Gallery Is Missing Files From Directory- How To Retrieve All Files From Directory
An alternative approach you may want to use to secure your list of thumbnails: $directory = 'thumb'; //where the gallery thumbnail images are located $files = glob($directory."/*.{jpg,jpeg,gif,png}", GLOB_BRACE); natsort($files); //sort by filename Then to render it out simply do this: <?php for($x = 0; $x < count($files); $x++): $thumb = $files[$x]; $file = basename($thumb); $nomargin = $x%4 == 0?" nomargin":""; $title = htmlspecialchars($file); ?> <div class="thumbs fancybox<?= $nomargin ?>" style="background:url('<?= $thumb ?>') no-repeat 50% 50%;"> <a rel="group" href="images/'.<?= $file ?>" title="<?= $title ?>"><?= $title ?></a> </div> <?php endfor;

Categories : PHP

How to access a file in a directory from other directory, when both are in same parent directory with HTML
if dir1 and dir2 are in the same parent directory then this is how you access 2.html from 1.html: <a href="../dir2/2.html">link to 2.html</a> hope it helped :)

Categories : HTML

How to get current user's default movie directory and other default directories?
If you just want to get access to common directories like Documents, Desktop, Movies, etc., -[NSFileManager URLsForDirectory:inDomains:] is the API you're looking for. You'll want to use the NSUserDomainMask for the domains parameter and one of the NSSearchPathDirectory constants (like NSMoviesDirectory) for the directory parameter. If you're actually trying to get the list of folders the current user has in the "Favorites" section of their Finder sidebar (users can customize this list), this Stack Overflow question may have some answers for you.

Categories : Osx

Moveuploaded files function in PHP moves the file to the temp directory but not to the destination directory
First time you called move_uploaded_file() you moved that file from temporary folder to $workDir. After that, uploaded file no longer exists in temporary directory. Just use rename() function to move that file from $workDir."/".$tmpName to final destination. // moves file from workdir to final destination rename($workDir."/".$tmpName, $_POST['filetype'].'/'.$rightname);

Categories : PHP

getting the full filenames from all top directory files in a specific directory and suppressing the occuring error
Did I understand correctly that you only need the File-names with directory-names. This code works for me, no elevations needed. private void button1_Click(object sender, EventArgs e) { string folder = @"C:windowsprefetch"; string filemask = @"*.pf"; string[] filelist = Directory.GetFiles(folder, (filemask)); //now use filelist[i] for any operations. }

Categories : C#

Makefile: copy perl/python files from source directory into build directory
Basically, when you run make X, you are telling Make to find target X in your Makefile. So if you have no install: target, nothing will happen. All of this really depends what is in your Makefiles. If you want to copy your perl/python files into the build directory, one way to do so is to write a Makefile target that runs a *sh command like mv dir2/*.pyc build; mv dir2/*.pl build, and require that target somewhere else in your Makefile. If you need a good Makefile tutorial, here's one that I started with.

Categories : C++

How can I copy only files and folder created in the past hour in one directory to a new directory?
Robocopy doesn't have the granularity, but XXcopy seems to handle it. /DA#30m selects files made within the last 30 minutes. XXcopy is free for non commercial use and can be downloaded from http://www.xxcopy.com XXcopy is xcopy on steroids.

Categories : Batch File

How do I enumerate through a directory in Objective-C, and essentially clear out all the directories of non-directory files?
Something like this will work: NSURL *rootURL = ... // File URL of the root directory you need NSFileManager *fm = [NSFileManager defaultManager]; NSDirectoryEnumerator *dirEnumerator = [fm enumeratorAtURL:rootURL includingPropertiesForKeys:@[NSURLNameKey, NSURLIsDirectoryKey] options:NSDirectoryEnumerationSkipsHiddenFiles errorHandler:nil]; for (NSURL *url in dirEnumerator) { NSNumber *isDirectory; [url getResourceValue:&isDirectory forKey:NSURLIsDirectoryKey error:NULL]; if (![isDirectory boolValue]) { // This is a file - remove it [fm removeItemAtURL:url error:NULL]; } }

Categories : Objective C

Copy files from source directory to target directory and exclude specific file types from specified directories
This is one way to do it $SourceDirectory = 'C:Source' $DestinationDirectory = 'C:Destination' $ExcludeExtentions = '*.txt*', '*.xml*' $ExcludeSubDirectory = 'C:Sourcead_directory1', 'C:Sourcead_directory2' Get-ChildItem $SourceDirectory -Recurse -Exclude $ExcludeExtentions | Where-Object { $ExcludeSubDirectory -notcontains $_.DirectoryName } | Copy-Item -Destination $DestinationDirectory Your best friend here is Where-Object, or where. It takes a scriptblock as parameter and uses that scriptblock to validate each object that goes through pipeline. Only objects that make script return $true are passed through Where-Object. Also, take a look at the object that represents a file you get from Get-ChildItem. It has Name, Directory and DirectoryName containing pieces of file's FullNam

Categories : File

Import a directory with files and force-overwrite even if the directory already exists
Read svn help import and use it. If you task really is Add unversion tree from custom location into existing repository svn import /PATH/TO/PROJECT protocol://URL/IN/REPOSITORY will add as result Project as child to URL/IN/REPOSITORY Just to note: import will appear as commit in repository

Categories : Svn

Magento: overriding frontend phtml files without placing in default/default
If you need your custom info.phtml as part of a module, then declare it in module's xml. Then you can place your custom phtml file in appdesignfrontendwhateversomethingelse emplatesalesorder and it will override it. For example, see this thread about how to override existing template file.

Categories : Magento

Python : Directory bottom level cap
You are just doing next in your function, so it moves to the next position of iterable but does not return the islice. That's why it works for the first case but not the second. You need to do this in the function: def drop_n_elements(start, stop, iterable): return itertools.islice(iterable, start, stop) And then, instead of just calling the function, assign its result: iterable = drop_n_elements(0, 2, iterable) You also don't need None in the islice, because the step is optional, but that wasn't causing any problems.

Categories : Python

Having problems deleting all files in a directory, then the directory itself
Well, I can see a couple of places, where the error could be. First, this line: var item = (((sender as MenuItem).Parent as ContextMenu).Owner as Grid); As you know, when you cast types with as keyword, the result might be null and no exception is thrown. Second, and IMO most important: This line: string[] fileList = appStorage.GetFileNames(directory + "\*"); That won't find anything. You should use "." (star-point-star) instead of "*"(star) in search request. Also, when you work with IsolatedStorage, use using keyword, like: using (IsolatedStorageFile myIsolatedStorage = IsolatedStorageFile.GetUserStoreForApplication()) { // your code }

Categories : C#

How to move the oldest 10 files in a directory to another directory
var filesToMove = di .GetFiles() .OrderBy(f => f.CreationTime) .Take(10) .ToArray(); foreach (var rgFile in filesToMove) { rgfile.MoveTo(System.IO.Path.Combine(destinationDirectory, rgfile.Name)); }

Categories : C#

How do I move a Wordpress page up a directory level?
use rewrite rules. e.g. RewriteRule ^videos/(.*)$ /blog/videos/$1 [L] http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewriterule

Categories : Wordpress

How to list all final level of subfolders in a directory in vb.net?
Try something like this: Public Sub GetChildFolders(sFolderPath As String) For Each dir As String In IO.Directory.GetDirectories(sFolderPath) If IO.Directory.GetDirectories(dir).Length > 0 Then Call GetChildFolders(dir) Else ' Add "dir" to the ListBox End If Next End Sub And then call it with the father directory where all starts: Call GetChildFolders(startFolder) EDIT: Maybe you could do something like this to get rid of the amount of folders: Dim allDirs() As String = IO.Directory.EnumerateDirectories(path, "*", System.IO.SearchOption.AllDirectories) For Each dir As String In AllDirs If IO.Directory.GetDirectories(dir).Length = 0 Then ' Add "dir" to the ListBox End If Next

Categories : Vb.Net

Python function that navigates to top level module directory
Do not use os.getcwd() for this; use the module-level __file__ name instead. If the current working directory is elsewhere, you end up in an infinite loop when you reach the root directory and continually fail to go up one directory. import os.path here = os.path.dirname(os.path.abspath(__file__)) Now here is a path to the directory containing the current Python file. Use that to find the top of your project (not by using chdir() but by using os.path functions).

Categories : Python

Find top-level directory from subdirectory on Linux in Python
Find the real path based on the relative path of "up three directories," and extract the last part of that real path. [Edit: In response to your comment I have revised this. In my opinion it is getting complex enough that your chain of dirname's is better. At least it is easy to understand what it happening.] from os import path as p _, ci_root = p.split(p.abspath(p.join(__file__, '../../..')))

Categories : Python

Trim (or go up) one level of directory tree in powershell variable
$source = "C: empone wo hree" $dest = (new-object system.io.directoryinfo $source).parent.fullname EDIT: You can get a DirectoryInfo for a directory using get-item so you can instead do: $dest = (get-item $source).parent.fullname

Categories : Powershell

Select multiple files (different files from different directory) with 1 input type file element.
Using more than one <input type="file" /> element for your form is the best you can do. It's not possible to select multiple files from different directories in a single upload dialog.

Categories : HTML

Bash script that move files from one directory with lots of files to a month folder
something like this? DEBUG=echo cd ${directory_with_files} for file in * ; do dest=$(stat -c %y "$file" | head -c 7) mkdir -p $dest ${DEBUG} mv -v "$file" $dest/$(echo "$file" | sed -e 's/.* (.*)/1/') done DISCLAIMER: test this in a safe copy of your files. I won't be responsible for any lost of data ;-)

Categories : Bash

quickest way to count the number of files in a directory containing hundreds of thousands of files
What you do right now reads the whole directory (more or less) into memory only to discard that content for its count. Avoid that by streaming the directory instead: my $count; opendir(my $dh, $curDir) or die "opendir($curdir): $!"; while (my $de = readdir($dh)) { next if $de =~ /^./ or $de =~ /config_file/; $count++; } closedir($dh); Importantly, don't use glob() in any of its forms. glob() will expensively stat() every entry, which is not overhead you want. Now, you might have much more sophisticated and lighter weight ways of doing this depending on OS capabilities or filesystem capabilities (Linux, by way of comparison, offers inotify), but streaming the dir as above is about as good as you'll portably get.

Categories : Perl

How to control start level of bundles deployed from pickup directory?
You can only restrict the resolution of bundles to the availability of capabilities, but not the activation. Activation certainly happens after resolution, but resolved bundles may be activated in any order. So bundle-level activation dependencies don't work well. Instead, you should use "components" (i.e. declarative services) which have the option to bind their lifecycle to the availability of other components. With this option, the bundles may start in an arbitrary order, but services are still only activated/exposed once all its service dependencies are activated.

Categories : Misc

keeping last 7 days zip files and deleting rest all files from a directory
Do you really need to sort and all? If you need to delete files which are more than 7 days old, get the lastModifieddate and substract it from current time. if the difference is more than 7*24*60*60 seconds then you can delete it. All you need is a for loop after the f.listFiles() line. Not actual code - use to get to the working code. long timeInEpoch = System.currentTimeMillis(); // slightly faster than new Date().getTimeInMillis(); File f = new File("/tmp"); if (f.isDirectory()) { final File[] files = f.listFiles(); for(int i =0; i < files.length ; i++ ) { if( timeInEpoch - f.lastModifiedDate() > 1000*60*60*24*7 ) files[i].delete(); } System.out.println(fileList); }

Categories : Java

According to files names of a file, duplicate files into anther directory
You need to turn the first file into a set (for fast membership testing). You are also using os.walk, which gives you three pieces of information, the path to the directory, a list of subdirectories and a list of the files in that directory: import sys import shutil,errno import os srcDir = 'Root' dstDir = 'De' with open('file.txt','r') as f: read_filenames = {fname.strip() for fname in f} # set comprehension for root, directories, files in os.walk(srcDir): for filename in read_filenames.intersection(files): shutil.move(os.path.join(root, filename), dstDir) The .intersection() call returns all elements in the read_filenames set that are also in the files list. Note that I tell shutil.move() the full path of the file to move to dstDir, using os.path.join() based on th

Categories : Python

Maven - unpack files from jar if jar is used, copy then extracted files to a directory
The m2e-plugin can neither execute the maven dependency plugin nor copy sources on its own. You can use the maven dependency-plugin to extract files from jar: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <executions> <execution> <id>unpack</id> <phase>prepare-package</phase> <goals> <goal>unpack</goal> </goals> <configuration> <artifactItems> <artifactItem>

Categories : Java

deleting all zip files in target directory and only keeping latest two zip files
Not a optimized one but you can use. String[] extensions = {"zip","rar"}; Collection<File> fileList = listFiles(FilePath2,extensions,false); File[] fileArray = new File[fileList.size()]; int x = 0; for (Iterator iterator = fileList.iterator(); iterator.hasNext();) { fileArray[x] = (File) iterator.next(); x++; } File temp; for(int i=1; i< fileArray.length ; i++) { for(int j=0; j<fileArray.length-1; j++) { if(fileArray[j].lastModified() > fileArray[j+1].lastModified()) { temp = fileArray [j]; fileArray [j] = fileArray [j+1]; fileArray [j+1] = temp; } } } for(int i=0; i< fileArray.length-2 ; i++) { deleteQuietly(file

Categories : Java

how to find list of files file name starts with All_Responses_11367*.txt and copy total files to another directory in unix command
This find command should give all file starting with All_Responses_11367* in current directory modified/created in last 77 days: find . -name "All_Responses_11367*" -maxdepth 1 -type f -mtime -77 -exec cp '{}' dest ; Change dest to some other directory where you want to copy these files.

Categories : Unix



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