Mac OS command: ditto

ditto <from_directory> <to_directory> Bei Updates vom modified shop bekommt man des öfteren einen Verzeichnisbaum, in dem nur die zu aktualisierende Dateien enthalten sind. Um alle Dateien im <shoproot> zu aktualisieren, die in <update_root> enthalten sind, eignet sich der Befehl ditto.

HTML5 Apps

Here, I collect some CSS Tricks for HTML5 Applications. A default meta tag for an App-like feeling: <meta content="width=device-width, initial-scale=1, user-scalable=no, maximum-scale=1" name="viewport" /> Prevent ugly blueish boxes when tapping on a link / div / etc: -webkit-tap-highlight-color:rgba(0,0,0,0); [...]

DD-WRT as a print server

Install DD-WRT on your router. I assume you have installed: DD-WRT v24-sp2 (08/07/10) std . Give your router a static IP. Go to the graphical user interface (GUI) of your router by opening the url http://<routers-ip-address>  Log in with your credentials. In the GUI go to the tab "Administration" activa [...]

AngularJS + GAE webapp2 + CORS

I've just struggeled with some CORS issue using AngularJS with a Grunt server and GAE as the backend. My website lives on localhost:9000 and my backend server will return a JSON object when calling localhost:8080/json The problem is the following. When calling $http({method: 'GET', url: 'http://localhost:8080/json'}) .suc [...]

Saving with numpy

I had a problem, for which I needed to google a bit until I've solved it. I had an array of arrays with different datatypes: When I saved it with the numpy.save()  and open it with numpy.load() the datatypes were not the same anymore, all was converted to a string with length 2. arr = [['Peter', 63, True], ['Marie', 52 [...]

List comprehension in Python

Say you have following array: arr = [ ['Anton', 1.73], ['Marie', 1.66], ['Paul', 1.89] ] Now, you want to create an array with all persons that are smaller than 1.80m and you also like to have their height in centimeter. This can be pretty nicely implemented with list comprehension: new_arr = [ [item[0], item[1]*100 [...]

Lyx: How to change the appearance of operators

I struggled a bit with changing the appearance of the operator \Re in Lyx. In Latex one can change its appearance by: \renewcommand{\Re}{\operatorname{Re}} But somehow it just did not work with Lyx. The reason is simple. In Document->Settings->Math Options one can select between "Use AMS Math package automatically" and " [...]

Deleting every second element in an array

The task is pretty simple the solution is it as well: I've got an array that is too big to be shown for pylab's imshow. Without cropping it a segmentation fault occurs. The idea is to reduce the size by deleting every second element. This is how you do it:   data = np.random.rand(4000,4000) smaler_data = data[::2, ::2]