The Java Hacker – Peter Jaric's Blog

Category: Programming

Mathemancy.js – a Framework for Natural Language Arithmetic in JavaScript

A while ago, while I was riding my bike to work, I thought: “Would it possible to make evaluate to 7 in JavaScript?” I wanted to see if it was possible, and with some invaluable help from Mathias Bynens and Ingvar Stepanyan I was able to make it work. I give you: Mathemancy.js With […]

Using window.onerror to Brute-force Cross Domain Data (updated)

Update: If you haven’t read the post before, please read the original post below. I got a lot of interesting comments on Twitter about this post, and among them the obvious problem that this approach is slow. Then it hit me, I can do this as a binary search to make it much more efficient. […]

A JavaScript challenge for Nordic.js

Today and yesterday I’ve been visiting Nordic.js, a Scandinavian JavaScript conference. To celebrate the occasion I made a little JavaScript challenge that I announced at Twitter: I had a specific solution in mind, which I didn’t receive, but I got a load of other solutions instead: The first one was from Andreas Madsen and it […]

Agessa’s World – a game where the interface consists of only alert(), confirm() and prompt()

A while ago I asked myself: who uses alert() for anything but debugging in web applications nowadays? It didn’t take long to go from that question to the idea that I should make something that uses only native dialogs, just for fun. TL;DR: Play the game “Agessa’s World”! The result is a game that only […]

The Sea Surfer – a Simple Tool for CSRF Vulnerability Detection and Proof-of-Concept Creation

Lately I have taken an interest in web application security, as covered by OWASP. One common vulnerability in web applications is to be sensitive to CSRF attacks. I have made a small tool in the form of a bookmarklet to detect CSRF vulnerabilities and create proof-of-concept exploits. It is very simple, but it does the […]

Fun with JavaScript: count parentheses

Yesterday, I wrote a JavaScript function that returned another function. At one place I wanted to call the returned function immediately, resulting in code looking somewhat like this: When seeing that code, I asked myself: would it be possible to count the (pairs of) parentheses? After tinkering a bit, I first came up with (as […]

Matching combined results in jQuery – ordered correctly

Today I used the “selector1, selector2, selectorN” selector in jQuery and was confused that, in some cases, when looping over the results I got them in the order of the selectors and not in the order of the elements in the page. I had expected it to work as an OR operator. My code looked […]

Ripping sound from closed applications to files with reasonably good names

The idea Some applications that play sound do not allow the user to save those sounds for later listening. However, it is possible to tap into the audio playing through the sound card and record it to file (see here and here). This is one way to do what generally is called “ripping”. Sometimes it […]

Maximizing windows in Mac OS X

Since December I am a Linux-only user at home, but previously I had a mac. One of my main problems was that it was up to the applications if it would be possible to maximize their windows. There is a zoom button on every window, but the point of that button is not to maximize […]

Modules in Javascript

JavaScript does not have modules builtin, but since it is such an open language, it is possible for the developer to create a custom module system. Looking around on the web, it is soon obvious that there are several ways to do this. Here I will present that path I have taken. I have chosen […]