小编Sam*_*ami的帖子

同时运行多个python脚本

如何运行多个python脚本?目前我像这样运行一个python script1.py.

我试过了python script1.py script2.py,但这不起作用:只运行第一个脚本.另外,我尝试过使用这样的单个文件;

import script1
import script2

python script1.py
python script2.py
Run Code Online (Sandbox Code Playgroud)

然而,这也不起作用.

python linux shell

31
推荐指数
4
解决办法
9万
查看次数

将iOS项目转换为ARC时出现Lipo错误

我正在尝试将我的iOs项目转换为使用ARC,但是下面收到一个lipo错误是命令和错误

命令:

CreateUniversalBinary /Users/samichaudry/Library/Developer/Xcode/DerivedData/CartoonQuiz-bqmbxfcdkldmbqawgrfmjtebypuk/Build/Products/Debug-iphoneos/CartoonQuiz.app/CartoonQuiz normal "armv7 armv7s"
cd "/Users/samichaudry/Projetcs/CartoonQuiz/Application/V1.01 New Design Universal/Application"
setenv PATH "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
lipo -create /Users/samichaudry/Library/Developer/Xcode/DerivedData/CartoonQuiz-bqmbxfcdkldmbqawgrfmjtebypuk/Build/Intermediates/CartoonQuiz.build/Debug-iphoneos/CartoonQuiz.build/Objects-normal/armv7/CartoonQuiz /Users/samichaudry/Library/Developer/Xcode/DerivedData/CartoonQuiz-bqmbxfcdkldmbqawgrfmjtebypuk/Build/Intermediates/CartoonQuiz.build/Debug-iphoneos/CartoonQuiz.build/Objects-normal/armv7s/CartoonQuiz -output /Users/samichaudry/Library/Developer/Xcode/DerivedData/CartoonQuiz-bqmbxfcdkldmbqawgrfmjtebypuk/Build/Products/Debug-iphoneos/CartoonQuiz.app/CartoonQuiz
Run Code Online (Sandbox Code Playgroud)

错误:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo: can't figure out the architecture type of: /Users/samichaudry/Library/Developer/Xcode/DerivedData/CartoonQuiz-bqmbxfcdkldmbqawgrfmjtebypuk/Build/Intermediates/CartoonQuiz.build/Debug-iphoneos/CartoonQuiz.build/Objects-normal/armv7/CartoonQuizCommand /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/lipo failed with exit code 1
Run Code Online (Sandbox Code Playgroud)

architecture xcode automatic-ref-counting xcode4.6 lipo

7
推荐指数
1
解决办法
3819
查看次数

将首选项窗口添加到Mac App

好的,所以我已经制作和应用程序,我想添加一个首选项窗口到我的应用程序,可以从菜单栏访问.

任何人都可以为我提供有关如何做到这一点的教程或指南,谢谢,萨米.

macos window objective-c preferences

6
推荐指数
1
解决办法
2080
查看次数

Objective-C Mac OS X分布式通知iTunes

我需要一点帮助,我现在有一个方法; 我的Mac OS X应用程序中的updateTrackInfo获取当前在iTunes中播放的艺术家名称,曲目名称和曲目的持续时间

但是,我希望应用程序监听分发的iTunes通知; com.apple.iTunes.playerInfo然后在iTunes分发通知时调用方法updateTrackInfo.请有人帮助我,我需要在标题和实现文件中写什么.

谢谢,萨米.

xcode notifications itunes objective-c scripting-bridge

4
推荐指数
1
解决办法
3894
查看次数

游戏中心iOS 7无法正常工作

遵循Ray Wenderlich关于使用iOS 7实现Game Center的教程

http://www.raywenderlich.com/3276/game-center-tutorial-for-ios-how-to-make-a-simple-multiplayer-game-part-12

但是,我没有得到登录的提示,也没有欢迎回来横幅出现,尝试了很多教程,似乎无法让它与iOS 7一起工作.

这是我的代码

GCHelper.h

#import <Foundation/Foundation.h>
#import <GameKit/GameKit.h>

@interface GCHelper : NSObject {
    BOOL gameCenterAvailable;
    BOOL userAuthenticated;
}

@property (assign, readonly) BOOL gameCenterAvailable;

+ (GCHelper *)sharedInstance;
- (void)authenticateLocalUser;

@end
Run Code Online (Sandbox Code Playgroud)

GCHelper.m

#import "GCHelper.h"

@implementation GCHelper

@synthesize gameCenterAvailable;

#pragma mark Initialization

static GCHelper *sharedHelper = nil;
+ (GCHelper *) sharedInstance {
    if (!sharedHelper) {
        sharedHelper = [[GCHelper alloc] init];
    }
    return sharedHelper;
}

- (BOOL)isGameCenterAvailable {
    // check for presence of GKLocalPlayer API
    Class gcClass = (NSClassFromString(@"GKLocalPlayer")); …
Run Code Online (Sandbox Code Playgroud)

leaderboard ios game-center ios7

3
推荐指数
1
解决办法
2062
查看次数

Objective-C在NSUserDefaults中保存NSColor

如何保存点的颜色,以便在打开和关闭应用程序时,点是用户最后设置的颜色?

有人可以向我解释如何使用NSUserDefaults以及在哪种方法中声明NSUserDefaults.

到目前为止我有这个:

NSData *data = [NSArchiver archivedDataWithRootObject:color];
[[NSUserDefaults standardUserDefaults] setObject:data forKey:@"MyColor"];

NSData *data = [[NSUserDefaults standardUserDefaults] objectForKey:@"MyColor"];
NSColor *color = [NSUnarchiver unarchiveObjectWithData:data];
Run Code Online (Sandbox Code Playgroud)

我遵循的教程链接:http: //www.mactech.com/articles/mactech/Vol.25/25.04/2504RoadtoCode/index.html

objective-c save nsuserdefaults nscolor

1
推荐指数
1
解决办法
1250
查看次数

计算距离:方法"必须返回一个值"?

我正在尝试调用该dist()方法但是我一直收到错误,说dist()必须返回一个值.

// creating array of cities
double x[] = {21.0,12.0,15.0,3.0,7.0,30.0};
double y[] = {17.0,10.0,4.0,2.0,3.0,1.0};

// distance function - C = sqrt of A squared + B squared

double dist(int c1, int c2) {
    z = sqrt ((x[c1] - x[c2] * x[c1] - x[c2]) + (y[c1] - y[c2] * y[c1] - y[c2]));
    cout << "The result is " << z;
}

void main()
{
    int a[] = {1, 2, 3, 4, 5, 6};
    execute(a, 0, sizeof(a)/sizeof(int));

    int …
Run Code Online (Sandbox Code Playgroud)

c++ distance square-root

0
推荐指数
1
解决办法
214
查看次数

从plist中读取一系列字典

嗨,我正试着读一个plist的值,这就是我的plist看起来像atm

<plist version="1.0">
<array>
    <dict>
        <key>Title</key>
        <string>Mickey Mouse</string>
        <key>Image</key>
        <string>mickeymouse.png</string>
        <key>Hint1</key>
        <string>Hint 1</string>
        <key>Hint2</key>
        <string>Hint 2</string>
        <key>Hint3</key>
        <string>Hint 3</string>
    </dict>
    <dict>
        <key>Title</key>
        <string>Peter Pan</string>
        <key>Image</key>
        <string>peterpan.png</string>
        <key>Hint1</key>
        <string>Hint 1</string>
        <key>Hint2</key>
        <string>Hint 2</string>
        <key>Hint3</key>
        <string>Hint 3</string>
    </dict>
</array>
</plist>
Run Code Online (Sandbox Code Playgroud)

这个我正在使用的代码然而它只是崩溃了.

AppDelegate *appDelegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
NSString *questionNumber = [NSMutableString stringWithFormat:@"Item 0"];
NSString *path = [[NSBundle mainBundle] pathForResource:@"Level1" ofType:@"plist"];
NSMutableArray *array = [[NSMutableArray alloc] initWithContentsOfFile:path];
NSDictionary *questionNumberDictionary = [array objectForKey:questionNumber];
NSString *questionTitle = [questionNumberDictionary objectForKey:@"Title"];
NSString *questionImage = [questionNumberDictionary objectForKey:@"Image"]; …
Run Code Online (Sandbox Code Playgroud)

nsdictionary plist nsmutablearray nsarray

0
推荐指数
1
解决办法
4143
查看次数