tag:blogger.com,1999:blog-100264002024-03-13T15:24:51.773+00:00blog buckettMatthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.comBlogger167125tag:blogger.com,1999:blog-10026400.post-41795508068895170812018-11-23T12:36:00.002+00:002018-11-23T12:41:01.993+00:00Firewalling IPs on macOSI needed to selectively block some IPs from macOS and this is how I did it. First create a new anchor for the rules to go in. The file to create is:<samp>/etc/pf.anchors/org.user.block.out</samp> and it should contain:<br />
<code><br />
table <blocked-hosts> persist<br />
block in quick from <blocked-hosts><br />
</code><br />
Then edit: <samp>/etc/pf.conf</samp> and append the lines:<br />
<code><br />
anchor "org.user.block.out"<br />
load anchor "org.user.block.out" from "/etc/pf.anchors/org.user.block.out"<br />
</code><br />
Then to reload the firewalling rules run:<br />
<code><br />
$ sudo pfctl -f /etc/pf.conf<br />
</code><br />
and if you haven't got <samp>pf</samp> enabled you also need to enable it with:<br />
<code><br />
$ sudo pfctl -e<br />
</code><br />
Then you can manage the blocked IPs with these commands:<br />
<code><br />
# Block some IPs<br />
$ sudo pfctl -a org.user.block.out -t blocked-hosts -T add 1.2.3.4 5.6.7.8<br />
# Remove all the blocked IPs<br />
$ sudo pfctl -a org.user.block.out -t blocked-hosts -T flush <br />
# Remove a single IP<br />
$ sudo pfctl -a org.user.block.out -t blocked-hosts -T delete 1.2.3.4<br />
</code><br />
<br />
<br />
<br />
<br />
<br />
Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-26765408482732222212015-09-25T15:19:00.000+00:002015-09-25T15:19:23.028+00:00Bulk upload with cURL to a WebDAV serverTo quickly upload a load of files to a WebDAV server using cURL:<br />
<br />
<pre>ls *.txt | xargs -t -n 1 -P10 -J % curl -u username:password -T % https://mywebdav.server/
</pre>
<br />
This does the upload with 10 parallel cURL processes which can make uploading a large set of files much faster.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com1tag:blogger.com,1999:blog-10026400.post-8395432587781292982013-09-10T09:06:00.001+00:002013-09-10T09:06:50.642+00:00Texet Bluetooth Mouse (BTM-01) Pairing I recently got a very cheap Bluetooth mouse that is branded as a Texet Bluetooth Mouse (Model No: BTM-01) and pairing it is non-obvious. With the mouse on hold down:<br />
<ul><li>left click</li>
<li>middle click (scroll wheel)</li>
<li>right click</li>
</ul>When you release them the mouse should be discoverable. One thing to note is that the mouse is very cheap and it looks like they haven't got any bluetooth addresses as my mouse has a bluetooth address of <code>00:00:00:00:00:1D</code>, but it does at least work.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com19tag:blogger.com,1999:blog-10026400.post-54526068609884629752013-04-16T11:11:00.000+00:002013-04-16T11:11:05.042+00:00Generate some files in folders for testing using bash.<div>I wanted a small test data set consisting of some files in folders, heres a quick shell snippet to generate some:<br />
</div><code><br />
for dir in {1..100}; do<br />
for dir2 in {a..f}; do<br />
folder=dir-${dir}/dir-${dir2}; mkdir -p ${folder}<br />
echo "A file with some text" > $folder/`pwgen -A10`.txt<br />
done<br />
done<br />
</code><br />
<div>Every time you run it you get more files, but the folders remain the same. It needs bash 3 or greater to run and creates folder like:<br />
</div><code><br />
./dir-1/dir-a/euciphel.txt<br />
./dir-1/dir-b/aineijof.txt<br />
./dir-1/dir-c/naungeix.txt<br />
./dir-1/dir-d/oopoolah.txt<br />
./dir-1/dir-e/epahgome.txt<br />
./dir-1/dir-f/ahshicia.txt<br />
./dir-2/dir-a/busaenga.txt<br />
./dir-2/dir-b/waepheep.txt<br />
./dir-2/dir-c/jaeyahbi.txt<br />
./dir-2/dir-d/biejoong.txt<br />
</code>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-27137774654064826972013-04-02T13:57:00.001+00:002013-04-02T13:57:18.229+00:00Kerberos Tickets and VNC utilities on a MacA Mac ships with two useful utilities which are hidden away by default. The first it Ticket View which allows you to see the kerberos tickets you currently have and the second is Screen Sharing, which is a VNC client. I find it useful to create an alias to these two programs in the Applications/Utilities folder so that spotlight will index them and make them easy to launch. By default the applications are installed in:<br />
<br />
/System/Library/CoreServices/<br />
<br />
In finder you can go here in Finder by pressing <span style="font-family: Trebuchet MS, sans-serif;">⇧⌘G</span><span style="font-family: inherit;"> and pasting in the path. The drag the programs to:</span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">/Applications/</span><br />
<br />
Not you can easily find these programs and open them from spotlight.<br />
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>
<span style="font-family: Trebuchet MS, sans-serif;"><br /></span>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-77898687540949655832013-02-14T17:14:00.001+00:002013-02-14T17:14:27.836+00:00Testing with foreign character sets on a MacTo help with testing foriegn character sets I have created two additional character sets on my Mac that remap the standard British QUERTY keyboard to create readable but non-standard characters. This allows me to easily enter characters outside the normal ASCII range that are still readable. I created these character maps with <a href="http://scripts.sil.org/ukelele">Ukelele</a> that allows me to load the British character map and then remap the keys. Once I've remapped the keys I export the character maps as a bundle and put them in <code>/Library/Keyboard Layouts</code> and then use System Preferences to add them to the list of available keyboard maps.<br />
<div class="separator" style="clear: both; text-align: center;"><a href="http://2.bp.blogspot.com/-pjpGLXsKsHg/UR0Vk6Buh6I/AAAAAAAADBc/i4hCYfmxmLQ/s1600/Screen+Shot+2013-02-14+at+16.49.07.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://2.bp.blogspot.com/-pjpGLXsKsHg/UR0Vk6Buh6I/AAAAAAAADBc/i4hCYfmxmLQ/s1600/Screen+Shot+2013-02-14+at+16.49.07.png" /></a></div>So the two character maps are:<br />
<br />
<ul><li>British - Foreign : This uses accented characters that are below 0xFFFF in Unicode and so in plane 0. Ḥėṙė ïṡ ȧṅ ėẋȧṁṗĺė ȯḟ ṫẏṗïṅġ ẇïṫḥ ṫḥïṡ ḳėẏḃȯȧṙḋ ṁȧṗ.<br />
<a href="https://dl.dropbox.com/u/13660778/blog/British-Foriegn.keylayout">Ukelele File</a></li>
<li>British - Mathematical : This uses mathematical versions of the standard lating characters and are above 0xFFFF, in this case in plane 1 in Unicode. 𝖧𝖾𝗋𝖾 𝗂𝗌 𝖺𝗇 𝖾𝗑𝖺𝗆𝗉𝗅𝖾 𝗈𝖿 𝗍𝗒𝗉𝗂𝗇𝗀 𝗐𝗂𝗍𝗁 𝗍𝗁𝗂𝗌 𝗄𝖾𝗒𝖻𝗈𝖺𝗋𝖽 𝗆𝖺𝗉.<br />
<a href="https://dl.dropbox.com/u/13660778/blog/British-Mathematical.keylayout">Ukelele File</a></li>
</ul>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-51387364269226979742013-02-14T16:38:00.000+00:002013-02-14T16:38:41.456+00:00Character encoding on requests and SakaiSo an issue has come to light in our local Sakai deployment with character encodings. Some request were being incorrectly interpreted to be encoded using ISO-8859-1 instead of UTF-8. Before I explain what was going on here is some background.<br />
<h3>
HTML specification</h3>
<div>
The HTML specification has <a href="http://www.w3.org/TR/html401/interact/forms.html#h-17.13.1">stuff about encodings</a> and the short of it is that if you are making a request to a web server using a GET then you shouldn't have any foreign characters in the URL, you should just be using ASCII. In practice you can use foreign characters if you UTF-8 encode them as that's commonly assumed to be the used encoding by browsers, but it's not part of the standard. For example here is Google Chrome displaying a URL with UTF-8 encoded characters at the end.</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://4.bp.blogspot.com/-YiOXJPbeLek/UR0NwAbSMyI/AAAAAAAADBM/dlc6sWWIMeA/s1600/Screen+Shot+2013-02-14+at+16.15.34.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="http://4.bp.blogspot.com/-YiOXJPbeLek/UR0NwAbSMyI/AAAAAAAADBM/dlc6sWWIMeA/s1600/Screen+Shot+2013-02-14+at+16.15.34.png" /></a></div>
<div>
<span style="font-family: inherit;">The URL in the referencing page ends <code>096/%E1%B8%9F%C8%AF%E1%B9%99%C3%AF%C4%97%C4%A1%E1%B9%85.%E1%B9%AB%E1%BA%8B%E1%B9%AB</code> which is the URL encoded version of the UTF-8 characters "0</span>96/ḟȯṙïėġṅ.ṫẋṫ"<span style="font-family: inherit;">.</span></div>
<div>
<span style="font-family: inherit;">If you have a browser making POSTs to the server, then you have a choice of two ways of submitting the data, <code>application/x-www-form-urlencoded</code> (which is the default on a </span><br />
<form>
<span style="font-family: inherit;">tag) or<code>multipart/form-data</code>. If you are using characters in your form outside ASCII then you should use multipart/form-data as browsers don't typically say what encoding they are using when performing <code>application/x-www-form-urlencoded</code>, although lots of people assume it to be UTF-8.</span></form>
</div>
<h3>
Servlet request decoding.</h3>
<div>
When a request comes in to Tomcat a <a href="http://docs.oracle.com/javaee/6/api/javax/servlet/http/HttpServletRequest.html">HttpServletRequest</a> object is built and this includes the raw request path as well as a decoded one. Commonly containers such as <a href="http://tomcat.apache.org/">Tomcat</a> will use ISO-8859-1 to decode the path although this can be overridden in configuration. If the request is a POST and the content type is <code>application/x-www-form-urlencoded</code> then the container must also make the form data available as parameters and it will decode any characters using the character set supplied by the browser, however most browsers don't appear to sent a character set when submitting urlencoded POSTs and so it falls back to the containers default which in the case of Tomcat is ISO-8859-1, this can be overridden by calling <a href="http://t/ServletRequest.html#setCharacterEncoding(java.lang.String)">ServletRequest.setCharacterEncoding(String)</a>.</div>
<div>
<br /></div>
<div>
If a request is a POST and the content type is <code>multipart/form-data</code> then the container doesn't do any decoding and it's up to the application to decode the body of the request and extract any parameters from it. This is one reason why people adopt <code>application/x-www-form-urlencoded</code> forms as it means they don't have to deal with parsing the requests, although there are lots of frameworks that help with this.</div>
<div>
<br /></div>
<div>
Part of the reason for only having the container decode <code>application/x-www-form-urlencoded</code> requests is that <code>multipart/form-data</code> are often used when file uploads are performed and may be large in which case you have to be careful about when you consume the upload and where you put the data.</div>
<h3>
Sakai and character sets</h3>
<div>
So Sakai supports unicode and uses UTF-8 as it's default encoding. But it does this through configuring all requests to use UTF-8. So in the Tomcat connector configuration the URI encoding is specified to be UTF-8 instead of ISO-8859-1 and the Sakai request filter which preprocesses all requests to Sakai (<a href="http://qa1-nl.sakaiproject.org/codereview/trunk/api/org/sakaiproject/util/RequestFilter.java.html">RequestFilter</a>) sets the request encoding (if not already set) to be UTF-8 for any URL encoded form submissions.</div>
<div>
<br /></div>
<div>
This means that you can create a form in Sakai and leave the encoding as <code>application/x-www-form-urlencoded</code> and because the RequestFilter sets the encoding to UTF-8 everything works, really this is a bug and the form should be changed to use the correct encoding but as it generally works nobody notices. The more technically correct solution would be to have the original form submission made using <code>multipart/form-data</code> as this way you normally get the character encoding used by the browser in submitting the request.</div>
<h3>
Back to the problem...</h3>
<div>
We had a filter that was doing some authentication (OAuth) before the standard Sakai request filter. It was all working correctly but we started seeing bugs when people submitted some requests with foreign characters in them. After some investigation it turned out that the cause was the OAuth filter and through it's inspection of the request parameters.</div>
<div>
<br /></div>
<div>
The OAuth filter needs to look at the request parameters to extract any authentication information but in doing so it causes the servlet container to decode all the request paramaters. By default (and following the spec) a servlet container will decode URL encoded parameters according to the ISO-8859-1 character set. Once decoded the parameters remain decoded with that initial character set.</div>
<div>
<h3>
References</h3>
</div>
<div>
<br />
<ul>
<li><a href="http://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data">http://stackoverflow.com/questions/4007969/application-x-www-form-urlencoded-or-multipart-form-data</a></li>
<li><a href="http://download.oracle.com/otndocs/jcp/servlet-2.5-mrel2-oth-JSpec/">http://download.oracle.com/otndocs/jcp/servlet-2.5-mrel2-oth-JSpec/</a></li>
<li><a href="http://www.w3.org/TR/html401/interact/forms.html">http://www.w3.org/TR/html401/interact/forms.html</a></li>
</ul>
</div>
Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-41849560328513913322012-10-29T18:41:00.000+00:002012-10-29T18:44:31.647+00:00Allow Cyberduck to login to Amazon S3If you have created a user in the Amazon IAM Console and wish to allow them to use Cyberduck to connect to Amazon S3 you need to grant them the ability to list all the buckets. This is done by applying a policy on the user of:<br />
<br />
<code><br />
{<br />
"Statement": [<br />
{<br />
"Effect": "Allow",<br />
"Action": [<br />
"s3:ListAllMyBuckets"<br />
],<br />
"Resource": "arn:aws:s3:::*"<br />
}<br />
]<br />
}<br />
</code><br />
<br />
This means they can see all the buckets that exist on your account but can't actually see then contents of them without getting some policies applied on specific buckets.<br />
<br />
This all comes about from the way Cyberduck does it's initial login to Amazon S3.<br />
<br />
<b>Update: </b>If you just connect directly to the bucket using it's bucket name as part of the hostname (eg www.example.com.s3.amazonaws.com), you don't need to grant this permission but you do get an <a href="http://trac.cyberduck.ch/ticket/3813">SSL issue</a>.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-71837313437602750202012-07-05T20:09:00.001+00:002012-07-05T20:09:24.599+00:00virsh vol-upload errorI was attempting to upload a file into a volume using virsh with libvirt to a qemu/kvm hypervisor storage pool and I was getting:<br />
<code><br />
vol-upload error: unknown procedure: 208<br />
</code><br />
<br />
Turns out this is because the remote libvirt version was 0.7.5 and upload support wasn't added until 0.9.0. Hope this helps someone else.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-21905455071881078922012-06-05T20:43:00.002+00:002012-06-05T20:43:33.927+00:00tftpd on Mac OS XMac OS X comes with a TFTP daemon which is all setup to use <a href="https://developer.apple.com/library/mac/#documentation/Darwin/Reference/Manpages/man1/launchctl.1.html#//apple_ref/doc/man/1/launchctl">launchctl</a>, the only issue is it's disabled by default. launchctl allows you to override the disabled entry when loading the file so to use the TFTP daemon:<br />
<br />
<code>sudo launchctl load -w /System/Library/LaunchDaemons/tftp.plist</code><br />
<br />
Then it will serve files up from <em>/private/tftpboot/</em> just make sure they are readable by all. To shutdown the daemon just run:<br />
<br />
<code>sudo launchctl remove com.apple.tftpd</code>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-71675886935554418162012-05-28T10:22:00.002+00:002012-05-28T10:22:39.986+00:00svn diff of just modified filesI was working against a project in which I had a few conflicts, but wanted to generate a patch containing some of the changes to that project, in this case I wanted files I had modified but not the ones that had conflicts. In short svn doesn't provide a way todo this but using a few additional tools it works fine:<br />
<br />
<code><br />
svn st | awk '$1 == "M"{print $2;}'| xargs svn diff<br />
</code><br />
<br />Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-89965082935618401322012-03-19T21:39:00.000+00:002012-03-19T21:39:22.034+00:00Random Skype DisconnectionsRecently I'd started having problems with Skype disconnecting several minutes into a call and losing internet access in other applications as well. This initially was only happening with Skype on the iPad so I put it down to bugginess on the iOS version of Skype crashing the router or something on the iPad, however I just had the same disconnection symptoms after about 5 minutes of a video call on my Mac. This time I went to the router's administration page and found that the router (Speedtouch ST780) hadn't recently rebooted but in the event log it said:<br />
<br />
<table border="0" cellpadding="0" cellspacing="0" class="edittable" style="background-color: white; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: small; text-align: left;"><tbody>
<tr><td class="evenrow" style="background-color: #efefef; padding-left: 4px; padding-right: 4px;"></td><td align="left" class="evenrow" style="background-color: #efefef; padding-left: 4px; padding-right: 4px;">Mar 19 22:04:10</td><td align="left" class="evenrow" colspan="3" style="background-color: #efefef; padding-left: 4px; padding-right: 4px;">IDS dos parser : udp flood (1 of 1) : 192.168.1.69 80.229.225.26 1018 UDP 65177->45237</td></tr>
</tbody></table><br />
Now this tied in exactly with the time of the call dropping so it looks like Skype is triggering the udp flood detection on the router. There isn't a simple way to disable this through the web interface. So you have to telnet to the router and issue the commands:<br />
<br />
<code><br />
ids config state=disabled<br />
saveall<br />
</code><br />
<br />
which disables the intrusion detection system. I'm not too worried about this as the router doesn't have any real services listening on it's WAN IP and I trust all the internal clients. Anyway, hopefully problem solved for now.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com2tag:blogger.com,1999:blog-10026400.post-26780495705448763372011-12-31T10:32:00.001+00:002011-12-31T10:32:05.319+00:00General Logging in MySQL<br />
<br />
I was looking to investigate some connection problems we were having to a MySQL database and wanted to be sure that the client was connecting to correct machine. MySQL 5.1 doesn't provide this information on it's own, but it is contained in the general log. However the log contains all statements executed against MySQL so will have a performance impact on a production machine. The general log can be enabled/disabled while MySQL is still running which means you can enable the logging, capture the events your interested in and then disable it again. Todo this connect to MySQL as a user who can set GLOBALS (typically root) and run:<br />
<br />
<pre>mysql> SET GLOBAL general_log_file='/var/log/mysql.log';
Query OK, 0 rows affected (0.00 sec)
mysql> SET GLOBAL general_log = 1;
Query OK, 0 rows affected (0.00 sec)
</pre><br />
Then the file /var/log/mysql.log should start filling up with statements. Once your done disable the general log:<br />
<br />
<pre>mysql> SET GLOBAL general_log = 0;
Query OK, 0 rows affected (0.01 sec)
</pre><br />
In my case I was looking for connection messages so a simple grep pulled out the lines I was interested in:<br />
<br />
<pre>grep Connect /var/log/mysql.log | less
</pre>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com1tag:blogger.com,1999:blog-10026400.post-37973179547722341602010-06-01T13:25:00.004+00:002010-06-01T14:09:36.420+00:00Using a maven SNAPSHOT plugin from repository.apache.org<p>
I was working on a project and hitting a <a href="http://jira.codehaus.org/browse/MECLIPSE-605">bug</a> in the <a href="http://maven.apache.org/plugins/maven-eclipse-plugin/">maven eclipse plugin</a> which was causing the JRE to be placed incorrectly in the Eclipse .classpath. If it was just a single project I'd have gone and edited the resulting file manually but it affected a few, so I thought I'd try and grab a newer copy of the maven eclipse plugin. I did this by first adding a profile to my maven setttings.xml file ($HOME/.m2/settings.xml on UNIX).
</p>
<div>
<code>
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"><br>
<br>
<profiles><br>
<br>
<!-- This is the additional bit you need --><br>
<profile><br>
<id>apache-plugin-snapshots</id><br>
<pluginRepositories><br>
<pluginRepository><br>
<id>apache-snapshots</id><br>
<name>Apache Snapshot Repository</name><br>
<url>https://repository.apache.org/content/groups/snapshots-group/</url><br>
<releases><br>
<enabled>false</enabled><br>
</releases><br>
<snapshots><br>
<enabled>true</enabled><br>
</snapshots><br>
</pluginRepository><br>
</pluginRepositories><br>
</profile><br>
<br>
</profiles><br>
<br>
</settings><br>
<br>
</code>
</div>
<p>
and then run the mvn eclipse command:
</p>
<code>
mvn -Papache-plugin-snapshots org.apache.maven.plugins:maven-eclipse-plugin:2.9-SNAPSHOT:eclipse
</code>
<p>
which downloaded the newer plugin and then ran it against the project I had checked out.
</p>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-39791627004726453542009-03-23T13:40:00.002+00:002009-03-23T13:55:57.793+00:00Java host caching (sun.net.inetaddr.ttl/networkaddress.cache.ttl) on OS XOn my Mac OS X box I was trying to get some round robin DNS working from Java (1.5) but I was the host was always resolving to the same IP. I'd set <code>sun.net.inetaddr.ttl=0</code>, but that didn't seem to help. It seems out of the box a Mac will <a href="http://inertramblings.com/2004/05/11/mac-os-x-clearing-dns-cache/">cache lookups</a>, but you can clean out the cache with the command <code>dscacheutil -flushcache</code>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com1tag:blogger.com,1999:blog-10026400.post-79403088812157705042009-02-02T10:55:00.002+00:002009-02-02T11:15:39.504+00:00gitweb - 500 - HEAD ref not found for project<p>
We have some git repositories here at Oxford and a gitweb interface to view them. For some of our projects I was seeing:
</p>
<code>500 - HEAD ref not found for project</code>
<p>It turns out this was because the <code>HEAD</code> file ( {git-directoy}/HEAD ) was pointing to <code>ref: refs/heads/master</code> and these projects didn't have a master branch. Changing the HEAD file to point to the correct branch fixed gitweb.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-73813561334424168272009-01-22T16:24:00.003+00:002009-01-22T16:52:46.705+00:00Trimpath error "context._MODIFIERS is undefined"<p>
I was doing a little JavaScript templating with <a href="http://code.google.com/p/trimpath/wiki/JavaScriptTemplates">Trimpath</a> today and at one point I was getting a nice error in my console of:
</p>
<code>
context._MODIFIERS is undefined
</code>
<p>
Looking through the trimpath code it turned out this was because I was passing in a string rather than an object as my context for the generation of the template. So I was effectively doing:
</p>
<code>
TrimPath.processDOMTemplate("someNodeId", "some string");
</code>
<p>
rather than:
</p>
<code>
TrimPath.processDOMTemplate("someNodeId", {key: "value", otherKey: "value"});
</code>
<p>
In my case I was getting the error because I forgot to eval some JSON before passing it to trimpath.
</p>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com2tag:blogger.com,1999:blog-10026400.post-88679079568666301782008-12-24T11:52:00.002+00:002008-12-24T12:00:17.363+00:00Pooling in Sakai LDAPHere at Oxford we connect to a LDAP server to get details about users for our <a href="https://beta.weblearn.ox.ac.uk/portal/">Sakai service.</a> Previously we had reports of some pages taking a long time to load when lots of users details where requested from the LDAP. One obvious change we could make was to switch to use pooling on our connections to the LDAP server. To check that this was improving the performance I wrote a little test case which attempts to get details about 100 users individually from the LDAP.
<ul><li>Without pooling - 100 users in 10 sec = 10 users/sec.</li><li>With pooling - 100 users in 5 secs = 20 users/sec.</li></ul>This is a nice doubling of performance, although I was still expecting to see better performance generally and while the test is running the local load on the machine isn't very high so I suspect any further performance improvements will have to come on the server.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-46317206536885259132008-12-23T15:05:00.002+00:002008-12-23T15:09:34.219+00:00Tomcat UNIX aliasesTo make managing development instances of tomcat a little easier I have a few bash aliases (you can add these lines to your ~/.bash_profile):
<pre>
alias tchome='export CATALINA_HOME=`pwd`; echo CATALINA_HOME=$CATALINA_HOME'
alias tctail='tail -f ${CATALINA_HOME}/logs/catalina.out'
alias tcless='less ${CATALINA_HOME}/logs/catalina.out'
alias tcshow='echo ${CATALINA_HOME}'
alias tc='${CATALINA_HOME}/bin/catalina.sh'
</pre>
so my typical workflow is <code>cd {tomcat-directory}</code>, <code>tchome</code> and then I move back around the filesystem and use <code>tc start</code> and <code>tctail</code>.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com1tag:blogger.com,1999:blog-10026400.post-67476019354985584252008-09-29T20:52:00.002+00:002008-09-29T20:58:23.454+00:00Keep on rolling...<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_FltME488_qM/SOFAn0ajnII/AAAAAAAAABk/Ct0TyX778GM/s1600-h/DSC00286.JPG"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_FltME488_qM/SOFAn0ajnII/AAAAAAAAABk/Ct0TyX778GM/s200/DSC00286.JPG" border="0" alt=""id="BLOGGER_PHOTO_ID_5251549693319814274" /></a>
Well after a quite a few weeks of waiting my new set of wheels turned up. A Brompton S6L in apple green. The gears needs a little adjusting but otherwise it's a great ride.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-1024613768058168532008-09-24T21:06:00.008+00:002008-09-26T16:45:28.196+00:00Error: sec_error_bad_signature with Firefox 3<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_FltME488_qM/SN0RmzWHsfI/AAAAAAAAABc/OHJ2ksBDz98/s1600-h/Picture+13.png"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://2.bp.blogspot.com/_FltME488_qM/SN0RmzWHsfI/AAAAAAAAABc/OHJ2ksBDz98/s320/Picture+13.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5250372098899554802" /></a>
<p>
Recently when most of our team upgraded their browsers to Firefox 3 we noticed then when we tried to visit on of our internal websites over a secure connection we would get presented with an error page saying "sec_error_bad_signature". Most of the <a href="http://technicalmumblings.wordpress.com/2008/06/13/firefox-3-handling-of-unverified-ssl-certificates/">existing comments</a> on the web seem to be saying that they are seeing this error when visiting a site with an untrusted certificate. However in our case it was a correctly signed certificate obtained through the <a href="http://www.ja.net/services/scs/">JANET Server Certificate Service</a>.
</p>
<br clear="all"/>
<p>
<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_FltME488_qM/SNqzfJWEdJI/AAAAAAAAABU/_xH2GzsZ8UY/s1600-h/Picture+15.png"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://1.bp.blogspot.com/_FltME488_qM/SNqzfJWEdJI/AAAAAAAAABU/_xH2GzsZ8UY/s200/Picture+15.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5249705663319536786" /></a><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_FltME488_qM/SNqy9ie8vfI/AAAAAAAAABM/Mhigg0vS73c/s1600-h/Picture+14.png"><img style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;" src="http://3.bp.blogspot.com/_FltME488_qM/SNqy9ie8vfI/AAAAAAAAABM/Mhigg0vS73c/s200/Picture+14.png" border="0" alt=""id="BLOGGER_PHOTO_ID_5249705085952114162" /></a>
The server is just a Ubuntu Linux server with a standard installation of Apache Tomcat 5.5 and another very similar setup was working correctly. But after close inspection it became clear that the server had a public key using the <a href="http://en.wikipedia.org/wiki/Digital_Signature_Algorithm">DSA</a> algorithm but the machine that was working correctly was using the <a href="http://en.wikipedia.org/wiki/RSA">RSA</a> algorithm. The certificate work was done with the Java keytool command and I think I probably didn't specify the <code>-keyalg RSA</code> argument. After recreating with RSA the certificate and installing it everything was working correctly. The screenshots are taken with Safari (which worked fine with DSA) and shows the two different certificates.
</p>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com4tag:blogger.com,1999:blog-10026400.post-8373226301196990032008-08-16T08:45:00.002+00:002008-08-16T09:06:30.199+00:00Jack BuckettWell it's happened again and our second son <a href="http://flickr.com/photos/buckett/sets/72157606610427214/">Jack Buckett</a> was born on Wednesday the 6th of August at 8:31 weighing 4.09kgs. We are all home and doing well now.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0tag:blogger.com,1999:blog-10026400.post-58354603623467115692008-07-15T09:04:00.005+00:002008-07-15T09:15:42.861+00:00RSF Error<p>
I've just been doing a little web development with <a href="http://www2.caret.cam.ac.uk/rsfwiki/">RSF</a> and it seemed that sometimes when accessing the RSF webapp I would get an error:
</p>
<code>
[An error occurred handling this RSF request]<br/>
[Context has not been started properly]<br/>
</code>
<p>
with a stack trace starting with:
</p>
<code>
WARN: Error initialising SakaiRSF servlet: (2008-07-15 10:07:43,909 http-9080-Processor21_PonderUtilCore)<br/>
java.lang.IllegalStateException: Error acquiring web application context - servlet context not configured correctly<br/>
at uk.ac.cam.caret.sakai.rsf.servlet.ReasonableSakaiServlet.init(ReasonableSakaiServlet.java:41)<br/>
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1139)<br/>
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:791)<br/>
</code>
<p>
It seems that this occurs if you access the RSF webapp while it is still starting up. The only way to fix it is to reload the webapp again and give it a little more time.
</p>Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com1tag:blogger.com,1999:blog-10026400.post-58508830500059973522008-04-15T10:20:00.005+00:002008-04-15T10:44:17.616+00:00Removing Eclipse team provider information<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp3.blogger.com/_FltME488_qM/SASF1kRf3tI/AAAAAAAAAAU/k6HneCIkor0/s1600-h/team-empty.png"><img style="margin: 0pt 10px 10px 0pt; float: right; cursor: pointer;" src="http://bp3.blogger.com/_FltME488_qM/SASF1kRf3tI/AAAAAAAAAAU/k6HneCIkor0/s400/team-empty.png" alt="" id="BLOGGER_PHOTO_ID_5189419825954283218" border="0" padding="2px" /></a>At the moment there are two competing plugins for Eclipse that can provide SVN integration, Subversive and Subclipse. At various times I have tried each of them and they both have their plus points however if I have a project checked out with one plugin and the Eclipse installation I am using doesn't have that plugin installed I don't get any options under the team menu to share the project.
<p>
Rather than getting the old plugin back running and "un-sharing" the project you can just delete a file from the workspace metadata to allow you to re-share the project.
<br/>
<code>workspace/.metadata/.plugins/org.eclipse.core.resources/.projects/{projectname}/.index.properties</code>
<br/>
This seems to work for me under Eclipse 3.3.2.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com1tag:blogger.com,1999:blog-10026400.post-28782986748768146562008-03-19T09:28:00.002+00:002008-03-19T09:33:13.523+00:00tailor for svn to hgWell after attempting to convert the portal part of the sakai subversion repository to mercurial I have discovered that tailor (the tool I used) doesn't understand svn tags and branches (or doesn't convert them to mercurial tags and branches). So although is seems to have converted the portal ok. I now have a huge checkout:
<p>
<pre>
buckett@oucs-matthewb:~/tmp/portal $ du -sh *
228M branches
4.0K project.log
739M tags
23M trunk
</pre>
<p>
So I think tailor would well for converting a branch (eg 2.5-x) or trunk but not for keeping details about when those branches were made from trunk.Matthew Bucketthttp://www.blogger.com/profile/15152807926093631820noreply@blogger.com0