Morphex's blogologue (Life, technology, music, politics, business, mental health and more)

This is the blog of Morten W. Petersen, aka. morphex in various places. I blog about my life, and what I find interesting and/or important. This is a personal blog without any editor or a lot of oversight so treat it as such. :)

My email is

An OGG/Vorbis player, implemented in Javascript.

My Kiva bragging page
My shared (open source) code on GitHub

Morphex's Blogodex


Zope hosting by Nidelven IT

Morten Petersen on Linkedin

Morten Petersen on Facebook

Morten Petersen on SoundCloud

Morten Petersen on MixCloud

Blogologue on Twitter

Older entries

Atom - Subscribe - Categories

Facebook icon Share on Facebook Google+ icon Share on Google+ Twitter icon Share on Twitter LinkedIn icon Share on LinkedIn

Graceful degredation of redirect using meta http-equiv and Javascript in XHTML, for caching

So, I saw that SSL was becoming more or less mandatory these days, so I got SSL setup for the domain

However, since I also wanted to keep serving the site over HTTP as well as HTTPS (for graceful degradation and a fallback), and I have a cache sitting between the SSL-server and the weblog system, which pretty much caches everything, all the time, for a long time, I had to do a bit of extra work.

The cache in this setup isn't able to tell the difference between requests coming via HTTP or HTTPS, so an extra '&protocol=http[s]' is added at the end of URLs.

So with this code

  <meta http-equiv="refresh" id="meta_refresh" content="1;" />
  <script type="text/javascript">
    refresh = document.getElementById('meta_refresh');

it is possible to have the page redirect with the protocol key without Javascript, while this piece of Javascript

    <script type="text/javascript">
    // <![CDATA[
    function myOnLoad() {
      if (window.parent.document.location.toString().indexOf('') != 0) {
        if (window.parent.document.location.toString().indexOf('https:') != 0) {
      if (window.parent.document.location.toString().indexOf('') != 0) {
        if (window.parent.document.location.toString().indexOf('http:') != 0) {
    document.getElementById('iFrameLoadTest').myOnLoad = myOnLoad;
    // ]]>

does redirect to setup frames *and* add the protocol key. I setup this site so that it would be possible to access the site without a browser that supports [i]frames, and I guess it is reasonable to expect that a browser that doesn't support Javascript, also doesn't support frames.

Although for example the NoScript extension for Firefox does enable blocking Javascript per-site etc. for security.

So the cache is able to cache http and https pages differently, which again is tidy and neat, as URLs generated on the blog are often absolute starting with http: or https: - and not relative, for example /morphex.

If you're wondering how the meta tag is generated, that's by a script on the server side, which decides to redirect with an &protocol= suffix on URLs, based on an environment variable HTTP_X_FORWARDED_PROTO, which the cache sitting in the middle, is unable to take into account.

It did add "Vary: HTTP_X_FORWARDED_PROTO" to the pages generated in the weblog, but that did not affect the cache.

Now, I was wondering how long a timeout the http-equiv refresh should have, and found 0 was too short, and 2 was too long. If the timeout is 0, it is reasonable to expect that the browser will execute the refresh immediately. It is also reasonable to expect that within 1 second, the following <script> tag is read and executed, and when that Javascript is run, it deletes the meta tag, and from what I can tell, deleting the meta tag, also stops any actions contained within that tag.

You might think that adding <meta> tag within a <noscript> tag in the header would be much easier, and it would be, however, that is not valid XHTML according to the W3C validator, so this "hack" is what will work and be accepted as valid XHTML.

[Permalink] [By morphex] [Web (Atom feed)] [23 Jun 15:18 Europe/Oslo]

I will be attending the Norwegian constitution day 17. Mai (17 of May), but not celebrating it

So, tomorrow is Norway's constitution day, celebrating the signing of the Norwegian constitution in 1814.

I will be attending some social events tomorrow, to enjoy some company and different good food. But I won't be celebrating or congratulating others on the occasion, because of my experiences in the Norwegian society.

I have two kids, 6 and 8 years old, and I haven't met them in person since the start of November 2017, and it is now the middle of May, 2018.

I broke up with the kids mom in 2013, and since then I haven't seen the kids much. Even though I've been to every meeting, every planned time with the kids etc. since then.

I was thinking of taking a picture of the children marching tomorrow celebrating the day, but after some thought I created this collage of the Trondheim hospital St. Olav and the Norwegian flag (taken from so I have the "day off" tomorrow, and also don't take a picture of different people who haven't asked to be associated with this blog post.

Picture of St. Olav with Norwegian flag superimposed

So yeah, I found taking a picture of the hospital fitting for different reasons, one of them being that I broke up with the kids mom while I was diagnosed with one or two serious psychiatric disorders, and today about 10% of my net income goes to paying off previous court costs and current lawyer costs, to get to see the kids.

To be correct, I have to say that the kids mom has offered a deal for me seeing the kids now, but I have negative trust towards the kids mom after what has happened earlier, so I think her presence during my meetings with the kids would be negative in more than one way. And as they say, "fool me once - shame on you, fool me twice - shame on me". I have suggested meeting in public spaces in Mo i Rana, but that was not acceptable for the kids mom.

So it looks like it will be another round in court, so that I can get supervision from the state when seeing my kids, which will limit the amount of time I get with the kids, but since the kids mom refuses to let me be alone with the kids, and I don't trust the kids mom, it's the best solution I see.

The kids mom has also earlier said that the situation was stressful with me and me seeing the kids, so when she doesn't have to do anything beyond dropping off the kids and picking them up, that should be a practical solution for her as well.

But yeah, the picture above. I moved recently. and the hospital is now within walking distance. I have given the healthcare system in Norway quite a bit of criticism, but when I see little of my kids for years and years, and 10% of my income goes to legal costs, and this situation started when I had serious psychiatric diagnoses, was taking a significant amount of mind-altering medicine and was going to therapy and was talking about serious problems with the kids mom, they are getting what they deserve.

[Permalink] [By morphex] [Politics (and judicial matters) (Atom feed)] [16 May 12:38 Europe/Oslo]

Experiencing the surrealism of the Norwegian "wellfare" system

So, last month I was in a meeting with NAV, the wellfare office, employment office, pension office etc. in Norway, aptly named NAV (wheel hub in English).

They want to get me into a work preparation program, or as I suspect, a suitability for work program, while I am more on the exercise a lot and do different interesting computer things, that I'm motivated for doing and that will help me get a job later.

Since last summer, I've exercised a lot, and I can feel a positive development and see a positive development on my body since then. I've also dabbled in different computer things, for example the Java Twitter export tool that I blogged about on my blog, and the source code is available on Twitter.

I've worked hard most of my life, and I have to say I'm disappointed in seeing how the Norwegian system works. After I got psychotic at the end of 2009, I drained the company (my own company) for money, when I probably should have been 100% on sick leave and gotten money from the state.

So today, although I feel motivated to work in my company and could probably work 8-16 hours a week, I am unable to, because I've earlier exhausted the funds in the company, Nidelven IT.

In addition to this, the work-sickleave-unemployment route I've taken, or have been guided through by NAV and the healthcare system, gives me very little money, now that I'm on "work assessment allowance", and I'm also paying around 10000 a year in interest on the court costs that the kids mom accrued, after she over a long period did a lot of things and practically provoked a round in court.

Now it looks like I'll have to take another round in court, and with the payments on the new court case and the previous one, I'm paying around 10% of my net income in these court costs, and I have low income.

This comes in addition to the over 30.000 kroner I've had in expenses seeing the kids, after I rejected the kids mom in the summer 2013, which the kids mom refuses to share according to the law defined norm, as she claims we had an agreement on travel costs, but not on how often I should see the kids, or rather how often the kids should get to see me.

So yeah, NAV want to put me through the stress of a work assessment program, when I have a positive development with things I've chosen to do myself, that do help my health and my work prospects.

A while ago, a dentist documented and treated me for an infection in the gums, something that is probably because of the medication I've been taking, and this is something that NAV has paid for, the dental treatment. And the Norwegian patient injury reparation organization has said that it remains to see if it is a permanent problem.

It still remains to be seen if this treatment will be necessary in the future though, or if I have a permanent problem.

But, here is the conundrum. I've been advised that the medication I've taken, Seroquel, can lead to diabetes and heart problems in the long term. So, if NAV pressures me into this work assessment program, and I later get diabetes, who is responsible, and what do I get for it?

If I've been advised that I can get a condition from a medication, I can't sue to get reparations. I can take diabetes pills, but still the diabetes would affect my life quality and life expectancy.

I guess any wise person would say that there is nothing more important than having good health, and that no amount of money can replace good health.

So I guess it might be that I, and many others, are destined to be medical trial subjects, in a semi-nazi government system, that sells a lot of present for an unknown future.

[Permalink] [By morphex] [Health (Atom feed)] [29 Apr 19:47 Europe/Oslo]

Now making (an almost) complete Twitter archive using Java, validating as UTF-16LE XHTML


I was figuring out the latest bits to my Twitter archival tool today, and once I made a complete dump of all Tweets, I saw that I had forgotten to HTML-encode URLs, so & was breaking the validation.

Boy, was my face red for a split second. Anyway, the nice org.apache.commons folks have created a tool to encode URLs for HTML, so that was an easy fix.

However, the W3C validator

Was still giving weird errors, and after some fiddling around and googling, I found the W3C I18N checker, which explained that XHTML couldn't be prefixed with an <?xml declaration. It's been a while since I worked properly with web documents I guess, so I'd forgotten about that.

So OK, I removed the declaration, and thought I'd add a meta http-equiv or charset tag to the document, to be declarative about the content of the document.

However, the I18n validator first complained about that, saying I couldn't use UTF-16LE as an encoding, and that I had to say UTF-16, but when that was fixed, the validator complained and said that I shouldn't specify the encoding in the document.

And that makes sense, because the document starts with a BOM, which indicates the charset and the endianness of the charset.

Anyway, I get a whiff of cultural imperialism when I see that W3C says UTF-8 is the recommended encoding, and the main validator is so unhelpful when giving feedback on what is wrong with the document. :\

So, here's the commit of today's work:

A productive day, and

Shows an almost complete archive of my Tweets. A grep shows that my archive is 3128 tweets:

iconv test3.html -f utf-16|grep "class='tweet"|wc -l
iconv: incomplete character or shift sequence at end of buffer

while Twitter says I have well over 4000 tweets:

    Tweets 4,943
    Following 98
    Followers 189

So I guess Twitter has some segmentation of its archive, for unknown reasons.

I did get some feedback on my blogging about Java and type-casting, and using Java generics it is possible to avoid this tedious type-casting I was talking about earlier. I had seen the syntax for Java generics before and found it to a bit of an eyesore, but seeing how it saves quite a bit of tedious typing and that the syntax is straightforward, I guess I can't complain.

It's not Perl after all..

[Permalink] [By morphex] [A Java-based tool to export tweets from Twitter for safe keeping (Atom feed)] [23 Apr 16:52 Europe/Oslo]

A light chickpea snack / meal (cheap and nutritious)

So, these last couple of years I've started making meals from scratch, to improve the health, but also to save significant amounts of money.

I'm now on a flexitarian diet, and I don't eat much red meat anymore, and rarely white meat such as chicken. I eat quite a bit of fish, tuna and salmon. I also consume eggs and dairy products.

I go to the local immigrant stores and buy packs of veggie products, such as chickpeas. 1 KG costs 35 kroner, 4.5 dollars, 3.75 euros, and divided up, gives significant protein to 10-15 veggie meals.

Today I took one of those chickpea packs (ca 200 grams), and fried it in a pan, alongside some chopped garlic (6 gloves) and a handful of olives:

Picture of chickpeas, olives and chopped garlic fried in a pan, with a spoon

I used Canola oil to fry it in, and added some salt and black peppers to spice things up.

I've been very restrictive on the spices in my food, but this week I shelled out some cash on a 20-gram pack of black pepper, and will start to use pepper a bit more in the cooking. Spices add flavour, but also mask other flavours, so I guess experimenting with different ingredients is easier with less flavour complexity.

Anyway, I'm not sure whether to call this a snack or a meal, but a light meal should be a fitting categorization. And very nutritious and healthy.

[Permalink] [By morphex] [Food (Atom feed)] [22 Apr 15:05 Europe/Oslo]

Can I Java cup of coffee? Isn't that valid?

Yesterday I made some progress on the twitter-exporter tool, working and thinking quite a bit in one day.

I'm surprised I am as productive as I am in Java, since I haven't used it in work-related projects. Yesterday it felt like I had a couple of cups of coffee too many, maybe it's the spring, but I was cranking out code and dealing with Exceptions like I'd been eating a lot of cake and drinking a lot of coffee.

I'm particularly pleased with this piece of code:

class TwitterStatusFetcher {
        Twitter twitter;
        ArrayList statuses = new ArrayList();
        Integer page = 1;
        Integer count = 20;

        TwitterStatusFetcher(Twitter twitter_) {
                twitter = twitter_;

        Status getNextStatus() throws TwitterException {
                if (statuses.isEmpty()) {
                        // See if more tweets can be found
                        ResponseList results = twitter.getUserTimeline(
                                new Paging(page, count));
                if (statuses.isEmpty()) {
                        return null;
                Status status = (Status) statuses.get(0);
                return status;

Which works with the twitter4j code and Twitter API to deliver one status at a time to the rest of my app code. Maybe it's not that big of a deal, but I found it elegant, and it does use the object-oriented paradigm that Java is big on.

It seems the most frequent mistake I make coming from Python, is forgetting the semicolon; I like to indent code regardless of language, so it's the semicolon that I forget.

I guess one thing I've found annoying about Java so far, is the type casting that is necessary at different places. I was working on some code which I guess was eventually removed, where I knew the method to call, but because of some abstraction in a method call, the returned objects were java.lang.Object, and calling a method, a String method I think, on that object failed in compilation.

I was also almost smacking my head yesterday, when I discovered that twitter4j returns shortened (and expanded) URLs in their Tweets as well, and thought I'd developed quite a bit of code for no good reason.

However, as it turns out, some tweets do contain shortened URLs that aren't mentioned in the Tweet metadata, so the class I wrote to resolve URLs still has some use. Phew.

Finally, I found Firefox now displayed the test.html output page as XML, instead of XHTML. So I made the code output a Unicode BOM, and Firefox says it is in standards compliance mode, and Chrome does not complain. However, the validator on, - still does not validate the page when it has a UTF-16LE BOM.

I'm not sure what's going on there, but to me it looks like the w3c validator isn't working.

A test.html page I just created is available at - just rename it to test2.html after download and open it in Firefox to see the rendered archive of my tweets.

[Permalink] [By morphex] [A Java-based tool to export tweets from Twitter for safe keeping (Atom feed)] [14 Apr 10:35 Europe/Oslo]

Doodeling along with Java development, "unit development" and more

Yeah, I've been developing a Java app to export all my tweets for safe-keeping.

I'm new to Java, so I asked a bit about limiting the amount of pieces of development software, so it was less complicated to see what the problem was when the code failed.

I asked on, with the message ID <>. I did get some useful feedback, but I guess my idea of a simple bootstrapping development environment has something to it. Why not make something less complex if you can?

I worked on the code for resolving Twitter URLs today, and this is the file as of now:

I have to say, that coming from the Python world, a lot is the same, although I have to say Python is less bureaucratic and easier on the eyes. Maybe in Java's advantage, things are well packaged and one is pretty much forced to think in an object-oriented way.

I can't say that developing in Java is worse than Python, I think they are even in many ways.

The code I've been develolping is fairly simple, the data it works on is also uncomplicated, with standard encodings, data formats and protocols.. so I'm not learning anything new there, and keeping things very simple on whatever I need to store as well, plain-text file format. If I was learning some new protocols and software libraries it could be a bit more difficult.

It's nice though, to see that I'm able to be very productive in a language I haven't used in a work-related context, feels like I'm firing on all cylinders again.

[Permalink] [By morphex] [A Java-based tool to export tweets from Twitter for safe keeping (Atom feed)] [09 Apr 13:33 Europe/Oslo]

Automating builds using Maven, writing XHTML & refactoring in Java

In my efforts to write a tool for exporting Tweets from Twitter for safe-keeping in Java, I came a bit closer to the goal to create such an archive today, when I managed to automate the build of the app a bit, and make the app create something that resembles the desired end-result.

Earlier I had to download jar files from projects that my project depended on, but with the following commit:

One jar is built, and it is run using the command

java -cp ./twitter-exporter-1.0-SNAPSHOT-jar-with-dependencies.jar

I would like run the app in an even simpler way, but it is a big improvement from downloading jar files manually and including them on the "java -cp" command.

I was initially thinking I'd keep things as simple as possible and avoid unnecessary dependencies and systems, but seeing that there are collections of Java classes with useful features, features you'd expect to be in the Java core, it is great to be able to include these using some lines in the pom.xml Maven file.

Secondly I refactored the code a bit, so that the main App class was able to write an XHTML file containing a number of tweets:

You can download the generated output here:

I had to call the file test.html.bin to fool the application server into treating it as a binary file, as UTF16-LE is the encoding of the file and I guess the application server uses UTF-8. Renaming it to test.html and opening it in Firefox should work.

StringEscapeUtils.escapeXml10 is a nice tool, and something you'd assume would be so necessary and standard that it would be included with Java by default. Seeing this is the way it is, I guess there is really no way around using a tool like Maven to build projects.

[Permalink] [By morphex] [A Java-based tool to export tweets from Twitter for safe keeping (Atom feed)] [05 Apr 19:36 Europe/Oslo]

Sex in the 21st century, follow-up

So, I emailed my lawyer a while ago, asking about fatherhood, rights and obligations. Here:

He did not reply to that message, but I asked someone else who has some legal expertise, and I understood the message as, if you make someone pregnant, you cannot legally deny fatherhood or child support.

So, basically, if you're at a party, have a good time, and end up with someone, and have sex that one time, you can end up paying child support for 18+ years.

If in addition to this, the woman is difficult, you not only have to pay a substantial amount of money, but you also have a difficult person to deal with.

Now, it is the case that women do rape; so worst case is that a woman rapes you, makes your life a living hell, and you have to pay a lot of money for kids you don't get to see (often).

I can understand that the state wants its inhabitants, and having kids is an important part of life.. but it seems to me that men are shafted in many different ways when it comes to family life.

94.5% of the inmates in Norwegian prisons in 2015 were male.

[Permalink] [By morphex] [Health (Atom feed)] [04 Apr 16:41 Europe/Oslo]

Testing out Java's Unicode support, UTF-16LE the choice for now

So, in my efforts to create a tool to export my Tweets from Twitter for safe-keeping, and learning a bit of Java in the process, I today created a Java snippet of code to write an XHTML file, to get acquainted with Java and its Unicode support.

I've worked with Unicode in Python and in C, and a while ago I started some discussions on comp.lang.c, as I was testing out C to write an XML parser. That project ran out of steam, but I still think today that UTF-32 is the least discriminatory (and uncomplicated) approach to sharing information like web pages.

Anyway, here's the Java code for writing a test XHTML page, fully validating on the W3C validator:

Well, it was validating on the W3C validator, but once I added code to write a BOM, it no longer validated. 🤔 But shows up fine in Firefox, and "file test.html" says:

test.html: XHTML document text (version 1.0), Little-endian UTF-16 Unicode text, with no line terminators

So I'm not sure what's going on there.

As I was testing out Java, I was hoping and optimistic for having a Unicode solution that just worked, and even more so when OutputStreamWriter accepted an encoding argument.

But as you can see on the history of, I had to revert to using just FileOutputStream, and encoding strings and writing them as bytes to the test.html file.

So much for that dream. Well, this is all alright, I find Java a bit verbose, but it also reminds me a bit about C and that's nice.

A thing that surprised me though, was that Firefox did not support UTF-32LE encoded XHTML. Why not?

[Permalink] [By morphex] [A Java-based tool to export tweets from Twitter for safe keeping (Atom feed)] [04 Apr 00:06 Europe/Oslo]

Resolving URLs from a URL shortening service in Java

So, in my efforts to create a tool to keep a (complete) archive of my Twitter activity, I today wrote a tool to help replace URLs in my tweets, with the actual URL, here:

Now I come from the Python world, and lately I've been looking at Java to learn it properly. To improve my chances of having gigs that are interesting, regardless of programming language.

I started looking at URL objects and generating a connection from that, but since I'm going to resolve a lot of addresses, found that it would be better if I kept an HTTPS connection open to the server, and then pass the final part of the URL over to Another issue here is maybe a "resting period" between each resolved URL, so as to not appear "spammy" or "resource hogging" on the server.

Anyway, luckily I found an example online that I could adapt for my purposes, and I'd have to say, compared to Python, Java is a bit bureacratic with its classes and types, but other than that, Java is just fine.

[Permalink] [By morphex] [A Java-based tool to export tweets from Twitter for safe keeping (Atom feed)] [01 Apr 12:05 Europe/Oslo]

A Java-based tool to export tweets from Twitter for safe keeping

So, I was looking into exporting all my tweets the other day, to keep a copy just in case something happened to my Twitter account.

I tried exporting from Twitter (using a desktop browser as they asked on the export page), but I have so far not seen a dump of all my tweets.

I see there are other tools available for exporting Tweets, websites, but I thought to myself, why not create a simple, safe tool for exporting and safe-keeping Tweets.

So, after a bit of rummaging I found twitter4j, and started to build a Twitter export client using a text editor, a Makefile and javac/java.

However, I quickly ran into a NoClassDefFoundError, and after googling a bit, I felt an obscure-configuration-detail-headache coming on, and decided I could try to use Maven, which is mentioned on the Twitter4j website for the build process.

The Maven quickstart guide instructed me to use this command to generate a Maven project:

mvn archetype:generate -DartifactId=twitter-exporter -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false

And after downloading some components etc. - Maven had a file hierarchy for me.

I then added the following section to pom.xml


To include the twitter4j components in the Maven project. I then preceeded to run "mvn package" and then entered the target directory, and with the command

java -cp ./twitter-exporter-1.0-SNAPSHOT.jar

I got the result

Hello World!

Which is what one can expect, as the project was just generated. Afterwards I created a new repository on GitHub, and uploaded the project (output of "history|grep git" in bash):

 2172  git init
 2173  git add pom.xml src
 2175  git config --global ""
 2176  git config --global "Morten W. Petersen"
 2177  git commit
 2182  git remote add origin
 2183  git push -u origin master
 2184  history|grep git

I started with this before I decided to blog about it, so I guess to setup the enviroment you have to run "sudo apt install maven openjdk-8-jdk openjdk-8-jre git" on Ubuntu/Debian.

The source code website for the project is here:

[Update same day: I had to download the twitter4j jar and add it to the java command above: "java -cp ./twitter-exporter-1.0-SNAPSHOT.jar:./twitter4j-core-4.0.4.jar"]

[Update later same day: twitter4j-core-4.0.4.jar can be downloaded from]

[And update even later same day: twitter4j-core-4.0.6.jar can be downloaded from - it's necessary for the latest code to run]

[Permalink] [By morphex] [Java (Atom feed)] [30 Mar 15:19 Europe/Oslo]

I'm not an actor, I'm not a star..

Picture of bike, with text I'm not an actor, I'm not a star, but I've got this bike and it gets me around like a motherfucker

[Permalink] [By morphex] [Health (Atom feed)] [28 Mar 12:06 Europe/Oslo]

Charges pressed against NAV and NAVI

So, I've had issues over time with NAV and NAVI, NAV being the Norwegian employment and wellfare office, NAVI being the child support collectors (some branch related to NAV I guess).

Over time there has been some critique and questions, and things turned a bit weird not so long ago, when my primary care physician basically said he wanted me to find another primary care physician.

So I filed a report against NAV and NAVI today, here's the original, and here's the translation:

To: Police Trøndelag (county police) <>
Cc: Police internal affairs <>, Sveinung Hestad Strand <>, Elisabeth Nossum <>, Per Olav Gundersen <>, NAVI <>
Bcc: Dad <>


In 2009 I became acutely [mentally] ill, psychotic, and was until then on an up-and-coming arch salary-wise, in my own company.

Today I have a low income, and I am in many ways financially painted into a corner, and also have problems with my kids mom, and have met the kids 2-3 hours a month on average since 2013.

I have asked questions to NAV about their methods, and a short while ago I asked to have all papers to my case printed out. I moved apartments in that period, and got a message to get the papers on NAV Lerkendal. When I got there, I got a message to pick them up at NAV Heimdal.

When I collected the papers at NAV Heimdal, they were in an unsealed envelope, with a thin rubber band wrapped around.

NAV has also recently rejected a meeting at the conflict council [the first step to arbitrating a conflict in the Norwegian legal system], after one arbitrating session there.

I was in a meeting on Wednesday at NAV Lerkendal with Elisabeth Nossum and Per Olav Gundersen, where NAV and I did not agree on the path [for me getting back to work life]. When I after the meeting applied for financial welfare support for a lawyer, so I can understand my rights and obligations regarding NAV and AAP, it was suggested I instead contact the free legal help [organisation that provides free legal assistance]. But I applied for welfare support for a lawyer anyway, 1020 kroner.

If the free legal help is OK for all legal questions and cases, I guess we don't need lawyers and the licenses to practice as lawyers?

Shortly before this [couple of weeks], my primary care physician Thor Digre displayed weird behaviour, and asked me to find a new primary care physician.

NAVI has on their end done some weird things, and I have given them information relevant to the case and my situation, which it looks like they have ignored.

So I'm asking what NAV and NAVI are doing [and have been doing]. Now one should be very careful to [be the boy who cried wolf], especially with a prior history of serious mental illness, but you can consider this a legal maneuver to give you an approach vector.

You know, there is a 5 year statute of limitations on crimes with a maximum penalty of 4 years.

A signed copy of this document will be sent later.


Morten W. Petersen

[Permalink] [By morphex] [Politics (and judicial matters) (Atom feed)] [24 Mar 12:27 Europe/Oslo]

More emails with Inger-Ritha Olsen, leader of child protection services, Rana municipality

So, I emailed some more with Inger-Ritha Olsen, and I have not seen a response since I emailed her last Friday, 4 days ago. I have also not seen a vacation message saying she for example moved to Spain and married her Spanish lawyer.

So here are the messages, I think they are pretty self-explanatory. Translated, originals are here and here.

To: Inger-Ritha Olsen
Cc: Lawyer, Healthcare, Family counselling, Rana court, Trøndelag County Manager office
Bcc: Dad, police
Subject: Recommended tapering speed, Seroquel
Date: Friday, 16th of March 2018, 19:02

Hi again Inger-Ritha.

There was one thing I was wondering about. It is the case that I want more contact with the kids.

I've made this clear to the kids, because I feel it is important that they know I want more contact, because they will then feel wanted.

[Comment: It's been recommended to me that I keep the conflict level down when talking to the kids, because they shouldn't have to take sides, manage the stress etc. at their age]

But what's your opinion about [the oldest son] being separated from me, and me having little contact with [the youngest son]?

How does this affect their mental health, in the short term and the long term? What about their personality?

They must have understood by now, that things aren't alright now, or later. Who is going to explain things to them?

What does a child feel, if it can see that one parent is fake, and hinders contact with the other parent, and the child is caught up in that situation?

What does [the oldest son] feel if he finds sensitive and partially incorrect information about me, and [the kids mom] has set that up?



Email 2

To: Inger-Ritha Olsen
Cc: Lawyer, Healthcare, Family counselling, Rana court, Trøndelag county manager office
Bcc: Dad, police
Date: Monday, 19th of March 2018, 19:57

Hi again Inger-Ritha.

If I don't see a reply on this email by 1500 Tuesday, I will blog about this as well.



[Permalink] [By morphex] [Family (Atom feed)] [20 Mar 15:45 Europe/Oslo]

Some emails with Inger-Ritha Olsen, leader of child protection services, Rana municipality

So, I haven't seen the kids in person since November 2017, and I've had one video chat with the kids this year.

I've asked for more physical meet-ups, and video chats, but the kids mom is not cooperating.

So my lawyer sent a letter last week, asking that the kids mom agrees to supervision from the state so I can see the kids, be relaxed about seeing the kids and also fulfilling the kids moms "needs" to be assured things are going OK.

I exchanged some emails with Inger-Ritha Olsen today, leader of the child protection services in Rana municipality. I've been in contact with her several times, and also sent "concern messages" regarding the kids well-being. My impression is that the kids want to see me more, but the kids mom doesn't respect that.

So yes, today I emailed her (email 1, email 2 and email 3 on the tail of that email thread), and she has been droning on about this not being a matter for the child protection services, that the kids mom makes it difficult to see the kids or that she has used them to blackmail me/harass me sexually.

On that last email I asked Inger-Ritha if it is tolerable that a mom makes it difficult for the dad to see the kids, if the dad rejects a sexual relationship with the mom. I've seen the kids 2-3 hours on average each month since the summer of 2013.

And the mental health professionals in the court case in the summer of 2015 painted a glorious picture of the kids mom, despite her selfish actions.

With the court case in 2015 which looks like a joke, I have no other real option than to go for a minimum of time seeing the kids in court the next time, because that is what would be difficult to lose on in court, and I wouldn't have to bear the court costs of the kids mom when "losing" a case.

And the court costs for the previous case are something I have to pay, and it was 80.000 NOK, but is now according to the mom, close to 100.000 NOK. That more than 8000-10000 euros, or 10-13000 US dollars. So the kids mom is earning interest on a court case she saw as "necessary", and I have an income of under 200.000 NOK per year.

I have not seen a reply from Inger-Ritha Olsen yet on my last questions.

Email 1 has been edited to remove the name of the kids mom, and may look slightly different.

[Permalink] [By morphex] [Family (Atom feed)] [15 Mar 19:01 Europe/Oslo]

Sex in the 21st century (an email to my lawyer)

So, after my experiences in life, I decided to email my lawyer the other day, to clarify some things about sexual relations with women.

I thought it would be good to share this email with you all, so here it is translated. I'm not using the name of the lawyer, because I don't know if he wants it to be disclosed.

To: Lawyer
From: Morten
Subject: Question about kids from one-night stands, relationships etc.

Hi Lawyer.

I guess I feel open about being in a relationship again, but I am worried about getting into another situation with a woman making it difficult to see the kids, getting pregnant "by accident" etc.

So I was wondering if I sleep with a woman one night, and she becomes pregnant, does one then have to pay child-support for 18-21 years?

Can one make a deal [sign a contract] before sleeping together, where one disclaims any responsibility, that kids are not planned etc.?

Does something like that need a signature, or would an SMS suffice?



[Permalink] [By morphex] [Health (Atom feed)] [05 Mar 20:39 Europe/Oslo]

The kids mom is not cooperating

So, I heard at the start of this week, that the kids mom is coming to Steinkjer this weekend, from my mom.

The kids mom has rejected meeting me in a public play park in Steinkjer today, because I won't sign an agreement she has dictated, regarding seeing the kids.

So after using the kids to try to get sex, then trying to get me to keep my mouth shut, she is now using them to get an agreement she has dictated, and she won't answer simple questions about the agreement. I have no trust in the kids mom, so I can't sign an agreement where I am forced to be at her place, with only her family around.

She will not setup meets in public places, for example in kids play parks, which I know the kids enjoy.

So rather symbolically, I stopped by the Trondheim train station today, to show that I was there and ready to take the train about 200 KMs to see the kids, but the kids mom would not set it up.

Morten standing in front of the departure screen at the trainstation

Because the kids mom has been difficult for over 4,5 years now, I am now publishing the latest email thread, where the man married to the kids mom twin sister, is acting as a negotiatior. I'm also showing the last SMS sent to the kids mom, confirming that my understanding is that she will not let me see the kids in a public place.

The SMS was sent yesterday, Friday, today is Saturday.

Because these last files contain names, I am blocking web indexing spiders, so that it will not be possible to search by their name on Google for example and find this blog post.

I think that's a fair compromise, between upping the sanctions to get a solution, and protecting privacy.

[Permalink] [By morphex] [Family (Atom feed)] [03 Feb 14:14 Europe/Oslo]

Charges pressed against the Norwegian police, and the Norwegian health care system

So, earlier today I filed a police report, filed a report, reported the police and health care system, to the police. And to the justice department.

In english, the content of that report was (roughly translated):

Subject: Charges pressed against the Norwegian police, and the Norwegian health care system
Cc: Sveinung Hestad Strand <>


I want to press charges against the Norwegian police, and the Norwegian health care system, for the legally punishable actions they have made, in connection with the case that the woman I have two children with, has made it difficult to see the kids since the summer 2013, as well as other things.

And by actions, I mean that choosing to not do something, is an active choice/action as well.

It looks like the kids mom also before the summer 2013, laid plans to make it difficult for me to see the kids, and I have a reason to also consider that she could have done things, before the firstborn was born, which later could be used in manipulation, making it difficult to see the kids etc.

After a round in court and 4,5 years, it is still difficult to get simple things regarding seeing the kids done. One week before the first time I was seeing the kids after going to court, I was in an accident that could have resulted in paralysis and/or death.

A signed copy of these charges is coming soon.

<signature, date>
<different identification and contact information.>

A PDF of the signed document is here:

[Permalink] [By morphex] [I will soon be reporting the police in Trondheim and Mo i Rana, and the health care system, to the police, for their criminal (in)actions (Atom feed)] [27 Jan 21:34 Europe/Oslo]

I will soon be reporting the police in Trondheim and Mo i Rana, and the health care system, to the police, for their criminal (in)actions

In a recent calculation, I found that since the summer 2013, I've seen the kids on average, 2-3 hours each month. And that is something I have worked (too) hard at getting.

So the kids mom and I have been in a conflict since then. I think it is safe to say that the situation is about as bad today, as it was in the summer 2013; in other words, it has not improved.

I have been in contact with the police in Mo i Rana, and Trondheim and they have been well informed, and the health care system has also been well informed since 2009/2010. Other state instances have also been informed / in the loop at times.

The last time I went to the police at Trondheim central police station, the person receiving my complaint regarding the kids mom, smiled and shrugged at me, calling it a matter for a civil suit. I've already been to court once.

I think it has been well documented that the kids mom is not cooperating, and I have seen little action from the police. And from what I see in the law text, if one parent makes it difficult for the other parent to see the kids, without reason, that is a criminal offence.

So I am within days, going to sign and send a document where I am reporting the police and the state health care system for their criminal (in)actions. It will be sent to the police in Trondheim, the police in Mo i Rana and the local health care branch. It will also be sent to what I guess translates to the internal affairs branch of the police.

[Permalink] [By morphex] [Family (Atom feed)] [26 Jan 21:44 Europe/Oslo]

Questioning mental health experts in the Norwegian court

So.. it's been well over 2 years since the court case, which I participated in to get to see my kids and clear up some things about the kids mom, after many unfortunate acts and questionable behaviour.

When I was in court the summer 2015, and afterwards, it felt like a weird experience, for different reasons. But looking back at the whole process, there are a lot of questionable things going on.

But a week ago, I sent an email to the court-appointed mental health experts that were to evaluate me and the kids mom. In their report and in court, they said that the kids mom had no narcissistic or sociopathic traits.

I don't have any formal psychological education, but with my experience of the kids mom and life in general, I find that hard to believe.

So in this email I asked the mental health experts in what was called "INSTITUTT FOR KLINISK FOREBYGGENDE TILTAK AS" [Edit: LTD replaced with AS] (loosely translated to "INSTITUTE FOR CLINICALLY PREVENTATIVE MEASURES LTD" [Edit: Added LTD]), now called "KLINISK KOMPETANSETEAM AS" (loosely translated to "CLINICAL COMPETENCE TEAM LTD"), if they could clarify what they meant by saying that the kids mom had no narcissistic or sociopathic traits, and also say something about how likely it is in general that a person does not have a trait in one of those categories.

It looks like that email was sent 09:05 AM on the 21st of December, and counting the 21st, 22nd, 27th and 28th as working days, I have not seen a response on email, regular snail mail or my phone from these mental health experts. I would think that they could at least give an indication that they would or would not answer in 4 working days.

As for my timing right around Christmas eve, well the case was submitted to the court right before Christmas 2014, by the kids mom. And this is their j-o-b.

It should be mentioned that I filed a complaint to the police against these mental health experts earlier, for false testimony. I have not heard anything from the police regarding this, which is interesting in itself. But I was at the Trondheim police station some weeks ago, wanting to file a complaint against the kids mom, but the person receiving me smiled, shrugged it off and called it a private matter and something that belongs in a civil suit(...).

I've previously written about these mental health experts here:

On a last note, I've talked to other people regarding this, and it seems that equality for mom and dad isn't a reality here in Norway. That's one thing, another might be regional politics, meaning old-fashioned culture and/or a need to keep the population numbers growing.

To me it is clear that the kids mom has played me for some years now, but I doubt she or those directly around her has the muscle to pull off all of this, all by themselves.

[Permalink] [By morphex] [Family (Atom feed)] [28 Dec 18:27 Europe/Oslo]

Raspberry Pi as a WiFi uplink point for cable switch

So.. to keep myself entertained and work a bit with technical things I haven't worked a lot with earlier, I dug out the old Raspberry Pi and figured I could use it as an uplink for a switch I recently bought.

So basically I have

  The internet -> Apartment router -> My WiFi Router -> Raspberry Pi with Wifi -> Switch -> Computer x,y,z

This enables me to setup computers with internet, by just plugging them into the switch with an Ethernet cable. The ISC DHCP server is running on the Raspberry Pi, and deals out the necessary bits to each computer so that it gets internet access.

You can see the switch as well as the Pi on the following picture:

Raspberry Pi and ethernet switch with LED lights

Now I thought the whole thing was a bit daunting and didn't know where to start, but some recipes on the net made things fairly easy, and I do know a bit about networking etc. from earlier on.

Now, the Raspberry Pi has a DHCP server running, which deals out IP addresses, gateway etc. to each computer that connects to the switch.

The DHCP server is configured basically like this and listens on the Raspberry Ethernet port, eth0:

option domain-name "";
option domain-name-servers;

default-lease-time 600;
max-lease-time 7200;

ddns-update-style none;

subnet netmask {
        option routers;

But the Pi also has to know how to send data to and from the computers that are hooked up to the switch, and here's a script that sets that up:

echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT

Using those two bits, and using the built-in WiFi configuration in raspi-config, I setup a network for easy internet access in a couple of hours.

[Permalink] [By morphex] [Technology (Atom feed)] [27 Dec 00:26 Europe/Oslo]

I have a problem, and it is just not with my kids mom

So, it seems I have a problem not only with the kids mom, but also with the health system and bureaucracy.

Some 8 years ago, I started taking medication to treat psychosis, and it was a medication called Seroquel.

The long-term side-effects of Seroquel can be diabetes and heart disease, so I was a bit surprised when the psychiatrist was negative towards me starting to exercise regularly, my physician wasn't overly positive and the NAV bureaucracy that doles out money to me wouldn't set it up as something they would sponsor.

So it seems that the system doesn't mind that I can get diabetes, because it is treatable. At the same time, I guess it advances the medical sciences. [Added a bit later: I guess it is more correct to say that diabetes is *manageable*]

Also, confidential and partially incorrect information has been abused, which means I don't trust the way confidential information is used and find it better to not talk to a psychiatrist at this point.

I'm in a situation now, 2,5 years after going to court with the kids mom, where the interest for her court costs, which I have to pay, is 1000 kroner, has a big impact on my economy. [Added a bit later: That is 1000 kroner per month]

I think the situation would have been different if I had been in an institution initially for a longer time and treated differently, instead of taking a medication that not only treats psychotic symptoms.

But I guess it is a lot cheaper to give a patient pills, and leave him with a person that later turns out would make it very difficult to see the kids, among other things. And if the patient happens to get diabetes, I guess that would be sad, but at the same time it advances the medical sciences.

[Permalink] [By morphex] [Health (Atom feed)] [14 Dec 17:22 Europe/Oslo]

Recording multiple audio input streams on Linux

I guess one of the important things for me dabbling with music, is the ability to perform using only a guitar and my voice. Piano and vocal is another thing I'd like to do, but maybe a bit later. So when I'm able to play the guitar and sing at the same time, why not record both at the same time.

So, I was looking at the possibility of recording the guitar and the vocal microphone at the same time, using Audacity.

I also googled a bit and it was a lot of yada yada expensive sound cards.

Now I have a built-in soundcard on the motherboard of my desktop computer, I also had a USB stick soundcard lying around.

So why not plug in the USB card and see if I can setup a system where I record guitar and vocal using two separate sound cards?

The sound system on my Fedora desktop is ALSA:

[morphex@localhost ~]$ ps uaxww|grep alsa
root 874 0.0 0.0 17160 2892 ? SNs nov.26 0:00 /usr/sbin/alsactl -s -n 19 -c -E ALSA_CONFIG_PATH=/etc/alsa/alsactl.conf --initfile=/lib/alsa/init/00main rdaemon
morphex 23598 0.0 0.0 119468 960 pts/5 S+ 19:00 0:00 grep --color=auto alsa
[morphex@localhost ~]$

And to get a list of recording devices, I used

[morphex@localhost ~]$ arecord -l
**** List of CAPTURE Hardware Devices ****
card 0: Megalodon [Razer Megalodon], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 0: ALC1150 Analog [ALC1150 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: PCH [HDA Intel PCH], device 2: ALC1150 Alt Analog [ALC1150 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 3: Device [USB PnP Sound Device], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
[morphex@localhost ~]$

I guess the most complicated part of getting this multi-source recording to work was getting the arecord commands right. But here's the recording script:

[morphex@localhost ~]$ cat
arecord -D hw:1,0 -f S16_LE -d 360 -c2 -r 44100 voice.wav &> voice.wav.log&
arecord -D hw:3,0 -f S16_LE -d 360 -c1 -r 44100 guitar.wav &> guitar.wav.log&
[morphex@localhost ~]$

arecord gave an obscure message which led me to try -c2 as an argument on the first command, and there was also some sampling rate issues so I set both sampling rates to 44100.

I was worried about syncing issues on a setup like this, but importing both wav files into Audacity and working on them from there, there were no issues with one track lagging behind the other. I can't notice any guitar echo on the vocal mic on the recording below.

So there you have it, fairly simple and cheap to setup a multi-input-source recording system on Linux.

You can hear the result here:;feature=yout...

I also created that video using kdenlive, which is about the simplest and best video editor I've found on Linux. I'm not an advanced video editor, and it was fairly easy to get results using kdenlive.

[Permalink] [By morphex] [Music (Atom feed)] [27 Nov 18:58 Europe/Oslo]

License to chill

So, a while ago I got a stretch at the top of my gluteus maximus (or right butt-cheek if you will), which was quite painful.

After that, I got different pain medications from my doctor, used towards max recommended dosage in the beginning and then tapered it off. Now I'm on Paracetamol, Ibuprofen and Tramadol:

Picture of Tramadol slow release, Paracetamol and Ibuprofen

A key thing about taking this pain medication, is that it makes it a lot easier to stretch out the core muscles and the leg muscles, when it is very painful if the muscles haven't been warmed up.

So these days I exercise 2-3 days in a row, stretch and take as little pain medication as possible, and then have a resting day. On the resting day it is nice to just rest, and do as little as possible, and then I take a Tramadol slow release tablet, then 3-4 hours after that take a Paracetamol and Ibuprofen tablet. From what I gather, it takes 4-5 hours for the Tramadol to peak, and about 1 hour for the Paracetamol and Ibuprofen to peak. So now in about 45 minutes I should be at the peak effect of all of these drugs, and I've also had some cups of coffee which also has a pain-killing effect.

Then I'll do some stretches, and take Paracetamol and Ibuprofen again in about 5 hours, and try to stretch at least 5 times today. I also have a massaging device which can be applied to the affected areas to increase the blood-flow, which should help heal and repair damage.

But I guess a key question is why I'm still on pain medication, as the original stretch in the butt seems to have healed and now I have a problem with the right bottom part of the foot twisting outwards when I sit resting towards a wall. I noticed that my feet (maybe only right foot) weren't responding properly well before this stretch, so it might have something to do with the bus accident a couple of years ago, or even go further back.

So I'm on a two-pronged "attack" now, to see if blame should/could be put on the bus company or earlier medical treatment that was not good enough. It might I am to blame for most or all of it, but we'll see.

Anyway, here I am taking an opioid drug (Tramadol) when I could've perhaps used a cannabinoid painkiller instead. Makes me wonder if old political rhetoric is still ruling our modern lives with an iron fist. 😕

[Permalink] [By morphex] [Health (Atom feed)] [09 Nov 16:08 Europe/Oslo]