Crash Reporter for Cocoa app [closed] - objective-c

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm working on a Cocoa app targeting Leopard and above, and I'm thinking about adding a crash reporter to it (I'd like to think my app won't crash, but let's get real here). I have some mostly conceptual questions before I really get started.
1) How does this work conceptually, knowing when there's a crash and bringing up a reporter? Do I have a daemon running looking for a crash, or do I wait until my app is launched next time to report?
2) Can this be done in Cocoa? Or would I have to dip into Carbon or IOKit or somesuch?
3) Is this even a good idea? Mac OS X already has a built in crash reporter, but as a developer I don't get to see the crash logs. I don't think my app will be crashing often, frankly, but I just don't want to be naive but this sort of thing.
What are your thoughts and opinions regarding this?

I've had a lot of success with UKCrashReporter. The code is straighforward and easy to modify to match the L&F of your app.
PLCrashReporter looks interesting, though.
I'd stay away from Smart Crash Reporter just because many users (rightfully) don't appreciate your app injecting code into unexpected places and it strikes me as a fragile (perhaps dangerous to use in a released app) approach.

Others have answered the question well and pointed to some good example code.
Coding it yourself is fairly simple. The strategy generally is:
catch appropriate signals
launch a separate crash reporter app that lives inside your application's bundle
the crash reporter app then finds the latest crash log entry for your app and sends it to you via whatever method you desire (POST, email, etc)

I've also rolled my own: SFBCrashReporter
There is a small post on my blog about it.

I have seen a few apps use Smart Crash Reporter or perhaps some variant of it. When your application crashes, it will bring up the usual Apple crash dialog with an extra button which says "Send to both Apple and You"

I would shy away from Smart Crash Reporter for the single reason that it has a bad taste for a lot of users, and is a good way to get bad press for your app (deserved or not) PLCrashReporter or UKCrashReporter http://zathras.de/angelweb/sourcecode.htm they will give some ideas about what to do and how to do it in ways that don't inject into other code space.

Another option is Google's Breakpad. It has a Cocoa framework wrapper, and is compatible with Mozilla's Socorro server. It's used by Firefox, and the Cocoa framework is used in the current betas of Camino. The client-side integration is pretty easy, but I've never looked at what it takes to run an instance of the Socorro server.

I'm using ILCrashReporter and it works really nicely. The method is email based so it works well with Fogbugz.

Related

How do I render nice desktop notifications from Java? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
Improve this question
I am writing this very basic J2SE application which alerts the user with some info every now and then. Currently I am using the SystemTray and TrayIcon classes to show notifications, but I am not really pleased with that. It does not allow me to tweak the notifications, nor gives them a good look.
So, does anyone know an easy to use library to generate nice notifications?
btw, I will be porting to Linux (Ubuntu) to, but will be using notify-OSD there, which is exactly what I need.
Shameless plug: I've just released a project called Twinkle that is pretty much Growl for Java Swing.
I' not aware of a Java library abstracting all OS specific desktop notifications. But if you know, you are limited to Ubuntu (and perhaps a limited number of other OS), you can create a own Interface and implement it for the specific OS.
Ubuntu: You can access /usr/bin/notify-send via Runtime like this: usr/bin/notify-send -t 30000 "Text1" "Text2" -i /path/to/48x48.png
Mac OSX: Java Growl API
For JAVA implementations you may look at Jazz or Mylyn (see Java Desktop Notifications).
You can use JCommunique for cross-platform Java desktop notifications. Here is a short demo adapted from the examples on the wiki:
// makes a factory with the built-in clean theme
// themes are customizeable
NotificationFactory factory = new NotificationFactory(ThemePackagePresets.cleanLight());
// factories build notifications using a theme, while managers handle how
// how they appear on the screen
// this manager just simple pops up the notification in the specified location
// other managers do sliding, queues, etc.
NotificationManager plain = new SimpleManager(Location.NORTHEAST);
// creates a text notification; you can also have progress bar Notifications,
// icon Notifications, Notifications that ask for user feedback, etc.
TextNotification notification = factory.buildTextNotification("This is a title",
"This is a subtitle");
notification.setCloseOnClick(true);
// the notification will disappear after 2 seconds, or after you click it
plain.addNotification(notification, Time.seconds(2));
Brief confession: I also am the creator of this project. It's open source so I don't get any revenue from it.
Some other libraries to have a look at:
Twinkle
This is already mentioned in another answer so I won't say too much about it. I tried the Java Webstart demo and it looked pretty nice. It allows for some more complicated background color options such as gradients that JCommunique doesn't have.
About 3,500 lines.
Has a bunch of fancy styling options such as round vs. rectangle close buttons, gradient vs. solid color, and light vs. dark notifications. However, has just one sequential manager.
The wiki has links to javadocs and a getting started document.
No external dependencies (I think?).
JCarrierPigeon
Very lightweight. Looking at the jar, it has just six classes.
Depends on the "Timing Framework" library.
The website shows that it can do some sliding in effects, but I don't think it does fading or other types of animations.
JTelegraph
Requires JCarrierPigeon and "Timing Framework" in the classpath to build
Has dozens of nice-looking icons included with the project. I'm not sure how these are licensed, but they could be useful if you don't have your own.
As far as I can tell, it doesn't include many more features than those provided in JCarrierPigeon. It mainly includes a bunch of built in icons and a different API.
I can't post links to these since I don't have enough reputation, but they are easy to find on the internet.
Now I will try to objectively evaluate my own library in comparison with the above. Please keep in mind that this list is a bit more extensive since I know more about my project than the others. Let me know if there is anything that I'm missing.
JCommunique
Many features. As far as Notifications go, there are TextNotifications, IconNotifications, AcceptNotifications, and ProgressNotifications (show a progress bar). NotificationManagers handle how Notifications show. These include SimpleManager, QueueManager (scrolls down old Notifications to reveal new ones), SlideManager (slides Notifications into position), and SequenceManager (only shows a Notification when the previous one has disappeared).
Relatively large. I think it clocks in at about 2,500 lines in total.
Has a wiki with a number of examples.
Notifications look a bit plain because they can only be one solid color. Twinkle wins in this respect; it has gradients and outlines around its notifications.
A handful of built-in themes. At time of writing these include dark, light, and aqua. You can also add your own.
No external dependencies other than Java.

Should I write my app with Sencha Touch or Native? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 9 years ago.
Improve this question
With the recent updates to Sencha Touch, it's looking more and more like a native app for iPhone and even iPad. There are still many differences and the documentation is a little lacking at the moment.
My question is, given that I am already fully capable of creating native app in Objective C, should I switch to Sencha Touch and PhoneGap, or start integrating those tools?
What are the pros and cons?
EDIT:
Thanks for the insightful points. One of my partners wrote up their opinion over the weekend with some ideas that haven't been mentioned here: Web vs Native: How Should You Write Your App?
Pros:
Easier to port to other platforms.
You can distribute outside the App Store if the app doesn't require any native APIs.
Cons:
Scrolling still doesn't feel quite right with any of the web-based touch frameworks.
Slower (hardware-accelerated CSS animations help, but it's not nearly as flexible as Core Animation).
Lacks full access to native hardware and OS-integration (PhoneGap provides some, but not everything), such as:
Push notifications.
Local notifications.
Background location updates (including significant location monitoring).
This is debatable, but in my opinion Cocoa Touch is easier to develop in than JavaScript + Sencha/XUI/etc.
Questions leading to your own answer:
Do you need the raw performance of a native ARM app? Or do you need an API that's only available to Objective C? (For instance, for real-time audio synthesis, etc.) Do you want to use Apple's latest APIs without waiting for some tool or library vendor?
Do you mind that your javascript source code in visible unencrypted inside every customer's .ipa file?
Or do you want to easily port a simpler app cross-platform?
Pros: None
Cons: It will never be as native as a
native app. And you depend on an API
that isn't yours, eg. all your apps
will be useless once they stop
maintaining their API.
However, if you were unexperienced and only needed to make a App for a short event (upcoming movie promotion, etc), this would be perfect as it would save you time. But well, if you want a App with a longer lifecycle, go native.
Forget the details of comparing these frameworks to native apps, native will always win. If your app needs to run on "multiple" platforms, then you are better off using PhoneGap and a javascript framework. These frameworks are going to take awhile to mature, so you'll have to figure out if you can get by on what they offer now. PhoneGap is also open source, so if there is something native that you want to expose, contribute to the project.

When is [NSWindowDelegate windowWillClose] called?

I have observed that windowWillClose is called when the user closes a window but is NOT called when the window is closed because of app termination.
Now, for me this is a good thing because I want a certain piece of code to run when the window is closed but not at shutdown.
The reason for the question is that I cannot see why this should be the case from the Apple docs (all it says is "Tells the delegate that the window is about to close."). Can I rely on this behaviour not being "fixed" in future Cocoa versions?
It's impossible to know for sure what Apple will do in the future. However, that has been the behavior for as long as I've been programming Cocoa. My guess would be that it's not going to change any time soon, especially since this is in a pretty mature part of the framework. But that's just my guess.

Other than Xcode, are there any full functioned IDEs for Objective-C? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking us to recommend or find a tool, library or favorite off-site resource are off-topic for Stack Overflow as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it.
Closed 8 years ago.
Improve this question
I know and have Xcode, but I was wondering if there were any other complete development environments that support Objective-C? I'm not looking for solutions with vim or emacs, nor editors like BBEdit that support syntax highlighting, but a full fledged IDE with:
code completion
compilation
debugging
refactoring
Extra points for being cross platform, supporting vi key bindings and supporting other languages.
Note:
I've updated and accepted my answer below as Jetbrains has released Early Access for AppCode, their new Objective-C IDE. Since this has been a fairly popular question, I thought it worthwhile to update the information.
I recently learned that Jetbrains the make of my favorite IDE (Idea) may support Objective-C (though it is unclear how much it will work for iPhone/iPad development). See the thread here for early discussion on this.
In the last year or two, they have started adding additional language support both in their flagship IDE as well as specialized IDEs (for Ruby, Python, PHP). I guess this is just another step in the process. I for one would love to have another option other than XCode and I couldn't think of one that I'd love more.
This is obviously vaporware at the moment, but I think it is something to keep an eye on.
This is now a real product, albeit still in Early Access. See here for a the blog on this new product, which will give you pointers to check out the EAP.
UPDATE: AppCode has now been released and offers a true alternative to using Xcode for Objective-C and iPhone/iPad/Mac development. It does still rely on Interface Builder for layout and wiring of GUI components and uses the iOS simulator, but all coding, including a slew of refactorings, smart templating and static analysis, is available through App Code.
Textmate is an editor like BBEdit but it has the ability to run commands such as compilation, debugging, refactoring (though it will do so via XCode). It also has code completion.
In addition, you can write your own commands for Textmate that you can then run.
I have been searching for something like this that does NOT run on mac for quite a few months now. Unfortunately I think that due to the relative obscurity of the Objective-C language that nobody has ever bothered producing such a full featured IDE for it. Until now, and we only have Xcode.
Using JBuilder I fell in love with the auto-completion and displaying the function 'hints' on the screen while I type. I am that sort of person who remembers the 'ideas' better than the actual syntax and really benefits from knowing right then and there that the code I typed was correct, not having to find out a minute later at compile time. And then to have to try and figure out if I just misspelled something, or if I truly made a conceptual error due to a misunderstanding of proper use of the language. Code completion and hints have always saved time on this for me.
I know some people may look down on this and say the feature is unnecessary if you know what you're doing, but I never claimed to be better than anyone else.
I may have to just give up and try and get OS X running on my PC. Which doesnt bother me in the least, just the rebooting to go back and forth to windows. I've tried to run it virtualized under VMWare but XCode kept crashing :( That reminds me I am going to google 'leopard vmware' and see if any progress has been made in that area.
Another problem in designing a full code-completion system with objective C is that the syntax is a little more forgiving, I dont know the exact technical term (strongly typed?) it is much harder to say exactly what sort of object belongs in a certain parameter and ANY object can be sent ANY message whether it implements that function or not. So you can spell a function name wrong, but it doesnt necessarily mean you made a syntax error... maybe you mean to call a function of that OTHER name and you just want nothing to be done if the function is not implemented by your object.
That's what I would really like to see for Objective-C, is an IDE that once it notices you are sending a message to an object, it displays a list of methods and function definitions that the object is known to accept, and walks you through filling in the parameters.
I think you would waste less time by sticking with Xcode rather than looking for another IDE if you want to develop for the Mac (or iPhone).
Apple made a lot of effort to kill any competitor in that area to make sure any developer wanting to develop for the Mac platform use Xcode and only Xcode.
It might not be the best IDE but it does work well and it is the IDE developers at Apple are using. Somehow it does its job. The frameworks and the documentation are very well integrated.
I use TextMate a lot and also SubEthaEdit but they are not full IDE as you’ve described above.
Best Regards.
Check out JetBrains' new IDE called "App Code". It's still in the Early Access Program, but even with the Early Access bugs it is hands-down better than xcode 4. I've been using it for commercial iPhone and iPad development.
http://www.jetbrains.com/objc/
I would like to second Troy's answer and note that JetBrains has AppCode in early access, so you can try it for free. It has the familiar UI of their other products, and yes, it supports vi! So far it has been very good. I have run into a few issues, and a few vi-isms that don't work quite right, but it is still better than suffering with Xcode. I do text editing with syntax completion in AppCode, but switch back to XCode to get into the GUI builder which is actually quite good in Xcode.
If you are an old vi-guy like myself, it is invaluable.
The short answer is: No. There are thousands of IDEs but Xcode is the only one which you seriously can name IDE. I suggest you have a look at the tries of GNUStep (in form of Projectcenter, Gorm) and then you can imagine the state of affairs.
I believe KDevelop is the only full IDE that supports Obj-C, but I'm not even sure how fully it supports it, having never used it myself. Worth a shot, maybe.
There are a few programmers text editors that support Objective-C, but I like Editra, mainly because I also write Python on Windows\Nix and it has great features. Editra runs well on all platforms and has a nice plug-in that supports Mercurial, GIT, and Subversion if you need them. Another nice thing, its written in Python. Editra Home
Found another, though it sounds less than ideal:
ActiveDeveloper - doesn't appear to have active support (last update was in 2006). Mac only.
KDevelop sounds like it only supports Objective-C syntax and only through its C support. I'm going to check it out anyway.
Textmate has a couple screencasts for Objective-C (here and here). It is Mac only, but otherwise looks pretty good. It is hard to tell from the screencast how strong the integrated support is as it seems to just have a lot of scripts to handle the code. Also, I can't tell if it does true code completion or just expansion for snippets.
So it doesn't look like there is anything out there that hits everything. I'll probably do most of my development on Mac, so I'm thinking I'll try out TextMate with XCode to see if it is any better than straight XCode. I'll take a quick look at KDevelop.
Thanks.

How do I stop Windows applications from stealing focus [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 9 years ago.
Improve this question
I know this isn't strictly a programming question but y'all must have experienced this.
So...you have four or five RDP sessions open over the corp VPN, you're bashing away inside your favourite IDE, your VPN to the data centre bounces briefly then recovers, all your RDP sessions start re-establishing their connections and whilst doing so sequentially keep grabbing focus, one after the other. Pretty bloody annoying and downright rude.
Any idea how to prevent this behaviour and just make the RDP client flash it's taskbar button instead of totally grabbing focus away from whatever you were doing?
#Jason - thanks for the reply, I'm running 64 bit Vista and 64 Bit Windows 2008. Any ideas how well it plays?
#Jason - good idea. Done.
#Ryan - thanks also for the answer. I tried Terminals a few times before, but quite often I need to see two or three sessions side by side which the tabbing doesn't really facilitate too well, would've been nice to have a 'pop out in own window' button. I did once grab the source code to fix stuff like that, but never got the time. I also found it behaved oddly whenever there was a brief network disconnect (e.g. xDSL flapping) and it would reconnect to the wrong session (usually a new one) and leave the session I had opened in a disconnected state on the server. Otherwise Terminals would've been really cool, we have 200+ windows servers, and organising all those .rdp files can be a pain.
I use Tweak UI to configure explorer so that apps don't steal focus; you can also configure how many times they flash in the taskbar as well.
EDIT: Once you are within Tweak UI, these options are found under General > Focus.
EDIT: #Kev, apparently there is a 64-bit version (not MS approved, apparently, I would scan it for viruses of course) that works successfully with the 64-bit version of XP. From what I understand, you download that and then run it in XP compatibility mode as administrator and it will do the trick. Tweak UI is basically a nice wrapper around a collection of registry hacks, so I imagine you could find the hacks themselves if you didn't care for running Tweak UI in this manner. Hope that works for you!
As an alternative, you could try using something like Terminals. It allows you to have multiple remote desktop windows open at once all as tabs in the same window. Quite cool. Also, it is open source so you can change its behavior if needed (although I don't believe it steals focus like a normal RDP session does).
Since I don't think there's an approved version of TweakUI other than for XP. Apparently making this change in the registry has a similar impact for Vista:
[HKEY_CURRENT_USER\ControlPanel\Desktop]
ForegroundLockTimeout = 0
However I found (Vista x64) that while focus on the original was maintained the offending window would still take the foreground - quite distracting.