How not to support your users

I have small experience with LaTeX, though enough to write a couple of articles, half dozen of thesis and create a number of presentations.

Recently for some paper I picked Texmaker (I intentionally put a link here despite the fact what I’m writing next) as an editor of choice. It’s cross-platform, created with QT (which is pretty good).
On Windows with MikTeX it worked OK out of the box (with some changes like replacing pdflatex with xelatex).
On OSX it was working like that:
1) I click Quick Build
2) it shows the proper log from xelatex
3) the resultant PDF file is not created

When the same command was ran from the terminal the file was created properly.

OK, strange, so I went to the programs page on Google Code and file an issue (it is deleted now… :) explaining the situation above in a neutral and standard language, providing the details above.

Now I stop explaining and just provide 3 answers I got from this… person (unfortunately I don’t have my own comments saved and the issue is deleted from the tracker by the program maintainer – so silly):

Updates:
Status: Invalid

Comment #1 on issue 664 by texmaker@gmail.com: Quick build not working on OSX

http://code.google.com/p/texmaker/issues/detail?id=664

??? It’s not a texmaker trouble
If the pdf is not created, texmaker can’t show it!
And if the pdf is not created, that’s because xetex was not able to create it : the error should be displayed in the log file.
A latex editor only launches the commands : the document are not compiled by texmaker, but by xetex, pdflatex, etc…

—–

Comment #3 on issue 664 by texmaker@gmail.com: Quick build not working on OSX

http://code.google.com/p/texmaker/issues/detail?id=664

#2 ???. I’m very calm. Why are you so agressive?
You said “the pdf file is not in the destination folder (not created/updated)” : if the pdf is not created, how can a program can display it???
You said that manually, you use xelatex file.tex but in the texmaker command, you use xetex instead of xelatex!!!

—–

Comment #5 on issue 664 by texmaker@gmail.com: Quick build not working on OSX

http://code.google.com/p/texmaker/issues/detail?id=664

#4 the pdf is not created by texmaker but by xelatex!
You should learn latex before posting.

GA Profile ID (for instance to use with gdata library)

I think google’s API and its Python binding are a huge mess.
And poor documentation makes them even worse.
You can find the majority of parameters described in quite understandable way, but you can’t start using them because you have to authorize first, and this topic is among worst explained.

But even if you passed it, you’re stuck with some tricky params that you have to discover SOMEHOW.
Example: for exporting data from GA you have to provide some PROFILE ID (it is often called the TABLE ID in the docs).
Great, have a nice time clicking around your account settings trying to find it.

UPD: I thought the only way to solve it is like that: http://blog.explainum.com/2011/05/how-to-find-profileid-in-new-google.html
But there’s actually an ‘official’ way – click your account settings, then on the Profiles tab pick the profile and click the profile settings tab.
The ID is actually there.

Another nice example – they have the API Key. But it’s not supported by the library so if you’re going to collect some stats on the server, you have to store your email / password, or to mess with OAuth.

And another point. You start with creating a service like

service = gdata.analytics.service.AnalyticsDataService(
                source=settings.GA_APP_NAME,
                email=settings.GA_USERNAME,
                password=settings.GA_PASSWORD
            )
1
2
3
4
5
service = gdata.analytics.service.AnalyticsDataService(
                source=settings.GA_APP_NAME,
                email=settings.GA_USERNAME,
                password=settings.GA_PASSWORD
            )

Good, then try requesting your data — even though you’ve provided your credentials, this bitch didn’t authorize you. Cool?
Call

service.ProgrammaticLogin()
1
service.ProgrammaticLogin()

, then you’re done.

Error trying initialize default postgres db?

$ sudo su postgres -c '/opt/local/lib/postgresql91/bin/initdb -D /opt/local/var/db/postgresql91/defaultdb'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by initdb but was not found in the
same directory as "initdb".
Check your installation.
1
2
3
4
5
6
7
8
$ sudo su postgres -c '/opt/local/lib/postgresql91/bin/initdb -D /opt/local/var/db/postgresql91/defaultdb'
shell-init: error retrieving current directory: getcwd: cannot access parent directories: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
could not identify current directory: Permission denied
The program "postgres" is needed by initdb but was not found in the
same directory as "initdb".
Check your installation.

Then first do

cd /opt/local/var/db/postgresql91/
1
cd /opt/local/var/db/postgresql91/

PyCharm / Webstorm JS autocompletion / inspector is great

I’m calling a function accepting a hash of options.

THe function is declared in a separate file included through script.

IDE highlights the keys that are not used in the function being called.

And also SO: Specify type of globals declared in another file.

jQuery.sortItems

A much-requested on SO function for sorting DOM elements.

jQuery.fn.sortItems = function (key) {
    var $items = [],
        $wrap = $('<div/>'),
        i, l;
    this.each(function () {
        $items.push([key(this), $(this)]);
    });
    if (!$items) {
        return;
    }
    $wrap.insertBefore($items[0][1]);
    $items.sort();
    for (l = $items.length, i = l - 1; i >= 0; i--) {
        $items[i][1].insertAfter($wrap);
    }
    $wrap.remove();        
};
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
jQuery.fn.sortItems = function (key) {
    var $items = [],
        $wrap = $('<div/>'),
        i, l;
    this.each(function () {
        $items.push([key(this), $(this)]);
    });
    if (!$items) {
        return;
    }
    $wrap.insertBefore($items[0][1]);
    $items.sort();
    for (l = $items.length, i = l - 1; i >= 0; i--) {
        $items[i][1].insertAfter($wrap);
    }
    $wrap.remove();        
};

Demo.

Deluge torrent client

Installed it on my home server under Ubuntu Server 11.04, configured daemon and web UI startup – looks really cool, as a normal full-featured desktop client

Emacs-style shortcuts outside of Emacs

1) on Linux and Mac OSX you can use them in terminal, for example:
ctrl+A to go to the beginning of the line (or God, I needed this so much, but was always forgetting to google for it)
ctrl+E to go to the end of the line
ctrl+T to transpose the characters on either side of the cursor
ctrl+D to delete the character to the right of the cursor
ctrl+K to delete the rest of the current line

2) these shortcuts are also supported by Cocoa native text fields. This means, that on Mac OSX you can use them, for example, in your browser’s address bar. Awsome!

BIOS reset with HP 6910p

For 2 days I was burning various Windows PE / FreeDOS / custom tools to the RW trying to erase the BIOS setup password
Then just followed the official guide, released the keyboard in 5 minutes, and unplugged the RTC battery for extra 5 minutes — done.

Eclipse is just amazing…

PyQt4 on MAC OSX

Tiered of installing from sources?
The answer is as easy as

sudo port install py27-pyqt4
1
sudo port install py27-pyqt4

Of course, the python version can be different for you.