问题列表 - 第165879页

如何禁用表格视图单元格标签上的自动动态类型?

我正在开发iOS 8应用程序.我想更改表格视图单元格上的字体,但由于应用了自动动态类型,我无法这样做.

有没有办法关闭此行为,还是我必须编写自己的单元格才能更改字体?

ios8

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

功能什么都不做

我无法使函数mostrarmatriz()工作.该程序从头到尾编译和运行没有错误,但函数mostrarmatriz()没有显示任何东西.当我将该功能复制到主功能时,它可以完美地工作.看来我通过引用传递值时遇到了问题.请帮忙,我被困住了.

Main.c文件:

#include "InvMatriz.h"
#include <stdio.h>

int main(int argc, char **argv)
{
    float **A;
    int n;
    printf("Ingrese el tamaño de la matriz: ");
    scanf("%d", &n);

    A = ingresematriz(n);
    void mostrarmatriz(A, n);
    printf("adfasd");

    return 0;
}
Run Code Online (Sandbox Code Playgroud)

头文件InvMatriz.h

#ifndef INVMATRIZ_H_
#define INVMATRIZ_H_

float** ingresematriz(int );
void mostrarmatriz(float**X ,int x);

#endif // INVMATRIZ_H
Run Code Online (Sandbox Code Playgroud)

Ingrese Matriz.c文件

#include "InvMatriz.h"
#include <stdio.h>



float **ingresematriz(int n)
{

    int i, j;

    //Asigna espacio en la memoria

    float **A;

    A = malloc(n * sizeof (float *));
    for (i = …
Run Code Online (Sandbox Code Playgroud)

c file parameter-passing pass-by-reference

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

在开发基于组件/环的应用程序时使用emacs/cider的正确方法是什么?

在开发基于组件/环的clojure应用程序时,emacs/cider的正确工作流程/使用途径是什么?

我觉得我可以"附加"到我正在运行的compojure/ring-process,更改其代码,读取/更改其数据,但我无法理解我该如何做到这一点?什么是正确的方法?

我所做的?

lein new compojure my-project
cd my-project
lein ring server-headless
Run Code Online (Sandbox Code Playgroud)

开发服务器现在运行.如果我更改项目中的文件,它们将自动重新加载.那很好.但我想要的是,我直接附加到流程并更改其功能,例如.

我明白这是可能的,但我无法理解.

emacs clojure compojure ring leiningen

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

如何在UITableView中插入和删除行时模拟纸张折叠

因此,我试图模拟折纸类型纸张折叠,同时添加和删除单元格,就像偷看日历应用程序:在此输入图像描述

通过继承UITableView并重写insertRowsAtIndexPaths:withRowAnimation:和deleteRowsAtIndexPaths:withRowAnimation,我已经非常接近这个功能了:

但是现在我似乎无法让动画看起来正确.下面是我目前的代码 - 我只想帮助克服这最后的障碍(或者可能有一种完全不同的方法,例如向tableviewcell添加tableview).

- (void)insertRowsAtIndexPaths:(NSArray *)indexPaths
              withRowAnimation:(UITableViewRowAnimation)animation
{
    [super insertRowsAtIndexPaths:indexPaths withRowAnimation:UITableViewRowAnimationNone];
    float duration = .30;
    int i = 0;
    for (NSIndexPath *indexPath in indexPaths) {
        __block UITableViewCell *cell = [super cellForRowAtIndexPath:indexPath];
        if (cell) { // If indexPath isn't visible we'll get nil here

            //even cells flip up while odd cells flip down
            if(i % 2 ==0){
                cell.layer.anchorPoint = CGPointMake(.5, 0);

                //start row off by rotating 90 degrees
                __block CATransform3D t = CATransform3DIdentity;
                t = CATransform3DTranslate(t, 0, -cell.bounds.size.height/2, 0); …
Run Code Online (Sandbox Code Playgroud)

uitableview ios ios7

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

当线程使用调度器并且主线程正在等待线程完成时死锁

有人可以解释为什么这会造成僵局,以及如何解决它?

        txtLog.AppendText("We are starting the thread" + Environment.NewLine);

        var th = new Thread(() =>
        {

            Application.Current.Dispatcher.Invoke(new Action(() => // causes deadlock
            {
                txtLog.AppendText("We are inside the thread" + Environment.NewLine); // never gets printed
                // compute some result...
            }));


        });

        th.Start();
        th.Join(); // causes deadlock
        // ... retrieve the result computed by the thread
Run Code Online (Sandbox Code Playgroud)

说明:我需要我的辅助线程来计算结果,并将其返回到主线程。但是辅助线程也必须将调试信息写入日志;并且日志在 wpf 窗口中,因此线程需要能够使用 dispatcher.invoke()。但是在我执行 Dispatcher.Invoke 的那一刻,发生了死锁,因为主线程正在等待辅助线程完成,因为它需要结果。

我需要一个模式来解决这个问题。请帮我重写这段代码。(请编写实际代码,不要只说“使用 BeginInvoke”)。谢谢你。

另外,理论上,我不明白一件事:只有当两个线程以不同的顺序访问两个共享资源时,才会发生死锁。但在这种情况下,实际资源是什么?一种是图形用户界面。但另一个是什么?我看不到。

而死锁通常是通过强加线程只能以精确的顺​​序锁定资源的规则来解决的。我已经在其他地方这样做了。但是在这种情况下我怎么能强加这个规则,因为我不明白实际的资源是什么?

c# wpf multithreading deadlock dispatcher

5
推荐指数
2
解决办法
7848
查看次数

Facebook登录不能正常使用PHP API

这是我的代码(App id和App secret都可以):

session_start();

require_once( 'Facebook/FacebookSession.php' );
require_once( 'Facebook/FacebookRedirectLoginHelper.php' );
require_once( 'Facebook/FacebookRequest.php' );
require_once( 'Facebook/FacebookResponse.php' );
require_once( 'Facebook/FacebookSDKException.php' );
require_once( 'Facebook/FacebookRequestException.php' );
require_once( 'Facebook/FacebookAuthorizationException.php' );
require_once( 'Facebook/GraphObject.php' );
require_once( 'Facebook/HttpClients/FacebookCurl.php' );
require_once( 'Facebook/HttpClients/FacebookCurlHttpClient.php' );
require_once( 'Facebook/HttpClients/FacebookHttpable.php' );

use Facebook\FacebookSession;
use Facebook\FacebookRedirectLoginHelper;
use Facebook\FacebookRequest;
use Facebook\FacebookResponse;
use Facebook\FacebookSDKException;
use Facebook\FacebookRequestException;
use Facebook\FacebookAuthorizationException;
use Facebook\GraphObject;
use Facebook\FacebookHttpable;
use Facebook\FacebookCurlHttpClient;
use Facebook\FacebookCurl;

FacebookSession::setDefaultApplication('App_id', 'App_secret');
Run Code Online (Sandbox Code Playgroud)

我得到的错误是:

致命错误:第33行的/home/superwed/public_html/HS/Facebook/HttpClients/FacebookCurlHttpClient.php中找不到界面'Facebook\HttpClients\FacebookHttpable'

这是非常奇怪的,因为我检查过的所有地方都定义好了.

php api facebook

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

如何将自定义方法添加到restangular服务?

我有一个解耦的Restangular服务,我想附加一个自定义方法.看来,唯一的方法,在默认情况下收集回来的getList,onepost.我想要做Locations.getLongLat()

我已经尝试将以下内容添加到我的服务中,但没有运气(该方法没有绑定到对象),我只是undefined is not an object回应了.

angular.module('myApp')
.factory('Locations', function (Restangular) {

    return Restangular.withConfig(function (RestangularConfigurer) {
        RestangularConfigurer.addElementTransformer('api/v1/locations', true, function (location) {
            location.addRestangularMethod('getLongLat', 'get', 'longlat');
            return location;
        });
    }).service('api/v1/locations');
})
Run Code Online (Sandbox Code Playgroud)

有人有主意吗?

angularjs angularjs-service restangular

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

在bash中修剪尾随和前导斜线-是否加入参数替换?

我正在尝试/从bash中的字符串的开头和结尾修剪可能的内容。

我可以通过以下方式完成此操作:

string="/this is my string/"
string=${string%/}
string=${string#/}
echo $string # "this is my string"
Run Code Online (Sandbox Code Playgroud)

但是,我想知道是否有一种方法可以将这两行(2 + 3)连接起来以一次替换两者。是否有加入替代的方法,还是我将获得的最好的替代方法?

提前致谢。

bash shell sh

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

尝试通过实体框架更新数据库对象时,对象已存在错误

我正在使用以下方法尝试使用实体框架更新对象:

public static void UpdateItem(Item updatedObject) {

  using (var context = new DbContext())
  {
    context.MyObjectsPropertys.Attach(updatedObject);
    context.Entry(updatedObject).State = EntityState.Modified;
    context.SaveChanges();
  }
}
Run Code Online (Sandbox Code Playgroud)

我在附件上收到错误消息:

 An object with the same key already exists in the ObjectStateManager. The ObjectStateManager cannot track multiple objects with the same key.
Run Code Online (Sandbox Code Playgroud)

如果我尝试将Attach调用更改为Add调用(具有相同键的对象已经存在objectstatemanager),则会得到:

Cannot insert duplicate key in object 'database.Table'. The duplicate key value is (AttributeValue). The statement has been terminated.
Run Code Online (Sandbox Code Playgroud)

我发现了很多与此错误有关的问题,但是在我的情况下,没有任何答案可以正常工作:

我也尝试删除“ Attach”语句,并按照Error的建议使用相同的键DbContext进行多个对象的状态更改,但这也不起作用。

对我而言,最令人沮丧的是,这与成功更新解决方案中其他内容的语句序列完全相同。

c# entity-framework asp.net-mvc-4

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

为什么target.write忽略我的%r格式?

我正在尝试编写一个类似于这个人的程序,该程序靠近页面顶部的Learn Python the Hard Way程序.

http://learnpythonthehardway.org/book/ex16.html

这是我的下面版本.但它告诉我"%r"最后使用它为什么这样做?我认为这就是你在括号中要做的事情.

# -- coding: utf-8 --

from sys import argv

script, filename = argv

print "Would you like file %r to be overwritten?" % filename
print "Press RETURN if you do, and CTRL-C otherwise."

raw_input('> ')

print "Opening the file ..."
target = open(filename, 'w')
target.truncate()

print "Now type three lines to replace the contents of %r" % filename

line1 = raw_input("line 1: ")
line2 = raw_input("line 2: ")
line3 …
Run Code Online (Sandbox Code Playgroud)

python format python-2.6 operator-keyword

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