Rename multiple files in cmd

Make sure that there are more ? than there are characters in the longest name: ren *.txt “???????????????????????????? 1.1.txt” See How does the Windows RENAME command interpret wildcards? for more info. New Solution – 2014/12/01 For those who like regular expressions, there is JREN.BAT – a hybrid JScript/batch command line utility that will run on … Read more

Java generics, Unbound wildcards vs

There are two separate issues here. A List<Object> can in fact take any object as you say. A List<Number> can take at least Number objects, or of course any subclasses, like Integer. However a method like this: public void print(List<Number> list); will actually only take a List which is exactly List<Number>. It will not take … Read more

Open file by filename wildcard

import os import re path = “/home/mypath” for filename in os.listdir(path): if re.match(“text\d+.txt”, filename): with open(os.path.join(path, filename), ‘r’) as f: for line in f: print line, Although you ignored my perfectly fine solution, here you go: import glob path = “/home/mydir/*.txt” for filename in glob.glob(path): with open(filename, ‘r’) as f: for line in f: print … Read more

When to use wildcards in Java Generics?

The big difference between public <T extends Animal> void takeThing(ArrayList<T> list) and public void takeThing(ArrayList<? extends Animal> list) is that in the former method you can refer to “T” within the method as the concrete class that was given. In the second method you cannot do this. Here a more complex example to illustrate this: … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)