Question on Java Generics Bounded Wildcard
Is there a difference between 1) <N extends Number> Collection<N> getThatCollection(Class<N> type) and 2) Collection<? extends Number> getThatCollection(Class<? extends Number>) ...
Is there a difference between 1) <N extends Number> Collection<N> getThatCollection(Class<N> type) and 2) Collection<? extends Number> getThatCollection(Class<? extends Number>) ...
Hi, I need to define a generic class, and the type parameter must be an enum. I think it should look something like public class <T> MyClass<T extends Enum<T>> { } But I can't seem to figure out the exact syntax. I should mention that I need a way to refer to the type (within MyClass) that it is instantiated with. Thanks! ...
i have a method that returns a map defined as: public Map<String, ?> getData(); the actual implementation of this method is not clear to me, but: when i try to do: obj.getData().put("key","value") I get following compile time error message: The method put(String, capture#9-of ?) in the type Map is not applicable for the ar...
Is there any bash command to do something similar to: if [[ $string =~ $pattern ]] but that it works with simple wild cards (?,*) and not complex regular expressions ?? More info: I have a config file (a sort of .ini-like file) where each line is composed of a wild card pattern and some other data. For any given input string that ...
I was reading an interview with Joshua Bloch in Coders at Work, where he lamented the introduction of generics in Java 5. He doesn't like the specific implementation largely because the variance support—Java's wildcards—makes it unnecessarily complex. As far as I know, C# 3 doesn't have anything like explicit, bounded wildcards, e.g. yo...
Why does the wildcard query "dog#V*" fail to retrieve a document that contains "dog#VVP"? The following code written in Jython for Lucene 3.0.0 fails to retrieve the indexed document. Am I missing something? analyzer = WhitespaceAnalyzer() directory = FSDirectory.open(java.io.File("testindex")) iwriter = IndexWriter(directory, anal...
i'm trying to remove junk files by using Process p = Runtime.getRuntime().exec(); it works fine as long as i do not use wildcards, i.e. this works: Process p = Runtime.getRuntime().exec("/bin/rm -f specificJunkFile.java"); while the following throws back "No such file or directory": Process p = Runtime.getRuntime().exec("/bin/rm -...
I'm looking for a fast library/class to parse plain text using expressions like below: Text is: <b>Name:</b>John<br><i>Age</i>32<br> Pattern is: {*}Name:</b>{%}<br>{*}Age</i>{%}<br> And it will find me two values: John and 32. Intent is to parse simple HTML web pages without involving heavy duty tools. It should not be using string op...
[UPDATE] The real situation was a bit more complicated than my initial question made it seem. I've changed the code a bit to reflect that.[/UPDATE] I'm a bit stumped by the following behavior. Given code like: interface Inter<T> { T makeT(); void useT(T t); } public class Foo { public void bar(Qux q) { Inter<?> x = getInterF...
i have two rules in my .htaccess file for url rewriting: for subdomain rewriting: xxx.domain.com is internally redirected to file.php?item=xxx RewriteCond %{HTTP_HOST} !^www.domain.com$ [NC] RewriteCond %{HTTP_HOST} ^(www.)?([^.]+).domain.com$ [NC] RewriteRule ^$ /file.php?item=%2 [QSA,nc] ordinary rewriting: RewriteRule ^([A-Za-z0...
Is there anyway to use a bounded wildcard require a class implement more than one interface? In otherwords, something like... class Foo<S extends Comparable && Clonable> ...which would require that objects extend both interfaces? I realize I can make another ComparableAndClonable which extends the two but I don't have control over...
Hi - i am building a search index that contains special names - containing ! and ? and & and + and ... I have to tread the following searches different: me & you me + you But whatever i do (did try with queryparser escaping before indexing, escaped it manually, tried different indexers...) - if i check the search index with Luke they ...
Hey guys, I've got a pretty much vanilla install of SOLR 1.4 apart from a few small config and schema changes. <requestHandler name="standard" class="solr.SearchHandler" default="true"> <!-- default values for query parameters --> <lst name="defaults"> <str name="defType">dismax</str> <str name="echoParams">expl...
hello all, i'm stuck at a point where i am using a wildcard parameter with the FtpWebRequest object as suck FtpWebRequest reqFTP = (FtpWebRequest)FtpWebRequest.Create(new Uri("ftp://" + ftpServerIP + "/" + WildCard)); now this works fine, however i now want to fetch a specific range of files. say the file naming structure is *YYY...
Hi all, hopefully this is a basic question about make pattern rules: I want to use a wildcard more than once in a prerequisite for a rule, i.e. in my Makefile I have data/%P1.m: $(PROJHOME)/data/%/ISCAN/%P1.RAW @echo " Writing temporary matlab file for $*" # do something data/%P2.m: $(PROJHOME)/data/%/ISCAN/AGP2.RAW ...
if the search form is blank, it should display an error that something should be entered by the user. it should only show those results which contain the keywords the user has entered in the search textbox. however, if the user enters % or _ or +, it displays all results. how do i display an error when the user enters these wildcard ch...
I am trying to become more familiar with using the builtin string matching stuff available in shells in linux. I came across this guys posting, and he showed an example a="abc|def" echo ${a#*|} # will yield "def" echo ${a%|*} # will yield "abc" I tried it out and it does what its advertised to do, but I don't understand what the...
I want to use wildcards to send the request to any sobdomains to the folder of the domain.please specify how to achieve this in apache2 using the virtual host settings.The domain and its subdomain uses the same IP address. the subdomains cannot be predetermined as they are created by users. Thanks ...
I'd never heard about wildcars until a few days ago and after reading my teacher's Java book, I'm still not sure about what's it for and why would I need to use it. Let's say I have a super class Animal and few sub classes like Dog, Cat, Parrot, etc... Now I need to have a list of animals, my first thought would be something like: List...
I have the domain, we'll call it "mydomain.com" and I want the following virtual hosts set up to resolve in the following way: mydomain.com / www.mydomain.com to point to /var/www/ dev.mydomain.com to point to /var/www/dev/ *.mydomain.com (all other subdomains) to point to /var/www/old My apache configuration is currently set up as: ...