osx-lion

Apple PrefPane example fails to build with clang error objecting to both -fobjc-arc and -fobjc-gc

*爱你&永不变心* 提交于 2019-12-10 15:29:14
问题 I'm trying to build a preference pane as a part of learning OS X development. After downloading Apple's preference pane example code and trying to build the project I get the following error: clang: error: cannot specify both '-fobjc-arc' and '-fobjc-gc' Turning off garbage collection in Build Settings allows the project to build properly, but once the preference pane example is installed on the local machine it won't start saying, "You can’t open PrefsPane preferences because it doesn’t work

Showing git branch in shell prompt?

北城余情 提交于 2019-12-10 15:26:18
问题 I am trying to get my shell prompt to display the current git branch name. I have read a few tutorials and blog posts etc. and as far as I understand I'm doing everything correctly but it doesn't seem to be working. I would like the prompt to look like this: dannys-macbook:hillcrest-store [master]$ but currently it looks like this: dannys-macbook:hillcrest-store danny$ I have added the following to ~/.bash_profile: PATH=$PATH:/usr/local/bin; export PATH COLOR1="\[\e[1;32m\]" COLOR2='\[\e[1;1m

NumPy won't upgrade from 1.5.1 to 1.6.2 on OS X 10.7

牧云@^-^@ 提交于 2019-12-10 13:48:06
问题 I am attempting to update/upgrade my NumPy, but am failing. I think I might have multiple versions of NumPy installed in different directories, but python by default imports an old one. Any help? Here's where my Python is: Gonzo-vs-Kitties:~ brian$ which python /Library/Frameworks/Python.framework/Versions/2.7/bin/python Here's the version that Python imports: Gonzo-vs-Kitties:~ brian$ python Python 2.7.3 (v2.7.3:70274d53c1dd, Apr 9 2012, 20:52:43) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)]

How to change the mirror of macports

你说的曾经没有我的故事 提交于 2019-12-10 13:21:53
问题 I'm a newbie to OS X, and totally confused about the way macports works. My question is, how to change the mirror or the sites where macports download the portfiles and distfiles. The mirror I'm trying to use: http://mirrors.ustc.edu.cn/macports/ Should I change the sources.conf? But this mirror has no rsync protocol(I'm not really clear about what rsync protocol is >_<). Or should I configure the macports.conf? I know about the macports offical guide, but I'm not smart enough to figure this

I want to use matplotlib in osx lion

我是研究僧i 提交于 2019-12-10 12:04:25
问题 I installed matplotlib from macports, and version of python is 2.7.1. $ sudo port install py27-matplotlib py27-matplotlib-basemap I wrote a sample program below. #!/usr/bin/python # -*- coding: utf-8 -*- from pylab import * plot([1,2,3]) show() But this didn't work correctly with error log "no module named pylab". And I tried easy_install. $ sudo easy_install matplotlib In this case, my program worked correctly with no errors. What is the difference between these two cases(macports and easy

Error when compiling simple Qwt program on Mac OSX 10.7.4

拜拜、爱过 提交于 2019-12-10 11:40:12
问题 I'm trying to get the following c++ program using Qwt v. 6.0.1 to work: #include <cmath> #include <QApplication> #include <qwt_plot.h> #include <qwt_plot_curve.h> int main(int argc, char **argv) { QApplication a(argc, argv); QwtPlot plot(QwtText("CppQwtExample1")); plot.setGeometry(0,0,640,400); plot.setAxisScale(QwtPlot::xBottom, 0.0, 2.0*M_PI); plot.setAxisScale(QwtPlot::yLeft, -1.0, 1.0); QwtPlotCurve sine("Sine"); std::vector<double> xs; std::vector<double> ys; for (double x=0; x<2.0*M_PI

NSEvent and Magic Mouse

风格不统一 提交于 2019-12-10 11:40:07
问题 How do I distinguish whether the event -(void)scrollWheel:(NSEvent *)event was triggered by a Magic Mouse or a trackpad? The reason I'm asking this question is because I want to assign a different action to the scrolling event when a trackpad is used because the user can pinch to zoom on the trackpad. On the magic mouse, however, the user can't pinch easily, so I want to use the scrolling function as a substitute for pinching. I can distinguish between a normal mouse and a Magic Mouse using

Deploy Lion app to 10.6 exception

感情迁移 提交于 2019-12-10 11:22:54
问题 I have an OS X App That builds on Lion (with latest sdk) but deploy set to 10.6 (to be able run on Snow Leo). ARC enabled. I want's to run app on Show Leopard. Application works well on Lion. But when I start application in 10.6 I get this exception in console: NSRLEArray objectAtIndex:effectiveRange: Out of bounds And nothing more. No stack or whatever. Just this one line. What I may do to clarify situation ? Problem seems more strange, since in Lion all works good. 来源: https://stackoverflow

Creating NSWindow in fullscreen mode

天大地大妈咪最大 提交于 2019-12-10 10:15:34
问题 Is there a way to create a NSWindow into fullscreen mode? NSWindow has the ToggleFullscreen: selector but then it creates the window normally and animates it to the fullscreen version which isn't what I want. Any other way of doing it? 回答1: First find the screen size NSRect screenRect; NSArray *screenArray = [NSScreen screens]; unsigned screenCount = [screenArray count]; unsigned index = 0; for (index; index < screenCount; index++) { NSScreen *screen = [screenArray objectAtIndex: index];

Correctly Installing and configuring Python/Pyside/PyDev on OS X Lion (and likely future versions of OS X)

眉间皱痕 提交于 2019-12-10 09:27:56
问题 I am having issues with PyDev not auto completing pyside correctly, I suspect that I am missing a crucial step in the installation process. So, How does one install and configure a fresh OS X lion install to develop pyside ? Note: This Question does NOT belong on another stack site. This is what a programmer has to do to get his machine in shape to develop python PySide using PyDev. A system administrator is unlikely to have encountered this specific issue. 回答1: I suspect you followed the