23 July 2013

# Ubuntu Edge

It's finally here: The Ubuntu Phone!
Well, almost...
Canonical anounced yesterday the Indiegogo campaign to fund the "commercial testbed for cutting-edge technologies" in the mobile industry: the production of the Ubuntu edge.
Initial funders could buy an ubuntu edge for $600, but limited to the first day and to 5000 funders. This first goal was reached rather quickly and now the phone costs$830. While the initial surge for the $600 edge suggested a rather high funding end-point, the pace has significantly slowed down after the first 5000 phones were sold. Let's hope the$32.000.000 can be reached in the 30 days period...
Update: Meanwhile Canonical offered several new reduced perks. While the "double edge" did not have a huge effect, the even newer and limited perks can be seen very clearly as different gradients in the funding curve.
Update2: Canonical has now also started the T-Shirt perk for $50. You can see the funding jump by zooming into 2013-07-30 11:30 UTC. Below is a graph of the funding process. The trending line uses the last couple of datapoints to extrapolate (via a simple linear regression). Do not take this too seriously, since the typical behaviour of crowd-funding campaigns follows more complicated rules than a simple linear trend. • Interaction: click-and-drag to pan, use the mousewheel to zoom, mouseover for a tooltip • Updates: automatically updated every 3minutes And since we all love graphs, here is one with the growth per hour...(sorry for the 1h data-gap, the bar surrounded by gaps is actually the sum of two hours): 11 July 2013 # What to do when you forgot the Django admin password on OpenShift So, you created a django app on OpenShift, added some changes, push the changes, ... and forgot to note the admin password! ## What to do next? It's actually quite easy: 1. ssh into your application 2. start the virtual env: source$OPENSHIFT_HOMEDIR/python/virtenv/bin/activate

3. change to the app dir:

is really a good thing, both for readability and for typing speed. Update: actually it's not that simple. But it got simpler with TexLive 2009. I have something like this in the preamble of my documents:
    \usepackage{mathspec}
\setmainfont[Mapping=tex-text]{CMU Serif}
\setsansfont[Mapping=tex-text]{CMU Sans Serif}
\setmathsfont(Greek,Latin){CMU Serif}
\setmathsfont(Digits){Neo Euler}

To insert greek characters in emacs, just type:
    C-\ greek RET

From then on, the

C-\

will switch between greek input and your normal input.

### PDFSync

Sometimes in larger documents, you want to jump directly from a line in your latex file to the corresponding line in the pdf file. With pdfsync and xpdf, this is possible (note that with TexShop the other way is also possible, but not with emacs at the moment). In you Latex file, insert the following:
    \usepackage{pdfsync}


Now just type:
    C-c C-v

and the line will be displayed in xpdf. Nice.

### OrgMode Tables

The Emacs Org mode is a great mode for table editing (and other things). The table editing mode can be called separate from the complete Org mode, which is a great tool for example for Latex, where the table editing is something very unpleasant! The following work flow helps a lot, but check out the full example here for more advanced options: OrgMode Manual
Let's start with a Latex file with the comment package (the org mode table is within a comment environment, so your latex does not get messed up!):
    \documentclass{article}
\usepackage{comment}
\begin{document}
Hallo!\\
\end{document}

Then type:
    M-x orgtbl-mode

This will ask you for a table name, let's say: atesttable
Now the document looks like this:
    \documentclass{article}
\usepackage{comment}
\begin{document}
Hallo!\\
\begin{comment}
#+ORGTBL: SEND atesttable orgtbl-to-latex :splice nil :skip 0
| | |
\end{comment}
\end{document}

And then you can change the table using the great OrgMode capabilities! Once you have done this, type
    C-c C-c

This will update the latex table to something like this:
    \documentclass{article}
\usepackage{comment}
\begin{document}
Hallo!\\
\begin{tabular}{rll}
Times [sec] & Names & something else \\
\hline
3 & John & hi \\
4 & Elisa & ho \\
5 & Nobody & hiho \\
&  &  \\
\end{tabular}
\begin{comment}
#+ORGTBL: SEND atesttable orgtbl-to-latex :splice nil :skip 0
| Times [sec] | Names  | something else |
|-------------+--------+----------------|
|           3 | John   | hi             |
|           4 | Elisa  | ho             |
|           5 | Nobody | hiho           |
|             |        |                |
\end{comment}
\end{document}

That's it. My current setup and usage of Emacs as a Latex IDE.

09 April 2009

03 April 2009

# OpenOffice

Why do I even try to used it again and again?
OpenOffice 3 crashed for the third time today. I really should have made that presentation with Latex-Beamer!
Oh and by the way: If I write μController I don't mean Mcontroller, AutoCorrect seems to think different...

27 March 2009

03 March 2009

# Precision of float calculations

Given that a and b are positive, the calculation:

a*b
and
exp(log(a)+log(b))
are mathematically the same.

### But is this true in computer languages?

a:1.2345678e-30
b:5.5889944e-28
The real result is: 6.89999252062032 e-58
What do the following programs tell me?

### C

#include <math.h>
#include <stdio.h>

int main(){
double a = 1.2345678e-30;
double b = 5.5889944e-28;
double c, d;

c = a * b;
d = exp(log(a)+log(b));

printf("a * b =                %.20e \n", c);
printf("exp(log(a) + log(b)) = %.20e \n", d);
return 0;
};


output:
 a * b = 6.89999252062031977189e-58 exp(log(a) + log(b)) = 6.89999252062023345995e-58  The real result is: 6.89999252062032

### Python

import math
a = 1.2345678e-30
b = 5.5889944e-28
print "----------math----------"
print "a * b =                %s" % repr(a*b)
print "exp(log(a) + log(b)) = %s" % repr(math.exp(math.log(a)+math.log(b)))

import mpmath
mpmath.mp.dps = 20
a = mpmath.mpf(1.2345678e-30)
b = mpmath.mpf(5.5889944e-28)
print "---------mpmath---------"
print "a * b =                %s" % repr(a*b)
print "exp(log(a) + log(b)) = %s" % repr(mpmath.exp(mpmath.log(a)+mpmath.log(b)))

output:
 ----------math---------- a * b = 6.8999925206203198e-58 exp(log(a) + log(b)) = 6.8999925206202335e-58 ---------mpmath--------- a * b = mpf('6.8999925206203201922352e-58') exp(log(a) + log(b)) = mpf('6.8999925206203201919869e-58')  The real result is: 6.89999252062032

### Scheme

(define x 0.0000000000000000000000000000012345678)
(define y 0.00000000000000000000000000055889944)
(* x y)
(exp (+ (log x) (log y)))

output:
 6.89999252062032e-58 6.899992520620233e-58 

### R

c = 1.2345678e-30 * 5.5889944e-28 print(c, digits=20) d = exp(log(1.2345678e-30) + log(5.5889944e-28)) print(d, digits=20)
output:
6.89999252062032e-58
6.899992520620233e-58
the real result is 6.89999252062032 e-58

### gcalctool

Not exactly a language, but interesting: the result is 6.89999252062032e-58 for a*b.
Note, that the standard windows calculator also prints the exact result.

### So what is the result:

Language Results
c: 6.89999252062031977189 e-58
6.89999252062023345995 e-58
python (math): 6.8999925206203198 e-58
6.8999925206202335 e-58
python (mpmath): 6.8999925206203201922352 e-58
6.8999925206203201919869 e-58
scheme: 6.89999252062032 e-58
6.899992520620233 e-58
R 6.89999252062032e-58
6.899992520620233e-58
gcalculator and windows calculator: 6.89999252062032 e-58
the real result: 6.89999252062032 e-58

27 Feb. 2009

# Xfce 4.6 released

You might have read it already, but today the Xfce team released Xfce 4.6!
Congratulation to the developers.
Take a look at the new features here: Tour

24 Feb. 2009

# Scientific python packages

I use these packages regularly:
• python 2.5 (http://www.python.org)
• matplotlib (http://sourceforge.net/projects/matplotlib)
• kapteyn (http://www.astro.rug.nl/software/kapteyn/)
• mayavi2 ( http://code.enthought.com/projects/mayavi/docs/development/html/mayavi/installation.html)

13 Feb. 2009

# To be done... part 2: Meta-information

#### My Problem:

I have a lot of unsorted scientific papers! Their filenames don't resemble their titles and they are stored in a bunch of places. I tend to download them as I search the internet for papers that help me with a problem and sometimes I even DownThemAll.
Weeks, month later, I try to find the *one paper* that was so interesting and cite it via BibTex in my Latex file. But I can't remember the filename, title, author, year or journal (in any combination).
Or I see a paper, know that I read it, but can't remember if it was that good...

#### Possible Solution:

Using a search engine (Tracker), a bibliography manager (Referencer) and a file manager (Thunar).
With Thunar, I can mark files as interesting.
With Tracker I can search the text of a document and tag it.
With Referencer I can tag a paper and export the meta-information to a Bibtex file.

#### Why I'm still unhappy:

It seems that Tracker, Referencer and Thunar don't use the same location to store meta-information about the documents. They all seem to use different databases. I would have to write a plugin for two of them to get the three of them working together.
Not good.

31 Jan. 2009

# Using numdisplay

Numdisplay is one of the cool python astronomy packages that lack documentation! What I want to do is display an image from the python shell (easy and well documented) and this image shall contain WCS information, because otherwise I could as well use matplotlib (really hard and NOT documented).
What I know so far:
1. open ds9 with the following command:
ds9 -unix "/tmp/.IMT3"
2. in the python shell create an UnixImageDisplay
uid = numdisplay.displaydev.UnixImageDisplay("/tmp/.IMT3")
3. don't really know how to continue ... the wcs stuff seems not to work the way I expect ...

Next try, this time with python-sao:
import pysao
ds9 = pysao.ds9()
ds9.view(hdul[6])


Much better :-)

08 Jan. 2009

# Python, Astronomy and Maps

Update: the solution is here: Kapteyn
Update 2: there is also a new package that I have not tested, but that seems to be good: APLpy
Update 3: and now there is also: pywcsgrid2

You might want to look at the following site for more up to date information: astropython

Python is a good language for scientists. It basically replaces proprietary software like IDL, Matlab or SAS. What it lacks at the moment is an easy way to display astronomical data saved as fits files containing WCS information.
WCS information standardizes the transformation between pixel coordinates and world coordinates (e.g. position in the sky). There is a good library, pywcs, that deals with this information. Matplotlib, a good choice for plotting data with python, includes Basemap, a toolkit to display maps (of the earth) in various projections. What is missing is a link between these two!

What kinds of projections are supplied by basemap and wcs?
Basemap nameFITS Code [WCS]Names
AZPZenithal perspective
SZPSlant zenithal perspective
Gnomonic ProjectionTANGnomonic
Stereographic ProjectionSTGStereographic
SINSlant orthographic
ARCZenithal equidistant
ZPNZenithal polynomial
Lambert Azimuthal Equal Area ProjectionZEAZenithal equal area
AIRAiry
CYPCylindrical perspective
CEACylindrical equal area
Cassini ProjectionCAR transverse case
CARPlate carree
Miller Cylindrical ProjectionCAR with unequal scaling
Mercator ProjectionMERMercator
Transverse Mercator ProjectionMER transverse case
Oblique Mercator Projection
Equidistant Cylindrical Projection
Sinusoidal ProjectionSFLSanson-Flamsteed
PARParabolic
Mollweide ProjectionMOLMollweide
AITHammer-Aitoff
COPConic perspective
Albers Equal Area ProjectionCOEConic equal-area
Equidistant Conic ProjectionCODConic equidistant
COOComic orthomorphic
Lambert Conformal Projection for sperical earth = COO
BONBonne's equal area
Polyconic ProjectionPCOPolyconic
TSCTangential Sperical Cube
Azimuthal Equidistant Projection
Orthographic Projection
Geostationary Projection
Robinson Projection
Gall Stereographic Projection
Polar Stereographic Projection
Polar Lambert Azimuthal Projection
Polar Azimuthal Equidistant Projection
McBryde-Thomas Flat Polar Quartic
van der Grinten Projection

08 Jan. 2009

# This is my first post

I wanted to switch from blogger to my own blogging software.
The main reason for this was that I wanted to do more with django and building my own blogging solution seemed to be a good start. I looked into pinax blog app and copied most part from there... And it seems to work!
What is missing:
• a cool admin interface (is it possible to include an emacs-nox into a django admin interface? that would be interesting...)
• file upload with automatic reference from within the blog post. Something like "attachment[1]"

28 Sept. 2008

# To be done ... part 1: PDF Annotations

Sometimes I think that there are so many problems to fix on the free desktop...
Today: PDF Annotation!

The PDF specification includes annotations, with position, color, text, highlighting, whatever.
This is a really useful feature, because I think that PDFs are an excellent way to share documents with other people, who are often supposed to make some corrections on that document (and no one wants to share whole latex directories...).
So if you work in a Microsoft environment, you are allowed to buy Adobe Acrobat. If you work on Mac OSX, you can use "preview" to annotate PDFs (in a very intuitive way). But if you work on GNU/Linux there are no good programs to do that.
Sure, there are a lot of programs, that you can use to do something very close to that, but thats not enough!

1. PDFedit: the interface is not very friendly. There is no back/undo button. There is no way to highlight just a word, strike through just a word. Make a box and add some text outside the page borders. AND I DONT NEED 10 colors for my pencil. 3 colors would be more then enough!
2. OpenOffice 3: The fonts are broken. Every time. If I can't read the PDF, I can't annotate it. And others won't be able to read my annotations. (And I don't even know, if annotations would be possible in OpenOffice...
3. Inkscape: Fonts are broken too. Only one page is open at a time. NO WAY.
4. Xournal: Close, but ... A simple box to write some text would be cool. Text highlighting as well. I know that it's not possible if the page is only loaded as an image, but that's what I would need.
5. Evince: well, there will be Annotation support at some time in the future, ... (hopefully).

19 July 2007

# Meld

Today I "discovered" Meld.
Meld is a tool to compare two files or directories, just like diff, but it has a really cool interface.
Here are some screenshots:

And after scrolling a bit down:

Wow. That's how I like a visual diff to appear. Both files are scrolled simultaniously, but in a way that takes care of the different file sizes. So you can always see the corresponding lines side by side.
And yes the arrows are for melding the differences from one file to the other.

This is really a tool that adds some value by using a good graphical interface.