binfalse
Getting into a new group
December 30th, 2015You know, … you just got this new floppy disk with very important material but you cannot access it because you’re not in the system’s floppy
group and, thus, you’re not allowed to access the floppy device. Solution is easy: add your current user to the floppy
group! Sounds easy, doesn’t it? The annoying thing is that those changes won’t take affect in the current session. You need to log out and log in again – quite annoying, especially if you’re into something with lots of windows and stuff. Just happened to me with docker again..
However, there are two methods to get into the new groups without the need to kill the current session:
- su yourself: let’s say your username is
myname
you just need tosu myname
to get a prompt with the new group memberships. - ssh localhost: that also gives you a new session with updated affiliations.
That way, you do not need to start a new session. However, you still need to start all applications/tools from that terminal - might be odd to those who are used to the gnome/kde menues.. :)
Supplemental material
Display group membership:
groups USERNAME
Add a new system group:
groupadd GROUPNAME
Add a user to a group:
useradd -G GROUPNAME USERNAME
CyanogenMod Updates and the firewall
November 3rd, 2015I’m running CyanogenMod on my phone and I have the firewall AFWall+ installed.
To update the list of available updates the application CM Updater need to be able to connect to the internet. It will contact a website from within the google empire and ask for available images.
In order to download a new image the application Media Storage, Download Manager, Downloads needs internet access, as this app is in charge of downloading the actual image file.
To be remembered.
JavaDoc Cheat Sheet
October 5th, 2015- The first sentence of each doc comment should be a summary sentence
- Write the description to be implementation-independent, but specifying such dependencies where necessary. (what is required, what is allowed)
- wrap keywords in
<code>...</code>
typical meta annotations
@author
is not critical, because it is not included when generating the API specification@version
SCCS string"%I%, %G%"
, which converts to something like “ 1.39, 02/28/97” (mm/dd/yy) when the file is checked out of SCCS@since
specify the product version when the Java name was added to the API specification (if different from the implementation)
typical method definition
@param parameter-name description
- followed by the name (not data type) of the parameter, followed by a description of the parameter
- the first noun in the description is the data type
@return description
- omit for methods that return void and for constructors
- include it for all other methods, even if its content is entirely redundant with the method description
@throws class-name description
should be included for any checked exceptions (previously, it was@exception
)
additional annotations
{@value package.class#field}
- when
{@value}
is used (without any argument) in the doc comment of a static field, it displays the value of that constant:The value of this constant is {@value}.
- otherwise it displays the value of the specified constant:
Evaluates the script starting with {@value #SCRIPT_START}.
- when
{@code text}
- Equivalent to
<code>{@literal}</code>
.
- Equivalent to
linking
@see reference
- Adds a
"See Also"
heading reference
is astring
: Adds a text entry for string. No link is generated. The string is a book or other reference to information not available by URL.reference
is an<a href="URL#value">label</a>
: Adds a link as defined by URL#value. TheURL#value
is a relative or absolute URL.reference
is anpackage.class#member label
: Adds a link (with optional visible text label) that points to the documentation for the specified name in the Java Language that is referenced.
- Adds a
{@link package.class#member label}
- in-line link with visible text label that points to the documentation for the specified package, class or member name of a referenced class
- not necessary to add links for all API names in a doc comment
@serial
(or@serialField
or@serialData
) for interoperability with alternative implementations of a Serializable class and to document class evolution
deprecation
@deprecated deprecated-text
- the first sentence should at least tell the user when the API was deprecated and what to use as a replacement
- a
{@link}
tag should be included that points to the replacement method
example
References
Block URLs on phone using AdAway
September 26th, 2015Using AdAway on your Android phones it is very easy to block a set of URLs.
AdAway (available from F-Droid, source from GitHub) is an ad-blocker. The application basically maintains a list of resources containing lists to ad-servers, see figure for example, e.g.:
# dest ip url
127.0.0.1 some.ad.server.com
This entry will redirect all traffic meant for some.ad.server.com
to the server 127.0.0.1
, which is your localhost. Entries from different resources are merged. Thus, all requests to typical ad-servers will fail → annoying advertisements won’t be delivered. It’s quite powerful and gives impressive results.
However, I didn’t want to talk about ad-stuff. The cool thing is
AdAway allows for extensions with own hosts files!
You can simply add another link to a file containing further host entries. I created my own AdAway file, uploaded it to https://stuff.lesscomplex.org/adaway.txt and added it to AdAway, as you can see in the figure. The current version contains a few entries for:
- facebook/yahoo/etc: I’m not using facebook or stuff, all these request shouldn’t leave my phone
- captive portal detection: To detect captive portals the phone downloads a few bytes from a google server and checks if it is able to access the real internet or just a captive portal
- swift key: I’m using swift key, but do not want it to communicate to the internet. Thus, I’m blocking a few URLs that swiftkey wants to talk to. As I’m already using a firewall this just adds another layer of privacy.
Feel free to use my “extension”, but I expect it to change over time. :)
Shortcomings
This method only works if applications load contents from URLs. As soon as the IPs are hard-coded the hosts file
Disable shutter sound on Cyanogenmod 12
August 26th, 2015Everyone knows that annoying shutter sound of the camera app on Android phones. It’s against the law to sell android phones which do not make sounds when taking pictures. And in general, it is a good feature as it improves other people privacies.
However, I still want to get rid of the sound. It’s a bit tricky, but having a rooted phone (with e.g. CyanogenMod) it’s very easy: Just delete the sound file /system/media/audio/ui/camera_click.ogg
! :)
For the lazy: Get a root shell (eg. ssh or adb) and execute the following:
Problem solved.