w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
SDWebImage Cancel downlaod
In your cell, you can cancel the image load if it's going to get re-used. In your UITableViewCell subclass add the following: -(void)prepareForReuse { [super prepareForReuse]; [self.imageView cancelCurrentImageLoad]; // UIImageView for whatever image you need to cancel the loading for } Be sure to #import "UIImageView+WebCache.h" as well. Though your app shouldn't be crashing, but I cannot help you without seeing some code, since it's not possible to pinpoint the cause of the crash from your description above.

Categories : Iphone

How to move large number of files files on disk to HDFS sequence files
Seems like a few lines of code with Camel. i.e. from("file:/..").to("hdfs:..") plus some init and project setup. Not sure how much easier (less lines of code) you can do it using any method. If the HDFS options in Camel is enough for configuration and flexibility, then I guess this approach is the best. Should take you just a matter of hours (or even minutes) to have some test cases up and running.

Categories : Apache

why my jsp 's compiled files i.e java files n class files are not visible in work folder
You can find where the class resides (inside a jar or whatever), via: <!-- This classes URL: <%= getClass().getProtectionDomain().getCodeSource() .getLocation().toExternalForm(); %> --> The getLocation delivers an URL.

Categories : Jsp

What is platform independent way of converting csv files to tsv files if the csv files can be quoted with comma inside the quoted strings?
Text::CSV_XS (XS is the C version of the module, and is faster than native Perl Text::CSV) is the usual tool of choice. It handles quoted (and comma containing) fields easily can be used for both reading and writing Can switch between delimiters so you can have a writer object using TAB. Example (sans error handling): my $csv_in = Text::CSV_XS->new ({ binary => 1 }); my $csv_out = Text::CSV_XS->new ({ binary => 1, sep_char => " ", eol => " " }); open my $fh_in, "<", "file_in.csv" or die "file_in.csv: $!"; open my $fh_out, ">", "file_out.csv" or die "file_out.csv: $!"; while (my $row = $csv_in->getline($fh_in)) { $csv_out->print ($fh_out, $row) } close $fh_in; close $fh_out;

Categories : Perl

App's locale files affect Engine's locale files. It force to have the same files in the hosting app. How fix it?
So I figured out where was the problem. I my engine's engine.rb file I had such a code for initialization. The problem was with receiver of config. Since I provide an app instance to the block, the receiver of config is app. And that caused the problem: initializer("my_engine.locales") do |app| tracking_logger = Logger.new(app.root.join('log', "my_engine_log.log"), 10, 30*1024*1024) config.i18n.load_path += Dir[root.join('my', 'locales', '*.{rb,yml}').to_s] config.i18n.default_locale = :ru config.i18n.fallbacks = [:en] tracking_logger.debug "MyEngine::Engine specific locale settings are set. Def locale == :ru " end So I changed the receiver to MyEngine and now everything works just fine: initializer("my_engine.locales") do |app| tracking_logger = Logger.new(app.root.join(

Categories : Ruby On Rails

how to select multiple music files from device,and to save those selected files in some whare
It does not seem like there is a way to select multiple files below API 19. See Select multiple files with Intent.ACTION_GET_CONTENT

Categories : Android

.gitignored some files only recently; trying to merge into a previous branch, ignored files show up as conflicts
I would rather, before merging devel to A, making sure all devel ignored files are ignored as well in A. The trick for that is to remove from the index of A everything, update the .gitignore content, and add everything back! git checkout A # update the .gitignore file from devel in A git checkout devel -- .gitignore # remove/add everything git rm --cached -r . git add . git commit -m "new commit with devel gitignore files out" # then git merge devel

Categories : GIT

Using command prompt batch files to move and automatically rename duplicate files
I have a pair of utility files that do this, so I can call from either command line, or another batch file. This manages several versions of the file in the same folder, and I would call it before moving your new file in. Usage is: archivefile 5 "c: empsongs" .txt [move] Where 5 is the number of versions to keep. The base file name in this example is "c: empsongs.txt" and it creates (in c: emp) 5 files: songs_1.txt songs_2.txt songs_3.txt songs_4.txt songs_5.txt If you specify move it will move the original songs.txt otherwise it copies it. Note, if you're using it from another batch file (which you'll probably want to), you need to use call or it won't return to your original batch file (both batch files will exit instead, which isn't what you want): call archivefile 5 "c: empsong

Categories : Windows

How to add security constraints in .clsss files to strict user decompiles class files
I want to add security in my classes so that no one can de-compile my class files or open jar files. You can't. It is mathematically impossible. If someone can get hold of the JAR file / ".class" files, they can extract and decompile the classes. (There are ways to make it a bit harder ... but there is nothing you can do to stop a skilled and motivated attacker ... apart from not delivering code to him, in any form.) I also want to add constraints in my web.xml file so that no one can try to access from another servlet. Also impossible: If you are talking about another servlet in the same web container, then anything you can put into the web.xml file can be edited out by the person who controls web container. If you are talking about a servlet in another web container, th

Categories : Java

How to search for few files out of hundred files in UNIX and if not find replace with 0 byte file
Assuming by shell u mean bash: Skeleton to start with: luk32:~/projects/tests$ cat ./process_files.sh #!/bin/bash DEST=./copies for num in "$@"; do file="AllResponses_"$num"_6_20_2013.txt" if [ -f $file ]; then cp $file $DEST else touch $DEST/$file fi done; It takes numbers as arguments, then tries to find a file with given pattern in current working directory. If found copy to destination folder, else touch the file. You will probably have to tinker a little bit to get friendlier than hard-coded date handling. Example: luk32:~/projects/tests$ ls -l total 40116 -rw-r--r-- 1 luk32 luk32 4 cze 21 11:33 AllResponses_1_6_20_2013.txt -rw-r--r-- 1 luk32 luk32 5 cze 21 11:33 AllResponses_3_6_20_2013.txt -rw-r--r-- 1 luk32 luk32 0 cze 21 11:32 AllResponses_4_6_20

Categories : Unix

Problems reading simple numeric values from files in Windows batch files
The issue here is that the entire IF expression is evaluated before the SET /P statement within it can be executed. InstalledVersion is not set yet, and so this invalid expression is evaluated: IF GEQ 2 ( Nothing inside of the IF expression executes because it cannot be completely evaluated. A solution is to enable delayed expansion and replace %InstalledVersion% with !InstalledVersion!, as described in this post. You can also restructure the code so the GEQ comparison happens after the IF expression.

Categories : Windows

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

Serving static files( including HTML files). Nginx vs Node.js. Which one is more scalable?
Both Node.js and Nginx are asynchronous (non-blocking) servers. Nginx is definitely more well suited for serving your static files. However, depending on your use case, the difference may not be worth the added administration overhead. You would really have to be running a significant amount of traffic before you would notice the difference.

Categories : HTML

Reinserting XML Comments into a tree of C# source files from the auto generated [assembly].xml files
Since code files are generated using a tool (ILSpy), code style and formatting (whitespaces and indentations) will be same for almost every code file. What I would do is check if decompiling of that 5000+ class library is against the law, write a simple parser to parse code files and find class/method/property definitions check if what I've found matches with what is in xml If everything is ok, then I would copy found xml tags to their new position on code files since now that I know positions of definitions in a file. PS: just a reminder, to ease string replacing/inserting, always do inserting from bottom of the file to top of the file. this way, whenever you insert a line, indexes of other lines to be inserted will remain same.

Categories : C#

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

Search through directories for specific Excel files and compare data from these files with inputvalues
In answer to the first question "How come I only get one result when I am printing excelfiles()" this is because your return statement is within the nested loop, so the function will stop on the first iteration. I would try building up a list instead and then return this list, you could also combine this with the issue of checking the name e.g. : import os, fnmatch #globals start_dir = os.getenv('md') def excelfiles(pattern): file_list = [] for root, dirs, files in os.walk(start_dir): for filename in files: if fnmatch.fnmatch(filename.lower(), pattern): if filename.endswith(".xls") or filename.endswith(".xlsx") or filename.endswith(".xlsm"): file_list.append(os.path.join(root, filename)) return file_list file_list = ex

Categories : Python

Why my .cs and .designer.cs files doesn't appears under my uitest files in Visual Studio?
You may need to edit your .csproj manually, something like this: [...] <ItemGroup> <Compile Include="RequestPage.cs"> <DependentUpon>RequestPage.uitest</DependentUpon> </Compile> <Compile Include="RequestPage.Designer.cs"> <DependentUpon>RequestPage.uitest</DependentUpon> </Compile> [...]

Categories : C#

Reading txt files and parsing them fast using c++ and boost memory mapped files
Streams are slow. Part is because the constraints that apply to them are onerous, part is because implementations have a tendency of being poorly optimized. Try using Boost.Spirit parsers. While the syntax takes a bit of getting used to and compilation can sometimes be very slow, the runtime performance of Spirit is very high.

Categories : C++

Perl: Read 7 files and search for a word (the name of the files change constantly)
Added loop around file processing, and collecting all log files before that, #!/usr/bin/perl use strict; use warnings; use POSIX 'strftime'; # my $current_date = strftime "%Y%m%d", localtime; # my $filename = "/home/ado/log/log.$current_date"; my @filenames = reverse sort glob("/home/ado/log/log.*"); if (@filenames > 7) { $#filenames=6; } for my $filename (@filenames) { my %output; open my $file, "<", $filename or die("$!: $filename"); while (<$file>) { if (/item_id:(d+)s*,s*start/) { $output{$1}++; } } close $file; for my $item(keys %output) { print "$item->$output{$item} "; } }

Categories : Perl

Can ANTLR4 java parser handle very large files or can it stream files
You could do it like this: InputStream is = new FileInputStream(inputFile);//input file is the path to your input file ANTLRInputStream input = new ANTLRInputStream(is); GeneratedLexer lex = new GeneratedLexer(input); lex.setTokenFactory(new CommonTokenFactory(true)); TokenStream tokens = new UnbufferedTokenStream<CommonToken>(lex); GeneratedParser parser = new GeneratedParser(tokens); parser.setBuildParseTree(false);//!! parser.top_level_rule(); And if the file is quite big, forget about listener or visitor - I would be creating object directly in the grammar. Just put them all in some structure (i.e. HashMap, Vector...) and retrieve as needed. This way creating the parse tree (and this is what really takes a lot of memory) is avoided.

Categories : Java

Why do I get "Cocoa error 513" when write files to "/var/mydir/files" on an jailbroken iPhone?
Cocoa error 513 is NSFileWriteNoPermissionError. You can find it in Foundation Constants Reference. Maybe you don't have write permission for /var.

Categories : Iphone

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

In grunt, if I'm watching multiple files and two or more change, how can I only run tasks on the changed files?
It's a pretty sophisticated solution using Lo-Dash debounce ;-) (in a sec...) Know that when you used your older code of: grunt.config(['coffee', 'glob_to_multiple', 'src'], filepath); Grunt is instructed to run the coffee task with the new file. The problem with this is that it's a synchronic process and so when another file is changed ( usually this happens in a matter of milliseconds) then Grunt Watch won't allow you to run another process until the debounceDelay has been reached. The default debounceDelay is 500 ms, but this can be changed using options of the watch task. (read more About option.debounceDelay Basically when you save multiple files, as you saw - only the first file saved is changed. In order to bypass this, a great utility for delaying (debouncing) function run i

Categories : Node Js

How to succinctly link files in Ubuntu where the library files have long address
You can define environment variables and use those during compilation. For example, say: INCDIR=/home/me/dir1/dir2 LIBDIR=/home/me/dir1/dir2/lib and execute gfortran by saying: gfortran myprog.f90 -I${INCDIR} -L${LIBDIR}

Categories : Ubuntu

Find Missing files and sub directories with it's files list while copy and paste?
Can i make one simple exe tool for this. Of course. How to i find that missing files can any one give some guide to do. You need two lists. You'll need to read and fill one, and then read and compare to determine what's missing. The code might look something like this: var targetFiles = new List<string>(); foreach (var f in Directory.GetFiles(targetDir)) { targetFiles.Add(Path.GetFileName(f)); } var missingFiles = new List<string>(); foreach (var f in Directory.GetFiles(sourceDir)) { if (targetFiles.Contains(Path.GetFileName(f))) { continue; } missingFiles.Add(Path.GetFileName(f)); } Now all of the missing files in the target are in the missingFiles list. You can then loop through that list to copy those missing files to the target.

Categories : C#

How to perform better document version control on Excel files and SQL schema files
Since you've tagged your question with git I assume you are asking about git usage for this. Well, SQL dumps are normal text files so it makes perfect sense to track them with git. Just create a repository and store them in it. When you get a new version of a file, simply overwrite it and commit, git will figure out everything for you, and you'll be able to see modification dates, checkout specific versions of this file and compare different versions. The same is true for .xlsx if you decompress them. .xlsx files are zipped up directories of XML files (See How to properly assemble a valid xlsx file from its internal sub-components?). Git will view them as binary unless decompressed. It is possible to unzip the .xlsx and track the changes to the individual XML files inside of the archive

Categories : GIT

Searching files by matching filename pattern and concatenating contents of the files
for the second NP_len_*.fa pattern the regex can be like .+NP_len_d{1,3}.fa and for the first one where you do not want the N us this .+?[^N]P_len_d{1,3}.fa this one will match all patterns just except N before P. I have considered that folder names might grow in future about you xaa part. you can alternatively match for string of length 3 also.

Categories : Python

Which files from phpexcel library are necessary to export data into excel2007 format ? I want minimum number of files
If you absolutely have to do this: Remove all locale files except those in the /en subdirectory. Remove all named Readers and Writers and associated subdirectories except those you need (you still need the Abstracts and the Interfaces though). Remove all CachedObjectStorage options except Memory/Icache/CacheBase. Remove Charts if you don't use them. Remove Shared PCLZip, OLE files and Escher.... and hope that I've not miscalculated

Categories : PHP

Project imported from Eclipse to Android Studio. APK files and some other files in bin folder are not updating anymore
I don't know if there's a way to get a clean build via the UI (I haven't found it yet, anyway), but it's pretty easy via commandline. From the root directory of your project: ./gradlew clean

Categories : Android

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

In Java 7, how to crete a real life example to demonstrate the difference between Files.exists and Files.notExists?
Following code will work. In your case your were getting denying permissions issue you may check the folder in operating system installation partition. (C:). Following will work. Path path = Paths.get("D:\TestFolder"); if (Files.exists(path)) { System.out.println("exist"); } if (Files.notExists(path)) { System.out.println("not exist"); } javadoc says about Files.notExists() Tests whether the file located by this path does not exist. This method is intended for cases where it is required to take action when it can be confirmed that a file does not exist. Note that this method is not the complement of the exists method. Where it is not possible to determine if a file exists or not then both methods return false. As with the exists method,

Categories : Java

opening webdav files in Chrome via the Office Authorization plug-in for NPAPI browsers fails for certain files
OK, thanks to Stuart's explanations in this issue, things started to make more sense. Basically I think the problem lies into the way the Microsoft plugin has been implemented when it comes to handling the strings that are passed from JavaScript. Stuart posted a question that shows the problem. The plugin code expects the strings to be null terminated when in fact that's not guaranteed. I did a test in my real app and I added the null character to url, i.e I passed url + '', and now the bloody thing works in Chrome. The question remains, is Microsoft going to fix their plugin?

Categories : Google Chrome

How to create a bash script that will lower case all files in the current folder, then search/replace in all files?
Something like this should work: #!/bin/bash for file in *.html do lowercase=`echo $file | tr '[A-Z]' '[a-z]'` mv "$file" "$lowercase" for f in *.html do sed -i "s/$file/$lowercase/g" "$f" done done Change *.html to *.<extension> if you're working with something other than html files.

Categories : Bash

VS 2012 MVC - How does file structure of View files affect access to relevant Model / Controller files?
I'm not clear on this line of code: public ActionResult ResourceType() { return View("ResourceType/Index"); } Does this mean that you are loading the resource type view from the Parameters controller? If that's the case, it's not what you want to do. You want to use RedirectToAction. Edit: you could also supply the model in your existing code using a different View() overload. I assume this isn't what you want, though, since you do have a ResourceTypeController. Edit #2 Based on your comment, I then figured that once those sub views were loaded, their own individual controllers would take over? No, it actually works the other way around. The controller loads the view (and passes the model, if one is required). It looks like you are trying to load the view, and expecting

Categories : C#

When building deb files using dpkg, I can't get it to ignore hidden files such as .git and .gitignore
I ended up placing my package root in a subdirectory and creating a build script at the root that created all the empty directories I needed, so I wouldn't need .gitignore files and the .git file would no longer get packaged.

Categories : Ubuntu

Where should I put my dart files if they are the server side files of restful api providers?
You can create an src within lib and put your files there. If the files are executable, you can put them inside bin, or within a directory inside bin. See the package layout conventions for details.

Categories : Dart

How can I switch between fstream files without closing them (Simultaneous output files) - C++
You are trying to reuse the Text_File fstream. To do this, you have to do a close() to flush the stream, after you are done writing to a csv file. Please see this question: C++ can I reuse fstream to open and write multiple files? Also: Here's my Google search for this question: http://goo.gl/Oy5KKM

Categories : C++

Tomcat Hot Deplot works fine for JSP Files But not for Java Files
Reading tomcat6 documentation and the part Deploying on a running Tomcat server, it states on the last line: Note that web application reloading can also be configured in the loader, in which case loaded classes will be tracked for changes. Therefore going to the loader documentation you can see that setting the attribute reloadable of your loader configuration will do exactly what you are asking reloadable: Set to true if you want Catalina to monitor classes in /WEB-INF/classes/ and /WEB-INF/lib for changes, and automatically reload the web application if a change is detected. This feature is very useful during application development, but it requires significant runtime overhead and is not recommended for use on deployed production applications. You can use the Manager web app

Categories : Tomcat

Error in creating .so file from .o files generated using multiple .c files
The problem is that you're linking the object files, not just compiling them. Make sure that you only compile the files, don't link them! You do that using the -c option. Do not use the -l option, you don't want to link anything at this stage. So: gcc -c -o usb_comm.o usb_comm.c gcc -c -o hex2bin.o hex2bin.c gcc -c -o hex_read.o hex_read.c gcc -c -o crc32.o crc32.c (I omitted the -I flags to save space here.) Then finally link all those object files into a shared library, and link against usb-1.0: gcc -shared -o libhello.so usb_comm.o hex2bin.o hex_read.o crc32.o -lusb-1.0 You should use a Makefile though for this. Or, even better, use a proper build system, like CMake, which is very easy to use. It's provided by all common Linux distros, so simply install it with the package man

Categories : C

Is there a way to commit part of modified files (all files are staged) by using libgit2sharp?
Is there a way to commit part of modified files (all files are staged) by using libgit2sharp? Currently, there's no way to perform a partial staging/unstaging in LibGit2Sharp. I'd suggest you to subscribe to Issue 195 in order to be notified when this is available. There are no Commit method in Repository that takes path parameter. Actually, the action of committing consists of taking a snapshot of the Index and creating a durable Commit git object in the object database. As such, the Commit API doesn't accept paths. In order to create a Commit from a file (or list of files) on your file system, you'd first have to add them to the Index with repo.Index.Stage(), then invoke the repo.Commit() method.

Categories : GIT



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