Next power of two in Processing

20.04.2015 by Michael

If you’ll ever need the next power of two of a number in #Processing:

int next = (int)pow(2, ceil(log(n) / log(2)));

http://stackoverflow.com/a/17379122

Drosselt da jemand?

17.04.2015 by Michael

tl;dr: Die Arte Mediathek ist über den Telekom DNS langsam, über den Google DNS normal schnell.

 

Seit ein paar Wochen kann ich die Arte Mediathek nur noch mit Modemgeschwindigkeit nutzen. Das Konzert mit Chilly Gonzales lädt z.B. mit knapp 50 kb/sec. Das dauert gut 8 Stunden bei 1.45GB.

Das Problem haben auch andere. Es gibt einen längeren Thread auf arte.de (Das Bild ruckelt beim abspielen), in dem die arte-Mitarbeiter regelmäßig antworten, das daran gearbeitet wird. Sie verweisen auf eine Testseite, mit der man Browser und Verbindung testen kann: http://configtest.arte.tv/#de

arte_config_test

An meinem DSL Anschluss scheint es nicht zu liegen. Der T-Online Speedtest zeigt für meinen Anschluss passable Werte. 13,94 Mbit/s.
DSL_Speedtest


 

Wenn ich als DNS Server den von Google (8.8.8.8) in den System Preferences von OS X eintrage, dann lädt das Konzert von Chilly Gonzales auch schnell!
(Über VPN übrigens auch.)

Scheinbar liefert der T-Online DNS einen anderen Server als der von Google:

DNS Server: 217.0.43.177 (T-Online)
Name: artestras.vo.llnwd.net
Address: 87.248.217.253

DNS Server: 8.8.8.8 (Google)
Name:    artestras.vo.llnwd.net
Address: 87.248.221.254

Update: Nicht nur die letzte Zahl unterscheidet sich. Auch die dritte Stelle.
T-Online: 87.248.217.253
Google: 87.248.221.254


Traceroute zeigt das man abhängig vom verwendeten DNS bei einem anderen Server rauskommt.
Telekom DNS: ve5.fr3.frf.llnw.net
Google DNS: tge1-3.fr4.par.llnw.net

traceroute artestras.vo.llnwd.net
traceroute: Warning: artestras.vo.llnwd.net has multiple addresses; using 87.248.217.253
traceroute to artestras.vo.llnwd.net (87.248.217.253), 64 hops max, 52 byte packets
 1  fritz.box (192.168.178.1)  4.854 ms  2.307 ms  2.914 ms
 2  87.186.224.136 (87.186.224.136)  33.046 ms  21.533 ms  19.431 ms
 3  87.186.196.250 (87.186.196.250)  21.334 ms  29.100 ms  22.587 ms
 4  217.239.39.26 (217.239.39.26)  23.222 ms  23.137 ms  23.116 ms
 5  80.156.163.178 (80.156.163.178)  30.860 ms  37.566 ms *
 6  ve5.fr3.frf.llnw.net (69.28.172.105)  31.426 ms  32.228 ms *

 

traceroute artestras.vo.llnwd.net
traceroute: Warning: artestras.vo.llnwd.net has multiple addresses; using 87.248.221.254
traceroute to artestras.vo.llnwd.net (87.248.221.254), 64 hops max, 52 byte packets
 1  192.168.178.1 (192.168.178.1)  1.429 ms  1.389 ms  1.182 ms
 2  87.186.224.136 (87.186.224.136)  19.631 ms  19.814 ms  19.343 ms
 3  87.186.196.254 (87.186.196.254)  25.084 ms  28.825 ms  22.290 ms
 4  f-ee5-i.f.de.net.dtag.de (62.154.14.246)  23.072 ms  40.082 ms  24.064 ms
 5  80.156.163.182 (80.156.163.182)  31.605 ms  32.852 ms  30.741 ms
 6  tge1-3.fr4.par.llnw.net (69.28.172.101)  35.035 ms  33.565 ms  35.642 ms

Woran das nun liegt und ob Arte oder die Telekom daran schuld sind kann ich nicht sagen. Nach dem Drosselkom Skandal richten sich die Augen aber zuerst auf die Telekom. “Told you so”.

Update 18.04.2015:
Winki hat ähnliche Probleme bei 1&1
Und er schreibt, das die meisten öffentlich-rechtlichen Mediatheken den CDN Limelight in den USA nutzen. Na Bravo.

wput: Upload to FTP subdirectory

23.08.2014 by Michael

Uploading a file via wget to a FTP subdirectory without mentioning the absolute path didn’t work.

$f = /home/my/files/image.jpg
wput -B -v –basename=/home/my/files $f ftp://user:password@192.168.0.222/images/

Logging in as user … Logged in!
==> CWD images/
==> TYPE I … done.
==> SIZE /image.jpg … failed.
==> PASV … done.
==> STOR /image.jpg … Send Failed (/image.jpg: Permission denied.) Skipping this file

It seems wput needs the absolute path name on the FTP server.

ftp://user:password@192.168.0.222/images/image.jpg

basename does the trick. It strips the path from the passed absolute url.

$f = /home/my/files/image.jpg
wput -B -v –basename=/home/my/files $f ftp://user:password@192.168.0.222/images/$(basename $f)

¯\_(?)_/¯ running through all installed fonts via #Processing

02.08.2014 by Michael

¯\_(?)_/¯

yumad_emoji
http://www.openprocessing.org/sketch/156356

Convert x3db to obj

19.07.2014 by Michael

Yvonne describes a quick way to convert x3db files from Shapewys’ 2D-to-3D tool to obj via InstantPlayer’s aopt:

aopt -i test.XXX -e test.obj
https://github.com/x3dom/x3dom/issues/263

Facedetection: Clones in Aldi’s ads (Photoshop Desaster)

20.04.2014 by Michael

I saw Aldi’s (german grocery chain) ad on the last Süddeutsche Jetzt magazine and wondered if they’ve got the approval of all the people / employees on the image. Then i recognized that they are not that many. Because it’s just some people photoshopped all over the seats. Picasa and Processing helped me to analyze the image and find duplicate images.


aldi_klone

aldi_klone_closeup
(Image Aldi Süd, Süddeutsche Jetzt)
Link to the Brochure

Statistic:
aldi_klone_statistik

Some people are up to 9 times on the image. And could only recognize the first 9 rows.

Misfit Shine Adventures

12.04.2014 by Michael

Update:

Here’s the answer from Misfit support:
“I am terribly sorry about the misunderstanding we might of had. Only bluetooth is required to sync your data to the app, however, an internet connection is needed to link your Shine to your email address. The data your Shine will provide to us will lead to improving our algorithm and increase accuracy of data. I ensure you that your privacy information will not be shared with any third party companies.”

Remember. The first information was:

“Therefore after that you wouldn’t need the internet anymore of syncing data and viewing your progress.”

////////////////////////////////////////////////////////////

I sold my Fitbit Flex because the activity tracker’s data was encrypted and i was forced to upload my data to Fitbit’s cloud in order so see it. My next try was Misfit Shine.

My question to Misfit’s support was:

“Do i need an online account to use the app? Do i need to upload the data to your server? Can i use the app offline?”

Misfit’s support told me that

“You would need an email address to sign in to the app/link the Shine to an email account. The data is sync via Bluetooth. Therefore after that you wouldn’t need the internet anymore of syncing data and viewing your progress. Hope that helps, thanks for your support.”

So i ordered one. But unfortunately that information was not true. Misfit’s Android App does not work at all without internet access. Either when there’s no internet connection or it’s blocked by Privacy Guard or Android Firewall. It does not even sync the tracker via Bluetooth without going online (see the Android Wifi icon).

Misfit_Sync_Network

mitmdump shows that it’s connecting to Misfit’s server to store the data. It doesn’t even calculate the graph on the phone but gets it from the cloud. That’s the output when touching the sync icon:

192.168.xxx.xx PUT https://shine.api.misfitwearables.com/shine/v7/pedometer
<< 210 nginx/1.2.6 413B
192.168.xxx.xx POST https://shine.api.misfitwearables.com/shine/v7/sync_logs
<< 200 OK 2B
192.168.xxx.xx GET https://shine.api.misfitwearables.com/shine/v7/goals?endTime=1397339999
<< 200 OK 836B
192.168.xxx.xx GET https://shine.api.misfitwearables.com/shine/v7/timeline_items?startTime=1397167200&endTime=1397339999
<< 200 OK 2.83kB
192.168.xxx.xx GET https://shine.api.misfitwearables.com/shine/v7/goal_progresses?type=2&startTime=1397253600&endTime=1397339999
<< 200 OK 264B
192.168.xxx.xx GET https://shine.api.misfitwearables.com/shine/v7/graph_items?startTime=1397253600&endTime=1397339999
<< 200 OK 4.66kB
192.168.xxx.xx GET https://shine.api.misfitwearables.com/shine/v7/timeline_items?startTime=1397080800&endTime=1397253599
<< 200 OK 266B
192.168.xxx.xx GET https://shine.api.misfitwearables.com/shine/v7/goal_progresses?type=2&startTime=1397167200&endTime=1397253599
<< 200 OK 264B
192.168.xxx.xx GET https://shine.api.misfitwearables.com/shine/v7/graph_items?startTime=1397167200&endTime=1397253599
<< 200 OK 274B

Misfit_Sync

That’s my motion data! I payed 120 € for the device. I don’t get it why you can’t simply add steps in the app as you told me.

What about my privacy?
Privacy is very important to us here at Misfit. We do not share any of your personal information with anyone without your approval.
http://misfit.helpshift.com/a/misfit-shine/?s=app&f=what-about-my-privacy

I asked the support guy what he thinks about it. I’ll keep you updated.

Arduino UNO on Synology Diskstation DS213j

04.04.2014 by Michael

Finally i got an Arduino UNO connected to a Synology Diskstation DS213j. It took me some time and i had to try several tutorials. I’ll try to document the necessary steps.

1. There’s no optware / IPKG installer for DS213j. Thus you have to build it yourself which is straight forward:
https://github.com/trepmag/ds213j-optware-bootstra

2. Add package sources: http://www.leben-zwo-punkt-null.com/?p=3787#more-3787

3. Modify /root/.profile:
#PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/syno/sbin:/usr/syno/bin:/usr/local/sbin:/usr/local/bin
#export PATH

4. Install the modules:
ipkg install kernel-module-usbcore
ipkg install kernel-module-usbserial
ipkg install kernel-module-ftdi-sio

5. There are not all usb packages available for DS213j. Thus i had to install the precompiled SynoZWave. But don’t enable it:
http://wiki.synozwave.com/index.php?title=Installation/en&setlang=en

6. Now usbserial works and Arduino shows up in dmesg. But it didn’t work. It took me a while to remember that Arduino UNO does not have a FTDI chip but its own. Thus i had to enable the cdc-acm module:
http://www.hetlab.tk/artikelen/synology-cdc-acm-ko
insmod /lib/modules/cdc-acm.ko
mknod /dev/ttyACM0 c 166 0

7. Yeah! It reads my temperature sensor. It’s quite warm in my office. Good i’m outside.
cat /dev/ttyACM0
22 Celsius, 71 fahrenheit -> 22 Max, 22 Min

My Joy Division 3D print made it to London Science Museum!

03.03.2014 by Michael

My Joy Division 3D print made it to London Science Museum! “3D: printing the future”


http://science-museum-3d-printing.tumblr.com/post/64208301940/from-left-to-right-pen-holder-white-donated-by

Open Data Mashup: Windpower in Bavaria / Windstrom in Bayern

13.02.2014 by Michael

Where are the wind power plants located in Bavaria? Seems there are not that many in Oberbayern and Niederbayern.
Wo wird Windstrom in Bayern produziert? Scheinbar nicht viel in Ober- und Niederbayern.

Screen Shot 2014-02-13 at 12.24.32

Screen Shot 2014-02-13 at 12.24.24

URL:
http://osm.quelltextlich.at/viewer-js.html?kml_url=http%3A%2F%2Fdev.m05.de%2Fwindkraft%2Fwindkraft_bayern_wikipedia_140213.kml&kml_attribution=Windmill%2Bbased%2Bon%2Bby%2BGP%2Bfrom%2Bthe%2BNoun%2BProject

Sources:
https://de.wikipedia.org/wiki/Liste_von_Windkraftanlagen_in_Bayern
https://toolserver.org/%7Epara/cgi-bin/kmlexport?project=de&article=Liste_von_Windkraftanlagen_in_Bayern&redir=google
http://svn.openstreetmap.org/applications/utils/osm-extract/polygons/germany/bayern.poly
http://osm.quelltextlich.at/wizard-kml-osmtools.html
http://thenounproject.com/term/windmill/15615/