Johann Burkard

Code snippets, quotes, BASH scripts and nonsense. Not surprisingly, my main site is called Johann Burkard, too. Check out my web applications: WMA to MP3 converter, QR Code Generator, Pearson Correlation calculator, PDF to TIFF converter and Forex Data Feed. Also, check out Ole’s Tauschbörse Arbeit.

Page 1 · Page 2 · Page 3 · Page 4 · Page 5 · Page 6 · Page 7 · Page 8 · Page 9 · Page 10

Aug 05 2011

I always giggle when people proclaim Chrome/Safari/… to be the fastest browser. From reading my log files, I know that WebKit-based browsers make an awful amount of needless HTTP requests. WebKit seems to have a really bad caching implementation and will make requests for files it already has cached before their expiry time.
I knew before that WebKit had a problem there but I never quantified it. Now, I found out that WebKit-based browsers easily make 10 times as many unnecessary requests than Firefox.
In my log files, 3 % of all WebKit requests were answered with a 304/Not Modified, compared to 0.18 % for Gecko, 0.93 % for MSIE and 0.97 % for Opera.

I always giggle when people proclaim Chrome/Safari/… to be the fastest browser. From reading my log files, I know that WebKit-based browsers make an awful amount of needless HTTP requests. WebKit seems to have a really bad caching implementation and will make requests for files it already has cached before their expiry time.

I knew before that WebKit had a problem there but I never quantified it. Now, I found out that WebKit-based browsers easily make 10 times as many unnecessary requests than Firefox.

In my log files, 3 % of all WebKit requests were answered with a 304/Not Modified, compared to 0.18 % for Gecko, 0.93 % for MSIE and 0.97 % for Opera.

May 17 2011

Dinge, die in Deutschland umsonst sind

(Liste wird erweitert, sobald ich noch mehr Dinge finde, die in Deutschland umsonst sind.)

Apr 14 2011

Jon is right.

Jon is right.

Feb 20 2011

FGSFDS

FGSFDS

Feb 01 2011

458 B cross-domain JavaScript/JSON-P loader

(Somewhat) readable

function load(u,c){
 var b=document, element = 'script', s=b.createElement(element), name=2166136261,
  i = u.length, backup = c, callback = /=\?/,
  b=b.body, x='onreadystatechange', y='onload', z='readyState';
 if (callback.test(u)) {
  while (i--) {
   name = (name * 16777619) ^ u.charCodeAt(i);
  }
  window[element += (name < 0 ? -name : name)] = function() {
   backup.apply(backup, arguments);
   delete window[element];
  }
  u = u.replace(callback, '=' + element);
  c = 0;
 }
 s[y]=s[x]=function(){
  if (/de|m/.test(s[z]||'m')) {
   c && c();
   b.removeChild(s);
   try { for (c in s) delete s[c]; } catch (e) {}
  }
 };
 s.src=u;
 window.setTimeout(function(){b.appendChild(s)},0);
}

Closure compressed (458 B)

function load(b,c){var d=document,f="script",a=d.createElement(f),e=2166136261,g=b.length,h=c,i=/=\?/,d=d.body;if(i.test(b)){for(;g--;)e=e*16777619^b.charCodeAt(g);window[f+=e<0?-e:e]=function(){h.apply(h,arguments);delete window[f]};b=b.replace(i,"="+f);c=0}a.onload=a.onreadystatechange=function(){if(/de|m/.test(a.readyState||"m")){c&&c();d.removeChild(a);try{for(c in a)delete a[c]}catch(b){}}};a.src=b;window.setTimeout(function(){d.appendChild(a)},0)};

Jan 30 2011

Spiel mit ein paar Ideen für http://media.io rum.

Spiel mit ein paar Ideen für http://media.io rum.

Jan 25 2011

Das dreckigste Hotel Europas steht in der Türkei.

Dreck-Rangliste für Europa und USA – Schmutzigste Hotels ermittelt. Nicht bloß DAS Dreckigste, sondern DIE ZWEI Dreckigsten.

Jan 14 2011

CLOUD PANIC is so good because it&#8217;s so true.

CLOUD PANIC is so good because it’s so true.

Jan 06 2011

I like Yottaa.

I like Yottaa.

Jan 04 2011

Android user agent statistics

Data collected from three or four weeks of log files. Hits only, no visitors.

Android versions
    410 Android 2.2
    376 Android 2.1-update1
    202 Android 2.2.1
     29 Android 1.6
      1 Android 1.5

User Agent substrings #1
    876 Android 2.1-update1; en-us; Ally Build/ERE27
    751 Android; Opera Mini/5.1.22460/22.387; U; en
    737 Android 2.2; en-us; Droid Build/FRG22D
    683 Android 2.2; en-us; Sprint APA9292KT Build/FRF91
    545 Android 2.1-update1; en-us; A6277 Build/ERE27
    497 Android 2.2.1; en-us; T-Mobile myTouch 3G Build/FRG83D
    489 Android 2.2; en-us; DROIDX Build/VZW
    432 Android 2.1-update1; en-us; SGH-T959 Build/ECLAIR
    413 Android 2.2.1; en-us; DROIDX Build/VZW
    390 Android 1.5; en-us; MB200 Build/CUPCAKE
    384 Android 2.1-update1; en-us; SPH-M910 Build/ECLAIR
    363 Android 2.2.1; en-us; Droid Build/FRG83D
    329 Android 1.6; en-us; SonyEricssonX10a Build/R2CA016
    270 Android 2.1-update1; en-us; DROIDX Build/VZW
    254 Android 1.6; en-us; T-Mobile myTouch 3G Build/DRD35
    246 Android-MMS-V1.0/1.2
    234 Android 2.2; en-us; ADR6300 Build/FRF91
    220 Android 1.6; en-us; T-Mobile G1 Build/DMD64
    219 Android 1.6; en-us; LG-GT540; Build/Donut
    203 Android 2.2; en-us; DROID2 Build/VZW

User Agent substrings #2
   1172  en-us; DROIDX Build/VZW
    876  en-us; Ally Build/ERE27
    751 Android; Opera Mini/5.1.22460/22.387; U; en
    739  en-us; Droid Build/FRG22D
    683  en-us; Sprint APA9292KT Build/FRF91
    545  en-us; A6277 Build/ERE27
    497  en-us; T-Mobile myTouch 3G Build/FRG83D
    432  en-us; SGH-T959 Build/ECLAIR
    390  en-us; MB200 Build/CUPCAKE
    384  en-us; SPH-M910 Build/ECLAIR
    363  en-us; Droid Build/FRG83D
    329  en-us; SonyEricssonX10a Build/R2CA016
    254  en-us; T-Mobile myTouch 3G Build/DRD35
    246 Android-MMS-V1.0/1.2
    234  en-us; ADR6300 Build/FRF91
    220  en-us; T-Mobile G1 Build/DMD64
    219  en-us; LG-GT540; Build/Donut
    203  en-us; DROID2 Build/VZW
    182  en-us; M860 Build/ERE27
    161  en-us; HTC Hero Build/CUPCAKE

Nov 20 2010

New Website Checklist

I will update this with more things that I do before launching a website.

Nov 16 2010

Download all images on a 4chan page

  1. jQuerify the page.
  2. Open Firebug.
  3. Select the ‘Console’ tab.
  4. Enter $('img[md5]').parent().each(function() { console.log($(this).attr('href')) });
  5. Copy the URLs into Notepad or any other text editor and save them to urls.txt.
  6. wget -nc -i urls.txt.
  7. Alternatively, cat | wget -nc -i -

Nov 12 2010

Google AdSense PPC with and without interest-based (retargeting) ads

Not sure about this because it wasn’t split tested but still interesting.

Nov 11 2010

Java PDF Open Source/Free Library Error Rates

Data quality is always a huge challenge in working with file formats. I wanted to find out the error rate of open source/free PDF libraries for Java, i.e. what percentage of PDF files they cannot read.

I downloaded 3583 PDF files from the intertubes and here are the results:

  1. ICEpdf

    ICEpdf couldn’t read 1.981579682 % of the files though I’m not absolutely sure of the number because exceptions were horribly intermingled with logging output.

  2. jPod

    jPod couldn’t read 2.093217974 % of the files.

  3. Apache PDFBox

    Apache PDFBox couldn’t read 2.121127547 % of the files.

  4. PDFRenderer

    PDFRenderer (or PDF Renderer?) couldn’t read 8.317052749 % of the files.

Here are the code snippets I used to parse the files. They are all written in Groovy, which is really good.

PDFBox

@Grab(group='org.apache.pdfbox', module='pdfbox', version='1.3.1')
import org.apache.pdfbox.pdmodel.*

(new File('/home/johann/Desktop/pdf/').listFiles() as List).each { try { PDDocument.load(it)?.close() } catch (Throwable t) { println "${it}: ${t.message}" } }

PDFRenderer

import com.sun.pdfview.*
import java.io.*
import java.nio.
import java.nio.channels.*

(new File('/home/johann/Desktop/pdf/').listFiles() as List).each {
 RandomAccessFile raf = null
 try {
  raf = new RandomAccessFile(it, 'r')
  FileChannel channel = raf.channel
  ByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size())
  PDFFile pdf = new PDFFile(buf)
 }
 catch (Throwable t) {
  println "${it}: ${t.message}"
 }
 finally {
  raf?.close()
 }
}

ICEpdf

import org.icepdf.core.exceptions.*
import org.icepdf.core.pobjects.*

(new File('/home/johann/Desktop/pdf/').listFiles() as List).each {
 Document document = new Document()
 try {
  document.file = it.absolutePath
 }
 catch (Throwable t) { println "${it}: ${t.message}" }
 finally {
  document.dispose()
 }
}

jPod

import de.intarsys.pdf.pd.*
import de.intarsys.tools.locator.*

(new File('/home/johann/Desktop/pdf/').listFiles() as List).each {
 try {
  FileLocator locator = new FileLocator(it.absolutePath)
  PDDocument.createFromLocator(locator)?.close()
 }
 catch (Throwable t) { println "${it}: ${t.message}" }
}

Oct 28 2010

Google /jsapi private data disclosure vulnerability

Google’s jsapi unintentionally discloses private data.

The URL of the page that requests the script will end up in the google.loader.OriginalAppPath property.

Because the file is cacheable for one hour, any other site that the visitor visits within one hour can access the URL of the site that initially loaded the file.

Google has been informed about this on 08 Oct 2010 14:55:25 +0200 but so far has failed to resolve this problem.

Example: Go to http://blog.dantup.com and visit view-source:http://www.google.com/jsapi.

Page 1 · Page 2 · Page 3 · Page 4 · Page 5 · Page 6 · Page 7 · Page 8 · Page 9 · Page 10

Johann Burkard, , @johannburkard
Teisendorf, Germany
N 47° 51' 5.904", E 12° 49' 0.012"