Archived entries for programming

Aptana SFTP “no suitable key exchange” or “socket is EOF” fix


Today I spun up a quick development instance using Ubuntu 15 and found that Aptana refused to connect via SFTP. After a few rounds of Google > Fix > New Error > GOTO 10 I’ve found that there are two problems.

  1. Aptana does not support anything more advanced than diffie-hellman-group1-sha1 for key exchange.
  2. OpenSSH has removed AES*-CBC ciphers from its default ciphers in favor of newer AES*-CTR ciphers.
  3. Aptana has explicitly disabled CTR support in their SSH library.

Continue reading…

Encoding and Decoding Large Numbers in PHP

I found an interesting question on StackOverflow today. Not necessarily because I have any interest in BitCoins [I don’t], but because the asker needed to convert the format of some very large numbers. In this case the number turned out to be 58 digits in base 10, and PHP has a tendency to crap out somewhere after 11 to 19 digits.

The first problem I tackled was writing a proper base58 encoding function since the ones floating around the internet seem to be spotty at best. But why limit it to just one encoding? I’ve written the same function a handful of times already, all with different, strange, and sometimes scrambled bases. I’d definitely been doing it wrong.

This is what I came up with:

function arb_encode($num, $basestr) {
	$base = strlen($basestr);
	$rep = '';

	while($num > 0) {
		$rem = $num % $base;
		$rep = $basestr[$rem] . $rep;
		$num = ($num - $rem) / $base;
	return $rep;

Continue reading…

HTTP Compression Self-Test in PHP

I’ve noticed that it can be difficult for many people to determine whether or not their server software is already compressing their output for them independently of what they have in their code. Most browsers do not present this information without an add-on, and Apache and IIS do not provide any information via the $_SERVER array as to whether compression is turned on, so the only way to check is to make a request against your server and inspect the response.

I’ve created the following script to simplify this process, just drop it somewhere on your server and request it with your web browser.. Continue reading…

A quick post to start things off

Instead of the usual “first post! blah blah” crap I usually start off with, replete with empty promises and high hopes, let me just crack right into some actual content.

Awhile ago I stumbled across a link to some info on the AI systems in Left4Dead. Not thinking much of it and looking for a quick read by someone who’s simply dug around in Steam’s ‘Hammer’ editor I had a look. To my surprise it was actually a full presentation by someone from Valve’s development team about the particular problems of populating and motivating a hundred shambling zombies at a time, and how they manage the game’s pacing while keeping the players from ragequitting.

Presentation can be seen after the jump. Continue reading…

Copyright © 2009–2010. All rights reserved.

RSS Feed.