<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3186290751960268973</id><updated>2024-09-05T05:56:56.623+00:00</updated><category term="Hy"/><category term="javascript"/><category term="python"/><category term="vim"/><category term="Latex"/><category term="amsthm"/><category term="canvas"/><category term="clock"/><category term="emacs"/><category term="flow"/><category term="gcalcli"/><category term="google  tasks"/><category term="google calendar"/><category term="google script"/><category term="hylang"/><category term="macros"/><category term="markdown"/><category term="math"/><category term="mdframed"/><category term="ntheorem"/><category term="orbital mechanics"/><category term="pandoc"/><category term="spaceship"/><category term="unnumbered"/><category term="xmobar"/><title type='text'>Tritlo&#39;s Web Log</title><subtitle type='html'>Hello, my friend. Stay awhile and listen.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://blog.mpg.is/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>22</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-219088160746449888</id><published>2015-01-17T23:54:00.000+00:00</published><updated>2015-01-17T23:56:39.443+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="canvas"/><category scheme="http://www.blogger.com/atom/ns#" term="clock"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>I wrote a clock!</title><content type='html'>So, I wrote &lt;a href=&quot;https://mpg.is/clock/&quot;&gt;a clock&lt;/a&gt;.&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://mpg.is/clock/static/img/clockfb.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 0em; margin-right: 0em;&quot;&gt;&lt;img style=&quot;background:white;&quot; height=&quot;494&quot; src=&quot;https://mpg.is/clock/static/img/clockfb.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
I based it on an analogue clock I had written for a tomato timer app (still working on that), but I added a color variation by the time, to make it cleaner. 
Writing the clock itself was just an exercise in Canvas, and the source code is all up there for everyone to browse. The hardest part to write was probably the color selection function, but it&#39;s tricky to make a function that&#39;s smooth, but also visually pleasing. I don&#39;t know if I&#39;ve hit on a great one, but I think this one looks alright. It varies the red color based on the hour, the green based on the minutes and the blue based on the seconds, though it tweens a lot so that the transition is more smooth. I hope you like it!</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/219088160746449888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2015/01/i-wrote-clock.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/219088160746449888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/219088160746449888'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2015/01/i-wrote-clock.html' title='I wrote a clock!'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-5627605200686720576</id><published>2015-01-17T23:46:00.000+00:00</published><updated>2015-01-17T23:46:44.275+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="flow"/><category scheme="http://www.blogger.com/atom/ns#" term="Hy"/><category scheme="http://www.blogger.com/atom/ns#" term="hylang"/><category scheme="http://www.blogger.com/atom/ns#" term="macros"/><title type='text'>Hy flow macros.</title><content type='html'>While working on my new web framework&amp;nbsp;&lt;a href=&quot;http://horn/&quot;&gt;Horn&lt;/a&gt;, written in Hy of course, I found myself lacking some flow controls. So I just wrote some macros!&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;;; Additional flow macros

(defmacro/g! guard [&amp;amp;rest args]
  (setv g!cond (car args))
  (setv g!body (car (cdr args)))
  (setv g!rest (cdr (cdr args)))
  (if g!rest
  `(if ~g!cond
       ~g!body
       (guard ~@g!rest))
  `(if ~g!cond
       ~g!body)))

(defmacro/g! switch [variable &amp;amp;rest args]
  (setv g!comp (car args))
  (setv g!body (car (cdr args)))
  (setv g!rest (cdr (cdr args)))
  (setv g!cond `(~(car g!comp) ~variable ~@(cdr g!comp)))
  (if g!rest
      (if (cdr g!rest)
        `(if ~g!cond ~g!body (switch ~variable ~@g!rest))
        `(if  ~g!cond ~g!body ~@g!rest))
      `(if  ~g!cond ~g!body)))
&lt;/pre&gt;
&lt;br /&gt;
As you can see, switch is basically just a guard statement, but with the original variable playing a role in every comparison, and with an additional else clause (since guard can only do that with a True).&lt;br /&gt;
It&#39;s amazing how powerful macros are, and I&#39;m really starting to like what I can do with them. I&#39;ve already submitted these to hy.contrib, and I hope they get accepted. Try some Hy!</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/5627605200686720576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2015/01/hy-flow-macros.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5627605200686720576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5627605200686720576'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2015/01/hy-flow-macros.html' title='Hy flow macros.'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-8097587277336482484</id><published>2015-01-13T17:01:00.003+00:00</published><updated>2015-01-13T17:01:48.242+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="amsthm"/><category scheme="http://www.blogger.com/atom/ns#" term="Latex"/><category scheme="http://www.blogger.com/atom/ns#" term="mdframed"/><category scheme="http://www.blogger.com/atom/ns#" term="ntheorem"/><category scheme="http://www.blogger.com/atom/ns#" term="unnumbered"/><title type='text'>Framed theorems in Latex</title><content type='html'>I just added framed theorems to my Latex repertoire.

 I&#39;ve been using amsthm for marking theorems for a long time, but since I encountered notes that had colored frames around the theorems, I decided that I&#39;d add them to my latex header file. The part of the header file that relates to theorems is now is thus:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
\usepackage{amsthm}
\usepackage[framemethod=tikz]{mdframed}
\renewcommand{\qedsymbol}{\textbf{Q.E.D}}

\mdfdefinestyle{theoremstyle}{%
roundcorner=5pt, % round corners, makes it friendlier
leftmargin=1pt, rightmargin=1pt, % this helps with box warnings
hidealllines=true, % even friendlier
align = center, %
}

\theoremstyle{plain}
\newtheorem*{setn}{Setning}
\newtheorem*{hsetn}{Hjálparsetning}

\theoremstyle{definition}
\newtheorem*{skgr}{Skilgreining}
\newtheorem*{daemi}{Dæmi}
\newtheorem*{frumsenda}{Frumsenda}
\newtheorem*{lausn}{Lausn}


\theoremstyle{remark}
\newtheorem*{ath}{Athugasemd}
\newtheorem*{innsk}{Innskot}

\surroundwithmdframed[style=theoremstyle,backgroundcolor = green!20]{skgr}
\surroundwithmdframed[style=theoremstyle,backgroundcolor=blue!10]{setn}
\surroundwithmdframed[style=theoremstyle,backgroundcolor = orange!20]{daemi}
\surroundwithmdframed[style=theoremstyle,backgroundcolor = red!20]{ath}
&lt;/pre&gt; &lt;br/&gt;
(All my notes are in Icelandic, of course,
This allows me to mark my theorems, my definitions, remarks and examples specially in the TeX, and to spot them easily, which is a lot of help when using the notes in open book exams. &lt;br/&gt;
First I tried using mdtheorem and newmdtheoremenv, but neihter would give me what I want (couldn&#39;t get it to be unnumbered without ntheorem, and that messed up the amsthm,... etc), so 
the ultimate solution was just to not use the built in features of mdtheorem, and just saying directly what I wanted (a colored box around my theorems). 

 I hope this is useful to others.</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/8097587277336482484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2015/01/framed-theorems-in-latex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/8097587277336482484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/8097587277336482484'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2015/01/framed-theorems-in-latex.html' title='Framed theorems in Latex'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-2369537715207177720</id><published>2014-12-21T17:32:00.000+00:00</published><updated>2015-01-17T23:47:25.607+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hy"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Proper tail recursion in Python and Hy</title><content type='html'>I recently came across a new language, &lt;a href=&quot;https://www.blogger.com/hylang.org&quot;&gt;Hy&lt;/a&gt;. It is a Lisp dialect of Python!
This means that I can finally start programming as I want in a functional language, Lisp, and not have to worry about whether others can use my code or whether I hit a snag that I can&#39;t figure out in lisp, as I can always drop back down to Python if necessary. &lt;br /&gt;
Anyways, since it is a Lisp dialect, I wished that it had proper tail recursion, as I utilize tail recursion a lot when programming in Lisp, and hitting a maximum recursion depth exception is quite common for me. As proper tail recursion is missing in Python, I first had to &lt;a href=&quot;https://gist.github.com/Tritlo/2a0e429f2b0037d8c2eb#file-tailrec-py&quot;&gt;implement tail recursion in Python &lt;/a&gt;. I did this using a decorator and an exception, which allows me to bail out of a function without returning anything, and the decorator tries to return from the function and catches these TailCall exceptions, and handles them so that it all works. This is probably a lot slower way of doing it than having it implemented in the interpreter itself, but seeing as you gain instead power to go much deeper in recursion, I think it is a fair trade-off. &lt;br /&gt;
The next step was implementing the decorator and exception in Hy. The &lt;a href=&quot;https://gist.github.com/Tritlo/2a0e429f2b0037d8c2eb#file-tailrec-hy&quot;&gt;tail recursion decorator and exception in Hy&lt;/a&gt; is a bit awkward, but works well enough.&lt;br /&gt;
The final step was &lt;a href=&quot;https://github.com/hylang/hy/pull/728&quot;&gt;implementing it in Hy itself&lt;/a&gt;, and I now have a pending pull request for the change. The implementation adds a new  import,&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;(import [__future__ [TailRec]]) 
&lt;/code&gt;&lt;/pre&gt;
which the Hy compiler recognizes and turns on tail recursion during the compilation. This adds the decorator around every function that uses tail recursion, and switches the return statements for raising of the TailCall exception. This effectively gives us proper tail recursion in Hy! &lt;br /&gt;
This allows us to do things like:&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;    (defn tcodd [n]
      (if (= n 0)
          False
          (tceven (- n 1))))
    (defn tceven [n] 
      (if (= n 0)
          True
          (tcodd (- n 1))))

    (print (tceven 1000))
&lt;/code&gt;&lt;/pre&gt;
and&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;(defn fact [n]
  (defn facthelper [n acc]
    (if (= n 0)
        acc
        (facthelper (- n 1) (* n acc))))
    (facthelper n 1))
(print (fact 1000))
&lt;/code&gt;&lt;/pre&gt;
without ever hitting the recursion depth exceeded exception! Woo!&lt;br /&gt;
Here&#39;s hoping that it makes it into Hy!</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/2369537715207177720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2014/12/proper-tail-recursion-in-python.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/2369537715207177720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/2369537715207177720'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2014/12/proper-tail-recursion-in-python.html' title='Proper tail recursion in Python and Hy'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-5763693868543969936</id><published>2014-12-06T17:18:00.002+00:00</published><updated>2015-01-17T23:47:14.878+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="Hy"/><category scheme="http://www.blogger.com/atom/ns#" term="python"/><title type='text'>Hy &lt;-&gt; Python Interop</title><content type='html'>I added &lt;a href=&quot;http://hy.readthedocs.org/en/latest/tutorial.html#hy-python-interop&quot;&gt;Hy &amp;lt;-&amp;gt; Python Interop documentation&lt;!-----&gt;&lt;/a&gt; to the Hy documentation today! Best part of open source is that if you find something missing, you can just add it! &lt;br /&gt;
&lt;h2&gt;
Hy &amp;lt;-&amp;gt; Python interop&lt;/h2&gt;
By importing Hy, you can use Hy directly from Python!&lt;br /&gt;
If you save the following in &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;greetings.hy&lt;/span&gt;&lt;/tt&gt;:&lt;br /&gt;
&lt;div class=&quot;highlight-clj&quot;&gt;
&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;kd&quot;&gt;defn &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;greet&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;[&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;name&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;nb&quot;&gt;print &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello from hy,&quot;&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Then you can use it directly from python, by importing hy before importing
the module. In Python:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;highlight-python&quot;&gt;
&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;hy&lt;/span&gt;
&lt;span class=&quot;kn&quot;&gt;import&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;greetings&lt;/span&gt;

&lt;span class=&quot;n&quot;&gt;greetings&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;greet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Foo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;p&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
You can also declare a function in python (or even a class!) and use it in Hy!&lt;br /&gt;
If you save the following in &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;greetings.py&lt;/span&gt;&lt;/tt&gt; in Python:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;highlight-python&quot;&gt;
&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;greet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;hello, &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;p&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
You can use it in Hy:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;highlight-clj&quot;&gt;
&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;import &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;greetings&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;nf&quot;&gt;.greet&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;greetings&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;foo&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;p&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
To use keyword arguments, you can use in &lt;tt class=&quot;docutils literal&quot;&gt;&lt;span class=&quot;pre&quot;&gt;greetings.py&lt;/span&gt;&lt;/tt&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;highlight-python&quot;&gt;
&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;k&quot;&gt;def&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;greet&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Sir&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;):&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;print&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;Greetings, &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;s&quot;&gt; &lt;/span&gt;&lt;span class=&quot;si&quot;&gt;%s&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;))&lt;/span&gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;p&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;pre&gt;and then in Hy:&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;highlight-clj&quot;&gt;
&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;import &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;greetings&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;nf&quot;&gt;.greet&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;greetings&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Foo&quot;&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;nf&quot;&gt;.greet&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;greetings&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Foo&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Darth&quot;&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;nb&quot;&gt;apply &lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;. &lt;/span&gt;&lt;span class=&quot;nv&quot;&gt;greetings&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;greet&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;s&quot;&gt;&quot;Foo&quot;&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;s&quot;&gt;&quot;title&quot;&lt;/span&gt; &lt;span class=&quot;s&quot;&gt;&quot;Lord&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;})&lt;/span&gt;
&lt;/pre&gt;
&lt;pre&gt;&lt;span class=&quot;p&quot;&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Which would output:&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;highlight-python&quot;&gt;
&lt;div class=&quot;highlight&quot;&gt;
&lt;pre&gt;Greetings, Sir Foo

Greetings, Darth Foo

Greetings, Lord Foo
&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;pre&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Simple as that! Now keep on the Hy life!</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/5763693868543969936/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2014/12/hy-python-interop.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5763693868543969936'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5763693868543969936'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2014/12/hy-python-interop.html' title='Hy &lt;-&gt; Python Interop'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-5605412550664961031</id><published>2014-02-15T19:48:00.001+00:00</published><updated>2014-02-16T12:38:16.726+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="math"/><title type='text'>A neat little result.</title><content type='html'>While going over some homework as a TA in computer science 2 at the University of Iceland, I noticed something I did not know.&lt;br /&gt;
&lt;br /&gt;
We already know that (assuming integer division) that&lt;br /&gt;
\[\left( \frac{x}{{10}^i} \right) \mod 10 \]&lt;br /&gt;
&lt;br /&gt;
gives us the \((n-i)\)-th digit of a number (\(n =\left\lfloor{\log_{10}(x)} \right\rfloor \), and &amp;nbsp;\( i = 0 \) gives you the last digit) when counting in a decimal system. But going over the homework batch where the students were supposed to implement radix sort, I noticed that&lt;br /&gt;
&lt;br /&gt;
\[ \frac{x \mod {10}^{i+1}}{{10}^i} \]&lt;br /&gt;
&lt;br /&gt;
gives you the \(i\)-th digit (where 0 gives you the first)! Pretty cool!&lt;br /&gt;
&lt;br /&gt;
I&#39;m not going to prove this, as I have far to little experience with integer division and the modulus operation, but it seems to work, judging by that my students queues all turn out sorted.</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/5605412550664961031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2014/02/a-neat-little-result.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5605412550664961031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5605412550664961031'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2014/02/a-neat-little-result.html' title='A neat little result.'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-6459938151722019682</id><published>2013-11-21T02:25:00.001+00:00</published><updated>2014-10-21T11:46:12.043+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="orbital mechanics"/><category scheme="http://www.blogger.com/atom/ns#" term="spaceship"/><title type='text'>Orbital Mechanics</title><content type='html'>This past few weeks I&#39;ve been working on a game in Computer Game Programming, &lt;a href=&quot;http://tritlo.github.io/JerbalSpaceProgram&quot; title=&quot;Jerbal Space Program&quot;&gt;Jerbal Space Program&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
You design a space ship, and then you fly around in it, trying to land on the moon, or what have you. It&#39;s a pretty open sandbox game.&lt;br /&gt;
&lt;br /&gt;
During it&#39;s development, I had to dive into orbital mechanics, to figure out the orbit of the spaceship, and then to render that orbit.&lt;br /&gt;
&lt;br /&gt;
I though it was pretty neat, but it was hard to figure out from wikipedia, so I thought I&#39;d write a post about it.&lt;br /&gt;
&lt;br /&gt;
Lets dive into the function:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;Ship.prototype.updateOrbit = function() {
    //Calculate orbit from orbital state vectors
    //Get the primary body the ship is orbiting
    var terr = entityManager.getTerrain(this.cx,this.cy);
    
    //One focus is in the center of the primary body 
    var focus = terr.center;
    var M = terr.mass;

    //Mu in the equations
    var mu = consts.G*(M+this.mass)
    
    //The posistion and velocity vectors.
    //Note that posistion is relative to the focus,
    //But the velocity is just the current velocity of the ship
    var r = util.vecMinus(this.center,focus)
    var v = [this.velX,this.velY];

    //Calculate the orbit specific energy, and from that we find the
    //semi-major axis. Note that this makes sense, as the semi major axis
    //basically tells us how high we&#39;ll go.
    var speed = this.getSpeed(); 
    var eng = (speed*speed)/2 - (mu/util.lengthOfVector(r));
    var a = -mu/(2*eng);
    
    //Calculate the eccentricity vector, and from that the eccentricity
    var tripleprod = util.tripleProduct(v,r,v);
    var vtimeshovermu = util.mulVecByScalar(1/mu,tripleprod); 
    var unitr = util.normalizeVector(r)
    var eccVec = util.vecMinus(vtimeshovermu,unitr);
    var ecc = util.lengthOfVector(eccVec);
    
    //ae is the distance from the center to a;
    var ae = a*ecc;
    //semi minor axis

    var b = a*Math.sqrt(1-ecc*ecc);
    //Find the center from the distance
    var cen = [f[0]-ae,f[1]];
    
    //Here we find the rotation of the eccentricity,
    //which tells us where the orbit is from the focus
    var angl = util.angleOfVector(eccVec);

    //rotate the center around the focus according to the angle
    cen = util.rotatePointAroundPoint(cen,angl,focus[0],focus[1]);

    //Set the properties of the orbit
    this.orbit = [cen[0], cen[1],a,b,angl,focus[0],focus[1]];
}&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now, using this we can plot our ellipse, knowing the center, and the angle of it. And it works, just zoom far enough out in the game, and take off! Happy flying!&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/6459938151722019682/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2013/11/orbitblog.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/6459938151722019682'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/6459938151722019682'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2013/11/orbitblog.html' title='Orbital Mechanics'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-5615117333725378261</id><published>2013-10-21T18:10:00.001+00:00</published><updated>2013-11-21T15:07:18.470+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="google  tasks"/><category scheme="http://www.blogger.com/atom/ns#" term="google calendar"/><category scheme="http://www.blogger.com/atom/ns#" term="google script"/><title type='text'>Function for quick adding tasks or events to google calendar.</title><content type='html'>I have written &lt;a href=&quot;https://script.google.com/d/1RrHoUllrzvjzOfcLnVbeGY8y0dsrn1IDW8odwZ0gb6FoEJioLDWhkpFf/edit?usp=sharing&quot;&gt;a function so that you can quick add tasks as well as events to google calendar&lt;/a&gt;, using &lt;a href=&quot;http://script.google.com/&quot;&gt;Google script&lt;/a&gt;.&lt;br /&gt;
&lt;pre&gt;&lt;code&gt;
&quot;use strict&quot;;
/*
01234567890123456789012345678901234567890123456789012345678901234567890123456789
*/
/*
 * @author Matthias Pall Gissurarson
 * @usage quickAddTaskOrEventFromString(quickadd);
 * @param quickadd A String describing the event to quickadd
 */
function quickAddTaskOrEventFromString(quickadd) {
  //Add a task if the string includes &quot; due &quot;, otherwise add an event.
  if(quickadd.indexOf(&quot; due &quot;) !== -1){
    //Use the already implemented quickAdd to create an event.
    var event = CalendarApp.createEventFromDescription(quickadd);
    //This event gets automatically added to the users calendar, remove it.
    event.deleteEvent();

    /*
    Create a new task, and have it have the same properties as the event.
    Tasks don&#39;t have dueTime as of now, so we add that to the note of the task.
    Also add the events location and description, these are often empty.
    */
    var task = Tasks.newTask();
    task.setDue(event.getStartTime().toISOString());
    task.setTitle(event.getTitle());

    task.setNotes([event.getStartTime().toString(),
                   event.getLocation(),
                   event.getDescription()].join(&quot;\n&quot;));

    //Add to the users default tasklist.
    Tasks.Tasks.insert(task,&#39;@default&#39;);
  } else {

    //Add the event as normal
    CalendarApp.createEventFromDescription(quickadd);
  } 
}

function main() {
  var s = &quot;Homework due tomorrow&quot;;
  var e = quickAddTaskOrEventFromString(s);
}
&lt;/code&gt;&lt;/pre&gt;
This function takes in a string, and if it contains &quot; due &quot;, it creates a task instead of an event on the default task list. Might this get implemented in the actual calendar?&lt;br /&gt;
I have &lt;a href=&quot;https://productforums.google.com/forum/?hl=en#!category-topic/calendar/share-and-discuss/managing-my-tasks/google-chrome/7repKG-M-8g&quot;&gt;posted a topic for this&lt;/a&gt; on the Google product forums. Let&#39;s see what happens.</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/5615117333725378261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2013/10/function-for-quick-adding-tasks-or.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5615117333725378261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5615117333725378261'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2013/10/function-for-quick-adding-tasks-or.html' title='Function for quick adding tasks or events to google calendar.'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-404963808203324233</id><published>2013-06-10T16:50:00.001+00:00</published><updated>2013-11-21T15:11:28.725+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="emacs"/><category scheme="http://www.blogger.com/atom/ns#" term="markdown"/><category scheme="http://www.blogger.com/atom/ns#" term="pandoc"/><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><title type='text'>Markdown blog posts via emacs/vim and pandoc</title><content type='html'>&lt;h2 id=&quot;using-markdown-on-google-blogs-from-the-commandline&quot;&gt;Using Markdown on google blogs from the Commandline&lt;/h2&gt;&lt;br /&gt;&lt;p&gt;As per the comment on my last post from Matthías Ragnarsson, I&#39;m using pandoc to generate html from a md file, albeit I&#39;m not using vim, but rather emacs (as setting up markdown-mode is simpler, and with &lt;em&gt;&lt;a href=&quot;http://www.emacswiki.org/emacs/Evil&quot; title=&quot;Evil&quot;&gt;evil&lt;/a&gt;&lt;/em&gt;, it&#39;s pretty much the same thing, only more easily extensible. It also fits better with the &lt;a href=&quot;http://en.wikipedia.org/wiki/Unix_philosophy#Eric_Raymond.E2.80.99s_17_Unix_Rules&quot; title=&quot;The Rule of composistion&quot;&gt;Unix philosophy&lt;/a&gt; of using external tools to do tasks, rather than hardcoding them into the program itself.&lt;/p&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/404963808203324233/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2013/06/markdown-blog-posts-via-emacsvim-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/404963808203324233'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/404963808203324233'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2013/06/markdown-blog-posts-via-emacsvim-and.html' title='Markdown blog posts via emacs/vim and pandoc'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-3571431683536177569</id><published>2013-06-08T21:13:00.001+00:00</published><updated>2013-11-21T15:06:38.768+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="gcalcli"/><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><title type='text'>Google calendar from the desktop, and posting through vim</title><content type='html'>&lt;h2 id=&quot;posting-trough-vim&quot;&gt;Posting trough vim&lt;/h2&gt;
&lt;p&gt;Here I am, writing a blog post in vim. If this actually gets posted, I&#39;ll be pretty impressed, as this makes posting to the google blogs extremely simple to implelement via a server. The api program itself is just a python program, so porting the functionality over to haskell shouldn&#39;t be hard at all. I might even make it and put it on hackage. It&#39;d be neat to have a package there!&lt;/p&gt;
&lt;p&gt;Anyway, I hope this test works, as it&#39;ll make code examples way simpler.&lt;/p&gt;
&lt;h2 id=&quot;google-calendar-on-the-desktop&quot;&gt;Google calendar on the desktop&lt;/h2&gt;
&lt;p&gt;I recently &lt;a href=&quot;https://github.com/insanum/gcalcli/pull/90&quot;&gt;made some commits&lt;/a&gt; so that it can display arbitrary colors in conky, and used it to create a neat display of my google calendar on the desktop, and you can see a picture of it included in the pull.&lt;/p&gt;
&lt;p&gt;My .gcalclirc is as follows:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;--calendar
icetritlo@gmail.com
--military
--monday
#Tomorrow-Night Palette
--conky_color0
    #282A2E
--conky_color8
    #373B41 
--conky_color1
    #A54242 
--conky_color9
    #CC6666 
--conky_color2
    #8C9440 
--conky_color10
    #B5BD68 
--conky_color3
    #F0C674 
--conky_color11
    #DE935F 
--conky_color4
    #5F819D 
--conky_color12
    #81A2BE 
--conky_color5
    #85678F 
--conky_color13
    #B294BB 
--conky_color6
    #5E8D87 
--conky_color14
    #8ABEB7 
--conky_color7
    #707880 
--conky_color15
    #F0C673 

#Viljum auka vidd ef a ad vera a isl
#--locale
#is_IS.UTF-8
#-w
#12&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I have that last part if I should want to have the dates and day names in Icelandic, but as neither are capitalized (correct in the middle of a sentence, but not standalone), and the english version suits me fine, I don&#39;t think I&#39;ll bother fixing it.&lt;/p&gt;
&lt;p&gt;[Edit: Rewrote this post in markdown, and used pandoc to translate it into html, as per the comment below. N.B. you need my fork of gcalcli for this to work, as the --conky_color options were added by me.]&lt;/p&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/3571431683536177569/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2013/06/google-calendar-from-desktop-and.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/3571431683536177569'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/3571431683536177569'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2013/06/google-calendar-from-desktop-and.html' title='Google calendar from the desktop, and posting through vim'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-610833455188917768</id><published>2013-06-05T18:11:00.001+00:00</published><updated>2013-06-05T18:11:23.549+00:00</updated><title type='text'>Using GoogleCL to post from the terminal</title><content type='html'>I&#39;m really just testing out using googleCl to post from my terminal to the blog. As simple as pacman -S googlecl, then authenticate via oauth (almost totally automatic, just enter your username and password in the browser window, grant access and done), and then $ google blogger post etc. Very basic. I wonder if I can post a text file....</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/610833455188917768/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2013/06/using-googlecl-to-post-from-terminal.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/610833455188917768'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/610833455188917768'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2013/06/using-googlecl-to-post-from-terminal.html' title='Using GoogleCL to post from the terminal'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-6458029152418830446</id><published>2013-04-20T16:45:00.001+00:00</published><updated>2013-11-21T15:06:53.094+00:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="xmobar"/><title type='text'>Using xmobar to display rcirc status from emacs</title><content type='html'>I use the emacs rcirc as my main irc client, and via &lt;a href=&quot;http://www.bitlbee.org/main.php/news.r.html&quot;&gt;BitlBee&lt;/a&gt;, facebook and skype chat. I use &lt;a href=&quot;http://xmonad.org/&quot;&gt;XMonad&lt;/a&gt; as my window manager, and &lt;a href=&quot;https://github.com/jaor/xmobar&quot;&gt;xmobar&lt;/a&gt; as my display bar. Today I added the rcirc status line to my xmobar, so that I can see if I have new messages on any channels/facebook chat/skype. I wrote a short bash scriptlet that I execute in xmobar with&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Run Com &quot;~/.scritpstouse/rcircActivity&quot; [] &quot;rcirc&quot; 100&lt;/blockquote&gt;
&lt;br /&gt;
the script is as follows:&lt;br /&gt;
&lt;br /&gt;
#!/usr/bin/env bash&lt;br /&gt;
if&amp;nbsp; emacsclient -e rcirc-activity-string &amp;gt; rcirc-string;then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; if ircstr=$(cat rcirc-string | tr &#39;&quot;&#39; &#39;\n&#39; | grep &#39;\[&#39;);then&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;&amp;lt;fc=#00ff00&amp;gt;&quot;$ircstr&quot;&amp;lt;/fc&amp;gt;&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;&amp;lt;fc=#0000ff&amp;gt;[]&amp;lt;/fc&amp;gt;&quot;&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; fi&lt;br /&gt;
else&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;&amp;lt;fc=#ff0000&amp;gt;[]&amp;lt;/fc&amp;gt;&quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
This contacts my running emacs server and asks for the status string, and then displays it. I&#39;d have it in the .xmobarrc, but it doesn&#39;t handle escaped &quot; so well. If my server isn&#39;t running or rcirc isn&#39;t, there is no field that contains [, so the output will be empty and my xmobar will just have a few spaces. The echos give me different colors on the xmobar based on what happened, green and the status if rcirc on, blue if emacs on but rcirc not, and red if emacs turned off. Try it!&lt;br /&gt;
&lt;br /&gt;
[Edit: I&#39;ve decided to try and use erc instead. The command is almost the same (the ircActivity), but the if clause is replaced with:&lt;br /&gt;
i&lt;br /&gt;
f&amp;nbsp; ercBuffers=$(emacsclient -e &quot;(if (functionp erc-track-shorten-function) (funcall erc-track-shorten-function (mapcar &#39;buffer-name (mapcar &#39;car erc-modified-channels-alist))) (nil))&quot;);then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if ircstr=$(echo ${ercBuffers:1:${#ercBuffers}-2} | tr &#39; &#39; &#39;,&#39; | tr -d &#39;&quot;&#39;);then&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; echo &quot;&amp;lt;fc=#00ff00&amp;gt;[&quot;$ircstr&quot;]&amp;lt;/fc&amp;gt;&quot;&lt;br /&gt;&lt;br /&gt;
&lt;br /&gt;
A little more complicated, but it works, and I believe erc is more feature rich.]&lt;br /&gt;
&lt;br /&gt;
I&#39;ll later try to explain my xmonad config, and include the (current) file. It handles everything for me, from handling my workpaces, windows etc.. to changing my keyboardlayout and handling my media keys. It rocks!&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/6458029152418830446/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2013/04/using-xmobar-to-display-rcirc-status.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/6458029152418830446'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/6458029152418830446'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2013/04/using-xmobar-to-display-rcirc-status.html' title='Using xmobar to display rcirc status from emacs'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-1415068271922783354</id><published>2013-02-03T22:43:00.002+00:00</published><updated>2013-04-24T00:08:18.218+00:00</updated><title type='text'>The MIT License </title><content type='html'>When I make code publicly available, I usually do it under the &lt;a href=&quot;http://en.wikipedia.org/wiki/MIT_License&quot;&gt;MIT License&lt;/a&gt;. Why? Because it is a so called &lt;a href=&quot;http://en.wikipedia.org/wiki/Copyfree#Copyfree&quot;&gt;copyfree&lt;/a&gt; license, which, in contrast to copyright, merely states that anyone is free to use the provided code, if they include the license (and thus preserving my name in the codebase). It is as follows:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;white-space: pre-wrap; word-wrap: break-word;&quot;&gt;Copyright (C) &amp;lt;year&amp;gt; &amp;lt;copyright holders&amp;gt;

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the &quot;Software&quot;), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED &quot;AS IS&quot;, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
&lt;/pre&gt;
&lt;div&gt;
&lt;br /&gt;
This, in contrast to copyright, does not restrict use of my code in other work, and in contrast to copyleft, does not force them to apply a specific license to their own code. It is thus a true free software license, allowing anyone to use my ideas for free - as long as they acknowledge my participation by including the license. Thus I enrich society by showing more examples of code, maybe help someone out on the project, and gain better reputation - instead of burdening it with pointless legal battles about something no one can really own. If you ever give out any code, use the MIT License, or at least a copyfree license.&lt;br /&gt;
&lt;br /&gt;
[Edit 2013-04-24: &amp;nbsp;After reading&amp;nbsp;&lt;a href=&quot;http://www.tldrlegal.com/&quot;&gt;tldr;legal&lt;/a&gt;, I&#39;ve decided that the GPL is actually a better license, by making more software free as in freedom. I have thus changed most of my projects to the GPL, and I recommend that you read up on tldr;legal and decide for yourself what license fits your project best. I hope that you&#39;ll choose the GPL, though anyone should of course be free to do with their work as they please.]&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/1415068271922783354/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2013/02/the-mit-license.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/1415068271922783354'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/1415068271922783354'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2013/02/the-mit-license.html' title='The MIT License '/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-3901469806223191925</id><published>2012-11-01T00:49:00.000+00:00</published><updated>2012-11-01T01:06:52.404+00:00</updated><title type='text'>Errata for &quot;A note on the Icelandic crash from an amateur Austrian perspective&quot;.</title><content type='html'>After receiving some comments on my previous post, I&#39;ve decided to update it with some errata, and just leave the post as it currently is. The following is verbatim from &lt;a href=&quot;https://pay.reddit.com/r/austrian_economics/comments/11fpy3/the_icelandic_crash_from_an_amateur_austrian/c6mc53a&quot;&gt;a comment&lt;/a&gt; by user &lt;a href=&quot;https://pay.reddit.com/user/herbert_spencer&quot;&gt;herbert_spencer&lt;/a&gt; on reddit.com:&lt;br /&gt;
&lt;br /&gt;
&amp;gt;busts are mainly caused by low interest rates.&lt;br /&gt;
&lt;br /&gt;
It may be more accurate to say that they are caused by unsustainable investments because of *artificially* low interest rates.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; Due to the large size of the Icelandic banks (among other things), the belief in Icelandic Krona was high, causing it to be seemingly overvalued.&lt;br /&gt;
&lt;br /&gt;
The fact that that the CBI said it would act as a lender of last resort and that the IMF was believed to have the capability to provide stability seems more important than the size of the banking system (which was albeit probably oversized) to the proliferation of currency mismatching.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;Central Bank of Iceland, through the Floating exchange rate policy raised the exchange rate.&lt;br /&gt;
&lt;br /&gt;
The CBI does not determine the exchange rate directly. The fact that the krona had a floating rate means that it can fluctuate on the market. There is the issue of foreign currencies having lower interest rates than the krona and the consequent currency mismatching because of the implicit guarantee of bailout from the IMF. &lt;br /&gt;
&lt;br /&gt;
&amp;gt; They might have tried to offer the krona undervalued, and then foreign currency would have flowed into the Central Banks stash, as always happens between good money and bad money, for all would have wanted to get their hands on the krona instead of the foreign currency, seeing as it was seen as being better.&lt;br /&gt;
&lt;br /&gt;
Again, a floating exchange rate does not allow the legal undervaluing or overvaluing of currencies. The state may however, as Iceland did following the crash of the krona, limit the use of foreign exchange.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; This enabled Icelanders to get pretty cheap loans&lt;br /&gt;
&lt;br /&gt;
Its not so much the value of the currency that allowed this as the easy monetary policy pursued by the ICB along with the low worldwide interest rates. Short term borrowing expanded as those rates remained low, which, in conjunction with increased long term investment created maturity mismatching (classic Austrian malinvestment) during the boom period.&lt;br /&gt;
&lt;br /&gt;
&amp;gt; for various items, and was used to buy cars etc.&lt;br /&gt;
&lt;br /&gt;
It is also important to remember, and perhaps mention that the credit expansion was not limited to loans for purchases of consumer goods but also in industry and capital goods (and international business). This is where the malinvestment comes into play.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;The price of housing was also artificially high&lt;br /&gt;
&lt;br /&gt;
It may be good to explain the causal relation between the monetary policy and housing prices.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;Then, when the Icelandic banks fell, due to being in a &quot;liquidity trap&quot;&lt;br /&gt;
&lt;br /&gt;
The Keynesian notion of a liquidity trap is questionable and not exactly the cause of the bank crash. It is important to note the difference between the liquidity crisis we saw, where the ICB had lent to insolvent banks (and to the government, which was insolvent). This is where the currency mismatching came back to haunt the ICB. Since debt was owed in foreign currency, there could be no bailout.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;gt;this of course raised the cost of capital to even higher levels than it should have been.&lt;br /&gt;
&lt;br /&gt;
The bust merely reveals the malinvestment.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;The belief in the Icelandic Krona fell, and thus the exchange rate set by the Central Bank was too high, causing an outflow of foreign currency, as it was now determined as being overvalued, and now no one wanted the Icelandic Krona. They then lowered the exchange rate, and thus the foreign currency loans which so many thought were so cheap turned out to be not so cheap at all, merely a fluke.&lt;br /&gt;
&lt;br /&gt;
Again, the exchange rate is not set but is determined by the foreign exchange market. When the bust reared its ugly head in Iceland, and bankruptcy ensued, faith in the krona collapsed, people tried to sell kronur for foreign currency, and its exchange rate naturally collapsed in consequence.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;How could the banks grow so large?&lt;br /&gt;
Also, it is important to ask how the banks could make such bad loans.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;We could start by going onto a gold standard, or some other standard in which the value of the currency is based on some commodity.&lt;br /&gt;
&lt;br /&gt;
While it would definitely be an improvement, a denationalized currency may be even better from an Austrian perspective.&lt;br /&gt;
&lt;br /&gt;
&amp;gt;It is a hassle to dig up more gold (certainly more than just to print more money/issue government bonds)&lt;br /&gt;
&lt;br /&gt;
If gold money is mined (on the market. If done by governments, then yes, there is still a problem but the state would probably rather resort to debasing the currency than to mine) to make money, then it is not even inherently a problem. The mining entrepreneur is acting as an arbitrageur since he realized people value gold more than anything else those miners (and the mining equipment) could be doing.&lt;br /&gt;
&lt;br /&gt;
End verbatim.&lt;br /&gt;
&lt;br /&gt;
As I&#39;ve previously stated, I&#39;m still studying Austrian economics, and many of these points highlight some of my misunderstandings. I believe that reading the book &lt;a href=&quot;http://library.mises.org/books/Philipp%20Bagus/Deep%20Freeze%20Icelands%20Economic%20Collapse.pdf&quot;&gt;Deep Freeze by Phillip Bagus&lt;/a&gt;&amp;nbsp;will further clarify this, and I hope to make another post after having read said book.</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/3901469806223191925/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2012/11/errata-for-note-on-icelandic-crash-from.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/3901469806223191925'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/3901469806223191925'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2012/11/errata-for-note-on-icelandic-crash-from.html' title='Errata for &quot;A note on the Icelandic crash from an amateur Austrian perspective&quot;.'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-4555246080524909461</id><published>2012-10-10T18:58:00.000+00:00</published><updated>2012-10-17T18:47:01.428+00:00</updated><title type='text'>A note on the Icelandic crash from an amateur Austrian perspective.</title><content type='html'>[Disclaimer: I am not an authority on these matters, and there may be mechanics to which I am oblivious at play. You should by all means try to come to your own conclusions, rather than blindly trusting something on the internet.]&lt;br /&gt;
&lt;br /&gt;
[Edit: This was posted on reddit, and after having received some feedback, there are some parts of this note which are wrong. I&#39;ll make a later post that will serve as errata for this post later.]&lt;br /&gt;
&lt;br /&gt;
By &lt;a href=&quot;http://wiki.mises.org/wiki/Austrian_Business_Cycle_Theory&quot;&gt;ABCT, Austrian Business Cycle Theory&lt;/a&gt;, busts are mainly caused by low interest rates. We see the phenomenon here in Iceland, when Icelanders could borrow money in the form of foreign currency. Due to the large size of the Icelandic banks (among&amp;nbsp;other things), the belief in Icelandic Krona was high, causing it to be seemingly overvalued.&lt;br /&gt;
&lt;br /&gt;
This increased demand for the krona, and responding to this, the &lt;a href=&quot;http://en.wikipedia.org/wiki/Central_Bank_of_Iceland&quot;&gt;Central Bank of Iceland&lt;/a&gt;, through the&lt;a href=&quot;http://en.wikipedia.org/wiki/Floating_exchange_rates&quot;&gt; Floating exchange rate policy&lt;/a&gt;&amp;nbsp;raised the exchange rate. They might have tried to offer the krona undervalued, and then foreign currency would have flowed into the Central Banks stash, as always &lt;a href=&quot;http://wiki.mises.org/wiki/Gresham&#39;s_Law&quot;&gt;happens between good money and bad money&lt;/a&gt;, for all would have wanted to get their hands on the krona instead of the foreign currency, seeing as it was seen as being better.&lt;br /&gt;
&lt;br /&gt;
This enabled Icelanders to get pretty cheap loans for various items, and was used to buy cars etc. The price of housing was also artificially high, causing many&amp;nbsp;entrepreneurs&amp;nbsp;to go into housing construction, trapping capital in projects in which there was not as much demand as it seemed.&lt;br /&gt;
&lt;br /&gt;
Then, when the Icelandic banks fell, due to being in a &quot;liquidity trap&quot;, this of course raised the cost of capital to even higher levels than it should have been. When capital was now more expensive, the nations companies could not delve into projects they had planned, and many had to stop existing projects, like the famous Harpa, &amp;nbsp;and the building of the University of Reykjavik. The belief in the Icelandic Krona fell, and thus the exchange rate set by the Central Bank was too high, causing an outflow of foreign currency, as it was now determined as being overvalued, and now no one wanted the Icelandic Krona. They then lowered the exchange rate, and thus the foreign currency loans which so many thought were so cheap turned out to be not so cheap at all, merely a fluke.&lt;br /&gt;
&lt;br /&gt;
But why did this happen? How could the banks grow so large? Well, for one thing, they can count on getting bailouts if they over extend themselves, causing them to take bigger risks. When the Icelandic banks were originally privatized, the Icelandic State guaranteed some portion of the deposits, thus leaving even less worries for those in charge to having to meet their obligations, if things should ever go wrong.&lt;br /&gt;
&lt;br /&gt;
So what is the lesson here? How can we prevent this from happening again?&lt;br /&gt;
&lt;br /&gt;
Well, we could start by going onto a &lt;a href=&quot;http://en.wikipedia.org/wiki/Gold_standard&quot;&gt;gold standard&lt;/a&gt;, or some other standard in which the value of the currency is based on some commodity (though not many commodities, as this would fix the exchange rate between them). Gold is seen as a pretty good commodity to base this on, for there seems always to be demand for gold, it is a hassle to dig up more gold (certainly more than just to print more money/issue government bonds), and as it does not corrode, it does not decrease in value. It is also almost universally&amp;nbsp;acknowledged&amp;nbsp;that gold is&amp;nbsp;valuable&amp;nbsp; so people would accept gold as an exchange for other commodities.&lt;br /&gt;
&lt;br /&gt;
This would stifle inflation, as it is caused mainly by more money entering the system, and through the gold standard this becomes hard. It also helps people pick up the notion that we have an economy because of scarce resources, and to actually raise prices of every thing (that is demand more resources for everything), there must be more resources to demand. Demand is caused by, as I&#39;ve gone into before, people having supply and wanting to exchange it for something else. More demand for everything would mean that people had more supply of everything to demand for, and thus the problem would resolve itself.&lt;br /&gt;
&lt;br /&gt;
Another step would be to not bailout banks, and letting the market actually control itself. Removing the safety net of guaranteeing the deposits would also force people to evaluate whether they trust the bank to store their money, and as they&#39;d be on a gold standard, they wouldn&#39;t actually be losing money to inflation by keeping it at home. If they want to get interests, they will have to give their money to the banks, and face the fact that if you want your money to make money for you, you&#39;ll have to risk losing some of the money.&lt;br /&gt;
&lt;br /&gt;
Not allowing the banks to borrow out their depositors money except when explicitly allowed to do so would also be a step, for if they have a deal with every depositor that they&#39;ll give them their money back at any time, they are actually committing fraud the moment when they can&#39;t pay all back at once. Don&#39;t worry though, they would still be able to loan out money, though this would have to be on money that people put into locked accounts, say for three months, and the bank could then loan out the money for those three months and pay them back after that time, without having committed fraud.&lt;br /&gt;
&lt;br /&gt;
All this would create a much stabler banking system, which wouldn&#39;t have to rely on bailouts time and time again to be functional, nor having it committing fraud just to meet their expected obligations. With a stable banking system, the market could function as it should and inflation would be less.&lt;br /&gt;
&lt;br /&gt;
Though I&#39;m by no means a fan, I&#39;d like to end this note by quoting Keynes via Wikipedia, on how the government can use inflation to confiscate wealth from the citizen, for he seems to&amp;nbsp;have gotten this one right:&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;&quot;John Maynard Keynes, who had argued against such a gold standard, proposed to put the power to print money in the hands of the [&lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Bank_of_England&quot; style=&quot;font-family: inherit; line-height: 17px;&quot;&gt;then&lt;/a&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;] privately owned Bank of England. Keynes, in warning about the menaces of inflation, said, &quot;By a continuous process of inflation, governments can confiscate, secretly and unobserved, an important part of the wealth of their citizens. By this method, they not only confiscate, but they confiscate arbitrarily; and while the process impoverishes many, it actually enriches some&quot;.&quot; - &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://en.wikipedia.org/wiki/Gold_standard&quot; style=&quot;font-family: inherit; line-height: 17px;&quot;&gt;Wikipedia: Gold standard&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;This turned out a bit longer than I anticipated (I actually removed &quot;short&quot; from the title), but I hope it leaves you a bit more understanding of the crash and how we could break the cycle. If you are interested in more, I recommend &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://mises.org/document/617/What-Has-Government-Done-to-Our-Money&quot; style=&quot;font-family: inherit; line-height: 17px;&quot;&gt;What Has Government Done to Our Money? by Murray N. Rothbard&lt;/a&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;, available for purchase or free at the link provided.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;tl;dr:&amp;nbsp;Busts are caused by over expansion of credit. By limiting the possibility of this&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;over-expansion&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;&amp;nbsp; we might be able to break the &lt;/span&gt;&lt;/span&gt;&lt;a href=&quot;http://www.youtube.com/watch?v=d0nERTFo-Sk&amp;amp;list=PLI1Cj70VxcjFEQEVxbNhBel8FLilsBmpw&amp;amp;index=1&amp;amp;feature=plpp_video&quot; style=&quot;font-family: inherit; line-height: 17px;&quot;&gt;boom and bust cycle&lt;/a&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;span style=&quot;line-height: 17px;&quot;&gt;P.s.:&lt;br /&gt;If you spot any error, feel free to notify me so I can rectify it.&lt;/span&gt;&lt;/span&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/4555246080524909461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2012/10/a-note-on-icelandic-crash-from-amateur.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/4555246080524909461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/4555246080524909461'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2012/10/a-note-on-icelandic-crash-from-amateur.html' title='A note on the Icelandic crash from an amateur Austrian perspective.'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-6093048717939917665</id><published>2012-10-04T00:26:00.002+00:00</published><updated>2012-10-04T00:26:21.579+00:00</updated><title type='text'>Proposal for a 3D screen.</title><content type='html'>&lt;a href=&quot;http://pastebin.com/45qmcCem&quot;&gt;This paste&lt;/a&gt;&amp;nbsp;from Markus Persson (aka. Notch) got me thinking on how we could create a real life 3-D screen. Now, this has probably already been figured out before, but here is my proposal:&lt;br /&gt;&lt;br /&gt;Have n^3 little translucent cube each with a built in radio/Wi-Fi/Bluetooth receiver (preferably translucent too) and LED light. Assemble them into a cube, and ta-da, you have a 3-D screen that is n pixels on each side. I think the main challenge here would be to a) create the transparent receivers/lights and b) make them small enough so that a high resolution screen could be built without it being too big. Then, one could use Notch&#39;s standard to control the screen, up to 1000 pixels, but it could of course be easily extended further. I think it would be pretty neat, especially for plotting various 3-D functions, and just general displaying of designs, many of which are already drawn up in 3-D. This might also help designers realize their designs better. I think the possibility of this warrants further investigation.</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/6093048717939917665/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2012/10/proposal-for-3d-screen.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/6093048717939917665'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/6093048717939917665'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2012/10/proposal-for-3d-screen.html' title='Proposal for a 3D screen.'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-5272751506264199875</id><published>2012-09-11T00:31:00.002+00:00</published><updated>2012-09-11T22:37:55.859+00:00</updated><title type='text'>Fast multiplication using bitshift and addition.</title><content type='html'>I have realized a method which one can use to multiply two numbers faster than using only addition, by utilizing &lt;a href=&quot;http://en.wikipedia.org/wiki/Bitshift#Bit_shifts&quot;&gt;bitshift&lt;/a&gt;&amp;nbsp;in addition to addition. By using the same idea as the fast fast power adding, but utilizing operators of a lower degree, so instead of using powers and multiplication, we are using multiplication and addition.&lt;br /&gt;
&lt;br /&gt;
Now, when multiplying by a power of two in a binary environment, we are simply preforming a number of bitshifts to the left equal to the power of two, so this is an efficient operation. To get the multiplication of a number which is not a power of two, we can simply go over the bits in the number we are multiplying with, and adding up the bitshifts of each power of two times the number where the bit is equal to one.&lt;br /&gt;
&lt;br /&gt;
I think it is best to describe this with an example, e.g.:&lt;br /&gt;
Let us say we&#39;re multiplying 5 by 3, that is 0101 and 0011. Now, we go over the number and find that in 3, there are bits in slot 0 and 1 (enumerated from the left in a &lt;a href=&quot;http://en.wikipedia.org/wiki/Endianness&quot;&gt;little-endian&lt;/a&gt; system such as this), so we find that&lt;br /&gt;
5*3 = (0101*0011) = &amp;nbsp;(1010 + 0101) = 1111 = 15.&lt;br /&gt;
And all this pretty efficiently!&lt;br /&gt;
&lt;br /&gt;
We can use this to efficiently compute multiplication, and we can also use this to efficiently compute powers. Might we also use it to efficiently compute addition, using addition and successors? Or even higher order operators? Probably!&lt;br /&gt;
&lt;br /&gt;
Update: By efficiently, I mean that it minimizes the amount of additions needed to be done, in favor of the (I believe) computationally simpler bitshift operation, reducing the additions to floor(log_2(N)), where N is the lower number being multiplied with, if preformed correctly.</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/5272751506264199875/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2012/09/fast-multiplication-using-bitshift-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5272751506264199875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5272751506264199875'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2012/09/fast-multiplication-using-bitshift-and.html' title='Fast multiplication using bitshift and addition.'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-2363659803858482490</id><published>2012-08-20T16:44:00.001+00:00</published><updated>2012-09-11T00:58:00.334+00:00</updated><title type='text'>What is computation?</title><content type='html'>Computation has many forms, but they all lead to the same result, and they are thus all equally valid. One of those forms is simplification, as in reduction. This is what allows lambda-calculus to compute. When I state the expression x + 5 = 8, the answer is already there. Every bit of information needed to &quot;solve for x&quot; is already embedded in the statement itself. Thus we can simplify, &lt;i&gt;reduce it&lt;/i&gt;, to the statement x = 3. This makes it more clearer what x is, and is thus simplified.&lt;br /&gt;
&lt;br /&gt;
That, in its essence, is what computation is. It&#39;s the simplification of statements into simpler statements. It is shown in languages such as Haskell, that one can do very powerful things without manipulating variables, by using just the reduction of statements into their simpler forms to compute. It has been shown that lambda-calculus is Turing complete, and can thus compute all efficiently computable expressions.&lt;br /&gt;
&lt;br /&gt;
But what about NP problems? NP problems are problems that cannot be computed in polynomial time as of what we know now. It has however, not been proven that NP =/= P nor that NP = P, so we don&#39;t know whether they can or cannot be computed in P time. But as we have seen, they contain all the information needed to solve them, we just don&#39;t know any better ways than to try all the different combinations. But they are computable.</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/2363659803858482490/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2012/08/what-is-computation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/2363659803858482490'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/2363659803858482490'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2012/08/what-is-computation.html' title='What is computation?'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-3848664205051919409</id><published>2012-08-11T17:05:00.004+00:00</published><updated>2012-08-11T17:06:28.617+00:00</updated><title type='text'>Say&#39;s Law</title><content type='html'>Say&#39;s law is a fundamental law of economics, which Lord John M. Keynes claims to have refuted. In his work, The General Theory of Employment, Interest and Money, he states Say&#39;s law as &quot;supply creates it&#39;s own demand&quot;. This statement however, leads to a wrong&amp;nbsp;interpretation&amp;nbsp;of the law. The true law is not that &quot;supply creates it&#39;s own demand&quot;, but rather that to demand, one must supply, for how would one trade if one did not &amp;nbsp;have anything to trade with? So a true statement of the law would be &quot;one&#39;s own supply creates one&#39;s own demand&quot;, for what you can demand in trade is a function of what you can supply to trade with.</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/3848664205051919409/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2012/08/says-law.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/3848664205051919409'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/3848664205051919409'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2012/08/says-law.html' title='Say&#39;s Law'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-851827262084667714</id><published>2012-08-04T23:14:00.000+00:00</published><updated>2012-08-04T23:18:02.507+00:00</updated><title type='text'>What entrepreneurs give back to society</title><content type='html'>The trend when justifying tax on production, is that the framework that society provides made the profits that the entrepreneurs utilizing the resource got for their trouble possible, and thus it is only natural that the entrepreneurs give something back to society.&lt;br /&gt;
&lt;br /&gt;
What is often forgotten is that these entrepreneurs have already given back to society. If they have made enough of the economic good so as if to satisfy their own demand, they lower the price by lowering the general demand for the good. If they have surplus and trade it for other goods, they have increased the supply, thus further reducing the price of that good. Both these effects lead to a lower price of the good, and thus people have easier access to it.&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;One could argue that this portion of the price which the entrepreneurial outfit lowers is what the entrepreneur gives back to society, and does this through the market. Whether this portion is enough, is another issue. But let it not be said that the entrepreneurs give nothing back to society.</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/851827262084667714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2012/08/what-entrepreneurs-give-back-to-society.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/851827262084667714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/851827262084667714'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2012/08/what-entrepreneurs-give-back-to-society.html' title='What entrepreneurs give back to society'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-5820307642767518474</id><published>2012-08-04T12:48:00.003+00:00</published><updated>2012-08-04T16:35:50.273+00:00</updated><title type='text'>Intuitive definitions of operations</title><content type='html'>Disclaimer: All of this is pure speculation, and should not be take seriously. Inspiration taken from the Wikipedia articles on the &lt;a href=&quot;http://en.wikipedia.org/wiki/Ackermann_function&quot;&gt;Ackermann function&lt;/a&gt; and &lt;a href=&quot;http://en.wikipedia.org/wiki/Hyperoperations&quot;&gt;Hyperoperations&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
It&#39;s interesting to note how the common operations in mathematics are easy to define from one another, on the set of positive natural numbers. The only thing we need for addition, multiplication and&amp;nbsp;exponentiation&amp;nbsp;is simply a function which gives us the next &amp;nbsp;member of the natural number set, &amp;nbsp;e.g. the next integer. We&#39;ll call this function S(x) (S for successor).&lt;br /&gt;
&lt;br /&gt;
Now, onto the definitions:&lt;br /&gt;
S(x) is the function which maps x, a member of a set, to the next member of that set.&lt;br /&gt;
We can define Add(a,b)* as S(S(S(...S(a)...), where the S function is applied b times.&lt;br /&gt;
Then Mul(a,b) ** is Add(a,Add(a,...Add(a,a)..) where Add is applied b times,&lt;br /&gt;
And Exp(a,b)*** is Mul(a,Mul(a,...Mul(a,a)..) where Mul is applied b times.&lt;br /&gt;
&lt;br /&gt;
Simple as that!****&lt;br /&gt;
&lt;br /&gt;
From this we can see, that if you want a machine that&#39;s able to preform addition, multiplication and exponentiation on the positive natural numbers, it is sufficient that it can apply the successor function to the members, and that it can call functions recursively.&lt;br /&gt;
&lt;br /&gt;
If we&#39;d want to define subtraction, we&#39;d simply swap the successor function for the predecessor function P. The multiplication function would then become a multiplication of a negative and a positive number, and the exponentiation function would be an exponentiation of a negative number. If we define the (-) sign, when joined with a as this operation (the swapping of S for P), we now have negative numbers (note however that b must remain a positive natural number, but a can be any integer).&lt;br /&gt;
&lt;br /&gt;
It would be interesting to see what happens if we use this definition on other sets, and might be a cause for inquiry later.&lt;br /&gt;
&lt;br /&gt;
Notes:&lt;br /&gt;
&lt;br /&gt;
* Usually written as a+b&lt;br /&gt;
** Usually written as a*b&lt;br /&gt;
*** Usually written as a^b (not to be confused with the natural exponent)&lt;br /&gt;
**** We could of course logically continue this process, and get operations where OP_n(a,b) is OP_(n-1) (a,OP_(n-1)(a,...OP_(n-1)(a,a)..) where OP_(n-1) is applied b times.&lt;br /&gt;
&lt;br /&gt;p.s. If you spot an error, point it out!</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/5820307642767518474/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2012/08/intuitive-definitions-of-operations.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5820307642767518474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/5820307642767518474'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2012/08/intuitive-definitions-of-operations.html' title='Intuitive definitions of operations'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3186290751960268973.post-9055847971850483549</id><published>2012-08-04T09:08:00.002+00:00</published><updated>2012-08-04T09:08:29.450+00:00</updated><title type='text'>The Dawn of a New Blog</title><content type='html'>&lt;br /&gt;
I&#39;ve decided to publish some of my thoughts and tales, for whomever might be interested in reading them.&lt;br /&gt;
&lt;br /&gt;
The first thing I&#39;d like to do is link to my&amp;nbsp;&lt;a href=&quot;https://github.com/Tritlo&quot;&gt;Github profile&lt;/a&gt;, where many of my programming projects will be published. Currently, it only has two, a program which simulates&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Conway%27s_Game_of_Life&quot;&gt;Conway&#39;s Game of Life&lt;/a&gt;&amp;nbsp;(and other&lt;a href=&quot;http://en.wikipedia.org/wiki/Life-like_cellular_automaton&quot;&gt;&amp;nbsp;Life-like cellular automata&lt;/a&gt;), and a program which efficiently calculates all&amp;nbsp;&lt;a href=&quot;http://en.wikipedia.org/wiki/Parasitic_numbers&quot;&gt;2-parasitic numbers&lt;/a&gt;&amp;nbsp;less than N in O(log_10(N)) time.&lt;br /&gt;
&lt;br /&gt;
Recently, I&#39;ve been taking a Standford Cryptography course through Coursera, which has involved some programming, but in order to encourage others to figure it out themselves, I&#39;ve decided not to share those programs.&lt;br /&gt;
&lt;br /&gt;
I hope you enjoy the tales!&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://blog.mpg.is/feeds/9055847971850483549/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://blog.mpg.is/2012/08/the-dawn-of-new-blog.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/9055847971850483549'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3186290751960268973/posts/default/9055847971850483549'/><link rel='alternate' type='text/html' href='http://blog.mpg.is/2012/08/the-dawn-of-new-blog.html' title='The Dawn of a New Blog'/><author><name>Matthías Páll Gissurarson</name><uri>http://www.blogger.com/profile/13084667521069523745</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry></feed>