小编Bha*_*rat的帖子

UICollectionView动态单元格高度(Pinterest布局)

我正在尝试在我的应用程序中实现Pinterest布局

我使用以下委托方法来实现它并动态设置单元格高度

 func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
    let boundingRect =  CGRect(x: 0, y: 0, width: self.view.frame.size.width / 2 - 20, height: CGFloat(MAXFLOAT))
    let data = articles[indexPath.row]
    let rect  = AVMakeRect(aspectRatio: (data.coverImage?.size)!, insideRect: boundingRect)
    return CGSize(width: rect.width, height: rect.height + 120) // Added 120 for a description I will add later 
}
Run Code Online (Sandbox Code Playgroud)

但是我得到了以下结果:

这里

灰色背景是单元格的背景,你可以看到每个单元格都有自己的高度(正如预期的那样),但是还有额外的空格,我不知道如何删除.

我怎样才能解决这个问题?

pinterest uicollectionviewcell swift

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

WPF unity尝试获取类型实例时发生激活错误

尝试使用Unity和Prism初始化模块时出现以下错误.该DLL被发现

return new DirectoryModuleCatalog() { ModulePath = @".\Modules" };
Run Code Online (Sandbox Code Playgroud)

找到dll并找到名称

  #region Constructors

    public AdminModule(
        IUnityContainer container,
        IScreenFactoryRegistry screenFactoryRegistry,
        IEventAggregator eventAggregator,
        IBusyService busyService
        )
        : base(container, screenFactoryRegistry)
    {
        this.EventAggregator = eventAggregator;
        this.BusyService = busyService;
    }

    #endregion

    #region Properties

    protected IEventAggregator EventAggregator { get; set; }
    protected IBusyService BusyService { get; set; }

    #endregion

    public override void Initialize()
    {
        base.Initialize();
    }

    #region Register Screen Factories

    protected override void RegisterScreenFactories()
    {
        this.ScreenFactoryRegistry.Register(ScreenKeyType.ApplicationAdmin, typeof(AdminScreenFactory));
    }

    #endregion

    #region Register Views and Various Services

    protected override …
Run Code Online (Sandbox Code Playgroud)

wpf modularity prism unity-container

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

编译器错误:无法读取.../Resources/Images.xcassets的文件属性

我最近更新到最新版本XCodeXamarin Xamarin.iOS 10.0.0.1 (29910bb)运行Visual Studio Professional 2015 Version 14.0.25431.01 Update 3.我的Mac(构建机器)和PC都是最新的.现在我有更新,我不再能够编译/构建除模拟器之外的任何东西.

编译错误.

> C:\Program Files
> (x86)\MSBuild\Xamarin\iOS\Xamarin.iOS.Common.targets(1028,3): error :
> Failed to read file attributes for
> "/Users/mod/Library/Caches/Xamarin/Resources/Images.xcassets"
Run Code Online (Sandbox Code Playgroud)

作为测试,我将解决方案文件复制到构建机器上,无需修改即可编译并运行任何目标.

我也尝试删除构建机器上的builds目录,没有任何帮助.

任何人都知道这方面的工作是什么?

xamarin.ios

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

违反了O1RA-0229完整性约束 - 未找到父密钥

SQL数据库代码:

CREATE TABLE MYBUILDING 
(
B_NUMBER NUMBER(1)      NOT NULL, 
NAME VARCHAR2(25)       NOT NULL, 
ADDRESS VARCHAR2(40)        NOT NULL, 
P_CODE VARCHAR2(6) , 
FLOOR_NUM_UP NUMBER(3)      DEFAULT '1' NOT NULL CHECK (FLOOR_NUM_UP >= 0), 
FLOOR_NUM_DOWN NUMBER(3)    DEFAULT '0' NOT NULL CHECK (FLOOR_NUM_DOWN >= 0), 
CONS_DATE DATE          NOT NULL, 
PRIMARY KEY (B_NUMBER)
); 
-------
CREATE TABLE FLOOR
(
B_NUMBER NUMBER(1)      NOT NULL,
F_NUMBER NUMBER(2)      NOT NULL CHECK (F_NUMBER >= -4 AND F_NUMBER <= 25),
SPACE_M NUMBER(4)       NOT NULL CHECK (SPACE_M > 0), 
PRIMARY KEY (B_NUMBER, …
Run Code Online (Sandbox Code Playgroud)

sql constraints foreign-keys

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

在 iis 上发布时出现 Angular 2 错误

我已经在 angular 2 中创建了演示应用程序,当我在本地运行它时它工作正常,但是当我在 iis serve 上发布它时出现错误。

我得到这个错误

Failed to load resource: the server responded with a status of 404 (Not Found)
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

这是我的代码 index.html

<!doctype html>
<html>
<head>
  <meta charset="utf-8">
  <title>MyApp</title>
  <base href="/">
  <link rel="stylesheet" href="https://bootswatch.com/darkly/bootstrap.min.css">  
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <script>
    System.import('app').catch(function(err){ console.error(err); });
  </script>
</head>
<body>
  <app-root>Loading...</app-root>
</body>

</html>
Run Code Online (Sandbox Code Playgroud)

app.router.ts

import {ModuleWithProviders} from '@angular/core';
import {Routes,RouterModule} from '@angular/router'; 

//import {AppComponent} from './app.component'
import {AboutComponent} from './about/about.component'
import {TechnologyComponent} from './technology/technology.component'

export const router : Routes …
Run Code Online (Sandbox Code Playgroud)

iis angular

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

Morris.js条形图缺少标签

我正在将JSON结构中的值解析为Morris JS条形图.JSON值通过Ajax加载.问题是只有每一秒的值都加载到x行(xkeys)中.

我的代码:

    <script>
    $( document ).ready(function() {
    $.ajax({
        url: "http://intra.site.com/_vti_bin/ListData.svc/ExchangeRates?$orderby=Modified%20desc",
        headers: { 'accept': 'application/json;odata=verbose', 'content-type': 'application/json;odata=verbose'},
        success: function(data){ 
                    var params = {
                        element: 'myfirstchart',
                        data: [],
                        xkey: 'year',
                        ykeys: ['value'],
                        barColors: ['#f46813'],
                        labels: ['Rate']
                                    };



                        data.d.results.forEach(function(element) {
                        var obj = { "year": element.ExchangeCross, "value": element.ApprovedRate }; 
                        params.data.push(obj);
                    });

                    Morris.Bar(params);

                                }  
            });
});
</script>
Run Code Online (Sandbox Code Playgroud)

图表呈现正常,但缺少一些标签.我拍了一张截图.

链接到图像

关于如何解决这个问题的任何建议?

javascript morris.js

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

.Net核心本地化视图:Linq表达式中的IViewLocalizer

我在.net核心写mvc应用程序,我有本地化问题,我不知道如何将IViewLocalizer添加到我的网格视图.这是我的代码:

@using NonFactors.Mvc.Grid;
@using Microsoft.AspNetCore.Mvc.Localization
@inject IViewLocalizer Localizer
@model IEnumerable<WeegreeEmployeeFormsCore.Models.Employee>

@(Html
    .Grid(Model)
    .Build(columns =>
    {
        columns.Add(model => model.Name).Titled(Localizer["Name"]).Sortable(true).Filterable(true);
        columns.Add(model => model.Surname).Titled(Localizer["Surname"]).Sortable(true).Filterable(true);
        columns.Add(model => model.EmploymentDate).Titled(Localizer["Hired"]).Sortable(true).Filterable(true);
        columns.Add(model => model.Country).Titled(Localizer["Country"]).Filterable(true).Sortable(true).Filterable(true);
        columns.Add(model => model.EmploymentForm).Titled(Localizer["EmploymentForm"]).Filterable(true);
        columns.Add(model => $"<a href=\"{Url.Action("Edit", "Form")}/{model.EmployeeId}\">{Localizer["Edit"]}</a>").Encoded(false);
        columns.Add(model => $"<a href=\"{Url.Action("Details", "Form")}/{model.EmployeeId}\">Details</a>").Encoded(false);


    })
    .Pageable(pager =>
    {
        pager.PagesToDisplay = 10;
        pager.CurrentPage = 1;
        pager.RowsPerPage = 10;
    })
    .Sortable()
    .Empty("No data found")

)
Run Code Online (Sandbox Code Playgroud)

当我{}用来插入内部表达model.EmployeeId它工作 - 链接工作,但当我想使用Localizer来获取题字Edit/Edytuj/??????? etc.而不是我在我看来得到这个: Microsoft.AspNetCore.Mvc.Localization.LocalizedHtmlString

c# linq linq-expressions asp.net-core asp.net-core-localization

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

R Shinydashboard自定义CSS到valueBox

我一直在尝试将valueBox的颜色更改为自定义颜色(超出了validColors中可用的颜色),但是无法这样做。我知道有一种使用标签来包含自定义CSS的方法,但是我无法将其放在正确的位置。

ui<- dashboardPage(   
                dashboardHeader(),  
                 dashboardSidebar(),  
                 dashboardBody(  
                           fluidRow(valueBoxOutput("name")  
                             )))

 server<- function(input, output){  
  output$name<- renderValueBox({ valueBox(  
    ("example"), subtitle = "Subtitle text",color="blue")}  
  )}
Run Code Online (Sandbox Code Playgroud)

任何帮助,不胜感激!

html css r shiny shinydashboard

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

如果jQuery Mobile弹出窗口打开,如何通过jQuery检查?

我可以激活以下jQuery Mobile弹出窗口:

<div data-role="popup" id="waiting1" data-overlay-theme="a" data-corners="false" data-tolerance="30,15" data-dismissible="false">
     <div class="modalAlert" id="waitingContent">
      Waiting...
     </div> 
</div>
Run Code Online (Sandbox Code Playgroud)

使用jQuery命令:

$(waiting1).popup('open');

但后来我想以编程方式确认弹出窗口打开,如果没有,则使用IF语句触发警报.我尝试使用CSS显示属性:

if ( $(waiting1).css('display') != 'block') {
    alert(
        "Error: Waiting popup should not be visible."
    );
    return( -1 );
};

...但作为一个jQuery Mobile弹出窗口,显然该属性始终是"阻止",无论它是否可见.在IF语句中检查这个的正确方法是什么?谢谢你的帮助.

jquery popup jquery-mobile

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

Jackson JsonParser 获取数组令牌

我正在使用 Jackson Json Parser 从 JSON 字符串中获取值,然后将它们插入到 Java 对象中。这是我正在处理的 JSON 的一部分:

{
    "address":"aURL",
    "links":[
        "aURL",
        "aURL",
        "aURL"
    ]
}
Run Code Online (Sandbox Code Playgroud)

这是我的 Java 代码中发生的事情。net 是一个全局的 ArrayList,Page 对象有一个 String 地址字段和一个 String[] links 字段。我想从 JSON 中获取链接的字符串数组并将它们插入到 Page 对象中。虽然我可以使用 getText() 方法轻松提取地址字符串,但我无法找到一种便捷的方法来获取字符串数组。这是我现在的代码:

private static void parse(String json) throws IOException {
    JsonParser parser = new JsonFactory().createJsonParser(json);
    while (parser.nextToken() != JsonToken.END_OBJECT) {
        String tok = parser.getCurrentName();
        Page p = new Page();
        if ("address".equals(tok)) {
            parser.nextToken();
            p.setAddress(parser.getText());
        }
        if ("links".equals(tok)) {
            parser.nextToken();
            //p.setLinks(HOW TO GET STRING ARRAY)
        }
        net.add(p); …
Run Code Online (Sandbox Code Playgroud)

java parsing json jackson fasterxml

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