小编Ben*_*ueg的帖子

git从历史记录中删除合并提交

我的Git历史看起来像这样:

Git历史

我想把紫色的提交压成一个.我不希望在我的提交日志中再次看到它们.

我试过做了git rebase -i 1,但即使1是在蓝色分支上(参见图片),我仍然看到我的紫色分支上的每个提交.

如何完全删除紫色分支(来自提交日志)?

git git-merge git-rebase

75
推荐指数
5
解决办法
12万
查看次数

UIPageViewController和故事板

我正在尝试从故事板中特定配置UIPageViewController:

在此输入图像描述

TutorialPageViewController.h

#import <UIKit/UIKit.h>
@interface TutorialPageViewController : UIPageViewController <UIPageViewControllerDelegate, UIPageViewControllerDataSource>
@end
Run Code Online (Sandbox Code Playgroud)

TutorialPageViewController.m

#import "TutorialPageViewController.h"

@interface TutorialPageViewController ()
@property (assign, nonatomic) NSInteger index;
@end

@implementation TutorialPageViewController
{
    NSArray *myViewControllers;
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.delegate = self;
    self.dataSource = self;
    [self didMoveToParentViewController:self];
    UIStoryboard *tutorialStoryboard = [UIStoryboard storyboardWithName:@"TutorialStoryboard" bundle:[NSBundle mainBundle]];
    UIViewController …
Run Code Online (Sandbox Code Playgroud)

ios uistoryboard uipageviewcontroller xcode-storyboard

45
推荐指数
4
解决办法
3万
查看次数

FBSDKLog:无法使用Facebook应用程序或Safari进行授权,fb****未注册为URL方案

我想要Facebook app native dialog login(https://developers.facebook.com/docs/technical-guides/iossdk/login/#fbnative).

在控制台中,单击FBLoginView时收到以下消息:

FBSDKLog: Cannot use the Facebook app or Safari to authorize, fb**** is not registered as a URL Scheme
Run Code Online (Sandbox Code Playgroud)

但我完全按照这里做的那样:将Facebook SDK更新为3.5后无法打开活动会话

facebook-login ios6

34
推荐指数
3
解决办法
3万
查看次数

ForeignKey不允许空值

我正在使用Django REST Framework 2.0.

这是我的模型类:

class Mission(models.Model):
    assigned_to = models.ForeignKey('auth.User',
                                    related_name='missions_assigned',
                                    blank = True)
Run Code Online (Sandbox Code Playgroud)

这是我的观点类:

class MissionList(generics.ListCreateAPIView):
    model = Mission
    serialize_class = MissionSerializer
Run Code Online (Sandbox Code Playgroud)
  1. 多部分表单在浏览器中呈现,assigned_to字段为空.

  2. 发布原始JSON时,我收到以下错误消息:

Cannot assign None: "Mission.assigned_to" does not allow null values.

django django-rest-framework

33
推荐指数
3
解决办法
5万
查看次数

Android相机教程(使用surfaceview)

这是我的示例代码:

package newslab.video.server;

import android.app.Activity;
import android.hardware.Camera;
import android.os.Bundle;
import android.util.Log;
import android.view.SurfaceHolder;
import android.view.SurfaceView;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class VideoServer extends Activity implements SurfaceHolder.Callback {
    TextView testView;

    Camera camera;
    SurfaceView surfaceView;
    SurfaceHolder surfaceHolder;

    private final String tag = "VideoServer";

    Button start, stop;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        start = (Button)findViewById(R.id.btn_start);
        start.setOnClickListener(new Button.OnClickListener() {
            public void onClick(View arg0) {
                start_camera();
            }
        });

        stop = (Button)findViewById(R.id.btn_stop); …
Run Code Online (Sandbox Code Playgroud)

android surfaceview

19
推荐指数
2
解决办法
9万
查看次数

使用xcode 6.0.1上传应用后,"您的二进制文件未针对iPhone 5优化"

我在使用Xcode Version 6.0.1(6A317)上传我的二进制文件后收到此电子邮件

您的二进制文件未针对iPhone 5进行优化 - 提交的新iPhone应用程序和应用程序更新必须支持iPhone 5上的4英寸显示,并且必须包含在UILaunchImages下的Info.plist中引用的启动图像,其UILaunchImageSize值设置为{320, 568}.启动映像必须是PNG文件,位于捆绑包的顶层,或者如果您本地化启动映像,则在每个.lproj文件夹中提供.在https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconsImages/IconsImages.html#/上查看"iOS人机界面指南",详细了解iPhone 5支持和应用启动图片/ apple_ref/doc/uid/TP40006556-CH14-SW5 '和' https://developer.apple.com/library/ios/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/App-RelatedResources/App上的'iOS应用程序编程指南' -RelatedResources.html#// apple_ref/doc/uid/TP40007072-CH6-SW12 '.

这是我的plist文件:

在此输入图像描述

这是我的Xcode树:

在此输入图像描述

这是我的捆绑根树:

在此输入图像描述

这是我在这个问题上可以找到的唯一资源,但它仍然没有答案(3天)... https://devforums.apple.com/message/1051948#1051948

xcode localization itunesconnect

18
推荐指数
1
解决办法
2万
查看次数

Android将EXIF GPS纬度和经度写入JPEG失败

我想在jpeg照片中添加经度和纬度等GPS数据.通过标签卡(NFC)捕获照片在logcat中可以显示正确的值,但这些值不能写入jpg照片文件!

下面是我的代码:它用于获取保存的jpg文件并调用下面的方法该方法用于将EXIF GPS参数添加到jpg中经度和纬度等GPS参数已经在另一个活动中使用.

我在Firefox中使用EXIF Viewer来查看结果.

IO异常的位置是否重要?

以下是可能导致失败的重要日志cat日志:07-26 11:48:30.386:D/NativeNfcTag(195):标记丢失,重新启动轮询循环

 public static void writeFile (File photo, double latitude, double longitude) throws IOException{


    ExifInterface exif = null;

    try{
        Log.v("latiDouble", ""+latitude);
        Log.v("longiDouble", ""+longitude);
        exif = new ExifInterface(photo.getCanonicalPath());
        if (exif != null) {
        double latitu = latitude;
        double longitu = longitude;
        double alat = Math.abs(latitu);
        double along = Math.abs(longitu);
        String stringLati = convertDoubleIntoDegree(alat);
        String stringLongi = convertDoubleIntoDegree(along);
        exif.setAttribute(ExifInterface.TAG_GPS_LATITUDE, stringLati);            
        exif.setAttribute(ExifInterface.TAG_GPS_LONGITUDE, stringLongi);
        Log.v("latiString", ""+ stringLati);
        Log.v("longiString", ""+ stringLongi);
        exif.saveAttributes();
        String lati = exif.getAttribute (ExifInterface.TAG_GPS_LATITUDE);  
         String longi …
Run Code Online (Sandbox Code Playgroud)

gps android jpeg location exif

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

Django日志过滤器用于慢速SQL查询

由于以下LOGGING设置,我目前正在记录所有SQL查询:

LOGGING = {
    'version': 1,
    'disable_existing_loggers': False,
    'filters': {
        'require_debug_false': {
            '()': 'django.utils.log.RequireDebugFalse'
        }
    },
    'formatters': {
        'standard': {
            'format' : "[%(asctime)s] %(levelname)s [%(name)s:%(lineno)s] %(message)s",
            'datefmt' : "%d/%b/%Y %H:%M:%S"
        },
    },
    'handlers': {
        'mail_admins': {
            'level': 'ERROR',
            'filters': ['require_debug_false'],
            'class': 'django.utils.log.AdminEmailHandler'
        },
        'console': {
            # logging handler that outputs log messages to terminal
            'class': 'logging.StreamHandler',
            'level': 'DEBUG', # message level to be written to console
        },
        'logfile': {
            'level':'DEBUG',
            'class':'logging.handlers.RotatingFileHandler',
            'filename': os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "log", "logfile"),
            'maxBytes': 50000,
            'backupCount': 2,
            'formatter': …
Run Code Online (Sandbox Code Playgroud)

sql django logging

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

为什么sort命令在法语区域中对"œ"和"oe"进行无差别的排序?

有人可以用字符 - 法语区域设置来解释sort命令的行为吗?

$ file file.txt
file.txt: UTF-8 Unicode text, with CRLF line terminators

$ wc -l file.txt
4 file.txt

$ cat file.txt
cœz
coez
coe
cœ

$ sort file.txt
coe
cœ
cœz
coez

$ sort -d file.txt
cœ
coe
coez
cœz

$ env | grep -P "(LC|FR)"
LANG=fr_FR.UTF-8
Run Code Online (Sandbox Code Playgroud)

"œ"小于或大于"oe"的事实在常规排序的情况下似乎是随机的,而在字典sort(sort -d)的情况下,该字符被简单地忽略.

我想这与整理有关,但我想在这里有一些见解.

unix windows sorting encoding cygwin

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

'WSGIRequest'对象没有属性'successful_authenticator'

我已经创建了一个认证类:

RESTful API的令牌认证:令牌是否应定期更改?

restapi/settings.py

REST_FRAMEWORK = {
    'DEFAULT_AUTHENTICATION_CLASSES': (
        'rest_framework.authentication.BasicAuthentication',
        'rest_framework.authentication.SessionAuthentication',
        # 'rest_framework.authentication.TokenAuthentication',
        'restapi.authentication.ExpiringTokenAuthentication',
    ),
    'PAGINATE_BY': 10
}
Run Code Online (Sandbox Code Playgroud)

restapi/authentication.py

import datetime
from rest_framework.authentication import TokenAuthentication

class ExpiringTokenAuthentication(TokenAuthentication):
    def authenticate_credentials(self, key):
        try:
            token = self.model.objects.get(key=key)
        except self.model.DoesNotExist:
            raise exceptions.AuthenticationFailed('Invalid token')

        if not token.user.is_active:
            raise exceptions.AuthenticationFailed('User inactive or deleted')

        # This is required for the time comparison
        utc_now = datetime.utcnow()
        utc_now = utc_now.replace(tzinfo=pytz.utc)

        if token.created < utc_now - timedelta(hours=24):
            raise exceptions.AuthenticationFailed('Token has expired')

        return token.user, token
Run Code Online (Sandbox Code Playgroud)

restapi/tests.py

def test_get_missions(self):
    """
    Tests that …
Run Code Online (Sandbox Code Playgroud)

authentication django token django-rest-framework

6
推荐指数
2
解决办法
5771
查看次数