Home

HowTo - Disable annoying XCode undo warning

  • Oct. 20th, 2008 at 7:43 PM

Ever since version 1.0, XCode has had this annoying 'feature' where, after saving a file, you will be warned when using undo-past that point. I have command-s committed to muscle memory and I love using undo so having to continually dismiss this sheet is a pain.

Fortunately, as with most Apple software, there is a preference to turn it off. Unfortunately, that preference is not exposed to the UI. Grrr.

To disable this warning, open /Users/your_user_name/Library/Preferences/com.apple.Xcode.plist and toggle the XCShowUndoPastSaveWarning value to NO.

XCodeUndo

Tags:

Cocoa Programming for Mac OSX

  • May. 25th, 2008 at 9:22 PM

My copy of the 3rd Addition of Aaron Hillegass's must-have book arrived last week. The 2nd edition pretty much convinced me to stick with Cocoa and was probably the best learn-an-API book I've ever read, for any platform. The latest edition continues this tradition and is jam-packed with screenshots and useful code snippets. It's perhaps a testament to Cocoa and Apple's tools that this book goes from introducing the Objective-C language to writing fully-featured document applications with undo, custom graphics and pasteboard support in 450 pages. The books I've seen on .Net tend to be 3x that length merely to cover the same functionality.

The 3rd edition introduces Tiger and Leopard technologies such as Core Data and Core Animation in addition to a wonderful new chapter on the new NSViewController class. Some material from the 2nd version is inexplicably missing however, such as the chapters on NSTextView and GNUStep. There is no mention of why these were removed so it still pays to have the earlier editions. The 2nd edition also included a section on developing IB 2.0 palettes which is entirely absent: I'd hoped that this would be updated for IB 3.0 as I've been unable to find much info on the web.

The new chapters on using NSTask and building a webservices are also nice editions with lots of reusable code.

Alas, this book also repeats some mistakes of its predecessors. It fails to explain some concepts, nor does it point you towards additional information. For instance, the section on adding undo-support to RaiseMan is virtually unchanged and instructs you to add the following methods to the document subclass:

- (IBAction)insertObject:(Person *p) inEmloyeesAtIndex:(int)index:
- (void)removeObjectFromEmployeesAtIndex:(int)index;

The text says these functions are 'called automatically' but it doesn't explain how or why. It turns out that when using an NSController to add and remove from mutable sets, where the controller's content binding is used, the Cocoa runtime builds the function name from the content name (in this case 'employees', an NSMutableArray). It took quite some time to figure this out as the key info is hidden away in Apple's docs. A 'more information' footnote or section would have made this and other code a great deal clearer.

This a great read, a solid refinement of the series. It's a shame that the book doesn't go into a bit more detail about how things work the way they do, especially as there really is no 'advanced version' of this book out there, and the removal of the previous chapters is shame. 'Building Cocoa Applications - A Step by Step Guide', by comparison, is far more featured introduction, but is in serious need of an update.

Epic Fail

  • May. 17th, 2008 at 11:14 PM

This guy should win an award for being one of the most self-obsessed, arrogant though plainly wrong, ignorant individuals on the net. I'm not going to comment on any of his articles; they just...fail by themselves.

Is this blog a joke? Certainly I've been tricked by such things before...but I don't think so.

[Edit] So this guy is also behind this heap of self-obsessed garbage: "If you want to be a genius, just listen to me."

Turns out he now works for Microsoft as a developer 'evangelist' (paid-fanboy to you and me). It makes me sick.

Tags:

std::map without sorting

  • May. 6th, 2008 at 2:22 PM

Here's a tip which may be of use to someone!

C++ STL programmers apreciate the usefulness of std::map which auto-sorts items by key on insert, but there was an occasion recently where the sort was undesired. There doesn't appear to be an associative container within the STL where sorting is not mandatory; I suppose std::vector<pair<x,y> > coupled with std::find() is the 'official' way to go but this would have meant re-writing significant amounts of code. Fortunately, the map was typedef'd so I could change the template in one place.

My first attempt was to provide a sorting functor that simply returned false:

struct NoSort 
{
	bool operator()(const CString& s1, const CString& s2) const {
		return false;
	}
};

typedef std::map<CString, float, NoSort>	StringToFloatMap


but this resulted in a infinite loop whenever an attempt was made to insert into the map. A collegue and I realized that the map will first test if s1 < s2 and then s2 < s1 but was a getting false in both cases (I suppose this is to avoid comparing doubles to doubles etc) Our solution instead was to cache the values of s1 and s2 in statics and swap the return on alternate iterations:

struct NoSort 
{
	bool operator()(const CString& s1, const CString& s2) const 
	{
		static CString sOld1;
		static CString sOld2;
		
		if ( s1 == sOld2 && s2 == sOld1 ) {
			return false;
		} 
		else 
		{ 
			sOld1 = s1;
			sOld2 = s2;
			return true;
		}
	}
};


which seems to work fine and saved me a lot of work. The [] override still appears to work although I tend to use insert<std::makepare()> to avoid subtle bugs resulting from std::map's behaviour of creating new pairs if the key does not exist. Also, map.find() will no-longer work, and of course you loose logarithmic complexity, but std::find() will do the job.

[Edit: Apologies for the bad formatting; LJ's HTML editor is very limited under Safari]

Stop

  • Apr. 23rd, 2008 at 12:03 AM

I'm absolutely fed up with with this Windows operating system. This ugly, slow, bloated, over-engineered, lagging-for-no-reason mess is the bane of my existence. How anyone can use this thing for real work is difficult to believe, but the fact that so many choose it as their _primary_ OS is astounding.

I've been spending some time learning .Net and C# in VisualStudio 2008 recently. I like learning new things and while I love Cocoa, .Net has been on my to-do list for some time. Now I'm running Windows on VMWare but the C drive has long since run out of space so about a year ago a created a second drive ('E:' - god what is this, the 70s?!) for installing new apps and keeping documents etc.

Now installing the new tools was a challenge in itself on this setup. Windows is so tied to the C: drive that even when you _explicitly_ select another drive for installations, it still insists on writing to C. And I'm out of space on C. But it will try writing to C anyway, only to fall over after issuing numerous 'C drive is critically low on space errors'. So I tried uninstalling things. I relocated the temp file directory to 'E:'. I moved every thing I could think of to free up space.

Photobucket

But when I run the VC2008 installer, it still insists on installing on C. And removing apps on Windows doesn't actually 'remove' them. I decided to remove Java to free up space, but no sooner had I done so, but the Java Update app kicked in to let me know a newer version was available?! What? How could an app that I just uninstalled tell me a new version is available? And then there's the fact that uninstalled apps leave empty folders and junk everywhere. Visual Studio 2005's 'Maintenance Mode' (when it finally decides to finish launching) kindly informs me that I cannot uninstall individual components because (and I quote) 'Some components have already been uninstalled'.

And don't get me started on the Registry.

I really, really don't want to come across as a platform fanboy. There are a few things I prefer in Windows, really. But this kind of stupidity is ridiculous. The constant updates and patching. The occasionally corrupted profile. The flashing taskbar icons telling me something I don't need to know. The convoluted process of just unmounting a USB drive (which 'Mass Storage Device' is it again?). It's habit of refreshing the desktop icons seemingly at random. The way apps just lag like f**k for no apparent reason, freezing momentarily with the ubiquitous 'Not Responding' message. The way Windows Explorer likes to crash for no reason, taking the Task Bar with it and leaving the system unusable. The way double-clicking a document opens a whole new instance of the associated application, instead of redirecting to the one which is already open and empty. Why why why?!!!

A lot of developers rave about .Net and Microsoft's modern development tools. And on paper it all looks great. But no-matter how good those tools are, they're still running on top of this closed, proprietary, unsafe mess. The CLR is no big advantage when the only supported platform is that with a Windows stamp on it.

My next job is going to be development for the Mac, or, if not that, some other OS. Microsoft, please, just stop. Stop inflicting this on us. Wipe the slate clean and build a new OS around a 'nix core. Do an Apple and leave COM, ATL and all that legacy stuff behind. Vista isn't it. Windows 7 won't be it. Just stop.

Oh and while I was typing this, Windows had another surprise for me:

Photobucket

Just. Stop.

Tags:

DRM

  • Aug. 27th, 2007 at 9:37 PM

With all the hoo-har recently over music-protection, you'd think that Apple Inc, as the self-proclaimed champions of DRM-free music tracks would have their heads on straight when it came to video protection, right? Well this Friday I was looking to order the complete Ghost in the Shell series box set from Amazon. I put down my credit card for the for the full amount and was ready to commit when Amazon helpfully reminded me that the boxset was encoded with the crappy NTSC Region-1 format rather than the PAL Region-2 format for the UK.

Now a little known fact about the DVD-players in modern Macs is that they can only be set to play DVDs from one region at a time. If you insert a disc from another region, you'll be asked if you want to change the setting to play it. Fair enough. Except you can only do this five times before the drive will permanently lock itself to the fifth region.

This boxset doesn't appear to be available in Region-2 along with a whole swathe of Anime DVDs I would like to buy. So instead of legally buying this product though officially-sanctioned channels, I'm being forced to look at less-then legal methods of either getting a ripped region-neutral DVD or downloading the thing from a P2P network.

Similarly, iTunes, Apple's iconic music portal, is region-dependant meaning that there are tracks that I, as UK customer, am simply blocked from buying. Ditto for iTunes video. So I'm forced to look elsewhere (read: Not necessarily legal channels). Does this seem like nuts to anyone else? How can a company, in a very public feel-good-PR-exercise remove the DRM from its music downloads, while still punishing consumers for living in the wrong country? By comparison, Nintendo's products are region-free; I can buy a DS game in Japan which will run quite happily on a UK DS and it doesn't seem to have hurt their business one bit.

Instead of actually protecting copyright, this DRM lunacy is actually encouraging customers to obtain artificially unobtainable products through less than legal means. I hope that in future we can all look back on DRM and laugh at it as a bad idea, like cigarettes and slavery. But I don't think that will happen anytime soon.

iPhoney

  • Jul. 2nd, 2007 at 1:39 PM

The BBC's review of the iPhone goes into detail about the 'extra' features, including the camera, email connectivity, support for YouTube and gorgeous UI. Except, they couldn't make actual calls.

Sadly, I can't comment on this as we weren't in a position to make any calls.

But, hey, it's an iPhone right? Who makes calls when you have IM. But wait...the iPhone doesn't support IM....

Tags:

Good things and small packages

  • Jun. 10th, 2007 at 12:54 AM

I've been cleaning out two years worth of accumulated junk and boxing up gear in preparation to relocate for an exciting new job starting this monday. It's amazing how much of this electrical junk I no-longer need, now that my computer has rendered it obsolete. My TV and DVD player sits gathering dust and I won't be taking them with me. Likewise my stereo has not seen use since...ever. My main development machine, a 1.42GHz G4 Mac Mini has neatly replaced them all as my 'entertainment hub' and yet I'm not really sure how this happened.

More... )

LOL

  • Jun. 4th, 2007 at 12:57 AM

This is one of the funniest things I've seen:

Export tests

  • Jun. 2nd, 2007 at 1:53 AM

The testing of Dr3 is going well and we've found quite a few bugs - some minor, some not so minor. I've corrected some long-standing bugs in the DXF export code and needed to try it out with a variety of other programs that support that format.

Info on the format is a bit scarce because Autodesk consider it proprietary so I've had to reverse engineer it. But supporting basic DXF guarantees compatibility between Aureole and huge swathe of 3D apps (and if they dont support creaky old DXF, they usually support WaveFront .OBJ which Aureole can also handle).

I seriously looked into replacing my old parsing code with DXFLib which is a seriously nice library. To use it, you create a class that implements some callback functions for the entities you're interested in and it calls them; a bit like a SAX XML parser. Nice. But inexplicably, dxflib doesn't support the 3DFACE entity (?!) so I had cleanup my old code instead. Turns out 3DFACE consists of four vertices, even for triangles. The fourth is simply equal to the third in that case.

Anyway I needed to try out the latest build and I've been playing way too much Start Trek Tactical Assault on the DS so I made a starship-thing.

Pics )

Vista Voice Recognition

  • May. 30th, 2007 at 9:39 PM

Microsoft touted voice-recognition as major innovation in Vista (Wow!) but from everything I've seen, it kinda reminds of the old KISS maxim; like when NASA spent millions developing a pen that worked in zero-G while those dastardly Soviets simply used pencils.

Here's a promo from Microsoft:



This video from one Vista fan demos how easy it is to write some Pearl script without the luxury of a keyboard.

http://video.google.com/videoplay?docid=-7180147645692108373&hl=en-CA

Hilarious! :P

ZOMG!!!!

  • May. 29th, 2007 at 8:46 PM

Look at this!!!.

The LOD stuff isn't the cool thing. The cool thing is the solid-operations (Difference, Union etc). This is easy enough with implicit surfaces, but meshes are a different order of complexity. I desperately want to add 'negative' objects to Aureole - these will look like standard primitives but will take material away instead of adding it.

This library will make this a heck of a lot easier!!!

Tags:

Dr3 Build Posted

  • May. 25th, 2007 at 5:13 PM

Dr3 is available for download on the testing forum.



Click for larger screenshot.

This version has been built as a Universal Binary meaning that it should run on both IBM PPC and Intel Macs; I've had this running happily on my Intel Core Duo 2 and it's been tested with the G4.

As of this version, Mac OS 10.4.x is REQUIRED. It won't run on Panther. Sorry about this; it looks like one of the 3rd party libs I'm using makes calls to Tiger-only functions. I'll look into fixing this for future.

25/5/07 DR3 Release Notes )

BuildFactory

  • May. 22nd, 2007 at 4:12 PM

I am SO excited about BuildFactory. CruiseControl is pretty good but I do hate web-UIs and having to manually configure XML to add new projects. And this supports Subversion and distributed builds!!!!

SWEEEET

Aureole Developer Release 3 Feature Set

  • May. 13th, 2007 at 9:38 PM

The long-overdue 3rd snapshot of Aureole is nearly ready for release. This is the most significant version so far and includes numerous enhancements and a few major new features.

Here are the highlights... )

Tags:

MAS & ZigVersion - Review

  • May. 12th, 2007 at 6:16 PM

It seems incredible to think now that 3 years ago I'd never even heard of source control management (SCM). I'd heard of CVS from the Linux folks but for me at least, backing up a project at a critical point meant physically copying the whole directory to another drive and putting the date in the filename. A source control system allows you to 'check out' code out of a repository, work on it, and then check it back in without losing the original copy. You can compare different file versions, line by line and even revert back to a older version from several versions ago. Best of all, a good SCM system keeps your project secure. I now consider SCM a must for any development project.

Under Windows I was introduced to Microsoft Visual Source Safe 6 (VSS) and later Subversion, a much improved version of CVS. But finding a solution for OSX was easier said than done. Subversion is opensource and one pioneering user has even packaged the OSX client binaries. It's enough to get a basic local (file://) repository going but unless you enjoy messing about with the command line that's it. VisualStudio developers can check-in code direct from their IDE and although XCode has some measure of Subversion support, I've found it incredibly buggy and nearly unusable for projects of any size. To really make Subversion useful, I needed to accomplish two things:

1) Find a decent UI-front end for my Subversion repository.
2) Find a way to host my repository on the network.

I found my solution... )

Eating your own dogfood

  • May. 10th, 2007 at 1:44 AM

The last two years have taught me the importance of software Quality Assurance (QA). Whole books have been written on the subject of effective QA. Companies make millions selling QA-oriented products and services. But you know what the most effective way to QA a product is?

Use it.

The history of software engineering is littered with failed, over-budget and flopped software projects. The most recent debacle is the NHS's MTAS recruitment system. I believe this happens because developers deliver software that meets a specification rather than a product that's necessarily fit for purpose. If you can't use you're own product, what makes you think the customer will?

Engineers are not Designers and Designers are not Engineers

If you're writing a word processor, use it to write an article. If you're writing a finance app, use it to track your expenditure.

Simply trying every menu item or clicking every button is not good enough, no matter how much code it exercises; a product can be functionally complete and check every box on the feature list, but if it's unintuitive, hard to use, slow, or buggy in real-term use, it's next to useless. Testing an app means taking off your programmer's hat and pretending to be a customer. It means forgetting about how the product works and concentrating on weather or not the product actually works.

If that menu seems oddly-titled or that button does something you didn't expect, chances are the end-user will feel the same way.

Ubuntu VM - Review

  • May. 7th, 2007 at 12:20 AM

I bought myself a new 2GHz Dual Core 2 MacBook before christmas. In addition to being able to test UB builds of my own OSX apps, the Intel architecture opens the door to running a variety of x86 operating systems. I was introduced to VMware during my day job and coming from a VirtualPC background, I was blown away by its performance, simplicity and compatibility. With the release of the free VMware Fusion for OSX, I can run Windows when I need it in a window (or fullscreen) without needing to partition my drive and restart and at near full speed. I was stoked that I could take a VM from a Windows system and run it right off the Mac.

VMware's website contains a list of prebuilt VMs you can download and I've heard good things about the Debian-based Ubuntu, a new Linux distro 'for the rest of us'. I consider myself an advanced user, but the command line scares me. I hate not being in control of my computer. This is after all, 2007 and if you need to make frequent trips to the Terminal, the OS GUI is clearly wanting. So the Ubuntu ideal appealed to me and I've long wanted to return to the Linux sandbox after some 5 year break. Plus running free software comes with a 'feel good' factor. Can this OS tempt me away from OSX?

Review - Warning pic heavy )

New Journal!

  • May. 2nd, 2007 at 12:13 AM

Hello there. I'm deep_blue_82 and this is my new journal devoted to programming, technologies and other such things. I plan to post regularly about my adventures and the progress I've made on my projects. Yes, I'm a geek and proud of it! :P

I have a degree in Software Engineering and recently quit my day-job in IT (MS Windows development) and until I find something else to pay the bills I can put my effort into brushing up my programming skills.

I'm a long-time Mac user (that means XCode, Cocoa, GCC and some UNIX) but I'm also comfortable with Windows (VisualStudio and the command line). My 'main' language is C++ but I can also use Objective-C, Java or VB if push comes to shove. I'm working on a couple of ambitious Cocoa projects right now in addition to raytracers, OpenGL demos, games and few other such things. I'm also hoping to learn a little more about embedded programming.

Above all I love to learn new things and master new technologies. I'm not a platform fanboi and although I grew up on the Mac with procedural Pascal and event loops, I've been using Windows heavily and have discovered tools and ways of thinking that I knew nothing about just two years ago. These include the wonder of source control, the world of .Net, automation, real cross platform development, the infinity of open source and much, much more.

It really is an exciting time to be into software.

Profile

[info]deep_blue_82
deep_blue_82

Advertisement

Latest Month

October 2008
S M T W T F S
   1234
567891011
12131415161718
19202122232425
262728293031 

Syndicate

RSS Atom
Powered by LiveJournal.com
Designed by Lilia Ahner