February 8th, 2009
As of OS 2.2 there was a problem with UITextAlignmentCenter and UITableViewCells where the text would always show left aligned. The easiest solution was to compile your application for OS 2.0, if you weren’t using any new API features, in which case the original behaviour continued to work. However as of OS 2.2.1 it appears that this no longer works! There were some proposed solutions but they also don’t appear to work anymore.
I’d like to continue building my application for OS 2.0 compatibility so I don’t unnecessarily inconvenience users who haven’t upgraded yet, so I built the following solution that you may find useful – a UITableViewCell subclass that centres the text itself and works when your application is compiled for OS 2.0 or 2.2.1 (and probably others in between).
@interface MyButtonTableViewCell : UITableViewCell
{
}
- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString*)reuseIdentifier;
@end
@implementation MyButtonTableViewCell
- (id)initWithFrame:(CGRect)frame reuseIdentifier:(NSString*)reuseIdentifier
{
if ((self = [super initWithFrame:frame reuseIdentifier:reuseIdentifier]) != nil) {
self.textAlignment = UITextAlignmentCenter;
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (void)adjustLabelSize
{
/* Center the label view. This works around a bug in OS 2.2 which now effects even code compiled for OS 2.0.
* When compiled for OS 2.2.1 this code is unnecessary but still works.
*/
NSArray *subviews = self.contentView.subviews;
if ([subviews count] > 0) {
unsigned int i, c = [subviews count];
for (i = 0; i < c; i++) {
UIView *subview = [subviews objectAtIndex:i];
if ([subview isKindOfClass:[UILabel class]]) {
CGRect frame = subview.frame;
frame.origin.x = floorf(self.contentView.frame.size.width / 2 - frame.size.width / 2);
subview.frame = frame;
}
}
}
}
- (void)layoutSubviews
{
[super layoutSubviews];
[self adjustLabelSize];
}
@end
Posted in iPhone | No Comments »
February 6th, 2009
This morning I have upgraded a non-production but important server from Debian Sarge to Debian Lenny. Figuring it was about time that I did the upgrade I took some advice that Lenny is very stable and could buy me a longer support period by skipping Etch altogether. Time will tell.
This post itemises the steps I went through for posterity and prosperity if I ever need to refer to them again. I’m writing this up from my notes so it is possible that I’ve missed something; if you do attempt a similar upgrade yourself and something turns up, please feel free to suggest it in the comments.
I started by reading (skimming) the release notes for Lenny on upgrading, which are currently in draft as it is in testing. In the future Lenny will obviously become the release version so that URL will become invalid. If you’re upgrading I suggest you to the same; furthermore if you’re upgrading from Sarge read over the Etch release notes for upgrading too. My process is based on and pretty much identical to the process described therein.
Read the rest of this entry »
Posted in Linux | 1 Comment »
December 29th, 2008
Hi all. Happy holidays!
I’ve put the finishing touches on some new features for Charles:
- Validation of Markup (HTML/XHTML), RSS / Atom & CSS
- XML import/export format for recorded sessions
- JSONP support
Download Charles v3.3 b1
Validation is a really exciting addition for web developers. If you’re trying to build valid HTML / XHTML pages (and the accompanying CSS and RSS/Atom feeds) then this will be invaluable for checking your work. First record your pages in Charles, then select them and choose Validate from the context-menu or the toolbar; Charles will validate each page, one at a time, using W3C’s validator web services. You can view a simple summary of the results or detailed warnings & errors for each page. Double-click the error message line numbers to view that line in the source. Note that the validation uses the source recorded by Charles, it doesn’t just pass the URL to the validator, so this correctly validates dynamically generated pages where the same page may emit different markup depending upon input or state. I’m very interested to hear feedback on this feature. Credit to Rowan Simpson and Glen Barnes for the idea to integrate validation into Charles.
Charles can now export and import recorded sessions in an XML format. This is useful if you want to analyse the data collected by Charles in your own software. To this end the Auto Save tool now also supports saving in any export format, rather than just the Charles session format. I’m going to be looking at more ways to integrate Charles into automated monitoring environments in the near future.
Finally, JSONP support was a small but irritating omission in Charles’s JSON support that is now fixed!
This is a public beta so I’m hoping for feedback and bug reports on the new features, especially if I’ve introduced any bugs! There have also been a few bug fixes in this release: fixes to the request editing feature, Map Remote with SSL, and using an external SOCKS proxy.
Please leave feedback in the comments or via the contact form on the Charles website.
Download Charles v3.3 b1
Posted in Charles | 10 Comments »
September 6th, 2008
A small bug fix release to Charles after a few quiet months. I’ve been a bit distracted with family and iPhone apps!
This release includes various minor bug fixes, which you read about. New features include remembering whether you use Structure or Sequence view, support for large files (>2GB) and binding reverse proxies and port forwardings to specific IP addresses on the local machine.
The next release won’t be far away and will include one major new feature around HTML validation, and numerous UI improvements as requested by you!
Download Charles 3.2.2
Posted in Charles | 10 Comments »
March 24th, 2008
Happy Easter! Charles 3.2 has been released today. There are lots of new features so I’ll cover a few of the highlights. You can read the full version history for the whole list.
Breakpoints let you interactively change requests or responses as they pass through Charles. This opens up whole new opportunities for debugging and testing your applications.
Throttling has been enhanced to allow individual throttle configurations for hosts, so not everything has to be throttled the same way anymore. Throttling now also has settings for down and up bandwidth, as these often differ in the real world.
OS integration has improved with the new .chls file extension for saved Charles sessions, and you can now open a .chls file and have it open Charles on Windows and Mac OS X. Windows also gets single-instanced support, so you won’t open a second instance of Charles and have it complain about ports in use! On Windows these enhancements have been made possible by the WinRun4J Java launcher.
Lots of improvements have been made in the Tools user-interface, including enable/disable checkboxes for each location listed in a tool for fine-grained control
There are lots of other enhancements and bug fixes, making this an exciting release! It’s been in beta testing for quite some time but there could still be some bugs; if anything isn’t working the way you expect, or if anything has regressed, please contact me immediately!
Finally, I am planning to change the licensing model for Charles in April: licenses will no longer include life-time upgrades, they will be for the current major version (2.x, 3.x) with upgrade pricing for subsequent versions. This will help Charles to keep improving! Existing license holders are of course not affected by this change.
Download
Posted in Charles | 16 Comments »
March 14th, 2008
Thank you very much to the MidpSSH users who have provided bug fixes or assistance in tracking down bugs recently. The current development release attempts to fix the problems that Blackberry users have been having downloading and installing MidpSSH (thanks rivviepop). It also adds tentative Wi-fi support for Blackberry; fixes an SSH protocol error and connection drop when connecting to some SSH servers (thanks Stefan) and improves the security of the SSH implementation against rogue servers (thanks Aleksy). Thank you again for helping find and or fix these bugs.
I haven’t been able to respond to many of the emails I get about MidpSSH; I really appreciate the positive feedback, and I’m sorry I am not able to help troubleshoot problems. I haven’t had any time to dedicate to MidpSSH in a long time and I sadly don’t have time ongoing.
I think MidpSSH is pretty good at what it does. So my focus on MidpSSH is to fix the bugs that can be fixed, and some of them just don’t seem to be able to (bad phone software). I’m especially happy to apply patches for bugs that users have fixed! I’m not intending to add any new features to MidpSSH myself, however I do welcome your contributions. Download the source and have a go. Send me patches (unified diff against the latest svn preferred). If you would like to be involved and don’t know what to do? I can help with that.
On that note I have got some contributed code that I haven’t got around to including yet. Bluetooth support from both Alex Haan & Joel Jose… I’m going to try to review and include their work soon.
Posted in MidpSSH | 115 Comments »
January 21st, 2008
The next major release of Charles is at a stage where I’d like more people to have a go using it, send feedback and find bugs before I roll it out properly. Charles 3.2 has been in development for the last six months in parallel with the maintenance of 3.1; it includes a number of major new features, redesign of existing features and new built-in help text.
The biggest new feature is Breakpoints, accessible from the reorganised Proxy menu (several things have moved there from the Tools menu). Breakpoints let you intercept and edit a request or response before they are passed on.
All of the tools have received a UI overhaul to make configuring and using them easier. Editing is now done in a pop up dialog rather than inline in the table view, and the location matching has been broken out into its constituent parts and documented in much more detail. You can also now enable each row in a tool separately so you can manage a few different configurations.
Charles saved sessions now have a new suffix .chls and can now be double-clicked to open Charles on Windows and Mac OS X. This makes them much more useful of course. Charles can also now open raw AMF dumps with suffixes .amf, .amf0 and .amf3 for those of you developing with AMF.
In December Adobe released the AMF3 specification. It was great to see that the community’s reverse engineering efforts had hit the nail on the head pretty much everywhere. With the specification they also released the BlazeDS reference implementation (soon to be open source). Charles 3.2 now supports BlazeDS so you can debug your BlazeDS applications! Previously versions of Charles couldn’t parse some of the AMF3 used by BlazeDS.
There are a few other changes and additions hidden in there as well. I have been using Charles 3.2 continuously throughout its development so I’m confident that it works well enough to release as a public beta! Please download and try it out and let me know how you get on, even if that’s just “works fine”.
Download the latest beta from http://xk72.com/charles/beta.php
Thanks!
Karl
Posted in Charles | 23 Comments »
November 12th, 2007
Over the past two months a few small new features and fixes have accumulated, and it’s time they were released (Mostly I’ve been busy implementing some exciting major new features, which I’ll post about shortly!).
The new features include new Chart types on the Chart tab, to help you get an overview of file sizes, durations and file types. Also the Request & Response tabs can now be combined into one Content tab, for all those of you who have requested that! You can activate this feature in the Preferences.
SSL handling now includes better support for reporting errors, such as rejected certificates. So you can now see why applications may not work using SSL through Charles – if they don’t trust the certificates that Charles creates.
Finally there are a few other changes and minor bug fixes that are all listed in the version history on the download page.
Download Charles 3.1.3
Posted in Charles | 9 Comments »
August 13th, 2007
Charles 3.1 has been released this morning. Thank you to everyone who helped test this release. I will be posting more information about the new features in the next few days, and updating the documentation.
Please take note of the changes that may effect existing users (pretty minor). These are listed on the download page and in the release notes.
Download Now
Posted in Charles | 3 Comments »
July 3rd, 2007
It’s time for the next update to Charles. This update includes a number of improvements and additions. I’m releasing it as a public beta so that we can iron out any major problems before the full release. Please read on for details and download instructions if you’d like to help.
Changes include:
The SSL functionality has been refactored so that Map and Map Local now work via SSL.
The Selected Hosts matching algorithm has been improved to support matching the URL’s protocol (http/https) as well as host name and path, and to fix some other pattern matching problems.
ICO and BMP viewing support has been added.
Minimise to system tray is now a preference option on Windows.
Web Interface: A new web-based interface allowing you to start/stop recording and throttling, and to quit Charles. This is the beginnings of being able to script Charles’s behaviour from external applications, such as in automated testing. The interface is designed to also be useable as RESTful services. The functionality is very basic at the moment, so please let me know how you’d like to see it developed if this interests you. The Web Interface is controlled in the Web Interface Settings in the Proxy menu. It is off by default and supports username/password authentication to prevent unauthorised access.
Finally, the layout of forms, such as in the settings dialogs, has been redone with a new layout manager, MigLayout. This fixes long-time annoyances; OK+Cancel button ordering across platform, consistency of form layout, and general improvements to appearance. I hope you enjoy (or at least can see) the difference.
All of this has meant that I’ve finally had to remove support for Java JDK 1.3. Please let me know if this effects you! I am quite confident that Charles will continue to support Java JDK 1.4 and higher for a long time yet, it was just 1.3 that was becomming a barrier to ongoing development.
This public beta is a release candidate so I consider it stable. I’d like to have people testing it for about a week to catch any problems. If you’d like to give it a go, please download from http://xk72.com/charles/beta.php and post comments here or send me feedback using the contact form on the site.
Posted in Charles | No Comments »