-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfeed.xml
More file actions
567 lines (451 loc) · 89.4 KB
/
feed.xml
File metadata and controls
567 lines (451 loc) · 89.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.7.4">Jekyll</generator><link href="http://localhost:4000/feed.xml" rel="self" type="application/atom+xml" /><link href="http://localhost:4000/" rel="alternate" type="text/html" /><updated>2019-10-03T09:03:53+02:00</updated><id>http://localhost:4000/feed.xml</id><title type="html">ResetGoToMain</title><subtitle>Ein Blog der sich mit Themen wie Linux, Programmierung, Webentwicklung und dem Protokoll QUIC beschäftigt. Auch andere Freizeitthemen finden hier Platz.</subtitle><entry><title type="html">Control Kodi with Tasker and Amazfit BIP</title><link href="http://localhost:4000/control-kodi-with-tasker-and-amazfit-bip/" rel="alternate" type="text/html" title="Control Kodi with Tasker and Amazfit BIP" /><published>2019-05-10T00:00:00+02:00</published><updated>2019-05-10T00:00:00+02:00</updated><id>http://localhost:4000/control-kodi-with-tasker-and-amazfit-bip</id><content type="html" xml:base="http://localhost:4000/control-kodi-with-tasker-and-amazfit-bip/"><p>A couple weeks ago I have purchased the Xiaomi Amazfit BIP smartwatch. It is a very cheap (50$) and simple watch with a GPS sensor, heart rate monitoring, sleep tracking, step counter and an enormous battery life of multiple weeks!
The long battery life is possible through the always-on display which seems to be based on an e-ink display of ebook readers like the Amazon Kindle. In contrast to the ebook readers this display also shows a low range of colors.</p>
<p><img src="/images/Amazfit_BIP.jpg" alt="Xiaomi Amazfit BIP" /></p>
<p>I thought it would be very convenient to pause and resume the Kodi playback on my Raspberry Pi. This can be realized with the Android app <a href="https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm&amp;hl=de">Tasker</a> and the <a href="https://play.google.com/store/apps/details?id=cz.zdenekhorak.amazfittools">Tools &amp; Amazfit</a>.</p>
<p>To get it work create on your phone a new Javascript file with this content:</p>
<figure class="highlight"><pre><code class="language-javascript" data-lang="javascript"><span class="kd">const</span> <span class="nx">REQ_URL</span> <span class="o">=</span> <span class="s1">'http://IP_ADDRESS_OF_KODI:PORT/jsonrpc?request='</span><span class="p">;</span>
<span class="p">(</span><span class="kd">function</span> <span class="p">()</span> <span class="p">{</span>
<span class="nx">flash</span><span class="p">(</span><span class="s2">"Button count: "</span> <span class="o">+</span> <span class="nx">button_count</span><span class="p">);</span>
<span class="c1">// ================ BUTTON COUNTER ================ //</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">button_count</span> <span class="o">==</span> <span class="mi">2</span><span class="p">)</span>
<span class="p">{</span>
<span class="kd">var</span> <span class="nx">url</span> <span class="o">=</span> <span class="nx">REQ_URL</span> <span class="o">+</span> <span class="s1">'{"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}'</span><span class="p">;</span>
<span class="nx">fetchURL</span><span class="p">(</span><span class="nx">url</span><span class="p">,</span> <span class="nx">data</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">data</span><span class="p">.</span><span class="nx">result</span><span class="p">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)</span>
<span class="nx">playOrPause</span><span class="p">();</span>
<span class="p">});</span>
<span class="p">}</span>
<span class="nx">exit</span><span class="p">();</span>
<span class="p">})();</span>
<span class="c1">// ================ HELPER FUNCTIONS ================ //</span>
<span class="kd">function</span> <span class="nx">playOrPause</span><span class="p">()</span>
<span class="p">{</span>
<span class="kd">var</span> <span class="nx">isPlayingURL</span> <span class="o">=</span> <span class="nx">REQ_URL</span> <span class="o">+</span> <span class="s1">'{"jsonrpc": "2.0", "method": "XBMC.GetInfoBooleans", "params": {"booleans": ["Player.Playing"]}, "id": 1}'</span><span class="p">;</span>
<span class="nx">flash</span><span class="p">(</span><span class="s2">"PlayPause"</span><span class="p">);</span>
<span class="nx">fetchURL</span><span class="p">(</span><span class="nx">isPlayingURL</span><span class="p">,</span> <span class="nx">data</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">data</span><span class="p">.</span><span class="nx">result</span><span class="p">[</span><span class="s1">'Player.Playing'</span><span class="p">]</span> <span class="o">===</span> <span class="kc">true</span><span class="p">)</span>
<span class="p">{</span>
<span class="kd">var</span> <span class="nx">pauseURL</span> <span class="o">=</span> <span class="nx">REQ_URL</span> <span class="o">+</span> <span class="s1">'{"jsonrpc":"2.0","method":"Player.PlayPause","params":{"playerid":1,"play":false},"id":1}'</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">fetchPause</span> <span class="o">=</span> <span class="kd">function</span><span class="p">()</span>
<span class="p">{</span>
<span class="nx">fetchURL</span><span class="p">(</span><span class="nx">pauseURL</span><span class="p">,</span> <span class="nx">data</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="c1">// Check if playback has been really paused</span>
<span class="nx">fetchURL</span><span class="p">(</span><span class="nx">isPlayingURL</span><span class="p">,</span> <span class="nx">data</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="nx">flashLong</span><span class="p">(</span><span class="s2">"Is Playing: "</span> <span class="o">+</span> <span class="nx">data</span><span class="p">.</span><span class="nx">result</span><span class="p">[</span><span class="s1">'Player.Playing'</span><span class="p">]);</span>
<span class="k">if</span> <span class="p">(</span><span class="nx">data</span><span class="p">.</span><span class="nx">result</span><span class="p">[</span><span class="s1">'Player.Playing'</span><span class="p">]</span> <span class="o">===</span> <span class="kc">true</span><span class="p">)</span>
<span class="p">{</span>
<span class="c1">// Still not paused, fetch pause again</span>
<span class="nx">fetchPause</span><span class="p">();</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="p">});</span>
<span class="p">}</span>
<span class="nx">fetchPause</span><span class="p">();</span>
<span class="p">}</span>
<span class="k">else</span>
<span class="p">{</span>
<span class="kd">var</span> <span class="nx">resumeURL</span> <span class="o">=</span> <span class="nx">REQ_URL</span> <span class="o">+</span> <span class="s1">'{"jsonrpc":"2.0","method":"Player.PlayPause","params":{"playerid":1,"play":true},"id":1}'</span><span class="p">;</span>
<span class="kd">var</span> <span class="nx">data</span> <span class="o">=</span> <span class="nx">fetch</span><span class="p">(</span><span class="nx">resumeURL</span><span class="p">);</span>
<span class="p">}</span>
<span class="p">});</span>
<span class="p">}</span>
<span class="kd">function</span> <span class="nx">fetchURL</span><span class="p">(</span><span class="nx">url</span><span class="p">,</span> <span class="nx">callback</span><span class="p">)</span>
<span class="p">{</span>
<span class="nx">fetch</span><span class="p">(</span><span class="nx">url</span><span class="p">)</span>
<span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="nx">response</span> <span class="o">=&gt;</span> <span class="nx">response</span><span class="p">.</span><span class="nx">json</span><span class="p">())</span>
<span class="p">.</span><span class="nx">then</span><span class="p">(</span><span class="nx">data</span> <span class="o">=&gt;</span> <span class="p">{</span>
<span class="nx">callback</span><span class="p">(</span><span class="nx">data</span><span class="p">);</span>
<span class="p">});</span>
<span class="p">}</span></code></pre></figure>
<p>Don’t forget to replace the IP address of your Kodi machine in the first line. We are working here with the <a href="https://kodi.wiki/view/JSON-RPC_API">JSON-RPC API</a> of Kodi. You can test the API by calling this URL:</p>
<div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>http://IP_ADDRESS_OF_KODI:PORT/jsonrpc?request={"jsonrpc": "2.0", "method": "Player.GetActivePlayers", "id": 1}
</code></pre></div></div>
<p>More examples of API calls can be found in the <a href="https://kodi.wiki/view/JSON-RPC_API/Examples">Kodi wiki</a>. The whole possibilities of the API can be seen <a href="https://kodi.wiki/view/JSON-RPC_API/v8">here</a>.</p>
<p>When we press the button on the Amazfit BIP two times in a row, the variable button_count gets filled with the amount of button presses. Then we fetch the URLs for the current running media and the status of it (playing or paused). After this a command to either play or pause the media will be sent. The code section with the fetchPause() function catches the moment when the pause has not been performed properly. This happens when the playback has been accelerated, then we need to press pause two times. But sadly this seems only to work in the browser. On my BIP I need to press the button 4 times to pause an accelerated playback.</p>
<p>Now create a Tasker profile with an event when the button on the Amazfit BIP is pressed. Create after this a new task for a Javascript file and link to the file with the code above. Make sure to remove the checkmark on “Auto Exit”. Return to Taskers main screen and apply the changes by pressing the checkmark at the top. You are done!</p>
<p>The possibilities with Tasker and Tools &amp; Amazfit are endless. If you would like to you can change the pause and resume with another Kodi action.</p></content><author><name></name></author><summary type="html">A couple weeks ago I have purchased the Xiaomi Amazfit BIP smartwatch. It is a very cheap (50$) and simple watch with a GPS sensor, heart rate monitoring, sleep tracking, step counter and an enormous battery life of multiple weeks! The long battery life is possible through the always-on display which seems to be based on an e-ink display of ebook readers like the Amazon Kindle. In contrast to the ebook readers this display also shows a low range of colors.</summary></entry><entry><title type="html">Nginx Virtual Host for redirecting non-www to www and HTTPS</title><link href="http://localhost:4000/nginx-virtual-host-for-redirecting-non-www-to-www-and-https/" rel="alternate" type="text/html" title="Nginx Virtual Host for redirecting non-www to www and HTTPS" /><published>2018-11-09T00:00:00+01:00</published><updated>2018-11-09T00:00:00+01:00</updated><id>http://localhost:4000/nginx-virtual-host-for-redirecting-non-www-to-www-and-https</id><content type="html" xml:base="http://localhost:4000/nginx-virtual-host-for-redirecting-non-www-to-www-and-https/"><p>In the past I had some problems with wrong redirections of my websites with the nginx webserver. Either the non-www to www or the redirect to the HTTPS version of my site didn’t worked. I figured out the problems with the help of others and some for myself and would like to show you how your virtual hosts should look like to prevent any random redirections. We desire that all requests without HTTPS or the www prefix (<em>example.com</em>) gets redirected to its counterpart (<em>https://www.example.com</em>).</p>
<p>At first we need to pickup all requests which address the unencrypted HTTP port 80. The server name should be here the www as well as the non-www version of your domain. Then we will make a redirect to the desired domain with www prefix and HTTPS included.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">server <span class="o">{</span>
listen 80<span class="p">;</span>
listen <span class="o">[</span>::]:80<span class="p">;</span>
server_name example.com www.example.com<span class="p">;</span>
<span class="k">return </span>301 https://www.example.com<span class="nv">$request_uri</span><span class="p">;</span>
<span class="o">}</span></code></pre></figure>
<p>Now there is the possibility to call the site over HTTPS but to omit the www prefix. Here we are listening at the HTTPS port for the non-www version and redirect it to the desired format. Note that we need to include here our certificates to be able to accept the connection. In this case I have included my <a href="https://letsencrypt.org/">Let’s Encrypt</a> certificate.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">server <span class="o">{</span>
listen 443 ssl http2<span class="p">;</span>
server_name example.com<span class="p">;</span>
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem<span class="p">;</span>
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem<span class="p">;</span>
<span class="k">return </span>301 https://www.example.com<span class="nv">$request_uri</span><span class="p">;</span>
<span class="o">}</span></code></pre></figure>
<p>For the last part there is only the main server block left for our desired URL format. This block listens for an incoming HTTPS request from a with a www prefixed URL. The user have typed the URL in the right format and triggered this block or more likely the block has been triggered by an redirection of one of our server blocks above. Include again here your certifactes and additional configurations by Let’s Encrypt. After this you can handle your main actions for your locations. I have added here some additions for restricting my Wordpress backend, for processing the PHP and a small block when my images, JS and CSS files should expire at.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash">server <span class="o">{</span>
listen 443 ssl http2 default_server<span class="p">;</span>
listen <span class="o">[</span>::]:443 ssl http2 default_server<span class="p">;</span>
root /var/www/example.com<span class="p">;</span>
index index.php index.html index.htm<span class="p">;</span>
server_name www.example.com<span class="p">;</span>
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem<span class="p">;</span>
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem<span class="p">;</span>
include /etc/letsencrypt/options-ssl-nginx.conf<span class="p">;</span>
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem<span class="p">;</span>
client_max_body_size 32M<span class="p">;</span>
location / <span class="o">{</span>
try_files <span class="nv">$uri</span> <span class="nv">$uri</span>/ /index.php?q<span class="o">=</span><span class="nv">$uri</span>&amp;<span class="nv">$args</span><span class="p">;</span>
<span class="o">}</span>
location /wp-admin <span class="o">{</span>
auth_basic <span class="s2">"Restricted"</span><span class="p">;</span>
auth_basic_user_file /var/www/.htpasswd<span class="p">;</span>
try_files <span class="nv">$uri</span> <span class="nv">$uri</span>/ /index.php?q<span class="o">=</span><span class="nv">$uri</span>&amp;<span class="nv">$args</span><span class="p">;</span>
<span class="o">}</span>
location ~ <span class="se">\.</span>php<span class="nv">$ </span><span class="o">{</span>
try_files <span class="nv">$uri</span> <span class="o">=</span>404<span class="p">;</span>
fastcgi_split_path_info ^<span class="o">(</span>.+<span class="se">\.</span>php<span class="o">)(</span>/.+<span class="o">)</span><span class="nv">$;</span>
fastcgi_pass unix:/run/php/php7.2-fpm.sock<span class="p">;</span>
fastcgi_index index.php<span class="p">;</span>
fastcgi_param SCRIPT_FILENAME <span class="nv">$document_root$fastcgi_script_name</span><span class="p">;</span>
include fastcgi_params<span class="p">;</span>
<span class="o">}</span>
<span class="c"># cache control</span>
location ~<span class="k">*</span> <span class="se">\.</span><span class="o">(</span>jpg|jpeg|png|gif|ico|css|js<span class="o">)</span><span class="nv">$ </span><span class="o">{</span>
expires 7d<span class="p">;</span>
<span class="o">}</span>
<span class="o">}</span></code></pre></figure></content><author><name></name></author><summary type="html">In the past I had some problems with wrong redirections of my websites with the nginx webserver. Either the non-www to www or the redirect to the HTTPS version of my site didn’t worked. I figured out the problems with the help of others and some for myself and would like to show you how your virtual hosts should look like to prevent any random redirections. We desire that all requests without HTTPS or the www prefix (example.com) gets redirected to its counterpart (https://www.example.com).</summary></entry><entry><title type="html">My i3 config</title><link href="http://localhost:4000/my-i3-config/" rel="alternate" type="text/html" title="My i3 config" /><published>2018-11-06T00:00:00+01:00</published><updated>2018-11-06T00:00:00+01:00</updated><id>http://localhost:4000/my-i3-config</id><content type="html" xml:base="http://localhost:4000/my-i3-config/"><p>Since I’m using the <a href="https://i3wm.org/">i3 window manager</a> I’ve been tweaking it to fit my needs till now. Sure this process will never come to end, but I want to share with you my current config. I’ve copied many useful things from other configs and added for myself some settings which might be useful for you. Feel free to copy some parts into your own config or to change some settings.</p>
<p>Here are some changes I would like to highlight:</p>
<ul>
<li>I’ve downloaded and moved the .ttf file of <a href="https://fontawesome.com/v4.7.0/">FontAwesome 4.7</a> into my fonts folder in <em>~/.fonts</em>. This allows me to use icons for my workspaces and my i3blocks status bar (not showing here because I’m not loading FontAwesome on this website).</li>
<li>dmenu shows at the bottom of the screen.</li>
<li>All my applications find their place on my five workspaces (browser, file manager, terminal, editors for coding and normal text editors like libreoffice, Texmaker).</li>
<li>When I suspend my computer I start a script which takes a screenshot, applys a blur effect on it and shows it at lock screen.</li>
<li>For my Lenovo T460 I’ve defined some key bindings which allow me to lower or raise the volume by 3% or my screen brightness by a custom step size.</li>
<li>Caps lock acts like the shift key.</li>
<li>My Logitech MX Master was really slow without any settings. I’ve increased the speed with xinput and set a custom coordinate matrix which helps a lot.</li>
</ul>
<p>You can find more info in the comments of my config below.</p>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">set</span> <span class="nv">$mod</span> Mod4
<span class="c"># Font for window titles. Will also be used by the bar unless a different font</span>
<span class="c"># is used in the bar {} block below.</span>
font pango:Droid Sans 10
<span class="c"># Use Mouse+$mod to drag floating windows to their wanted position</span>
floating_modifier <span class="nv">$mod</span>
<span class="c"># start a terminal</span>
bindsym <span class="nv">$mod</span>+Return <span class="nb">exec </span>i3-sensible-terminal, workspace <span class="nt">--no-auto-back-and-forth</span> <span class="nv">$wrksp3</span>
<span class="c"># kill focused window</span>
bindsym <span class="nv">$mod</span>+Shift+q <span class="nb">kill</span>
<span class="c"># start dmenu (a program launcher)</span>
bindsym <span class="nv">$mod</span>+d <span class="nb">exec </span>dmenu_run <span class="nt">-b</span> <span class="nt">-i</span>
<span class="c"># change focus</span>
bindsym <span class="nv">$mod</span>+j focus left
bindsym <span class="nv">$mod</span>+k focus down
bindsym <span class="nv">$mod</span>+l focus up
bindsym <span class="nv">$mod</span>+odiaeresis focus right
<span class="c"># alternatively, you can use the cursor keys:</span>
bindsym <span class="nv">$mod</span>+Left focus left
bindsym <span class="nv">$mod</span>+Down focus down
bindsym <span class="nv">$mod</span>+Up focus up
bindsym <span class="nv">$mod</span>+Right focus right
<span class="c"># move focused window</span>
bindsym <span class="nv">$mod</span>+Shift+j move left
bindsym <span class="nv">$mod</span>+Shift+k move down
bindsym <span class="nv">$mod</span>+Shift+l move up
bindsym <span class="nv">$mod</span>+Shift+odiaeresis move right
<span class="c"># alternatively, you can use the cursor keys:</span>
bindsym <span class="nv">$mod</span>+Shift+Left move left
bindsym <span class="nv">$mod</span>+Shift+Down move down
bindsym <span class="nv">$mod</span>+Shift+Up move up
bindsym <span class="nv">$mod</span>+Shift+Right move right
<span class="c"># split in horizontal orientation</span>
bindsym <span class="nv">$mod</span>+h split h
<span class="c"># split in vertical orientation</span>
bindsym <span class="nv">$mod</span>+v split v
<span class="c"># enter fullscreen mode for the focused container</span>
bindsym <span class="nv">$mod</span>+f fullscreen toggle
<span class="c"># change container layout (stacked, tabbed, toggle split)</span>
bindsym <span class="nv">$mod</span>+s layout stacking
bindsym <span class="nv">$mod</span>+w layout tabbed
bindsym <span class="nv">$mod</span>+e layout toggle split
<span class="c"># toggle tiling / floating</span>
bindsym <span class="nv">$mod</span>+Shift+space floating toggle
<span class="c"># change focus between tiling / floating windows</span>
bindsym <span class="nv">$mod</span>+space focus mode_toggle
<span class="c"># focus the parent container</span>
bindsym <span class="nv">$mod</span>+a focus parent
<span class="c"># focus the child container</span>
<span class="c">#bindsym $mod+d focus child</span>
<span class="c"># Make the currently focused window a scratchpad</span>
bindsym <span class="nv">$mod</span>+Shift+minus move scratchpad
<span class="c"># Show the first scratchpad window</span>
bindsym <span class="nv">$mod</span>+minus scratchpad show
<span class="c"># set own variables</span>
<span class="nb">set</span> <span class="nv">$wrksp1</span> <span class="s2">"1: Chrome"</span>
<span class="nb">set</span> <span class="nv">$wrksp2</span> <span class="s2">"2: Dateien"</span>
<span class="nb">set</span> <span class="nv">$wrksp3</span> <span class="s2">"3: Terminal"</span>
<span class="nb">set</span> <span class="nv">$wrksp4</span> <span class="s2">"4: Code"</span>
<span class="nb">set</span> <span class="nv">$wrksp5</span> <span class="s2">"5: Dokumente"</span>
<span class="c"># switch to workspace</span>
bindsym <span class="nv">$mod</span>+1 workspace <span class="nv">$wrksp1</span>
bindsym <span class="nv">$mod</span>+2 workspace <span class="nv">$wrksp2</span>
bindsym <span class="nv">$mod</span>+3 workspace <span class="nv">$wrksp3</span>
bindsym <span class="nv">$mod</span>+4 workspace <span class="nv">$wrksp4</span>
bindsym <span class="nv">$mod</span>+5 workspace <span class="nv">$wrksp5</span>
bindsym <span class="nv">$mod</span>+6 workspace 6
bindsym <span class="nv">$mod</span>+7 workspace 7
bindsym <span class="nv">$mod</span>+8 workspace 8
bindsym <span class="nv">$mod</span>+9 workspace 9
bindsym <span class="nv">$mod</span>+0 workspace 10
<span class="c"># move focused container to workspace</span>
bindsym <span class="nv">$mod</span>+Shift+1 move container to workspace <span class="nv">$wrksp1</span>
bindsym <span class="nv">$mod</span>+Shift+2 move container to workspace <span class="nv">$wrksp2</span>
bindsym <span class="nv">$mod</span>+Shift+3 move container to workspace <span class="nv">$wrksp3</span>
bindsym <span class="nv">$mod</span>+Shift+4 move container to workspace <span class="nv">$wrksp4</span>
bindsym <span class="nv">$mod</span>+Shift+5 move container to workspace <span class="nv">$wrksp5</span>
bindsym <span class="nv">$mod</span>+Shift+6 move container to workspace 6
bindsym <span class="nv">$mod</span>+Shift+7 move container to workspace 7
bindsym <span class="nv">$mod</span>+Shift+8 move container to workspace 8
bindsym <span class="nv">$mod</span>+Shift+9 move container to workspace 9
bindsym <span class="nv">$mod</span>+Shift+0 move container to workspace 10
<span class="c"># assign programs to workspaces</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"Chromium"</span><span class="o">]</span> <span class="nv">$wrksp1</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"Thunar"</span><span class="o">]</span> <span class="nv">$wrksp2</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"dolphin"</span><span class="o">]</span> <span class="nv">$wrksp2</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"terminal"</span><span class="o">]</span> <span class="nv">$wrksp3</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"Omnetpp"</span><span class="o">]</span> <span class="nv">$wrksp3</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"OMNeT</span><span class="se">\+\+\s</span><span class="s2">IDE"</span><span class="o">]</span> <span class="nv">$wrksp3</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"(?i)Sublime_text"</span><span class="o">]</span> <span class="nv">$wrksp4</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"(?i)Subl3"</span><span class="o">]</span> <span class="nv">$wrksp4</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"(?i)libreoffice"</span><span class="o">]</span> <span class="nv">$wrksp5</span>
assign <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"TexMaker"</span><span class="o">]</span> <span class="nv">$wrksp5</span>
<span class="c"># reload the configuration file</span>
bindsym <span class="nv">$mod</span>+Shift+c reload
<span class="c"># restart i3 inplace (preserves your layout/session, can be used to upgrade i3)</span>
bindsym <span class="nv">$mod</span>+Shift+r restart
<span class="c"># exit i3 (logs you out of your X session)</span>
bindsym <span class="nv">$mod</span>+Shift+e <span class="nb">exec</span> <span class="s2">"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'"</span>
<span class="c"># resize window (you can also use the mouse for that)</span>
mode <span class="s2">" resize"</span> <span class="o">{</span>
<span class="c"># These bindings trigger as soon as you enter the resize mode</span>
<span class="c"># Pressing left will shrink the window’s width.</span>
<span class="c"># Pressing right will grow the window’s width.</span>
<span class="c"># Pressing up will shrink the window’s height.</span>
<span class="c"># Pressing down will grow the window’s height.</span>
bindsym j resize shrink width 10 px or 10 ppt
bindsym k resize grow height 10 px or 10 ppt
bindsym l resize shrink height 10 px or 10 ppt
bindsym odiaeresis resize grow width 10 px or 10 ppt
<span class="c"># same bindings, but for the arrow keys</span>
bindsym Left resize shrink width 10 px or 10 ppt
bindsym Down resize grow height 10 px or 10 ppt
bindsym Up resize shrink height 10 px or 10 ppt
bindsym Right resize grow width 10 px or 10 ppt
<span class="c"># back to normal: Enter or Escape</span>
bindsym Return mode <span class="s2">"default"</span>
bindsym Escape mode <span class="s2">"default"</span>
<span class="o">}</span>
bindsym <span class="nv">$mod</span>+r mode <span class="s2">" resize"</span>
<span class="nb">set</span> <span class="nv">$bg</span><span class="nt">-color</span> <span class="c">#59647D</span>
<span class="nb">set</span> <span class="nv">$inactive</span><span class="nt">-bg-color</span> <span class="c">#2f343f</span>
<span class="nb">set</span> <span class="nv">$text</span><span class="nt">-color</span> <span class="c">#f3f4f5</span>
<span class="nb">set</span> <span class="nv">$inactive</span><span class="nt">-text-color</span> <span class="c">#8E95A3</span>
<span class="nb">set</span> <span class="nv">$urgent</span><span class="nt">-bg-color</span> <span class="c">#E53935</span>
<span class="c"># window colors</span>
<span class="c"># border background text indicator</span>
client.focused <span class="nv">$bg</span><span class="nt">-color</span> <span class="nv">$bg</span><span class="nt">-color</span> <span class="nv">$text</span><span class="nt">-color</span> <span class="c">#8BB7D6</span>
client.unfocused <span class="nv">$inactive</span><span class="nt">-bg-color</span> <span class="nv">$inactive</span><span class="nt">-bg-color</span> <span class="nv">$inactive</span><span class="nt">-text-color</span> <span class="c">#8BB7D6</span>
client.focused_inactive <span class="nv">$inactive</span><span class="nt">-bg-color</span> <span class="nv">$inactive</span><span class="nt">-bg-color</span> <span class="nv">$inactive</span><span class="nt">-text-color</span> <span class="c">#8BB7D6</span>
client.urgent <span class="nv">$urgent</span><span class="nt">-bg-color</span> <span class="nv">$urgent</span><span class="nt">-bg-color</span> <span class="nv">$text</span><span class="nt">-color</span> <span class="c">#8BB7D6</span>
<span class="c"># Start i3bar to display a workspace bar (plus the system information i3status</span>
<span class="c"># finds out, if available)</span>
bar <span class="o">{</span>
status_command i3blocks
colors <span class="o">{</span>
background <span class="c">#3E4557</span>
separator <span class="c">#757575</span>
<span class="c"># border background text</span>
focused_workspace <span class="nv">$bg</span><span class="nt">-color</span> <span class="nv">$bg</span><span class="nt">-color</span> <span class="nv">$text</span><span class="nt">-color</span>
inactive_workspace <span class="nv">$inactive</span><span class="nt">-bg-color</span> <span class="nv">$inactive</span><span class="nt">-bg-color</span> <span class="nv">$inactive</span><span class="nt">-text-color</span>
urgent_workspace <span class="nv">$urgent</span><span class="nt">-bg-color</span> <span class="nv">$urgent</span><span class="nt">-bg-color</span> <span class="nv">$text</span><span class="nt">-color</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="c">#########################################################</span>
<span class="c">#------------------ OWN ADDITIONS ----------------------#</span>
<span class="c">#########################################################</span>
<span class="c"># border style</span>
<span class="c">#new_window pixel 4 - removes title bar</span>
hide_edge_borders both
<span class="c"># own keybindings</span>
bindsym <span class="nv">$mod</span>+b <span class="nb">exec </span>chromium <span class="nt">--enable-native-gpu-memory-buffers</span>, workspace <span class="nt">--no-auto-back-and-forth</span> <span class="nv">$wrksp1</span>
bindsym <span class="nv">$mod</span>+c <span class="nb">exec </span>dolphin, workspace <span class="nt">--no-auto-back-and-forth</span> <span class="nv">$wrksp2</span>
bindsym <span class="nv">$mod</span>+z <span class="nb">exec </span>subl3, workspace <span class="nt">--no-auto-back-and-forth</span> <span class="nv">$wrksp4</span>
bindsym <span class="nv">$mod</span>+shift+a <span class="nb">exec </span>xfce4-appfinder
bindsym <span class="nv">$mod</span>+shift+s <span class="nb">exec </span>xfce4-screenshooter
bindsym <span class="nv">$mod</span>+shift+y <span class="nb">exec</span> ~/Skripte/Omnet_Automation.py
bindsym <span class="nv">$mod</span>+x move workspace to output right
<span class="c"># power menu from https://wiki.archlinux.org/index.php/i3</span>
<span class="nb">set</span> <span class="nv">$Locker</span> /home/denis/Skripte/lock.sh <span class="nt">-p</span>
<span class="nb">set</span> <span class="nv">$mode_system</span> shutdown <span class="o">(</span>d<span class="o">)</span>, reboot <span class="o">(</span>r<span class="o">)</span>, lock <span class="o">(</span>l<span class="o">)</span>, stand-by <span class="o">(</span>s<span class="o">)</span>, <span class="nb">logout</span> <span class="o">(</span>e<span class="o">)</span>
mode <span class="s2">"</span><span class="nv">$mode_system</span><span class="s2">"</span> <span class="o">{</span>
bindsym l <span class="nb">exec</span> <span class="nt">--no-startup-id</span> <span class="nv">$Locker</span>, mode <span class="s2">"default"</span>
bindsym e <span class="nb">exec</span> <span class="nt">--no-startup-id</span> i3-msg <span class="nb">exit</span>, mode <span class="s2">"default"</span>
bindsym s <span class="nb">exec</span> <span class="nt">--no-startup-id</span> <span class="nv">$Locker</span> <span class="o">&amp;&amp;</span> systemctl <span class="nb">suspend</span>, mode <span class="s2">"default"</span>
bindsym r <span class="nb">exec</span> <span class="nt">--no-startup-id</span> systemctl reboot, mode <span class="s2">"default"</span>
bindsym d <span class="nb">exec</span> <span class="nt">--no-startup-id</span> systemctl poweroff <span class="nt">-i</span>, mode <span class="s2">"default"</span>
<span class="c"># back to normal: Enter or Escape</span>
bindsym Return mode <span class="s2">"default"</span>
bindsym Escape mode <span class="s2">"default"</span>
<span class="o">}</span>
bindsym <span class="nv">$mod</span>+End mode <span class="s2">"</span><span class="nv">$mode_system</span><span class="s2">"</span>
<span class="c"># return to previous workspace by pressing last workspace again</span>
workspace_auto_back_and_forth yes
<span class="c"># remove title bar from programs</span>
for_window <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"Chromium"</span> <span class="nv">title</span><span class="o">=</span><span class="s2">"Chromium"</span><span class="o">]</span> border none
for_window <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"(?i)Sublime_text"</span> <span class="nv">title</span><span class="o">=</span><span class="s2">"Sublime Text"</span><span class="o">]</span> border none
for_window <span class="o">[</span> <span class="nv">title</span><span class="o">=</span><span class="s2">"^pdfpc - present"</span> <span class="o">]</span> border none floating <span class="nb">enable
</span>for_window <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"Galculator"</span><span class="o">]</span> floating <span class="nb">enable </span>resize <span class="nb">set </span>500 400
for_window <span class="o">[</span><span class="nv">class</span><span class="o">=</span><span class="s2">"Arandr"</span><span class="o">]</span> floating <span class="nb">enable</span>
<span class="c"># pulse audio controls</span>
bindsym XF86AudioLowerVolume <span class="nb">exec </span>amixer <span class="nb">set </span>Master 3%-
bindsym XF86AudioRaiseVolume <span class="nb">exec </span>amixer <span class="nb">set </span>Master 3%+
bindsym XF86AudioMute <span class="nb">exec </span>amixer <span class="nt">-q</span> <span class="nb">set </span>Master toggle
<span class="c"># screen brightness controls</span>
bindsym XF86MonBrightnessUp <span class="nb">exec</span> /home/denis/Skripte/backlight_fcn_keys.sh <span class="nt">-i</span>
bindsym XF86MonBrightnessDown <span class="nb">exec</span> /home/denis/Skripte/backlight_fcn_keys.sh <span class="nt">-d</span>
<span class="c"># change caps lock to shift</span>
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> xmodmap <span class="nt">-e</span> <span class="s2">"keycode 66 = Shift_L NoSymbol Shift_L"</span>
<span class="c"># set velocity for MX Master</span>
exec_always <span class="nt">--no-startup-id</span> xinput <span class="nt">--set-prop</span> <span class="s2">"pointer:Logitech MX Master"</span> <span class="s2">"libinput Accel Speed"</span> 1.0
<span class="c"># from https://unix.stackexchange.com/a/177640/182096</span>
exec_always <span class="nt">--no-startup-id</span> xinput <span class="nt">--set-prop</span> <span class="s2">"pointer:Logitech MX Master"</span> <span class="s2">"Coordinate Transformation Matrix"</span> 2 0 0 0 2 0 0 0 1.5
<span class="c"># enable natural scrolling on touchpad</span>
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> xinput <span class="nt">--set-prop</span> <span class="s2">"SynPS/2 Synaptics TouchPad"</span> <span class="s2">"libinput Natural Scrolling Enabled"</span> 1
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> xinput <span class="nt">--set-prop</span> <span class="s2">"SynPS/2 Synaptics TouchPad"</span> <span class="s2">"libinput Tapping Enabled"</span> 1
exec_always <span class="nt">--no-startup-id</span> xinput <span class="nt">--set-prop</span> <span class="s2">"TPPS/2 IBM TrackPoint"</span> <span class="s2">"libinput Left Handed Enabled"</span> 1
<span class="c"># startup programs</span>
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> nm-applet
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> solaar
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> redshift-gtk
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> dolphin
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> start-pulseaudio-x11
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> xfce4-power-manager
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> ~/.dropbox-dist/dropboxd
exec_always <span class="nt">--no-startup-id</span> compton <span class="nt">-CGb</span>
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> udiskie <span class="nt">-as</span>
<span class="c"># remove urgent from all windows</span>
<span class="nb">exec</span> <span class="nt">--no-startup-id</span> <span class="s2">"sleep 3; for win in </span><span class="k">$(</span>wmctrl <span class="nt">-l</span> | awk <span class="nt">-F</span><span class="s1">' '</span> <span class="s1">'{print $1}'</span><span class="k">)</span><span class="s2">; do wmctrl -i -r </span><span class="nv">$win</span><span class="s2"> -b remove,demands_attention; done"</span>
<span class="c"># set background image</span>
exec_always <span class="nt">--no-startup-id</span> feh <span class="nt">--bg-scale</span> /home/denis/Medien/Bilder/Glazer.jpg</code></pre></figure></content><author><name></name></author><summary type="html">Since I’m using the i3 window manager I’ve been tweaking it to fit my needs till now. Sure this process will never come to end, but I want to share with you my current config. I’ve copied many useful things from other configs and added for myself some settings which might be useful for you. Feel free to copy some parts into your own config or to change some settings.</summary></entry><entry><title type="html">Alternative to Page Builders: Widgetize your Wordpress Page</title><link href="http://localhost:4000/alternative-to-page-builders-widgetize-your-wordpress-page/" rel="alternate" type="text/html" title="Alternative to Page Builders: Widgetize your Wordpress Page" /><published>2018-04-08T00:00:00+02:00</published><updated>2018-04-08T00:00:00+02:00</updated><id>http://localhost:4000/alternative-to-page-builders-widgetize-your-wordpress-page</id><content type="html" xml:base="http://localhost:4000/alternative-to-page-builders-widgetize-your-wordpress-page/"><p>You have probably heared of the visual composer or the page builder for Wordpress. These tools allows you to create a custom page layout in your backend, which doesn’t looks like the common 2/3 wide blog with a 1/3 wide sidebar. The biggest advantage that these tools have is the ability to change the layout and the content from the backend without touching any line of code.</p>
<h3 id="problems-with-page-builders">Problems with Page Builders</h3>
<p>One main problem that these tools bring in is that they are very slow in handling. Every little change takes seconds until you can see the result, which is a huge slow down in the development process. The other drawback is the creation of massive overhead in the resulting HTML code. The content is nested in countless of cryptical div tags as you can see in the image below:</p>
<p><img src="/images/Nested_Divs.png" alt="Nested DIVs" /></p>
<h3 id="alternative-approaches">Alternative Approaches</h3>
<p>What are the alternatives without loosing the convenience of the codeless editing? We widgetize our pages! Every component of the page is a widget and can be edited easily in the backend.</p>
<p>It must be said, that there is no completely codeless solution for this. The first layout must be written in code, but afterwards you or your client can manage the content from the widget area in the backend and will never see the code behind this.</p>
<h3 id="register-new-widgets">Register new Widgets</h3>
<p>Open your <em>functions.php</em> file in your current theme under <em>/wp-content/theme/[<strong>YOUR_THEME</strong>]</em> and search for ‘<em>register_sidebar</em>’. The widgets there are included in a function which has something like ‘<em>widget_init</em>’ or ‘<em>register_widget</em>’ in the name. Here is an example how it could look like:</p>
<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">function</span> <span class="nf">hotel_hamburg_widgets_init</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">register_sidebar</span><span class="p">(</span> <span class="k">array</span><span class="p">(</span>
<span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="nx">esc_html__</span><span class="p">(</span> <span class="s1">'Sidebar'</span><span class="p">,</span> <span class="s1">'hotel-hamburg'</span> <span class="p">),</span>
<span class="s1">'id'</span> <span class="o">=&gt;</span> <span class="s1">'sidebar-1'</span><span class="p">,</span>
<span class="s1">'description'</span> <span class="o">=&gt;</span> <span class="nx">esc_html__</span><span class="p">(</span> <span class="s1">'Add widgets here.'</span><span class="p">,</span> <span class="s1">'hotel-hamburg'</span> <span class="p">),</span>
<span class="s1">'before_widget'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;section id="%1$s" class="widget %2$s"&gt;'</span><span class="p">,</span>
<span class="s1">'after_widget'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;/section&gt;'</span><span class="p">,</span>
<span class="s1">'before_title'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;h2 class="widget-title"&gt;'</span><span class="p">,</span>
<span class="s1">'after_title'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;/h2&gt;'</span><span class="p">,</span>
<span class="p">)</span> <span class="p">);</span>
<span class="o">...</span>
</code></pre></div></div>
<p>Copy the function <em>register_sidebar</em> including the last ‘<em>);</em>’ and paste it right before the closing curly bracket for the function. Change the name and the id of the widget and save the file:</p>
<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">function</span> <span class="nf">hotel_hamburg_widgets_init</span><span class="p">()</span> <span class="p">{</span>
<span class="nx">register_sidebar</span><span class="p">(</span> <span class="k">array</span><span class="p">(</span>
<span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="nx">esc_html__</span><span class="p">(</span> <span class="s1">'Sidebar'</span><span class="p">,</span> <span class="s1">'hotel-hamburg'</span> <span class="p">),</span>
<span class="s1">'id'</span> <span class="o">=&gt;</span> <span class="s1">'sidebar-1'</span><span class="p">,</span>
<span class="s1">'description'</span> <span class="o">=&gt;</span> <span class="nx">esc_html__</span><span class="p">(</span> <span class="s1">'Add widgets here.'</span><span class="p">,</span> <span class="s1">'hotel-hamburg'</span> <span class="p">),</span>
<span class="s1">'before_widget'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;section id="%1$s" class="widget %2$s"&gt;'</span><span class="p">,</span>
<span class="s1">'after_widget'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;/section&gt;'</span><span class="p">,</span>
<span class="s1">'before_title'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;h2 class="widget-title"&gt;'</span><span class="p">,</span>
<span class="s1">'after_title'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;/h2&gt;'</span><span class="p">,</span>
<span class="p">)</span> <span class="p">);</span>
<span class="nx">register_sidebar</span><span class="p">(</span> <span class="k">array</span><span class="p">(</span>
<span class="s1">'name'</span> <span class="o">=&gt;</span> <span class="nx">esc_html__</span><span class="p">(</span> <span class="s1">'MY_NEW_WIDGET'</span><span class="p">,</span> <span class="s1">'hotel-hamburg'</span> <span class="p">),</span>
<span class="s1">'id'</span> <span class="o">=&gt;</span> <span class="s1">'mynewwidget-1'</span><span class="p">,</span>
<span class="s1">'description'</span> <span class="o">=&gt;</span> <span class="nx">esc_html__</span><span class="p">(</span> <span class="s1">'This is a new widget.'</span><span class="p">,</span> <span class="s1">'hotel-hamburg'</span> <span class="p">),</span>
<span class="s1">'before_widget'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;section id="%1$s" class="widget %2$s"&gt;'</span><span class="p">,</span>
<span class="s1">'after_widget'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;/section&gt;'</span><span class="p">,</span>
<span class="s1">'before_title'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;h2 class="widget-title"&gt;'</span><span class="p">,</span>
<span class="s1">'after_title'</span> <span class="o">=&gt;</span> <span class="s1">'&lt;/h2&gt;'</span><span class="p">,</span>
<span class="p">)</span> <span class="p">);</span>
<span class="p">}</span>
</code></pre></div></div>
<p>The widget now appears in your backend and you can assign any content to the widget, but it still is not shown up in the frontend. Let’s change this.</p>
<p><img src="/images/New_Widget.png" alt="New Widget" /></p>
<h3 id="add-the-widget-to-your-template">Add the Widget to your Template</h3>
<p>We need now a custom template for our widgetized page. <a href="https://developer.wordpress.org/themes/template-files-section/page-template-files/" target="_blank">Create a page template</a> as described in the link. Don’t forget to set the page template in your page if you have set up a multiple purpose template!</p>
<p>Decide where you want to show up your widget in the page template and copy this code into it:</p>
<div class="language-php highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">&lt;?php</span> <span class="k">if</span> <span class="p">(</span> <span class="nx">is_active_sidebar</span><span class="p">(</span> <span class="s1">'mynewwidget-1'</span> <span class="p">))</span><span class="o">:</span> <span class="cp">?&gt;</span>
<span class="cp">&lt;?php</span> <span class="nx">dynamic_sidebar</span><span class="p">(</span> <span class="s1">'mynewwidget-1'</span> <span class="p">);</span> <span class="cp">?&gt;</span>
<span class="cp">&lt;?php</span> <span class="k">endif</span><span class="p">;</span> <span class="cp">?&gt;</span>
</code></pre></div></div>
<p>Save your file and look at your new widgetized page. Change if necessary the <em>before_widget</em>, <em>after_widget</em>, <em>before_title</em>, <em>after_title</em> attributes for your needs and add some styles.</p></content><author><name></name></author><summary type="html">You have probably heared of the visual composer or the page builder for Wordpress. These tools allows you to create a custom page layout in your backend, which doesn’t looks like the common 2/3 wide blog with a 1/3 wide sidebar. The biggest advantage that these tools have is the ability to change the layout and the content from the backend without touching any line of code.</summary></entry><entry><title type="html">Die Besonderheit der Implementierung von QUIC im User Space</title><link href="http://localhost:4000/die-besonderheit-der-implementierung-von-quic-im-user-space/" rel="alternate" type="text/html" title="Die Besonderheit der Implementierung von QUIC im User Space" /><published>2018-03-03T00:00:00+01:00</published><updated>2018-03-03T00:00:00+01:00</updated><id>http://localhost:4000/die-besonderheit-der-implementierung-von-quic-im-user-space</id><content type="html" xml:base="http://localhost:4000/die-besonderheit-der-implementierung-von-quic-im-user-space/"><p>Alle gängigen Netzwerkprotokolle ab der vierten Schicht des TCP/IP-Modells finden ihre Implementierung im Kernel des Betriebssystems (Kernel Space). Dieses Vorgehen wird gewählt, um bei der Menge an Netzwerkpaketen eine schnelle und effiziente Verarbeitung zu gewährleisten. Auf der anderen Seite gibt es den User Space dem die Protokolle aus der Applikations-Schicht zugeordnet sind. Dieser Beitrag soll die Unterschiede beider Bereiche herausstellen und am Beispiel von QUIC die Vorteile einer Implementierung im User Space beleuchten.</p>
<h3 id="der-kernel">Der Kernel</h3>
<p>Bei dem Kernel handelt es sich um die Komponente eines Betriebssystems, die den grundlegenden Zugriff auf die Hardware ermöglicht. Zu den Aufgaben des Kernels zählen die Verwaltung des Speichers, die Auswahl einer Ausführungsreihenfolge von Prozessen auf dem Prozessor (Scheduling), das Handling von Interrupts, die Bereitstellung einer Interprozesskommunikation, sowie die Verwaltung weiterer Services wie z.B. die Netzwerkkommunikation. Es gibt sicherlich viele weitere Bereiche in denen der Kernel tätig ist, jedoch soll es erstmal bei diesen Ausblick bleiben.</p>
<p>Dieser vollständige Zugriff auf die Hardware des Computers birgt die Gefahr, dass bei falscher Verwendung, z.B. das ständige Beschreiben des gleichen Speicherblocks auf einer SSD, es zu irrevesiblen Schäden kommen kann. Die Auslieferung des Kernels durch die Entwickler des Betriebssystems stellt sicher, dass wirklich nur privilegierte Anwendungen direkt auf die Hardware zugreifen können.</p>
<h3 id="kernel-und-user-space">Kernel und User Space</h3>
<p>Die Trennung des privilegierten Systemzustands inklusive eines geschützten Speicherbereiches vom Rest des Systems, erlaubt auch weniger vertrauenswürdigen Anwendungen eine Ausführung auf dem Computersystem. Ersteres wird als Kernel Space bezeichnet, während die Umgebung der Anwendungen den User Space darstellt. Ohne Zugriff auf den Kernel, um beispielsweise Dateien zu erstellen oder zu editieren, sind jedoch die User-Space-Anwendungen nutzlos. System Calls stellen daher einen Mechanismus dar, die es den Anwendungen aus dem User Space ermöglichen, über vordefinierte Funktionen auf den Kernel zuzugreifen. Die nachstehende Abbildung veranschaulicht den Ablauf eines System Calls:
<img src="/images/SysCallDiagramm.svg" alt="System Call Ablauf" style="width:150px;" /></p>
<p>Angenommen ein Programm möchte eine Datei lesen. Dazu führt das Programm den System Call <em>read()</em> aus. Es folgt ein Kontextwechsel vom User Space in den Kernel Space, der dem Programm ab diesen Zeitpunkt die Kontrolle entzieht. Die erforderlichen Daten werden vom Speicher gelesen und nach einem Wechsel zurück in den User Space dem Programm zur Verfügung gestellt. Ein simpler, aber effektiver Mechanismus.</p>
<p>Das Problem an dieser Sache ist, dass die Kontextwechsel immer mit zusätzlichen CPU-Zyklen und damit einem Performanceverlust behaftet sind. Bei vielen Zugriffen auf die Kernel-Funktionen, wie es beim Netzwerk mit dem Senden und Empfangen von Paketen der Fall ist, kommt ein gewisser Overhead zustande. Nicht zuletzt deshalb wurde für den Linux Kernel im Jahr 2015 vorgeschlagen den Teil der symmetrischen Ver- und Entschlüsselung des Verschlüsselungsprotokoll TLS in den Kernel Space zu verschieben (siehe <a href="https://lwn.net/Articles/665602/" target="_blank">LWN</a>). Im Linux Kernel 4.13 ist dieses Kernel TLS (KTLS) dann auch eingeflossen (siehe <a href="https://www.heise.de/ct/artikel/Die-Neuerungen-von-Linux-4-13-3771362.html" target="_blank">Heise</a>).</p>
<h3 id="quic-user-space-motivation">QUIC User Space Motivation</h3>
<p>Was sind die Gründe dafür ein Transportprotokoll wie QUIC im User Space zu implementieren, wo doch selbst im TCP/IP-Modell höher angesiedelte Protokolle bereits zum Teil im Kernel implementiert werden (siehe KTLS darüber)? Es folgt eine Auflistung der Vorteile aus inklusive eigener Ergänzungen:</p>
<h4 id="einsatz-moderner-softwareentwicklungsmethodiken">Einsatz moderner Softwareentwicklungsmethodiken</h4>
<p>Durch Unit- und Ende-zu-Ende-Tests wird es den Entwicklern ermöglicht schnell und ohne viel Aufwand Fehler im Code auszumachen, die unter den beschränkten Möglichkeiten des Kernel Spaces womöglich zu spät entdeckt worden wären. Dies resultiert letztendlich in einer höheren Robustheit der Software.</p>
<h4 id="erweitertes-logging">Erweitertes Logging</h4>
<p>Ein Nachteil am Kernel Space ist, dass Applikationen unter einer strengeren Speicherbeschränkung stehen, als im User Space. Für QUIC konnten die Entwickler deshalb auf ein erweitertes Logging in Verbindung mit einer Server-Logging-Infrastruktur zurückgreifen. Das erweiterte Logging hat bereits dazu geführt, dass ein Jahrzehnt alter Bug in der Congestion Control Cubic aufgedeckt werden konnte, wodurch die Performance von QUIC deutlich erhöht wurde.</p>
<h4 id="unabhängigkeit-vom-betriebssystem">Unabhängigkeit vom Betriebssystem</h4>
<p>Dieser Punkt gilt als der wahrscheinlich wichtigste Vorteil - die Unabhängigkeit vom Betriebssystem (weiter mit OS abgekürzt). Neue OS-Versionen werden meist in einem mehrjährigen Zyklus veröffentlicht und unterstehen der vollständigen Kontrolle der Entwickler des OS. Dies erschwert das Einspielen neuer Applikationsversionen und erfordert bei einem neuen Protokoll, wie QUIC, die Motivation und Bereitschaft bei den Beteiligten des OS überhaupt ein neues Protokoll zu integrieren.</p>
<p>Mit der Kopplung am OS werden auch die Nachteile einer langsamen und geringen Ausbreitung neuer Versionen mitgenommen. Das Einspielen neuer Updates für wichtige Sicherheitslücken oder neue Funktionen ist auf den Update- oder Realease-Zyklus des OS beschränkt. Auch kann niemand garantieren, dass das Update sofort bei einer breiten Masse an Computern ankommt, womit man dem Problem der Fragmentierung gegenübersteht.</p>
<p>Durch die Integrierung von QUIC im open source Webbrowser-Projekt Chromium, welcher auch vom weit genutzten Chrome verwendet wird, können die Entwickler auf einen vollkommen unabhängigen und iterativen Entwicklungsprozess für QUIC setzen. Die Bereitstellung von Chrome und Chromium über die gängigsten OS hinweg erreicht bei einem Update von QUIC wesentlich mehr Nutzer, als es bei einem einzigen OS der Fall wäre. Besonders bei Sicherheitslücken ist das eine Eigenschaft von großem Vorteil.</p>
<h3 id="negative-auswirkungen-der-user-space-implementierung">Negative Auswirkungen der User-Space-Implementierung</h3>
<p>Auch wenn bei der Entwicklung von QUIC der Fokus auf eine schnelle Entwicklung gelegt wurde, darf der Aspekt des Overheads durch die Kontextwechsel zwischen User und Kernel Space nicht ignoriert werden. In Messungen aus wurde im Vergleich zu einem Protokollstack bestehend aus TLS und TCP eine 3,5 mal höhere CPU-Auslastung beobachtet. Nach der Durchführung von Optimierungen konnte die Auslastung auf das 2-fache gesenkt werden.</p>
<p>Als mögliche Lösung des Problems wurde in die Nutzung des Frameworks netmap aufgeführt. Dieses Framework ermöglicht User-Space-Applikationen einen schnellen Zugriff auf Netzwerkpakete in dem es den Overhead der durch Speicherallokation, System Calls und der Kopie von Speicherinhalten entsteht, reduziert oder gar beseitigt. In Messungen des Netmap-Papers konnte der Transport eines Netzwerkpakets vom Kabel bis zur User-Space-Anwendung um mindestens eine Größenordnung beschleunigt werden.</p>
<h3 id="fazit">Fazit</h3>
<p>Die Implementierung von Anwendungen hat sowohl im Kernel als auch im User Space ihre Vor- und Nachteile. Der Kernel Space bietet die bessere Performance, schränkt jedoch dafür die Entwicklungsmöglichkeiten ein und ist vom OS abhängig, während es beim User Space anders herum ist. Der Schritt QUIC im User Space zu implementieren stellt sich vor dem Hintergrund einer schnellen Entwicklung, als ein gewagter aber sinnvoller Weg dar. Mit dem Netmap-Framework wurde außerdem eine Lösung vorgestellt, die die Performancenachteile durch den Kontextwechsel drastisch reduzieren kann. Es bleibt abzuwarten, ob eine Umsetzung des Netmap-Frameworks in Zukunft geplant ist. Falls doch, so würde dem weltweiten Einsatz von QUIC kaum noch etwas entgegenstehen.</p></content><author><name></name></author><summary type="html">Alle gängigen Netzwerkprotokolle ab der vierten Schicht des TCP/IP-Modells finden ihre Implementierung im Kernel des Betriebssystems (Kernel Space). Dieses Vorgehen wird gewählt, um bei der Menge an Netzwerkpaketen eine schnelle und effiziente Verarbeitung zu gewährleisten. Auf der anderen Seite gibt es den User Space dem die Protokolle aus der Applikations-Schicht zugeordnet sind. Dieser Beitrag soll die Unterschiede beider Bereiche herausstellen und am Beispiel von QUIC die Vorteile einer Implementierung im User Space beleuchten.</summary></entry><entry><title type="html">Quick UDP Internet Connections: Eine Einführung</title><link href="http://localhost:4000/quick-udp-internet-connections-eine-einfuehrung/" rel="alternate" type="text/html" title="Quick UDP Internet Connections: Eine Einführung" /><published>2018-02-18T00:00:00+01:00</published><updated>2018-02-18T00:00:00+01:00</updated><id>http://localhost:4000/quick-udp-internet-connections-eine-einfuehrung</id><content type="html" xml:base="http://localhost:4000/quick-udp-internet-connections-eine-einfuehrung/"><p>Das Transmission Control Protocol (TCP) ist selbst nach 36 Jahren seit der Standardisierung durch die IETF noch das am weitesten verbreitete Transportprotokoll für eine zuverlässige und reihenfolgegesicherte Übertragung. Es ist beachtlich, dass solch ein altes Protokoll so lange den stetig steigenden Anforderungen an das Internet standhalten konnte. Jedoch bringt TCP Probleme und Altlasten mit sich, die einer weiteren Entwicklung des Internets im Weg steht.</p>
<p>Im Jahr 2013 wurde von Jim Roskind (zu diesem Zeitpunkt noch bei Google angestellt) ein neues Transportprotokoll namens QUIC (Quick UDP Internet Connections) vorgestellt, das in vielen Bereichen einen ganz anderen Weg als die bisher bekannten Protokolle der Transportschicht einschlägt. Hier folgt eine kurze und unvollständige Auflistung der Hauptpunkte:</p>
<ul>
<li>Implementierung im User Space</li>
<li>Multiplexing</li>
<li>Verschlüsselung</li>
<li>Reduzierte Handshake-Laufzeiten</li>
</ul>
<h3 id="standardisierung">Standardisierung</h3>
<p>Seit 2016 bemüht sich eine Working Group innerhalb der IETF (<a href="https://datatracker.ietf.org/wg/quic/about/" target="_blank">QUIC WG</a>), QUIC zu einem festen Internetstandard zu entwickeln. Von der ursprünglichen Implementierung von Google hat sich die QUIC WG etwas distanziert. Die Unterschiede werden in einem späteren Artikel näher beleuchtet.<br />
Bis heute wurden von der QUIC WG Drafts zu QUIC selbst als auch der TLS-Verschlüsselung in Verbindung mit QUIC, der Congestion Control und noch weiteren Themen veröffentlicht. Im Dezember 2018 ist geplant, die Kern-Dokumente bei der IESG zur Standardisierung einzureichen, sodass wahrscheinlich im Jahr 2019 mit einer finalen Standardisierung von QUIC gerechnet werden kann.</p>
<h3 id="ausblick-auf-artikelserie">Ausblick auf Artikelserie</h3>
<p>Im Rahmen meines Masterprojekts beschäftige ich mich stark mit QUIC. In einer Artikelserie werde ich auf die Neuheiten und Funktionen von QUIC im Detail eingehen und hoffe, den Einen oder Anderen auch für das Protokoll begeistern zu können. Folgende Themen sind für die Serie zu Beginn angedacht:</p>
<ol>
<li>Die Besonderheit der Implementierung im User Space</li>
<li>QUIC 1-RTT-Handshake: Der Verbindungsaufbau</li>
<li>QUIC 1-RTT-Handshake: Der Verbindungsabbau</li>
<li>Die Unterschiede zwischen IETF QUIC und Google QUIC</li>
</ol>
<p>Es werden noch viele weitere Artikel erscheinen. Gerne könnt ihr mir über die Kontakt-Seite noch Wünsche zukommen lassen.</p></content><author><name></name></author><summary type="html">Das Transmission Control Protocol (TCP) ist selbst nach 36 Jahren seit der Standardisierung durch die IETF noch das am weitesten verbreitete Transportprotokoll für eine zuverlässige und reihenfolgegesicherte Übertragung. Es ist beachtlich, dass solch ein altes Protokoll so lange den stetig steigenden Anforderungen an das Internet standhalten konnte. Jedoch bringt TCP Probleme und Altlasten mit sich, die einer weiteren Entwicklung des Internets im Weg steht.</summary></entry><entry><title type="html">Install OMNeT++ on arch based systems</title><link href="http://localhost:4000/install-omnet+on-arch-based-systems/" rel="alternate" type="text/html" title="Install OMNeT++ on arch based systems" /><published>2018-02-16T00:00:00+01:00</published><updated>2018-02-16T00:00:00+01:00</updated><id>http://localhost:4000/install-omnet+on-arch-based-systems</id><content type="html" xml:base="http://localhost:4000/install-omnet+on-arch-based-systems/"><p>This guide shows the installation of <strong>OMNeT++ 5.2</strong> from the source files. The process should be similar to other versions of OMNeT++. Maybe you already know about the packages of <a href="https://aur.archlinux.org/packages/?O=0&amp;K=omnet" target="_blank">OMNeT++ in the AUR</a>. At this moment (16.02.2018) these packages were either outdated or provided a in the future coming build which is still in development. If there is a stable version in the AUR it can be preferred over the manual installation. Let’s start the installation:</p>
<ul>
<li>Download and unzip the source files (<a href="https://omnetpp.org/omnetpp" target="_blank">https://omnetpp.org/omnetpp</a>) in your home directory.</li>
<li>Add the following environment variables .bashrc or whatever rc file you are using.<br />
<em>Attention</em>: Change the version to your own.</li>
</ul>
<figure class="highlight"><pre><code class="language-bash" data-lang="bash"><span class="nb">export </span><span class="nv">PATH</span><span class="o">=</span><span class="nv">$HOME</span>/omnetpp-5.2/bin:<span class="nv">$PATH</span>
<span class="nb">export </span><span class="nv">LD_LIBRARY_PATH</span><span class="o">=</span><span class="nv">$LD_LIBRARY_PATH</span>:<span class="nv">$HOME</span>/omnetpp-5.2/lib:<span class="nv">$LD_LIBRARY_PATH</span></code></pre></figure>
<ul>
<li>Make sure you have installed the following dependencies in their newest version:
<ul>
<li>base-devel, gcc, g++, bison (2.4+), flex, perl</li>
<li>Recommended packages: Tcl/Tk, LibXML2, OpenJDK, Qt, OpenSceneGraph, osgEarth, GraphViz, Doxygen, MPI, Akaroa, Pcap</li>
</ul>
</li>
</ul>
<p>If there is a problem with a recommended package you can try to set the option in your <code class="highlighter-rouge">configure.user</code> file in your OMNeT++ directory to <em>no</em> and move on.</p>
<ul>
<li>Run <code class="highlighter-rouge">./configure</code> in your omnet directory</li>
<li>Run <code class="highlighter-rouge">make -j[YOUR NUMBER CPU CORES]</code></li>
<li>After compiling you can start omnet with <em>omnetpp</em></li>
</ul></content><author><name></name></author><summary type="html">This guide shows the installation of OMNeT++ 5.2 from the source files. The process should be similar to other versions of OMNeT++. Maybe you already know about the packages of OMNeT++ in the AUR. At this moment (16.02.2018) these packages were either outdated or provided a in the future coming build which is still in development. If there is a stable version in the AUR it can be preferred over the manual installation. Let’s start the installation: Download and unzip the source files (https://omnetpp.org/omnetpp) in your home directory. Add the following environment variables .bashrc or whatever rc file you are using. Attention: Change the version to your own. export PATH=$HOME/omnetpp-5.2/bin:$PATH export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/omnetpp-5.2/lib:$LD_LIBRARY_PATH Make sure you have installed the following dependencies in their newest version: base-devel, gcc, g++, bison (2.4+), flex, perl Recommended packages: Tcl/Tk, LibXML2, OpenJDK, Qt, OpenSceneGraph, osgEarth, GraphViz, Doxygen, MPI, Akaroa, Pcap</summary></entry></feed>