Javascript introspection
Very basic, but sometimes useful javascript object introspection
<img id="test"> <script type="text/javascript" language="JavaScript"> el = document.getElementById('test'); str = ''; for (i in el) str += i+'; '; alert(str); </script>
Safari popups in new tab
One of the browsers I’m using on Windows is Safari and I found an interesting tweak for it, that makes popup links open in a new tab instead of a new window. Now I can’t credit the person who discovered this, because I lost the link, but here’s what you do.
Go to C:\Documents and Settings\User\Application Data\Apple Computer\Safari\Preferences\
where User is your Windows username. Open the file com.apple.Safari.plist for modification and insert the lines below somewhere within the tag.
Strings in JAVA
A few days ago I needed to extract all strings from .java files and also thought that it would be a good idea to keep count how many times a string is used. So I came up with this simple python script. It’s kind of a quick and dirty solution, but it met my needs for the particular task.
import sys, os, re from operator import itemgetter files = [] strings = {} exp = re.