The case against ipv4 sockets

Nobody needs ipv4 sockets anymore. Even in ipv4 environments. You can use mapped ipv4 addresses for receiving from and connecting to ipv4 sockets. For this you must NOT enable IPV6_V6ONLY. Remove calls like this:

socket.setsockopt(IPPROTO_IPV6, IPV6_V6ONLY, 1)

This option is by default disabled so you don’t have to disable the option manually.

Python sample code for ipv6 ready sockets (client side):

import socket
from http.client import HTTPConnection
retval = socket.getaddrinfo(url, port, socket.AF_INET6, socket.SOCK_STREAM, flags=socket.AI_V4MAPPED)
if len(retval) == 1: # check if there was a result
    con = HTTPConnection(retval[0][4][:2])

Server side:

from http.server import SimpleHTTPRequestHandler, HTTPServer
import socket
PORT = 8000
class server(HTTPServer):
    address_family = socket.AF_INET6
    def verify_request(self, request, client_address):
        if client_address[0] in ["::1", "::ffff:"]: # check if localhost
            return True
        return False

httpd = server(("::", PORT), SimpleHTTPRequestHandler) # bind to anyaddress

Another pitfall is binding the server to localhost. This breaks ipv6, ipv4 compatibility as you can either specify an ipv4 mapped address or an ipv6 address. There are two solutions for this case:

  1. multiple binds (and reuseport, reuseaddr socket option)
  2. bind to anyaddress (“::”, in c:(in6addr_any)) and manually check ip addresses (easier and implemented in example, causes connection resets (port is visible))

fix texlive/tex hang (mktexlsr)

To fix a very slow mktexlsr, look up the pathes in which your distribution put texfiles, and run for each of the directories
texhash <directory>
most probably running:
mktexlsr <directory>
also works
in archlinux the core tex files are in texlive-core

Here an example :

sudo texhash /usr/share/texmf-dist
sudo texhash /var/lib/texmf

as result a file will be created in /etc and mktexlsr should work now

Update: a missing /usr/share/texmf directory is maybe the cause for the bug in the first place (this directory is created e.g. by gnuplot (archlinux))

gtk3 combobox

The combobox shows nothing?
Then you lack a renderer.
add it this way:

addnodecombo = self.builder.get_object("addnodecombo") # in my case get the combo box from gtk.Builder
addnodecomborender=Gtk.CellRendererText() # create a renderer
addnodecombo.pack_start(addnodecomborender, True) # add the renderer (what True does I haven't looked up)

# set the column (in my case 0)
# this can be a different column as the id column.
# what "text" does is most probably setting a column name which isn't shown. I think it can be everything
addnodecombo.add_attribute(addnodecomborender, "text", 0)

how to use gtk3 treestore in pygobject

1. Step:
create a treestoremodel
model=Gtk.TreeStore(str,str) (or use Gtk.Builder for this)

2. Step:
add an entry in the highest level and take its iterator. This can be done with
it=model.insert_with_values(None, -1, [0,1], [“hello”, “world”])
None: parent (None is the highest level)
-1: the last position=appending
[0, 1]: the columns
[“hello”,”world”]: fills the selected columns with values
it: the iterator, it becomes important for the next step

3. Step:
now we have an iterator. In the first call of insert_with_values we used None.
This is replaced by the iterator. And voila a child object

model.insert_with_values(iter, -1,[0,1],[“hello”,”child1″])
model.insert_with_values(iter, -1,[0,1],[“hello”,”child2″])

The last thing to do is to add the treestore to a treeview and add some Renderers for the columns,
but for that there is already a tutorial:

why commercial (proprietary) software sucks

People especially economists compare buying a software with buying a car. But this isn’t true. Actually the purchase is comparable to buy a license to use a special car with many restrictions.

e.g. you can’t

  • install it on as many pcs you want. In contrast everyone you trust and has driver license can drive your car
  • modify it (just a very little).
  • give it away/sell it
  • cannibalize it after it stopped working (a broken car you can strip from useful components)
  • go to a car dealer/repairshop of your choice (there are some movements in the car industry to restrict this either)
  • disable advertisments (in the car world they are optionally for your car)
  • have a choice which car you use. In software world nearly every company tries to lock in the users

One similarity is: you are the product.
Many people live from you by exploiting your nescience (in the car as in the software industry)

Android Autosync

Sorry it was late yesterday. I rewrote this article:

Checklist adding a google account to android:

  • deactivate Autosync by tapping on the email address (in accounts) and deactivating every sync option
  • deactivate in google preferences: check device for malicious apps especially the option beyond that you send them data

This is why I cannot recommend Android. It’s a clear breach of trust (you see the first thing never if you don’t know it and google doesn’t say it anywhere that autosync is active by default)

As I said in my former blog post I wouldn’t recommend deriviates either (same hyper-commercial App community)

I think the same is true for IOS and Windows 8 smartphones.

What exists and looks good is firefox os.  There are even some cheap smartphones. But I have no experience with it.

But I need App: xy
Install android-x86 in a virtual machine. I think it’s straigthforward so I don’t explain.
But be careful, don’t forget the checklist.
Anyway this is also a good way for non-smartphoner to have access to apps.
One difficulty is to install apps which doesn’t want be installed on tablets.
An approach is to install the apk file. Better would be to tricking android in believing a smartphone (sorry I didn’t find out how yet)

android and admins

The Android userbase is an hostile environment for admins and developers. Even android is technically a very good idea (except java).

Firstly every problem is appified. You don’t get any usefull information about internal stuff (e.g. where files lay around) by searching after the problem. The solution for every problem is: install app xy (and boost the download score of someone).

Secondly most android developers come from the windows world. They don’t share for free. Saying: this world doesn’t give anything for free why should I do so? Many apps say: hey I fix this, but lacking information how they do it. Sadly there is no filter to filter them away.

Thirdly transferring knowledge is risky. Some important features/bugs could be “fixed”. Or you could get legal trouble. Even android is under gpl this discourages people from transferring knowledge.

Fourthly you get logged and recorded on every step. I never thought about the normal world implications: Every app you looked, you installed, deinstalled is haunting you. Not the secret services, but the companies. They push advertisment crap. On a small display this is especially annoying.

Fifthly some apps have advertisements. They put you into the risk of beeing hacked by their advertisment crap (happened often enough). Also eating your internet, display space and battery. Imagine this on your PC. Every 10 Minutes something pops up and annoys you. I hadn’t this for years (since I switched to linux).
(I heard from a prof that the internet speed improvements are mostly for advertisments (that the speed penalty by them is noticed less))

tomoyo – tomoyo-loadconfig doesn’t load

You want to load a exception/domain file into tomoyo but you can’t because of some strange errors (exit with 1)?
And you are sure that tomoyo is loaded (has to be in the kernel bootline) and you ran tomoyo-initpolicy as root?

Here is the solution:
You may have not the permission to write into the /sys/…/tomoyo dir. You have to authorize some programs to do so.
Now check /etc/tomoyo/manager.conf. You see multiple paths. Now check if they are all real or went over links.
You can do this with realpath:

realpath <path>
realpath /usr/sbin/tomoyo-editpolicy

if the output is not the same as the input, then replace the path in the file with the output.Now reboot the PC (is needed to load the manager.conf) and now it should work

blender multiple smoke domains

sometimes you need more than one object to produce smoke but hups? what’s that? Just one object produces smoke.

The solution and the reason for this problem are simple:both objects are in the same flow group

What’s flow group?
You can create for an object a group via:
pressing on the cube in the right side bar (where can preferences of objects)
then scroll down to groups and press on the + sign to create a new one

And now you have a group. To asign a smoke domain to a group go to the smoke menu and click into the field flow group, then assign the group with the right smoke producing object.