Data detox (and some privacy improvements for this blog)

Today I tried the data detox kit on myshadow.org and I learned quite a few things I did not know, even though I care about my privacy.

One of the most important things one should know is that you can actually influence what data is collected on you — even if you do not want to give up on using certain services. Many offer settings where you can view and delete data they have on you, and you can disable data collection in the first place.

I found it impressive to see all the data Google has on me by visiting the Google My Activity page. And I was relieved to find what they do not have, because I have carefully adjusted the privacy settings on my account.

Even if you do not feel the need to change anything, I cannot recommend highly enough to take the tour they have created. Just seeing what others know about you is scary — and may change your mind.

Btw, I also disabled various default settings of this blog which enable tracking, like the social media sharing buttons. Many more are out of my control since it’s a free blog though. Especially the ads displayed here and not run by me, but by wordpress.com and/or their partners. You can use tools like ADBlock or Privacy Badger by the EFF to get rid of them.

Advertisements
Posted in privacy | Tagged , | Leave a comment

Getting started with MacOS / an iMac in a day (for Linux and Windows users)

I just started a new job (as a postdoc in computational neuroimaging) and there I got an iMac. I never used MacOS before, my operating systems of choice have been Linux (whenever possible) or Windows (when required) for many years. So if you’re in a similar situation and want to get started with MacOS quickly, here are some tipps:

What’s maybe most confusing is input/output. The mouse and keyboard are really weird in the beginning, but they also have some cool features and you can adapt them to your needs:

  • keyboard shortcuts like CTRL + C for copy don’t work: you have to press the Apple key instead of CTRL
  • right-clicking with the mouse performs a left-click (i.e., does not open the context menu): right-click is disabled by default. Don’t ask me why. But you can easily enable it in the system settings (click Apple, then System Preferences, Mouse).
    • In some apps (like Firefox), right-clicking still does not work: Hold the CTRL key and left-click instead, this seems to work always.
  • there is no mouse scroll wheel (and scroll bars do not exist): you can just scroll on the mouse, even if there is no wheel. The mouse has touch support. Check more touch gestures in the mouse system settings! EDIT: After a few weeks, I found the Apple Magic Mouse too annoying, I replaced it with a standard mouse with 5 buttons and a scroll wheel.
  • I use an English keyboard but sometimes need to type German umlauts: checkout this keyboard layout: http://hci.rwth-aachen.de/USGermanKeyboard

Another confusing thing is accessing software and the file system:

  • How to see all installed software: from the bottom quick-start bar, open Finder. This tool is a combination of Explorer and the start menu. Click Applications to find all installed apps. You can drag the ones you use often to the lower bar from here.
  • How to access a terminal: in Finder, under Applications, search for Terminal. Hint: you can download better ones from the internet, maybe try iTerm2.
  • How to access the whole hard disk (not only the Documents folder displayed in the Finder app):
    • First: configure Finder to display a link to the hard drive on the desktop (Finder > preferences > General).
    • Second: Open that link, navigate in the file system tree, and drag any directory you want to show up in Finder (e.g., your home directory under /Users/) into the list of directories in Finder.
  • I need to open my .bashrc or another dot file. But they do not show up in the File open menu of applications: you can press the following keys in the open window to make dot files appear: CMD (=WINDOWS KEY if you use a non-Mac keyboard) + SHIFT + .
    • just to be sure: you have to press 3 keys, the last one is the dot key.
  • Installing standard Linux tools or ‘Where is the package manager?’:
    • Install the homebrew tool, you can then install most software you need with brew install packagename

 

Hope this helps somebody.

Posted in IT and computers, mac os, troubleshooting | Tagged , , | Leave a comment

ImageMagick command line: create smaller version of images

I wanted to create smaller versions for many large images in a single directory and

  • have a file name for the new file that is derived from the original file name (to be able to easily identify the image or link them to full size versions later)
  • keep the original aspect ration of the image (unlike many thumbnail programs)
  • never scale the images up (i.e., only change them if they are larger than target size)

It turned out it was easiest to do this on the command line, using the convert program from ImageMagick. Here is what I did:

for FILE in *; do BN=${FILE%.*}; TARGET="${BN}_smaller.jpg"; echo "Converting file: $FILE to: $TARGET"; convert "$FILE[800x>]" "$TARGET"; done

 

Here is a detailed step by step explanation of what this does:

for FILE in *; do                        # Loops over all files in directory
    BN=${FILE%.*};                       # Extract part of file name before the first dot
    TARGET="${BN}_smaller.jpg";          # Construct output file name (and define output format with file extension)
    echo "Converting file: $FILE to: $TARGET";     # Tells user what we are doing atm
    convert "$FILE[800x>]" "$TARGET";    # perform scaling to width of 800 pixels (only shrinks images, never scales them up)
done                                     # ends the loop

 

Hope you find this useful!

Posted in general, Photography | Tagged , , , | Leave a comment

Enable code suggestions for Java in Netbeans 8 on every character entered

In the NetBeans 8 IDE, by default you get automatic code completion suggestions when typing a dot. You can also trigger the completion manually at any time by pressing CTRL + SPACE.

Pressing that key combination all the time can get annoying quickly though. So here is how to get it on every character you enter (or key you press):

First, go to Tools => Options. Then Select Editor in the top bar, and go to the Code Completion tab. You should now see this menu shown below. Make sure to select your language, in my case Java, in the drop down list:

netbeans_code_completion_select_java_here.png

 

Then enable the following two checkboxes named Auto Popup on Typing Any Java Identifier Part and Subword completion:

netbeans_code_completion_activate_both_checkboxes.png

Now you should get auto-completion as visible below:

 

netbeans_code_completion_result.png

That’s it, enjoy!

 

 

Posted in coding, IT and computers, tools, troubleshooting | Tagged , , , , , | Leave a comment

Lettuce tests with Python: make lettuce print to stdout

The lettuce BDD framework swallows the output of your steps if they try to print to stdout, so you will never see the output of the print in a step like this:

 
@step('Cell number (\d+) should (read|contain) "([^"]*)"')
def cell_group1_should_read_or_contain_group2(step, cell_number, read_or_contain, expected_text):
# your test logic here
print "somevar is now=" + some_var
assert_true(step, 15 == some_other_var)

If you need to print the variable during test development, e.g., because it contains the innerHMTL of some complex element, you can force lettuce to print it by abusing an always failing assertion:

@step('Cell number (\d+) should (read|contain) "([^"]*)"')
def cell_group1_should_read_or_contain_group2(step, cell_number, read_or_contain, expected_text):
# your test logic here
assert True == False, "somevar is now=" + some_var
assert_true(step, 15 == some_other_var)

It’s maybe easiest to run lettuce on the command line for this, e.g.,

cd my_app/test/
lettuce features/my_tested_feature_123123.feature

Hope this helps.

Posted in IT and computers, Software Design | Tagged , , | Leave a comment

WordPress mini theme published: customization of twentyseventeen theme for text links in footer menu

I really like the new WordPress default theme called twentyseventeen. I just needed some small customizations for creating professional websites in Germany.

As you may have heard, lots of things are regulated in Germany, and you may want to have named text links for stuff like the imprint and privacy information for a professional website.

My custom child theme twentyseventeen-textfooter allows you to have that instead of the icon links which are usually displayed in the secondary menu (because it is intended as a social media menu).

Here is a preview image (text links in red circle):
preview_twentyseven_child_theme_text_footer_menu.jpg

The changes are trivial, but if you are interested, get the theme at GitHub.

Posted in coding, general, IT and computers, web design | Tagged , , | Leave a comment

Node.js package published

In my new job I am doing front-end coding with React.js, and every Javascript programmer needs to have some package published at npmjs.com I guess. 😉

So here is my first package: js-object-util

It is inspired by the Immutable API but works for plain Javascript objects. You can use it to easily check for and retrieve properties of deeply nested objects. Let’s have a closer look at the usage:

var objectUtil = require('js-object-util');

// some deeply nested example input
const book = {
	publisher: {
		name: "dpunkt",
		address: {
			city: "Heidelberg",
			plz: 69123
		}
	},
	title : "React",
	year: 2015,
	properties: {
		includes_ebook: false,
		whatever: null,
		dunno: undefined
	},
	readers: [
		{
			type: "user",
			name: "Johnny",
			age: 32,
			nickname: null
		},
		{
			type: "user",
			name: "Brad",
			age: 13,
			nickname: "Bratze"
		}
	]
};

// let's go
var keyExists;
keyExists = objectUtil.hasIn(book, ['publisher', 'address', 'city']);	    // true
keyExists = objectUtil.hasIn(book, ['publisher', 'address', 'notthere']);   // false
var value;
value = ObjectUtil.getIn(book, ['year']);		   // 2015
value = objectUtil.getIn(book, ['readers', '1', 'name']);  // Brad
value = objectUtil.getIn(book, ['readers', '1', 'notthere'], 'alternate');  // 'alternate'

This is cool because you don’t have to do these stupid step-wise tests for the existence of certain properties anymore.

I hope you like it. See js-object-util for installation instructions. Unit tests and coverage stats are included, the source code is at github. License is MIT.

Posted in coding, IT and computers, tools | Tagged , , , , | Leave a comment