小编lak*_*esh的帖子

为什么"git branch"在我的新BitBucket克隆中没有显示任何内容?

我的同事在Bitbucket创建了一个存储库.我首先在计算机中创建了一个文件夹并输入git init.之后,我使用以下命令从存储库到我的计算机进行了克隆:git clone address.

但是当我输入时git branch,没有回复.它并不表示我在哪个分支.

git init
Initialized empty Git repository in /Users/IMAC/GsAdmin/.git/
git clone address
Cloning into 'gsadmin'...
Password: 
remote: Counting objects: 32, done.
remote: Compressing objects: 100% (24/24), done.
remote: Total 32 (delta 3), reused 0 (delta 0)
git branch
git status
# On branch master
#
# Initial commit
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   .DS_Store
#   gsadmin/ …
Run Code Online (Sandbox Code Playgroud)

git bitbucket

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

使用用户输入在Django中创建用户

我想使用用户输入在Django中创建/添加新用户到我的应用程序.我使用的是django提供的默认登录名.我正在尝试将用户添加到默认登录.https://docs.djangoproject.com/en/dev/topics/auth/中的示例:

>>> from django.contrib.auth.models import User
>>> user = User.objects.create_user('john', 'lennon@thebeatles.com', 'john password')
Run Code Online (Sandbox Code Playgroud)

传递用户名和密码.但我希望这可以通过用户输入来实现.我该怎么做呢?

需要一些指导......

我试过这个,但它似乎不起作用:

def lexusadduser(request):
    """
    add user
    """
    if request.method == "POST":
        user.save()

        auth_user = authenticate(username=user.username,password=user.password)

        if auth_user is not None:
            lexusmain(request)
        else:
            return render('adduser.html') 
Run Code Online (Sandbox Code Playgroud)

django

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

由于_NSURLIsExcludedFromBackupKey错误导致Phonegap 1.9.0应用程序崩溃

我正在尝试使用iOS加载Phonegap 1.9.0中的HelloWorld示例,我遇到了一些问题......我正在关注此问题:http://docs.phonegap.com/en/1.9.0/guide_getting-started_ios_index .md.html#Getting%20Started%20with%20iOS它说Apple Mach-O Linker(Id)错误.

当我点击错误时,它说:

Undefined symbols for architecture i386:
  "_NSURLIsExcludedFromBackupKey", referenced from:
      -[CDVFile setMetadata:withDict:] in Cordova
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Run Code Online (Sandbox Code Playgroud)

我写了一个类似的应用程序,不使用手机差距,它运行正常......但当我使用手机间隙,它给了我这个错误..不知道该怎么办...需要一些指导.

iphone ios ios5 cordova

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

在 Django 模板中打印字典值

我将两个名为student_ids和 的字典传递rows给一个 Django 模板。字典student_ids有一个名为student_idand的键invite_id,我想打印出来student_ids[student_id]以获取invite_id.

行字典中行中的第 4 个元素与student_id. 当我尝试下面的代码时,它不起作用......

Django 模板:

{% for row in rows %}
    <a href="#invite"
     data-invite="{{ invite_ids.row.4 }}">
     {{ row.2 }}
    </a>
{% endfor %}
Run Code Online (Sandbox Code Playgroud)

我应该怎么做才能在 Django 模板中获取正确的数据?我本质上需要student.ids[row[4]]被打印出来,并且为了它变得简单......

django

8
推荐指数
2
解决办法
9243
查看次数

在Iphone中使用页面控制扫描图像

我正在尝试制作练习应用程序,我可以使用页面控制滚动图像.我能够滚动图像并能够包含页面控件.但我面临的问题是我无法将两者联系起来.这意味着当我滚动图像时,页面控件不受影响,当我更改页面控件时,图像的滚动不受影响.

我已经提到了这个:http://www.iosdevnotes.com/2011/03/uiscrollview-paging/用于滚动页面控件.

Viewcontroller.h

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController <UIScrollViewDelegate>{
    UIScrollView *scrollView;
    UIPageControl *pageControl;

    BOOL pageControlBeingUsed;
}

@property (nonatomic, retain) IBOutlet UIScrollView *scrollView;
@property (nonatomic, retain) IBOutlet UIPageControl *pageControl;

- (IBAction)changePage;

@end
Run Code Online (Sandbox Code Playgroud)

Viewcontroller.m

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

@synthesize scrollView,pageControl;

- (void)scrollViewDidScroll:(UIScrollView *)sender {
    if (!pageControlBeingUsed) {
        // Switch the indicator when more than 50% of the previous/next page is visible
        CGFloat pageWidth = self.scrollView.frame.size.width;
        int page = floor((self.scrollView.contentOffset.x - pageWidth / 2) …
Run Code Online (Sandbox Code Playgroud)

iphone scroll uiscrollview uipagecontrol ios

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

在iOS中将NSString转换为unichar

我在stackoverflow中看到了将unichar转换为NSString的问题,但现在我想做相反的事情.

我该怎么做?

需要一些指导..谢谢

例如,我有一个字符串数组:[@"o",@"p",@"q"];

这些是里面的字符串.我如何将其转换回unichar?

objective-c nsstring unichar ios

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

在iOS中添加一天到当前日期

我看到这篇文章:iOS并找到了明天.

提供的代码是:

units = NSYearCalendarUnit | NSMonthCalendarUnit | NSDayCalendarUnit;
NSDateComponents* comps = [[NSCalendar currentCalendar] components:units fromDate:[NSDate date]]; 
// Add one day
comps.day = comps.day+1; // no worries: even if it is the end of the month it will wrap to the next month, see doc
// Recompose a new date, without any time information (so this will be at midnight)
NSDate* tomorrowMidnight = [[NSCalendar currentCalendar] dateFromComponents:comps];
Run Code Online (Sandbox Code Playgroud)

问题:我需要在当前日期添加一天,例如,2013年6月21日到2013年5月21日之间的差异是1个月而不是0个月.

我正在使用的代码:

    NSDate *selectedDate = [picker2 date];
    unsigned int unitFlags = NSHourCalendarUnit …
Run Code Online (Sandbox Code Playgroud)

date objective-c ios

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

MATLAB中的Canny边缘检测器

我试图在没有调用Matlab中的canny函数的情况下执行canny边缘检测器.我为高斯滤波器(sigma = 1)和非最大抑制写了一些函数.显示原始图像和结果图像..不确定错误是什么...

原始图像是

在此输入图像描述

我得到的输出是

在此输入图像描述

我附上了代码:

%% Read in
I = imread('fruit.jpg');
figure(1),imshow(I)
I = double(I);
%% Determine Mask Size
sigma = 2;
w = mask_size(sigma);
%% Gaussian Smoothing Filter
[ G,sum ] = gauss_mask(w,sigma);
%% Convolve
I1 = (1/sum) * image_convolution(I,w,G);
figure(2),imshow(I1);
%% Ix(derivative in x-direction)
Ix= delx(I1);
figure(3),imshow(Ix);
%% Iy(derivative in y-direction)
Iy= dely(I1);
figure(4),imshow(Iy);
%% Gradient Magnitude
If = grad_mag(Ix,Iy);
figure(5),imshow(If);
%% Non-maxmimum suppression
It = suppression(If,abs(Ix),abs(Iy));
figure(6),imshow(It);



function [ G,sum ] = gauss_mask( w,sigma )
min …
Run Code Online (Sandbox Code Playgroud)

matlab image-processing computer-vision edge-detection

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

如何在objective-c中以编程方式更改字体的样式

我想以编程方式更改字体的样式(如粗体,常规,浅色,倾斜).我知道我可以使用IB,但我想用编程方式更改它.需要一些指导.对不起,如果这是一个愚蠢的问题.

例如,我的代码如下所示:

lblAge.font = [UIFont fontWithName:@"Helvetica" size:20];
Run Code Online (Sandbox Code Playgroud)

我想添加常规的风格.我该怎么做?

objective-c uifont ios

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

performSelectorInBackground和detachNewThreadSelector如何工作?

我需要执行异步函数执行,因为它阻塞了主线程,因此UI不可用.

在查看stackoverflow中的问题后,我知道有三种方法可以执行异步功能.

一个例子:

[NSThread detachNewThreadSelector:@selector(showSpinner:) toTarget:self withObject:self.view];
// or 
[self performSelectorInBackground:@selector(showSpinner:) withObject:self.view];
// or 
NSInvocationOperation *invOperation = [[NSInvocationOperation alloc] initWithTarget:self selector:@selector(showSpinner:) object:self.view];
NSOperationQueue *opQueue = [[NSOperationQueue alloc] init];
[opQueue addOperation:invOperation];
// or 
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
    dispatch_async(dispatch_get_main_queue(), ^{
        [self showSpinner:self.view];
    });
});
Run Code Online (Sandbox Code Playgroud)

我的问题是如何performSelectorInBackgrounddetachNewThreadSelector回返回主线程?你怎么知道他们已经完成了?

multithreading ios

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