Today, I ran some tests with pypy and my few Project Euler solutions:
| Solution | Python 2.6.6 | PyPy 1.5 | Factor |
|---|---|---|---|
| 7 | 9.57s | 1.92s | 4.98 |
| 7_b | 0.52s | 0.14s | 3.71 |
| 9 | 0.51s | 0.10s | 5.1 |
| 14 | 6.70s | 6.97s | 0.96 |
| 25 | 1.25s | 0.68s | 1.83 |
I guess the main message to take home is (see especially 7 and 7_b): a good algorithm is way more important then the interpreter, but if you can choose (e.g. you don't need numpy), then why not use PyPy and gain some speed?
Today was another wasted day, mostly caused by Latex. To sum it up: Although there is no real alternative to Latex, and I will therefore continue to use it in the future: IT SUCKS!
Consider the following problem:
I want no pagenumbers on all pages from the first, until after the list-of-tables.
If Latex would be sensibly designed, somthing like the following would work:
\pagestyle{empty}
\maketitle
\tableofcontents
\listoffigures
\listoftables
\pagestyle{headings}
\usepackage{scrpage2}
[...]
\clearpage
\pagestyle{empty}
\renewcommand*{\chapterpagestyle}{empty}
\maketitle
\tableofcontents
\listoffigures
\listoftables
\addtocontents{toc}{\protect\thispagestyle{empty}}
\addtocontents{lof}{\protect\thispagestyle{empty}}
\addtocontents{lot}{\protect\thispagestyle{empty}}
\clearpage
\pagestyle{headings}
\renewcommand*{\chapterpagestyle}{plain}
And then run latex several times ...
Time to say goodby to Nokia phones and "hello!" to android (and hope for Ubuntu on smartphones...)
Today Nokia and Intel announced the merging of maemo and moblin to form MeeGo (TM).
While this might sound good to some, it is a bit sad for me. The first thing I'm sad of is the focus on C++ and Qt. As you might know, maemo 5, the operating system of the N900, is based on gtk and clutter.
Quote:
GTK and Clutter are also included for application compatibility.To me this sounds like: will be dropped in the next version.
But the biggest loss in this merge is the packet management system, which will be rpm.
Quote:
So: today I lost the urge to learn to develop software for my N900...Will MeeGo use .rpm or .deb as its packaging system?
MeeGo will use the .rpm format
I have had some trouble to figure out how to use a class as a decorator for a method (as opposed to a decorator for a function). Here is a script that prints some useful information about what is called when and with what parameters.
#!/usr/bin/env python
print "Classes as Decorators of Methods\n"
print "-----Parsing dec"
class dec(object):
def __init__(self, a):
print "----- dec init"
print type(a)
print "decorated method: ", a.__name__
self.a = a
def __get__(self, inst, cls):
print "-----dec get"
self._inst = inst
self._cls = cls
return self
def __call__(self, p):
print "-----dec call"
print type(self)
print type(self._inst)
print type(self._cls)
return self.a(self._inst, p.upper())
print "-----Parsing C"
class C(object):
def __init__(self):
self.X = "Hello"
@dec
def run(self, p):
print p,
print self.X,
return "world"
if __name__ == "__main__":
print "-----Object creation"
c = C()
print "-----Object method call"
print c.run("This is a decorator ")
#!/usr/bin/env python
print "--- Parsing dec"
def dec(f):
print "--- Run dec"
print f.__defaults__
def x(*args, **kwargs):
print "--- Run x"
print f.__name__
print args
print kwargs
f(*args, **kwargs)
return x
print "--- Parsing foo"
@dec
def foo(a, b=3):
print "--- Run foo"
print a, b
print "--- Calling foo"
foo(1)
print "--- Calling foo"
foo(2, 4)
Which outputs:Today I realized that the django way of internationalization is not as good as I had thought. Here are two areas where it could be improved:
Django has no default way of translating fields in models. This is a known shortcoming and was addressed in many plugins (transdb, transmeta, multilingual>, multilingual-model, translate, ...) and in a Google Summer of Code project by Marc Garcia.
As I see it, the translation of any kind of data should not be in a seperate table or in a metaclass. Why? Because translation should not be the way to think in the first place. If you have a piece of information that is not universally understandable (like an photograph), than you can assign a language or culture to that information. If your site should be available in several languages, then there is no good reason why one language should be superior (and allowed in the model), while other languages are inferior (and have to go into a translation table). So there is no translation of a first, superior string but there is a piece of information in different, equally important languages.
So, with regard to this poll, the only good option would be to state "this field is language specific" and django should create a field for every supported language (mainly like multilingual-model).
The admin interface should display these fields and a bonus would be to be able to create a report based on the missing translation fields.
But there are other fields where internationalization is also important and where I couldn't find any plugins or snippets. It's the url resolution. Your apps should have human-readable urls that don't change over time. Suppose you have this url in your shop: "/smartphone/linux/N900" and suppose that "smartphone" is a category that was not planned when the shop was planned but rather entered in the admin as a (translatable) categorization of a specific phone. Now if you want to make this translatable, you have to create a pattern like
"(?P
but how is that supposed to be distinguished from
"(?P
if these things should also be translatable? So the point is: the regular expressions in the url resolution mechanism are not translatable (if the strings are dynamical db content).
The could be an url manager that can receive signals about a change in the urls patterns. And there should be an attribute (db-field, function, ...) in every model or view which can take translatable fields as parameters and create and update the corresponding urlpatterns.
Angelia27REESE wrote: Various people all over the world receive the <a href="http://goodfinance-blog.com/topics/credit-loans">credit loans</a> in various banks, just because it is simple and comfortable.
If you work in Astronomy, you will likely have a lot of fits files lying around. Although the FITS format is absolutely not an image-only format, I would still like to see a preview in my filemanager if there is an image encoded in the file. The standard thumbnailers for Xubuntu don't do this, so here is how to create your own:
/usr/share/thumbnailers/fits-thumbnailer.desktop
[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=X-Thumbnailer
Name=FITS Thumbnailer
MimeType=image/x-fits;image/fits;application/fits;
X-Thumbnailer-Exec=python /usr/lib/thunar-thumbnailers/fits-thumbnailer.py %i %o %s
/usr/lib/thunar-thumbnailers/fits-thumbnailer.py
#!/usr/bin/env python
import pyfits
import matplotlib.pyplot as plt
import sys
try:
infile = sys.argv[1]
outfile = sys.argv[2]
except:
exit(1)
try:
size = sys.argv[3]
except:
size = 256
hdul = pyfits.open(infile)
data = None
# Is the primary HeaderDataUnit an image with data?
if (hdul[0].header["NAXIS"] != 0):
data = hdul[0].data
else:
# The primary had no data, so we search for the first image!
for hdu in hdul[1:]:
if (hdu.header["XTENSION"] == "IMAGE"):
data = hdu.data
break
if data != None:
plt.imshow(data)
plt.savefig(outfile, transparent=False, format="png")
/usr/lib/thunar/thunar-vfs-update-thumbnailers-cache-1
There are actually a lot of cases, where this will not work, it will not take WCS into account and is in general not very sophisticated, but it works for me (TM). For more information about Thunar thumbnailers see:
Additional thunar thumbnailers
Freedesktop thumbnailer spezification
Freedesktop desktop-entry spezification
term papers online wrote: There're no doubts that to buy term paper services of the highest quality at expert custom papers writing company is good decision for college students who don't ideas how to start their essays.
In a Latex figure environment, the label command has to follow the caption command. Otherwise referencing the figure will result in the section number (where the figure appeared) to be printed. Sometimes Latex is not very user friendly...
\begin{figure}[!th]
\centering
\includegraphics[width=2.5in]{some_filename}
\caption{some caption}
\label{fig:some_image}
\end{figure}
writing jobs wrote: This is surely nice that you are sharing the topic just about this post, therefore, I propose to use the assistance at the writer job service.
Update 2009-11-13: more notes on the greek input
I use the AUCTex mode in Emacs, which has lots of useful features. Here is a mix of commands and additions that help me improve the Emacs-Latex experience: RefTex (actually you will already use this if you use AUCTex mode), Greek Emacs input, PDFSync and Orgmode tables.
There is much to say about reftex. But I'll just show the two commands that I use regularly:
C-c =
This will open a buffer where you can navigate through your document's toc.

This comes very handy for large projects like PhD thesis :-). With python I use something like outline mode for roughly the same purpose, but this is perfect for my latex documents.
The other shortcut I use is:
C-c [
This command will ask you for your citation style

and for a regulare expression for searching your bibtex file to find the reference.

Then you can navigate through the matching references and choose the one that you want.

With a single bibtex file containing about 1000 references (managed with referencer) this feature is very handy.
If you are using texlive / xetex, then you have full utf-8 support built-in. Now you need a way to use it :-) If you write in a language other then english, you probably already use this feature.
Just typing
äöüß
instead of
\"a\"o\"u\ss{}
is already good. But being able to also type:
$αβγ = 3μm$
instead of
$\alpha\beta\gamma = 3\mum$
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.
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.
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
M-x orgtbl-insert-radio-table
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 RECEIVE ORGTBL atesttable
% END RECEIVE ORGTBL atesttable
\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 RECEIVE ORGTBL atesttable
\begin{tabular}{rll}
Times [sec] & Names & something else \\
\hline
3 & John & hi \\
4 & Elisa & ho \\
5 & Nobody & hiho \\
& & \\
\end{tabular}
% END RECEIVE ORGTBL atesttable
\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}
Bomentepe wrote: <a href=http://www.realcazinoz.com/riverbellecasino.htm>online casino</a>
mimiWrifetE wrote: <a href=http://www.onlinepokiesonline.com>free casino bonus</a> <a href=http://www.casinovisa.com/blackjack/>blackjack</a> , <a href=http://www.concordiaresearch.com/games/craps/index.html>roulette</a> , <a href=http://www.realcazinoz.com/bingo>paypal casino</a> , <a href=http://www.avi.vg/category.php?a=sex4sexx&cid=36>dongs</a>
Bomentepe wrote: <a href=http://www.casinoonlinebrazil.com/jogos-de-cassino>online blackjack</a> <a href=http://www.realcazinoz.com/mansion-casino.htm>casino mansion</a> <a href=http://www.realcazinoz.com/de/jackpotcity-casino-gratis.htm>jackpotcity</a> <a href=http://www.planet23.com/winner-bonus-code>winner casino</a> <a href=http://www.realcazinoz.com/swiss-casino.htm>casino swiss</a>
Given that a and b are positive, the calculation:
a:1.2345678e-30
b:5.5889944e-28
The real result is: 6.89999252062032 e-58
What do the following programs tell me?
#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;
};
a * b = 6.89999252062031977189e-58
exp(log(a) + log(b)) = 6.89999252062023345995e-58
The real result is: 6.89999252062032
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)))
----------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
6.89999252062032e-58
6.899992520620233e-58
| 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 |
high voltage cable testing wrote: I’m so glad that ordered high voltage cable testing of capacitors as this helped me to determine that there were the errors with their placing.
online essays wrote: If you want to build brilliant career, you will be able to buy custom writing at certified service.
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...
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.
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.
essays online wrote: It can be very comfortable to purchase course works from homes at the essay service. However, that is essential to hire professional paper writers.
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).
Much better :-)
buy essays wrote: If you think that to buy custom essay supposes to be bad, then you can be wrong! The writing corporations used to be invented to aid guys and that is not a crime if you look for a help!
buy essays uk wrote: The the greatest problem of academic papers writing market. Qulified uk papers service should get you assurance that its papers are non-plagiarized.
weddingcall wrote: <a href="http://www.dressmall.co.uk/sale-plus-size-wedding-dresses-46.html">Plus Size Wedding Dresses</a> <a href="http://www.dressmall.co.uk/sale-prom-dresses-2011-14.html">Prom Dresses 2011</a> <a href="http://www.dressmall.co.uk/sale-short-bridesmaid-dresses-42.html">Short Bridesmaid Dresses</a> <a href="http://www.dressmall.co.uk/sale-short-prom-dresses-19.html">Short Prom Dresses</a> <a href="http://www.dressmall.co.uk/sale-short-wedding-dresses-48.html">Short Wedding Dresses</a> <a href="http://www.dressmall.co.uk/sale-simple-wedding-dresses-49.html">Simple Wedding Dresses</a> <a href="http://www.dressmall.co.uk/sale-strapless-bridesmaid-dresses-43.html">Strapless Bridesmaid Dresses</a> <a href="http://www.dressmall.co.uk/sale-wedding-dresses-2011-52.html">Wedding Dresses 2011</a> <a href="http://www.dressmall.co.uk/sale-white-ivory-prom-dresses-38.html">White & Ivory Prom Dresses</a> <a href="http://www.dressmall.co.uk/sale-low-vneck-dresses-22.html">Low V-Neck Dresses</a> <a href="http://www.dressmall.co.uk/sale-plus-size-prom-dresses-21.html">Plus Size Prom Dresses</a>
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!
| Basemap name | FITS Code WCS | Names | |
|---|---|---|---|
| AZP | Zenithal perspective | ||
| SZP | Slant zenithal perspective | ||
| Gnomonic Projection | TAN | Gnomonic | |
| Stereographic Projection | STG | Stereographic | |
| SIN | Slant orthographic | ||
| ARC | Zenithal equidistant | ||
| ZPN | Zenithal polynomial | ||
| Lambert Azimuthal Equal Area Projection | ZEA | Zenithal equal area | |
| AIR | Airy | ||
| CYP | Cylindrical perspective | ||
| CEA | Cylindrical equal area | ||
| Cassini Projection | CAR transverse case | ||
| CAR | Plate carree | ||
| Miller Cylindrical Projection | CAR with unequal scaling | ||
| Mercator Projection | MER | Mercator | |
| Transverse Mercator Projection | MER transverse case | ||
| Oblique Mercator Projection | |||
| Equidistant Cylindrical Projection | |||
| Sinusoidal Projection | SFL | Sanson-Flamsteed | |
| PAR | Parabolic | ||
| Mollweide Projection | MOL | Mollweide | |
| AIT | Hammer-Aitoff | ||
| COP | Conic perspective | ||
| Albers Equal Area Projection | COE | Conic equal-area | |
| Equidistant Conic Projection | COD | Conic equidistant | |
| COO | Comic orthomorphic | ||
| Lambert Conformal Projection for sperical earth = COO | |||
| BON | Bonne's equal area | ||
| Polyconic Projection | PCO | Polyconic | |
| TSC | Tangential Sperical Cube | ||
| CSC | COBE Quadrilateralized Spherical Cube | ||
| QSC | Quadrilateralized Spherical 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 |
aremo wrote: abine Ziler
Stefan wrote: This is a test comment.
Jaiskefesip wrote: The talk within the finest used cellular phone for sale is built to be even any more fiercely asserted amidst consumers. There are lots of brands from which to decide with a lot of models. Then you need capabilities to walk off into account, and also battery. In the motive you be required to choice the one that’s kind for you, and also period’s your own private meet with of style. The fashionable best three hottest employed cellular phones at one's disposal would be the BlackBerry Bead, Your Apple IPhone, as luckily as the Motorola talkabout Blade. All three or more of such are imaginary candidates and each has their acutely own durability as highly as fragile spots. We will look at each one of these mutatis mutandis so that you can decide for yourself which of such you believe ordain be best. <a href=http://www.usedcellphonesforsales.info/>Used cellphones for sale</a>
custom thesis wrote: That column is really valuable! One day, article writing company facilitate me with writing an essay, which I was unable to terminate due to private causes. I consult you thesis writing that will assist you in your university life. Cheer!
alawarigr wrote: <a href=http://alawar-igri.ru/>Игры Alawar</a> В свою очередь мы подготовились к вашему приходу, собрав безотлучно самые лучшие зрелище alawar на нашем ресурсе. И наша заслуга по наполнению базы игр вовсе незакончена, она продолжается постоянно, благодаря чему выше сайт педантичный дополняется новинками, которые выпускает сооружение игр alawar.
ponsigarusi wrote: <a href=http://cybercrime-956631.ru/uniseks-sigarety/tyazhelye-sigarety.html>тяжелые сигареты</a> <a href=http://cybercrime-956631.ru/2008/kupit-elektronnye-sigarety-v-sviyazhske.html>купить электронные сигареты в свияжске</a> <a href=http://cybercrime-956631.ru/aksessuary/elektronnaya-sigareta-v-tverdoi-pachke-s-usb-zaryadkoi-dream.html>электронная сигарета в твердой пачке с usb зарядкой dream</a> <a href=http://cybercrime-956631.ru/nash-forum/kupit-elektronnye-sigarety-v-petrove-dalnem.html>купить электронные сигареты в петрове дальнем</a> <a href=http://cybercrime-956631.ru/aksessuary/kupit-elektronnye-sigarety-v-goryachevodskom.html>купить электронные сигареты в горячеводском</a> www nicotek ru золотой вавилон электронная сигарета электронная сигарета в верхней салде купить электронные сигареты в новотитароской электронная сигарета плюсы и минусы
Liposhock wrote: fnzfryvcvoujy, <a href="http://hcgproductsreview.com/liposhock-review">Liposhock</a>, SLNzhdP, [url=http://hcgproductsreview.com/liposhock-review]Liposhock[/url], bMfYGYY, http://hcgproductsreview.com/liposhock-review liposhock, FIqlwuY.
resume writing services wrote: The clients count on our resume service cause they are very reliable! Our organization represents resume writer to fit the precise field of study you prefer.


dance essays paper wrote: Generally I complete my research paper in the car. However, it's not really possible to do the same with history essays. Such kind of work I send to the custom writing corporations.
Comments: