Harm Derksen brachte uns schon im Jahre 1998 die weltschnellste Methode zur Berechnung irreduzibler Charaktere der symmetrischen Gruppe. Aber in seinem preprint, Computing with Characters of the Symmetric Group, bleiben einige Fragen offen, die ich hiermit zu klären versuche.
» The code to end all codes «

Die Welt ist einen halben Herzschlag alt. Der unsterbliche Prophet meditiert seit Anbeginn der Laufzeit auf dem তাজমহল und studiert die heiligen 12 Zeilen C-Code, die jede SAT Instanz in $\mathcal{O}(n^{9699690})$ lösen. Wenn der Puls eine Ganzzahl wird, so wird er erwachen und die Wahrheit verkünden, und Lob wird gepriesen, und Licht wird ewig scheinen auf die Kinder des Schaltkreises. Denn er ist der Taktgeber, und an der Spitze des Signals wird es sein, wenn er uns erscheint. Buch Arithmæl Circulæ, Vers 21:7 Wollen Sie mehr wissen?



Let's say you have a Windows PC on a 64 bit machine. Obviously, you have Cygwin because anything else would just be silly. Then you want to develop C-Applications that you can compile and run on large Linux-based servers, so you turn to an an IDE that can work with Cygwin. Now here comes the twist: For whatever stubborn reason, you want to be able to compile your applications native 64 bit, and you want to do it in Eclipse, and you want to be able to debug them. Do you want to know how?


Here's my code for quickly uploading files to virustotal and retrieving the reports.
import postfile
import sys

import json
from StringIO import StringIO

import urllib
import urllib2

import time

import webbrowser

apikey = 'YOUR API KEY ' + \
         '  GOES HERE  '
resources = []
for i in range(1, len(sys.argv)):
    file = sys.argv[i]
    print 'Preparing Scan of %s ...' % file

    host = 'www.virustotal.com'
    selector = 'https://www.virustotal.com/vtapi/v2/file/scan'
    fields = [('apikey', apikey)]
    file_to_send = open(file, 'rb').read()
    files = [('file', file, file_to_send)]

    print 'Uploading file...'
    ret = postfile.post_multipart(host, selector, fields, files)
    try:
        data = json.loads(ret)
    except ValueError:
        print 'Cannot decode server response: '
        print ret
        exit()
    print 'Upload done.'

    # for k in data: print '%s: %s' % (k, data[k])

    resources.append((file, data['resource']))

print 'Retreiving reports...'
i = 1
permalinks = []
for resource in resources:
    response_code = 0
    while response_code == 0:
        url = 'https://www.virustotal.com/vtapi/v2/file/report'
        parameters = {
            'resource': resource[1],
            'apikey': apikey
        }
        data = urllib.urlencode(parameters)
        req = urllib2.Request(url, data)
        response = urllib2.urlopen(req)
        ret = response.read()
        data = json.loads(ret)
        response_code = data['response_code']
        #print json.dumps(data, sort_keys=True, indent=4)
        if response_code == 0: time.sleep(5)
    #print json.dumps(data, sort_keys=True, indent=4)
    permalinks.append(data['permalink'])
    print '%2i: %s' % (i, resource[0]), 
    print ': %i / %i' % (data['positives'], data['total'])
    i += 1

wb = webbrowser.get()
selection = 0
while selection >= 0 and selection < len(permalinks):
    selection = int(raw_input('Open: '))-1
    if selection >= 0 and selection < len(permalinks):
        wb.open(permalinks[selection])
P.S.: This is all part of a great plan I'm following at the moment. Edit (2013-09-05): Since the VirusTotal API is now out there for a while, a lot of awesome python libraries have emerged: * https://github.com/Erethon/vta.py * https://github.com/Gawen/virustotal * https://github.com/botherder/virustotal * https://github.com/Xen0ph0n/VirusTotal_API_Tool


Under Cygwin, you can install the 64 bit mingw version of GCC, but you don't get the gnu multiprecision library for free with it, you'll much rather have to compile it from source. I ran into a bit of trouble here: It will not suffice to tell the configuration script about the new compiler, there are now mingw-64 versions of all relevant binaries that should be used instead. Basically, you go like
tar -xjf gmp-5.0.4.tar.bz2
cd gmp-5.0.4
./configure                          \
  AR=x86_64-w64-mingw32-ar           \
  AS=x86_64-w64-mingw32-as           \
  DLLTOOL=x86_64-w64-mingw32-dlltool \
  DLLWRAP=x86_64-w64-mingw32-dllwrap \
  CC=x86_64-w64-mingw32-gcc-4.5.3    \
  NM=x86_64-w64-mingw32-nm           \
  LD=x86_64-w64-mingw32-ld           \
  OBJDUMP=x86_64-w64-mingw32-objdump \
  RANLIB=x86_64-w64-mingw32-ranlib   \
  STRIP=x86_64-w64-mingw32-strip
I am not sure if all of these are needed, but it won't hurt either. After that, you should
make && make check
the whole thing. Worked perfectly for me, so now I can link with libgmp.a in .libs and native 64 bit bignum action ensues!


Just a checklist for programming the microncontroller Ralf gave me yesterday ((Also check out this useful article)) * you need a functional eclipse installation * Install WinAVR and be sure that it is in the PATH by executing  avr-gcc from a command prompt * Install the AVR-Interface into eclipse via HelpInstall New SoftwareAdd. Then paste the following link in the URL Box:
http://avr-eclipse.sourceforge.net/updatesite/
* When I create a new project, I need to adjust the following settings in the project properties: * AVRAVRDude Programmer click on New, Name: USBASP, Programmer Hardware (-c) USBasp, http://www.fischl.de/usbasp/ * AVRAVRDude, Advance be sure the check Disable device signature check * AVR → Target Hardware MCU Type select ATmega168 and set the MCU Clock Frequency to 12000000 (that's $12\cdot10^6$) * C/C++-Build → Settings unter Tool Settings check Generate HEX file for Flash memory * C/C++-Build → Settings unter Tool Settings, AVR CompilerOptimization set the Optimization Level to Size Optimizations (-Os).


After a couple of tests, it turns out that the very simple
#include <limits.h>

inline void memzap(void *dest, unsigned long count) {
    asm( "cld"
#   if ULONG_MAX == 0xffffffff
    "\n" "andl $3, %%ecx"
    "\n" "rep  stosb"
    "\n" "movl %%ebx, %%ecx"
    "\n" "shrl $2, %%ecx"
    "\n" "rep  stosl"
#   else
    "\n" "andq $7, %%rcx"
    "\n" "rep  stosb"
    "\n" "movq %%rbx, %%rcx"
    "\n" "shrq $3, %%rcx"
    "\n" "rep  stosq"
#   endif
      : "=c" (count), "=D" (dest), "=b" (count)
      :  "c" (count),  "D" (dest),  "b" (count), "a" (0)
    );
}
is the fastest way to zero out a large block of memory, which is not very surprising. It is about 4 to 5 times faster than memset and about as fast as new [], if I can trust @tobi on that matter. I tried using MMX registers, but anything that involves actually looping over the memory region will be about as fast as memset. The only way to get a bit of speed is using the rep opcode. Tiny Edit: The above code is much more safe to compile on both 64 and 32 bit computers.


For reasons I have not yet been able to figure out, @tobi is making me implement a couple of very rudimentary routines in x86 GCC inline assembler because he wants them faster than possible for mere mortal C. The first was a routine to calculate $\lfloor\log_2(n)\rfloor$ for $n\in\mathbb{N}$ and the second one was to zero out a large block of memory. For instance,
unsigned inline log2int(unsigned x) {
    unsigned l;
    asm("bsrl %1, %0" : "=r" (l) : "r" (x));
    return ( 1 << l == x ) ? l : l + 1;
}
is about 50 times faster than the C-native Version
unsigned inline log2int(unsigned x) {
   unsigned l = 0;
   while(x > (1<<l)) l++;
   return l;
}
even after optimization. For some reason, I found it tricky to google up the official intel x86 opcode reference ((Opcode Reference Part 1)) ((Opcode Reference Part 2)), so I am linking these here.


In retrospective, I don't even know why I am still using [nomenclature](http://ctan.org/tex-archive/macros/latex/contrib/nomencl), but with my current fixes it seems to work just fine. Do you want to know more?


I found a site full of examples to create knots in latex and it's quite a pain to paint them. They look nice, though. You basically paint them via xy and then place *"holes"* in the parts where you want to make a crossing. Here is an example:
\xy
 (-3.5,3.5)*{}="LEFTTOP";
 (3.5,-3.5)*{}="RIGHTBOTTOM";
 (3.5,3.5)*{}="RIGHTTOP";
 (-3.5,-3.5)*{}="LEFTBOTTOM";
 "LEFTTOP";"RIGHTBOTTOM" **\dir{-}; \POS?(.5)*{\hole}="HOLE";
 "RIGHTTOP";"HOLE" **\dir{-};
 "HOLE";"LEFTBOTTOM" **\dir{-};
 (0,0)*[gray]\xycircle(5,5){-};
\endxy


Everyone who tried to get isolate compiled tex-code in an svg knows that this is kind of complicated if you try to do it by hand and via manual picture editing. So it sounds convenient that there exists a software that inputs Tex-Code in a software like Inscape ... and so it is! After running into a lot of 32 / 64 bit problems and some weird dll-issues when I had ImageMagick or GraphicsMagick installed I finally got the following to work (assuming that you have Miktex installed): * Inkscape 0.46 (not motivated to install it in the current version and it now runs though) * Download and Install pstoedit (be sure to install it without this Magick-Integration and put the folder of the executable in your path). * Download and Install textext. For those who are interested (i.e. myself, when I try to set it up on someone else's computer), here are the details. For faster debugging I used and edited the textext.py-File in the Inkscape Extension Folder:
Func SendF($str)
$clip = ClipGet()
ClipPut($str)
Send("^v")
ClipPut($clip)
EndFunc

Run('PATHTO046\inkscape.exe')
WinWaitActive('New document')
Send('^o')
WinWaitActive('Select file')
SendF('PATHTO\test.svg')
Send('{ENTER}')
WinWaitActive('test.svg')
Send('!c{DOWN 8}{ENTER}')
WinWaitActive('TeX Text')
SendF('$\alpha\leq\beta$')
Send('!o')
to finally get that it calls something like
pstoedit -f plot-svg tmp.pdf test.svg -dt -ssp -psarg -r9600x9600
which results in the errors I then tracked down to the problems with CORE_RL_Magick++_.dll. Links that helped me: * http://www.calcmaster.net/personal_projects/pdf2svg/ * http://pav.iki.fi/software/textext/ * http://www.pstoedit.net/