小编Phi*_*Bot的帖子

iOS 7自定义UINavigationBar TitleView在推送或弹出新的View Controller时移动

我正在使用UINavigationBar的自定义标题视图,其代码如下:

// Set a label to the nav bar
THLabel *titleLabel = [[THLabel alloc] init];
titleLabel.text = @"Test";
titleLabel.font = [UIFont fontWithName:APP_FONT size:22.0];
titleLabel.frame = CGRectMake(0, 0, 100, 30);
titleLabel.textAlignment = NSTextAlignmentCenter;
titleLabel.textColor = CUSTOM_LIGHT_BLUE;
titleLabel.strokeColor = kStrokeColor;
titleLabel.strokeSize = kStrokeSize;
self.navigationItem.titleView = titleLabel;
Run Code Online (Sandbox Code Playgroud)

问题是,当呈现一个新的viewcontroller然后返回到原始视图控制器时,这个自定义视图会移动,然后重新居中.请参阅视频以了解相关信息.

请在此处观看视频:https: //www.youtube.com/watch?v = 961CCVQmpJM&feature = youroutu.be

我已经使用故事板和每个视图控制器的代码禁用了导航控制器的每个子视图的自动调整:

    // Set the navigation bar hidded on the log in view
    UINavigationController* mainViewController = (UINavigationController*)self.appDelegate.window.rootViewController;
    [mainViewController setNavigationBarHidden:YES];
    [[mainViewController navigationBar] setAutoresizesSubviews:NO];
Run Code Online (Sandbox Code Playgroud)

但它仍然调整大小!我怎么能阻止这个 - 我做错了什么?谢谢!

iphone objective-c uinavigationbar ios autoresizingmask

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

ALSA配置如何在asound.conf中组合MMAP仿真和Ladspa插件

我使用rpi dac在Raspberry Pi计算模块(Linux)上有一个工作的PCM输出和良好的声音.'aplay -l'命令输出显示以下内容:

>> aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: sndrpirpidac [snd_rpi_rpi_dac], device 0: RPi-DAC HiFi pcm1794a-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 8/8
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
Subdevice #7: subdevice #7
card 1: ALSA [bcm2835 ALSA], …
Run Code Online (Sandbox Code Playgroud)

linux alsa tinyalsa libasound libalsa

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

使用Gitlab的Ruby Gems没有这样的文件加载 - rb-inotify

我正在使用Gitlab,我正在尝试按照这些说明将我的gitolite v2升级到v3:

"如果这个问题发生在2.9.x,你应该重新安装gitolite.

1)备份所有存储库.只需在其他地方复制/ home/git/repositories/*即可.

2)安装新的gitolite.请参阅https://github.com/gitlabhq/gitlabhq/blob/master/doc/installation.md

3)复制存储库.

4)sudo -u gitlab -H bundle exec rake gitlab:gitolite:update_keys && sudo -u gitlab -H bundle exec rake gitlab:gitolite:update_repos

就这样.

该步骤还与想要将gitolite v2更新为v3的用户有关"

我的Gemfile和Gemfile.lock中有rb-inotify,如下所示:

gitlabhq@build:~/gitlabhq$ grep notify Gemfile
gem 'rb-inotify', :require => linux_only('rb-inotify')
gitlabhq@build:~/gitlabhq$ grep notify Gemfile.lock
rb-inotify (0.8.8)
rb-inotify
Run Code Online (Sandbox Code Playgroud)

我试图使用以下命令更新我的密钥和repos,但我总是得到错误" 没有这样的文件加载--rb-inotify "

gitlabhq@geminibuild:~/gitlabhq$ sudo -u gitlabhq -H bundle exec rake gitlab:gitolite:update_keys
rake aborted!
no such file to load -- rb-inotify
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)

我试图进行捆绑安装,"使用"列表不包含rb-notify gem.

我试过像这样安装rb-inotify gem:

sudo -u …
Run Code Online (Sandbox Code Playgroud)

ruby gem gitolite bundler gitlab

14
推荐指数
2
解决办法
8436
查看次数

嵌入式Linux开发模型与Jenkins

我是一个从事嵌入式Linux项目的小团队(4-5人)的一员.我们正在使用Buildroot和Linaro工具链来构建我们的目标.我们使用git进行版本控制,使用Jenkins进行夜间构建.

这是我们第一次参加这样的项目,但是我找不到任何用这种环境描述开发模型的资源是不成功的.

现在,在每晚构建之后,我创建了一个Buildroot'output'目录的tarball,其中包含u-boot映像和根文件系统.这可以直接从Jenkins'archive'页面下载,以便上次成功构建.

我们中的一些人将致力于低级开发,一些用于用户空间开发(QT).我们的问题是决定什么是最有效/简化的方法是在这样的环境中开发,因为人们将在项目范围内的不同领域开展工作.用户专家可以下载所有内容的tarball并将他们的应用程序合并到rfs中以在板上运行并进行调试,但是我们应该如何处理在较低级别开发上完成的工作?基本上,我们应该如何将工件分发给团队?我非常感谢任何想法.

linux embedded continuous-integration build jenkins

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

django-allauth使用iOS设备上的Facebook令牌登录

我正在使用Facebook iOS SDK将Facebook Access Token发布到我的Django服务器URI.相应的views.py函数如下所示,当我从iOS执行POST时,我得到200响应代码.但是,我有第二个@login_required修饰的URI,我立即从iOS设备调用后认为我没有登录并将我重定向到我的主页面.我究竟做错了什么?从iOS成功发布POST后,如何"保持"登录状态?

# For POSTing the facebook token
from django.views.decorators.csrf import csrf_exempt
from allauth.socialaccount import providers
from allauth.socialaccount.models import SocialLogin, SocialToken, SocialApp
from allauth.socialaccount.providers.facebook.views import fb_complete_login
from allauth.socialaccount.helpers import complete_social_login

# Log in from Facebook
@csrf_exempt
def mobile_facebook_login(request):
    response = HttpResponse() ## Create an HTTP Response Object
    if request.method == "POST": # The method better be a POST
        access_token = request.POST.get('access_token') # Get token   
        try:
            app = SocialApp.objects.get(provider="facebook")
            token = SocialToken(app=app, token=access_token)

            # Check token against facebook …
Run Code Online (Sandbox Code Playgroud)

python django facebook objective-c django-allauth

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

适用于Rails App Gitlab的Apache2 ProxyPass

我正在尝试使用Apache2设置代理,以便传入http://myipaddress.com的请求转到http://localhost:3000/我运行Gitlab(rails应用程序)的地方.以下是我在Ubuntu 10.04上的Apache配置文件中的内容.我最初可以成功访问gitlab默认页面,但是之后通过点击其他页面执行的任何后续请求都会转到404 NOT FOUND页面.我可以在任何这些失败的重定向前面手动输入/ gitlab /它们工作得很好.在初始请求之后,如何在每次重定向请求之后不必重写/ gitlab /来完成这项工作?

## Setup a proxy which listens on the port that gitlabh does ( from start_server.sh )
ProxyRequests Off
ProxyPass /gitlab/ http://localhost:3000/
ProxyPassReverse /gitlab/ http://localhost:3000/
#DocumentRoot /home/gitlabhq/gitlabhq/public
<Proxy http://localhost:3000/>
  Order deny,allow
  Allow from all
</Proxy>
Run Code Online (Sandbox Code Playgroud)

我知道我可以使用下面的代码,这将解决我的问题.但我不知道如何修改gitlab rails服务的前缀.我真的很感激一些帮助!

ProxyPass /gitlab/ http://localhost:3000/gitlab/
ProxyPassReverse /gitlab/ http://localhost:3000/gitlab/
Run Code Online (Sandbox Code Playgroud)

更新:

感谢Friek的评论,我已经非常接近解决这个问题了.下面是我的http.conf文件的一部分.唯一的问题是,当我点击主页按钮或gitlab应用程序上的徽标时,它会尝试重定向到gitlab /,这给了我Apache2的基本index.html文件,说'它有效!'.我怎么能配置这个让我简单地得到/ gitlab它带我到gitlab的根目录视图?谢谢!

## For Gitlab using Apache2 Passenger
## Install on Ubuntu by:
## sudo gem install passenger && sudo passenger-install-apache2-module
## but only …
Run Code Online (Sandbox Code Playgroud)

apache proxy redirect apache2 proxypass

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

Python PEP 273和Amazon BotoCore

在一个空间有限的小型嵌入式Linux设备上,我试图将大型[10 Mb]亚马逊(AWS)BotoCore库(https://github.com/boto/botocore)放在一个zip文件中进行压缩,然后导入它在我的Python脚本中使用zipimport,如PEP273(https://www.python.org/dev/peps/pep-0273/)中所述.

我修改了我的脚本,在开头有以下几行:

## Use zip imports
import sys
sys.path.insert(0, '/usr/lib/python2.7/site-packages/site-packages.zip') 
Run Code Online (Sandbox Code Playgroud)

site-packages zip文件中只包含botocore,而site-packages目录本身也有我使用的其他模块,但不包括botocore.

这是该目录的列表:

    /usr/lib/python2.7/site-packages >> ls -rlt
    total 1940
-rw-rw-r-- 1 root root   32984 Jun  8 12:22 six.pyc
-rw-r--r-- 1 root root     119 Jun 11 07:43 README
drwxrwxr-x 2 root root    4096 Jun 11 07:43 requests-2.4.3-py2.7.egg-info
drwxrwxr-x 2 root root    4096 Jun 11 07:43 six-1.9.0-py2.7.egg-info
drwxrwxr-x 2 root root    4096 Jun 11 07:43 python_dateutil-2.4.2-py2.7.egg-info
drwxrwxr-x 2 root root    4096 Jun 11 07:43 jmespath-0.7.0-py2.7.egg-info
-rw-rw-r-- 1 …
Run Code Online (Sandbox Code Playgroud)

python python-import pep python-2.7 botocore

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

OpenGL ES 2如何渲染纹理和提取数据以进行GPGPU测试

我试图提交一个小浮点数组作为OpenGL ES 2.0纹理并读回来以更好地理解GPGPU.我试图在TI OMAP3 ARM SoC上的SGX 530 GPU上执行此操作.

我一直在关注本指南: 在此处输入链接说明

我的代码当前创建并填充2个浮点数组,然后像这样创建"传递"着色器:

void GLWidget::initializeGL()
{

    // Max texture size in each direction
    int maxSize;
    glGetIntegerv(GL_MAX_TEXTURE_SIZE,&maxSize);
    texSize = sqrt(maxSize);
    texSize = 2;
    qDebug() << "GL_MAX_TEXTURE_SIZE " << maxSize << " SQRT " << texSize;

    // Define input and output arrays of RGBA format with each channel being u8
    m_Format = 4;
    dataX = (quint8*)malloc(m_Format*texSize*texSize*sizeof(quint8));
    dataY = (quint8*)malloc(m_Format*texSize*texSize*sizeof(quint8));

    // Setup some dummy data
    int arraySize = m_Format*texSize*texSize;
    qDebug() << "Array Size: " << …
Run Code Online (Sandbox Code Playgroud)

c++ linux qt opengl-es

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

AVCaptureMovieFileOutput NSInvalidArgumentException没有活动/启用的连接

NSInvalidArgumentException当我开始在一个视频viewController控制器中拍摄照片时开始录制视频时,我偶尔会遇到异常.我已经尝试了Google和So的一些建议,但仍然在startRecordingToOutputFileURL:fileURL通话时收到此错误.

如果我没有访问另一个拍摄照片的视图控制器,我就不会收到错误 - 只有当我拍照时才会出现错误,然后切换到进行视频录制的新视图控制器.

我认为拍照留下了一些遗留问题,但是当我初始化我的录像机视图控制器时,我没有错误设置会话和诸如此类的东西.有什么想法或如何从中恢复?为什么这是一个NSInvalidArgumentException例外?谢谢!

这是我的代码:

dispatch_async(dispatch_get_main_queue(), ^{

            // Try to Fix bug:
            // http://stackoverflow.com/questions/5979962/error-while-recording-video-on-iphone-using-avfoundation

            [self.captureSession beginConfiguration];

            // Ensure session is running
            if ( [self.captureSession isRunning] == NO ) {
                NSLog(@"Capture session is NOT running... Starting it now!");
                [self.captureSession startRunning];
            }
            else {
                NSLog(@"Capture session is ALREADY running...");
            }

            NSLog(@"File URL is: %@",fileURL);
            NSLog(@"FileOutput is: %@",self.fileOutput);

            [self.fileOutput startRecordingToOutputFileURL:fileURL recordingDelegate:self];

            // Try to Fix bug:
            // http://stackoverflow.com/questions/5979962/error-while-recording-video-on-iphone-using-avfoundation
            [self.captureSession commitConfiguration];

        });
Run Code Online (Sandbox Code Playgroud)

这是错误回溯:

2014-05-18 16:01:38.818 app[1699:60b] …
Run Code Online (Sandbox Code Playgroud)

cocoa objective-c avfoundation ios avcapturesession

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

如何在Raspberry Pi上使用C++将收到的UDP音频数据正确写入ALSA

我有2个Raspberry Pis,其中1个将UDP帧的音频数据传输到另一个Raspberry Pi.收到的UDP数据包各为160字节.传输的Raspberry Pi正在发送8KHz 8位单声道样本.接收Raspberry Pi使用带有QUDPSocket的Qt 5.4.0并尝试使用ALSA播放接收的数据.代码如下.每当字节到达接收Raspberry Pi时触发"readyRead"信号,缓冲区就会写入ALSA.我在接收Pi上的耳机插孔中发出了非常低声和毛躁的声音 - 但它是可识别的.所以它工作但听起来很糟糕.

  1. 对于ALSA,我的配置是否有任何明显的错误?
  2. 我应该如何使用snd_pcm_writei将收到的UDP数据包写入ALSA?

谢谢你的任何建议.

UdpReceiver::UdpReceiver(QObject *parent) : QObject(parent)
{

    // Debug
    qDebug() << "Setting up a UDP Socket...";

    // Create a socket
    m_Socket = new QUdpSocket(this);

    // Bind to the 2616 port
    bool didBind = m_Socket->bind(QHostAddress::Any, 0x2616);
    if ( !didBind ) {
        qDebug() << "Error - could not bind to UDP Port!";
    }
    else {
        qDebug() << "Success binding to port 0x2616!";
    }

    // Get notified that data is incoming to …
Run Code Online (Sandbox Code Playgroud)

c++ linux qt alsa raspberry-pi

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