wildcards

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>) ...

Java bounded wilcard type

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! ...

Problem using generic map with wildcard

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

Linux command to do wild card matching

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

C# generics - without lower bounds by design?

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

Wildcards in Lucene

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

java Runtime.getRunTime().exec & wildcards?

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

Parsing text with simple wildcards logic in Java / C / Objective-C

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

How to use a generic result as a generic parameter when the type is a wildcard?

[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...

mod_rewrite: url rewriting plus subdomain (wildcard) rewrite at the same time

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

Combining bounded wildcards in Java

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

Lucene: Wildcards are missing from index

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

Wildcard searching and highlighting with Solr 1.4

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

how to fetch a range of files from an FTP server using C#

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

makefile pattern rules: single wildcard, multiple instances in prerequisite

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

% _ in search form displays all results

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

Linux: shell builtin string matching

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

pointing multiple subdomains using wildcards to a folder

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

What's the purpose behind wildcards and how are they different from generics?

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

Apache Config with Wildcard/Non-Wildcard Subdomain Mix

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: ...