<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en"><generator uri="https://jekyllrb.com/" version="3.8.5">Jekyll</generator><link href="https://tomk32.de/feed.xml" rel="self" type="application/atom+xml" /><link href="https://tomk32.de/" rel="alternate" type="text/html" hreflang="en" /><updated>2023-09-12T10:23:49+02:00</updated><id>https://tomk32.de/feed.xml</id><title type="html">Thomas R. Koll</title><subtitle>Ruby on Rails developer available for projects remotely and in Austria</subtitle><entry><title type="html">Bitbucket pipeline with an elasticsearch server</title><link href="https://tomk32.de/2023/09/12/bitbucket-pipeline-with-elasticsearch.html" rel="alternate" type="text/html" title="Bitbucket pipeline with an elasticsearch server" /><published>2023-09-12T00:00:00+02:00</published><updated>2023-09-12T00:00:00+02:00</updated><id>https://tomk32.de/2023/09/12/bitbucket-pipeline-with-elasticsearch</id><content type="html" xml:base="https://tomk32.de/2023/09/12/bitbucket-pipeline-with-elasticsearch.html">&lt;p&gt;This week I’m setting up a &lt;a href=&quot;https://bitbucket.org/product/de/features/pipelines&quot;&gt;bitbucket pipeline&lt;/a&gt; for a Ruby on Rails app that uses a few services, among them elastic search.
Now starting that service throws up an error as elasticsearch servers are social animals and really like to connect to other elasticsearch servers and you’ll see this erro in the log/tab for the elasticsearch server:&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The error doesn’t provide the answer or rather configuration you need as it is &lt;code class=&quot;highlighter-rouge&quot;&gt;discovery.type=single-node&lt;/code&gt; what you want to use. I also use that option in the &lt;code class=&quot;highlighter-rouge&quot;&gt;docker-compose.yml&lt;/code&gt; for local development on that app.&lt;/p&gt;

&lt;p&gt;Simple you think, just add this to the &lt;code class=&quot;highlighter-rouge&quot;&gt;bitbucket-pipelines.yml&lt;/code&gt;? Not quite because if you do this is the error you get from bitbucket pipelines and on top of that, bitbucket’s own validator is just fine with it. Yeah, I guess there’s two different pieces of code for the yml file…&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;There is an error in your bitbucket-pipelines.yml at [definitions &amp;gt; services &amp;gt; elasticsearch]. The variable name “discovery.type” is invalid. It should contain only alphanumeric characters and underscores and it should not begin with a number.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After quite some research a &lt;a href=&quot;https://stackoverflow.com/a/70289927/336392&quot;&gt;stackoverflow answer&lt;/a&gt; pointed me into the right direction, &lt;a href=&quot;https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#docker-configuration-methods&quot;&gt;elasticsearch has become more flexible about their configuration&lt;/a&gt;,
starting with version 7.15 (I have to run 7.17, lucky me) and you can substitute &lt;code class=&quot;highlighter-rouge&quot;&gt;discovery.type&lt;/code&gt; with &lt;code class=&quot;highlighter-rouge&quot;&gt;ES_SETTING_DISCOVERY_TYPE&lt;/code&gt; giving you the following &lt;code class=&quot;highlighter-rouge&quot;&gt;bitbucket-pipelines.yml&lt;/code&gt;:&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;definitions:
  services:
    elasticsearch:
      image: elasticsearch:7.17.6
      variables:
        ES_SETTING_DISCOVERY_TYPE: single-node
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name></name></author><category term="bitbucket" /><category term="pipeline" /><category term="elasticsearch" /><summary type="html">This week I’m setting up a bitbucket pipeline for a Ruby on Rails app that uses a few services, among them elastic search. Now starting that service throws up an error as elasticsearch servers are social animals and really like to connect to other elasticsearch servers and you’ll see this erro in the log/tab for the elasticsearch server:</summary></entry><entry><title type="html">HDD Data Rescue - Fixing a HDD with a burnt cable</title><link href="https://tomk32.de/2022/10/03/hdd-data-rescue-a-burnt-cable.html" rel="alternate" type="text/html" title="HDD Data Rescue - Fixing a HDD with a burnt cable" /><published>2022-10-03T00:00:00+02:00</published><updated>2022-10-03T00:00:00+02:00</updated><id>https://tomk32.de/2022/10/03/hdd-data-rescue-a-burnt-cable</id><content type="html" xml:base="https://tomk32.de/2022/10/03/hdd-data-rescue-a-burnt-cable.html">&lt;p&gt;Last month my girlfriend’s Seagate Barracuda 7200.12 500GB HDD went up in smoke, luckily it was just the drive’s power cable in that dusty PC, but the damage was done and I wasn’t keen on just replacing the cable. After reading a bit into the topic I figured I could do the data rescue myself as a burnt cable and PCB usually just involved replacing the PCB to regain access to all the data. So Igot a replacement disk of the same model and &lt;em&gt;same revision number of the PCB&lt;/em&gt;, this is important, removed the PCB of both discs, located the ROM chip, de-soldered it on both and put the chip from the fried PCB onto the new PCB that I installed on the old drive and it did work!&lt;/p&gt;

&lt;p&gt;The ROM had a 25FU406B 07 1PHOS written on it. Note that my PCB had another 8-legged IC on it but with a very different number on it. ROMs are easy to spot once you have a general idea about their number patterns.&lt;/p&gt;

&lt;p&gt;A SMD soldering station is highly recommended, it’s just so much easier than with a plain soldering iron.&lt;/p&gt;

&lt;p&gt;You’ll see on the photos that the ROM isn’t that perfectly on its pads, but I used a magnifying glass to visually confirm there were no shorts and it did work. Sloppy work is just alright, eh?&lt;/p&gt;

&lt;p&gt;The disk was then copied onto a fresh disk using &lt;a href=&quot;https://www.gnu.org/software/ddrescue/&quot;&gt;ddrescue&lt;/a&gt;, part of the &lt;a href=&quot;https://www.system-rescue.org/&quot;&gt;SystemRescue Linux distribution&lt;/a&gt; and almost no bad sectors were discovered.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Lastly: This whole operation was just to get the data from the HDD. The disk will not be used beyond that and be replaced with a new HDD!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Here’s a few photos with details of the damage, chips etc.&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/hdd-burnt-pcb.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/hdd-burnt-pcb.jpg&quot; alt=&quot;The smoke makes it look worse than it is, except for the plastic connector the PCB might be fine and re-usable (I will not)) &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;The smoke makes it look worse than it is, except for the plastic connector the PCB might be fine and re-usable (I will not)) &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/burnt-power-cable.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/burnt-power-cable.jpg&quot; alt=&quot;Looks like the cable powering the HDD spontaneously developed a short? &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;Looks like the cable powering the HDD spontaneously developed a short? &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/dusty-hdd.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/dusty-hdd.jpg&quot; alt=&quot;It was very dusty after all &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;It was very dusty after all &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/burnt-hdd-pcb.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/burnt-hdd-pcb.jpg&quot; alt=&quot;The burnt PCB &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;The burnt PCB &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/hdd-in-comparison.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/hdd-in-comparison.jpg&quot; alt=&quot;The HDDs in comparison, look at all that dust! &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;The HDDs in comparison, look at all that dust! &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/hdd-pcb-original-rom.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/hdd-pcb-original-rom.jpg&quot; alt=&quot;In case of this PCB the ROM was located at the corner &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;In case of this PCB the ROM was located at the corner &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/hdd-pcb-partnumbers-withs-revisions.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/hdd-pcb-partnumbers-withs-revisions.jpg&quot; alt=&quot;The revisions are etched into the PCB. Note that the numbers on the HDD sticker might be the same but the PCB revisions still be different like REV A vs REV B &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;The revisions are etched into the PCB. Note that the numbers on the HDD sticker might be the same but the PCB revisions still be different like REV A vs REV B &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/hdd-pcbs-in-comparison.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/hdd-pcbs-in-comparison.jpg&quot; alt=&quot;The meaty side of the PCBs in comparison. Different chips but all we care about is the revision &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;The meaty side of the PCBs in comparison. Different chips but all we care about is the revision &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/hdd-pcb-without-the-rom.jpg&quot;&gt;
    &amp;lt;img src=’/assets/hdd-data-rescue/thumbnails/hdd-pcb-without-the-rom.jpg’ alt=’Here’s the ROM chip de-soldered ‘ /&amp;gt;
    &lt;span class=&quot;text&quot;&gt;Here’s the ROM chip de-soldered &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/hdd-pcb-with-swapped-rom.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/hdd-pcb-with-swapped-rom.jpg&quot; alt=&quot;And the ROM soldered onto the replacement PCB. Not the most perfect job but it will do for the rescue operation &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;And the ROM soldered onto the replacement PCB. Not the most perfect job but it will do for the rescue operation &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span class=&quot;gallery image&quot;&gt;
  &lt;a href=&quot;/assets/hdd-data-rescue/ddrescue-results.jpg&quot;&gt;
    &lt;img src=&quot;/assets/hdd-data-rescue/thumbnails/ddrescue-results.jpg&quot; alt=&quot;The results of ddrescue, barely anything was lost  &quot; /&gt;
    &lt;span class=&quot;text&quot;&gt;The results of ddrescue, barely anything was lost  &lt;/span&gt;
  &lt;/a&gt;
&lt;/span&gt;&lt;/p&gt;</content><author><name></name></author><category term="data rescue" /><category term="HDD" /><summary type="html">Last month my girlfriend’s Seagate Barracuda 7200.12 500GB HDD went up in smoke, luckily it was just the drive’s power cable in that dusty PC, but the damage was done and I wasn’t keen on just replacing the cable. After reading a bit into the topic I figured I could do the data rescue myself as a burnt cable and PCB usually just involved replacing the PCB to regain access to all the data. So Igot a replacement disk of the same model and same revision number of the PCB, this is important, removed the PCB of both discs, located the ROM chip, de-soldered it on both and put the chip from the fried PCB onto the new PCB that I installed on the old drive and it did work!</summary></entry><entry><title type="html">Sign-in options - good practices</title><link href="https://tomk32.de/2022/09/13/data-migration-is-ux-hell.html" rel="alternate" type="text/html" title="Sign-in options - good practices" /><published>2022-09-13T12:01:43+02:00</published><updated>2022-09-13T12:01:43+02:00</updated><id>https://tomk32.de/2022/09/13/data-migration-is-ux-hell</id><content type="html" xml:base="https://tomk32.de/2022/09/13/data-migration-is-ux-hell.html">&lt;p&gt;A bit of a rant to be honest, but as I’m currently once again moving from one android phone to the other, there’s a few things in terms of UX that I’d like to complain about from worst to best:&lt;/p&gt;

&lt;h2 id=&quot;no-data-transfer-at-all&quot;&gt;No data transfer at all&lt;/h2&gt;

&lt;p&gt;This is pretty much the default with most apps and if you have more than one instagram account like I do, you’ll hate signing into all of those accounts. I understand this behaviour for something like
banking apps, but insta or any other non-sensitive app?&lt;/p&gt;

&lt;h2 id=&quot;copy-part-of-the-login-credentials&quot;&gt;Copy part of the login credentials&lt;/h2&gt;

&lt;p&gt;I didn’t see this with any app, but how about just storing the user name in the cloud and when opening the app on the new device as for the passwort? Certainly an interesting option for sensitive apps&lt;/p&gt;

&lt;h2 id=&quot;copy-data-via-exportimport&quot;&gt;Copy data via export/import&lt;/h2&gt;

&lt;p&gt;K9 Mail is an example for this, still a bit annoying as you have to copy the file from one phone to the other, but certainly makes having multiple mail accounts with complicated setups more easy.&lt;/p&gt;

&lt;h2 id=&quot;qr-code-to-copy-data&quot;&gt;QR code to copy data&lt;/h2&gt;

&lt;p&gt;Now this is of course only an option if you still have the old device. I’ve seen a few apps that put my credentials and data into a QR code on the old device that I had to read with the new device and
was all set up. Google Authenticator is the best example for this and it’s just brilliant. The learning app my kid uses for schools also has this feature, who would have thought?&lt;/p&gt;

&lt;h2 id=&quot;sync-the-data-via-the-cloud&quot;&gt;Sync the data via the cloud&lt;/h2&gt;

&lt;p&gt;A few non-sensitive apps had this and I’m happy to have this feature with those apps but wouldn’t want it with my banking app. BBC Sounds, Strava or any other low-key app would benefit from this sort
of UX behaviour.&lt;/p&gt;

&lt;h1 id=&quot;conclusio&quot;&gt;Conclusio&lt;/h1&gt;

&lt;p&gt;The levels of user convenience vary a lot and tend to the bad end of none at all. But as we know, implementing a simple QR code with either the necessary data or just a reference to data on a server
is very simple. I did this for Budgetfuchs a few years ago to allow users to sign-in from a mobile device more quickly and to invite others to use the app with them.&lt;/p&gt;</content><author><name></name></author><category term="UX" /><category term="mobile" /><category term="user" /><summary type="html">A bit of a rant to be honest, but as I’m currently once again moving from one android phone to the other, there’s a few things in terms of UX that I’d like to complain about from worst to best:</summary></entry><entry><title type="html">Cleaning bad laptop speakers</title><link href="https://tomk32.de/2019/05/20/cleaning-bad-laptop-speakers.html" rel="alternate" type="text/html" title="Cleaning bad laptop speakers" /><published>2019-05-20T08:01:43+02:00</published><updated>2019-05-20T08:01:43+02:00</updated><id>https://tomk32.de/2019/05/20/cleaning-bad-laptop-speakers</id><content type="html" xml:base="https://tomk32.de/2019/05/20/cleaning-bad-laptop-speakers.html">&lt;p&gt;Over the last months the speakers of my Thinkpadx X240 got worse and worse. Sure, half-broken bottom case with screws missing didn’t help but the sound was just awful when turned up to 11.&lt;/p&gt;

&lt;p&gt;So when I finally replaced that bottom case (€30 well spent) I finally had a look into the speaker issue and had the idea it might be just dirty. Luckily I tried to clean it with my somewhat magnetic
screwdriver and small bits of metal unstuck from the speaker and stuck to the screwdriver. Yay.
A few minutes the two speakers were all nice and clean again and the sound just perfect once more.&lt;/p&gt;

&lt;p&gt;Below are pictures from before and after.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://tomk32.de/assets/2019-laptop-speaker-cleanup/speaker-with-bits-of-metal.jpg&quot; alt=&quot;Before&quot; /&gt;
&lt;img src=&quot;https://tomk32.de/assets/2019-laptop-speaker-cleanup/bits-of-metal.jpg&quot; alt=&quot;Bits of meta&quot; /&gt;
&lt;img src=&quot;https://tomk32.de/assets/2019-laptop-speaker-cleanup/clean-speaker.jpg&quot; alt=&quot;After&quot; /&gt;&lt;/p&gt;</content><author><name></name></author><category term="laptop" /><category term="speakers" /><category term="sound" /><category term="fix" /><summary type="html">Over the last months the speakers of my Thinkpadx X240 got worse and worse. Sure, half-broken bottom case with screws missing didn’t help but the sound was just awful when turned up to 11.</summary></entry><entry><title type="html">Rails url helpers as liquid filters</title><link href="https://tomk32.de/2019/05/14/rails-url-helpers-as-liquid-filters.html" rel="alternate" type="text/html" title="Rails url helpers as liquid filters" /><published>2019-05-14T00:00:00+02:00</published><updated>2019-05-14T00:00:00+02:00</updated><id>https://tomk32.de/2019/05/14/rails-url-helpers-as-liquid-filters</id><content type="html" xml:base="https://tomk32.de/2019/05/14/rails-url-helpers-as-liquid-filters.html">&lt;p&gt;For a new personal project, &lt;a href=&quot;https://checklistenguru.de?utm_source=tomk32.de&amp;amp;utm_campgaign=guru&quot;&gt;Checklistenguru.de&lt;/a&gt; I wanted to use &lt;code class=&quot;highlighter-rouge&quot;&gt;liquid&lt;/code&gt; for the longish description texts that get filled with
links to other pages inside the app. Naturally the usual url helpers get used and I had to come up with a way to use them.&lt;/p&gt;

&lt;p&gt;I got the inspiration from &lt;a href=&quot;https://philippe.bourgau.net/including-railsapplicationroutesurlhelpers-fr/&quot;&gt;Philippe Bourgau&lt;/a&gt; and the following lines will allow you to use any named route &lt;strong&gt;_path&lt;/strong&gt; in a
liquid filter, e.g. &lt;code class=&quot;highlighter-rouge&quot;&gt;{{&quot;moon-trip&quot; | public_template_list_path }}&lt;/code&gt;. If you also set the &lt;code class=&quot;highlighter-rouge&quot;&gt;default_url_options&lt;/code&gt; you will be able to use the &lt;strong&gt;_url&lt;/strong&gt; helpers as well.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;c1&quot;&gt;# app/helpers/link_helper.rb&lt;/span&gt;
&lt;span class=&quot;c1&quot;&gt;# yes, not in the initializers but the helpers&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;module&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;LinkFilter&lt;/span&gt;
  &lt;span class=&quot;kp&quot;&gt;include&lt;/span&gt; &lt;span class=&quot;no&quot;&gt;Rails&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;application&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;routes&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;url_helpers&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;default_url_options&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{}&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;

&lt;span class=&quot;no&quot;&gt;Liquid&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;::&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;Template&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;register_filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;no&quot;&gt;LinkFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name></name></author><category term="rails" /><category term="liquid" /><category term="filters" /><summary type="html">For a new personal project, Checklistenguru.de I wanted to use liquid for the longish description texts that get filled with links to other pages inside the app. Naturally the usual url helpers get used and I had to come up with a way to use them.</summary></entry><entry><title type="html">Pundit with inherited resources</title><link href="https://tomk32.de/2019/04/22/pundit-with-inherited-resources.html" rel="alternate" type="text/html" title="Pundit with inherited resources" /><published>2019-04-22T00:00:00+02:00</published><updated>2019-04-22T00:00:00+02:00</updated><id>https://tomk32.de/2019/04/22/pundit-with-inherited-resources</id><content type="html" xml:base="https://tomk32.de/2019/04/22/pundit-with-inherited-resources.html">&lt;p&gt;Call be old-fashioned and out-dated, but I’m still a huge fan of &lt;a href=&quot;https://github.com/activeadmin/inherited_resources/&quot;&gt;&lt;code class=&quot;highlighter-rouge&quot;&gt;inherited_resources&lt;/code&gt;&lt;/a&gt; and
of ourse I’m using it in my latest project which will be about checklists.&lt;/p&gt;

&lt;p&gt;I also added &lt;code class=&quot;highlighter-rouge&quot;&gt;pundit&lt;/code&gt; and &lt;code class=&quot;highlighter-rouge&quot;&gt;pundit_extra&lt;/code&gt; to the project and when using the latter you’ll run into some
conflict with &lt;code class=&quot;highlighter-rouge&quot;&gt;inherited_resources&lt;/code&gt; method &lt;code class=&quot;highlighter-rouge&quot;&gt;resource&lt;/code&gt;. The &lt;code class=&quot;highlighter-rouge&quot;&gt;load_resource&lt;/code&gt; from &lt;code class=&quot;highlighter-rouge&quot;&gt;pundit_extra&lt;/code&gt;
ultimately uses &lt;code class=&quot;highlighter-rouge&quot;&gt;instance_variable_get &quot;@#{resource_name}&quot;&lt;/code&gt; to get the resource and so I replace the method with my own.&lt;/p&gt;

&lt;div class=&quot;language-ruby highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;  &lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;resource_instance&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;params&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;ss&quot;&gt;:id&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;resource&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;else&lt;/span&gt;
      &lt;span class=&quot;n&quot;&gt;build_resource&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
  &lt;span class=&quot;k&quot;&gt;end&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name></name></author><category term="inherited_resources" /><category term="pundit" /><summary type="html">Call be old-fashioned and out-dated, but I’m still a huge fan of inherited_resources and of ourse I’m using it in my latest project which will be about checklists.</summary></entry><entry><title type="html">ej2 DataManager with Rails</title><link href="https://tomk32.de/2019/03/16/ej2-datamanager-with-rails.html" rel="alternate" type="text/html" title="ej2 DataManager with Rails" /><published>2019-03-16T19:01:59+01:00</published><updated>2019-03-16T19:01:59+01:00</updated><id>https://tomk32.de/2019/03/16/ej2-datamanager-with-rails</id><content type="html" xml:base="https://tomk32.de/2019/03/16/ej2-datamanager-with-rails.html">&lt;p&gt;Recently I used &lt;a href=&quot;https://ej2.syncfusion.com/documentation/calendar/getting-started/&quot;&gt;syncfusion’s ej2 calendar&lt;/a&gt; in a small Rails project and
ran into a few problems because Rails is tough on security.&lt;/p&gt;

&lt;p&gt;The &lt;code class=&quot;highlighter-rouge&quot;&gt;UrlAdaptor&lt;/code&gt; that comes with &lt;code class=&quot;highlighter-rouge&quot;&gt;ej2-data&lt;/code&gt; needs to send our beloved &lt;code class=&quot;highlighter-rouge&quot;&gt;csrf-token&lt;/code&gt; with all &lt;code class=&quot;highlighter-rouge&quot;&gt;POST&lt;/code&gt; requests and this is the way I implemented it:&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;UrlAdaptorWithCredentials&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;extends&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;UrlAdaptor&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
      &lt;span class=&quot;nx&quot;&gt;beforeSend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataManager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;XMLHttpRequest&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;withCredentials&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;;&lt;/span&gt;
        &lt;span class=&quot;kd&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;token&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;nb&quot;&gt;document&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;querySelector&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'meta[name=&quot;csrf-token&quot;]'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;content&lt;/span&gt;
        &lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;setRequestHeader&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'X-CSRF-Token'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;token&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
        &lt;span class=&quot;k&quot;&gt;super&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;beforeSend&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nx&quot;&gt;args&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;xhr&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
      &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;nx&quot;&gt;data&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;DataManager&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;({&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;url&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;       &lt;span class=&quot;s1&quot;&gt;'/calendar'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;crossDomain&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kc&quot;&gt;true&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
      &lt;span class=&quot;na&quot;&gt;adaptor&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nx&quot;&gt;UrlAdaptorWithCredentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Lastly a general advice on &lt;code class=&quot;highlighter-rouge&quot;&gt;fetch&lt;/code&gt;: With rails you’ll need to send the cookie for &lt;code class=&quot;highlighter-rouge&quot;&gt;GET&lt;/code&gt; requests and you can do this by adding &lt;code class=&quot;highlighter-rouge&quot;&gt;{credentials: &quot;include&quot;}&lt;/code&gt; in the options.&lt;/p&gt;

&lt;div class=&quot;language-javascript highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;    &lt;span class=&quot;nx&quot;&gt;fetch&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s1&quot;&gt;'/calendar'&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;credentials&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;include&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;</content><author><name></name></author><category term="rails" /><category term="xhr" /><category term="ej2" /><summary type="html">Recently I used syncfusion’s ej2 calendar in a small Rails project and ran into a few problems because Rails is tough on security.</summary></entry><entry><title type="html">Rails credentials gone bad</title><link href="https://tomk32.de/2019/03/05/rails-credentials-gone-bad-md.html" rel="alternate" type="text/html" title="Rails credentials gone bad" /><published>2019-03-05T00:00:00+01:00</published><updated>2019-03-05T00:00:00+01:00</updated><id>https://tomk32.de/2019/03/05/rails-credentials-gone-bad-md</id><content type="html" xml:base="https://tomk32.de/2019/03/05/rails-credentials-gone-bad-md.html">&lt;p&gt;It’d be boring if you didn’t start you day with a nice error message,
no matter what I tried, even editing the credentials gave an error.
Here’s the one I got today, and some quick look into &lt;code class=&quot;highlighter-rouge&quot;&gt;ActiveSupport::MessageEncryptor&lt;/code&gt;
showed me that something was wrong with the credentials.&lt;/p&gt;

&lt;div class=&quot;highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;rescue in _decrypt': ActiveSupport::MessageEncryptor::InvalidMessage
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;The credentials.yml.enc had been modified in the repo just slightly
during a merge conflict and though they were now the same again, it didn’t play along.
Maybe a newline or something?&lt;/p&gt;

&lt;p&gt;Anyways, I went straight for a solution by resetting the repo to before the change to
the &lt;code class=&quot;highlighter-rouge&quot;&gt;credentials.yml.enc&lt;/code&gt; file, run &lt;code class=&quot;highlighter-rouge&quot;&gt;rails credentials:edit&lt;/code&gt;
to copy its contents into a temporary file, back to the terminal, reset to &lt;code class=&quot;highlighter-rouge&quot;&gt;HEAD&lt;/code&gt;
run &lt;code class=&quot;highlighter-rouge&quot;&gt;rails credentials:edit&lt;/code&gt; again and paste in the contents from the temporary file.&lt;/p&gt;

&lt;p&gt;Easy, right?&lt;/p&gt;</content><author><name></name></author><category term="rails" /><category term="bug" /><category term="credentials" /><summary type="html">It’d be boring if you didn’t start you day with a nice error message, no matter what I tried, even editing the credentials gave an error. Here’s the one I got today, and some quick look into ActiveSupport::MessageEncryptor showed me that something was wrong with the credentials.</summary></entry><entry><title type="html">What to do when your Linux upgrade goes wrong</title><link href="https://tomk32.de/2019/01/23/what-to-do-when-your-linux-upgrade-goes-wrong.html" rel="alternate" type="text/html" title="What to do when your Linux upgrade goes wrong" /><published>2019-01-23T00:00:00+01:00</published><updated>2019-01-23T00:00:00+01:00</updated><id>https://tomk32.de/2019/01/23/what-to-do-when-your-linux-upgrade-goes-wrong</id><content type="html" xml:base="https://tomk32.de/2019/01/23/what-to-do-when-your-linux-upgrade-goes-wrong.html">&lt;p&gt;Strange how rarely I write about Linux, the OS that I’m using since 1998 (with some gap filled with OSX).
I love it to bits because it’s is super reliable both on the desktop and server. I even have one machine with
SteamOS installed. But of course there are exceptions like 20 years ago
when I was using Debian testing and libpam had a bad update. Took me a week to get back into my system.
The olden days without backup-systems…&lt;/p&gt;

&lt;p&gt;This week’s outtake was much shorter and completely my fault, but my backup-strategy was a second PC. Not the perfect
solution if the situations change and I have no access to another machine or the internet.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First of all, what did I do wrong?&lt;/strong&gt; Well, I downgraded readline, don’t ask, I just had to. Bash didn’t like that and insisted on readline 8.
A fact I realized only after booting the system when I came home from work.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;So, what took you so long?&lt;/strong&gt; Well, not being able to get into my system to reinstall the newer readline version that
was still in pacman’s cache. My disks aren’t ecrypted (files are, there’s even a mountable encrypted disk image) so
recovery was easy enough.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What will I change in the near future?&lt;/strong&gt; First off all, a newer, bigger disk is on my shopping-list. I’l configure it to feature
an additional, minimalistic boot drive that I can use to access my other partitions when needed.
Another fallback will be changing the external hard-drives that I have around the house, I’ll add boot drives to those as well.
You might wonder why that, but the reason is quite simple: I don’t want to rely on an USB stick for a boot drive because I probably
will overwrite it after a while.&lt;/p&gt;</content><author><name></name></author><category term="linux" /><category term="backup" /><summary type="html">Strange how rarely I write about Linux, the OS that I’m using since 1998 (with some gap filled with OSX). I love it to bits because it’s is super reliable both on the desktop and server. I even have one machine with SteamOS installed. But of course there are exceptions like 20 years ago when I was using Debian testing and libpam had a bad update. Took me a week to get back into my system. The olden days without backup-systems…</summary></entry><entry><title type="html">Stuck shutter problem: Olympus PEN E-PL5</title><link href="https://tomk32.de/2019/01/05/olympus-pen-e-pl5-stuck-shutter-problem.html" rel="alternate" type="text/html" title="Stuck shutter problem: Olympus PEN E-PL5" /><published>2019-01-05T00:00:00+01:00</published><updated>2019-01-05T00:00:00+01:00</updated><id>https://tomk32.de/2019/01/05/olympus-pen-e-pl5-stuck-shutter-problem</id><content type="html" xml:base="https://tomk32.de/2019/01/05/olympus-pen-e-pl5-stuck-shutter-problem.html">&lt;p&gt;There’s an anoying mechanical problem with a few cameras like my Olympus PEN E-PL5 which results in a shutter stuck when trying to take a photo. Someone even made a
&lt;a href=&quot;https://www.youtube.com/watch?v=UP0Imk14yQw&quot;&gt;video&lt;/a&gt;, and &lt;a href=&quot;https://www.flickr.com/groups/2139817@N23/discuss/72157646093507478/&quot;&gt;others&lt;/a&gt; report the same issue too.
The camera’s film function works as expected.&lt;/p&gt;

&lt;p&gt;The camera has to shutter curtains according to &lt;a href=&quot;https://www.mikrocontroller.net/topic/443826#5292973&quot;&gt;this comment on mikrocontroller.net&lt;/a&gt; and while the first one works without a hitch,
the other one is the one prune to get stuck.&lt;/p&gt;

&lt;h2 id=&quot;my-solution&quot;&gt;My solution&lt;/h2&gt;

&lt;p&gt;So, once you are sure the problem description fits and you can safely assume it’s a mechanical problem, then I have a solution for you.
It requires applying some force. You get yourself a decent sized book and place it on the table, the book is what you’ll slam the camera onto.&lt;/p&gt;

&lt;p&gt;Best to do this without a lense installed.&lt;/p&gt;

&lt;p&gt;First start the camera, set a long exposure time, click the button and then slam the camera on the book.
You might have to repeat this a few times or slam it on a different side.&lt;/p&gt;

&lt;p&gt;I had the issue twice and that’s how I solved it both times.&lt;/p&gt;

&lt;p&gt;If it worked for you, please do send me a mail and let me know.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Update 2019-03-26:&lt;/em&gt; It happened again, but a 5s exposure and and whack on the knee loosened the shutter.&lt;/p&gt;</content><author><name></name></author><category term="brute force" /><category term="mechanical problem" /><category term="camera" /><summary type="html">There’s an anoying mechanical problem with a few cameras like my Olympus PEN E-PL5 which results in a shutter stuck when trying to take a photo. Someone even made a video, and others report the same issue too. The camera’s film function works as expected.</summary></entry></feed>