标签: helper

使用const的Delphi ShortInt帮助器ToString

我在一个单独的单元中有一些常量,如果type为ShortInt(<128),我不能对这些常量执行.ToString.

示例:创建单位并添加:

const abc = 127;
Run Code Online (Sandbox Code Playgroud)

创建一个TForm并在FormShow中执行:

Edit1.Text := abc.tostring;
Run Code Online (Sandbox Code Playgroud)

你知道为什么它不起作用吗? 输入所需的记录,对象或类.

如果常量在同一个单元中,它可以工作.

delphi const helper

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

什么是蛋糕框架中自动完成助手的最佳IDE

什么是自动完成助手的最佳IDE.因为我不记得html助手或其他的所有方法或属性,例如:

$this->Html->tableHeaders(array('Date','Title','Active'));
Run Code Online (Sandbox Code Playgroud)

但我应该写tableHeaders和IDE不能识别Html的属性和方法.

谢谢.

ide cakephp autocomplete helper

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

C# 助手模式与服务方法

假设我们有以下类:

public class Ticket {
  public int Id { get; set; }
  public string Event { get; set; }
  ...
}

public class TicketService {
  public void acceptTicket(Ticket ticket) {
    ...
  }

  ...
}
Run Code Online (Sandbox Code Playgroud)

我的问题是,添加与工单实体相关的静态辅助方法(不需要像服务类那样的状态)的最佳位置在哪里?(请记住,这是整个系统中许多其他实体/服务中的一个实体/服务)。

现在我正在考虑以下可能性:

  1. 在其自己的 .cs 文件中创建一个名为 TicketHelper 的新类。
  2. 直接在 Ticket 类上创建静态 Helper 类
  3. 直接在Service类上创建静态Helper类
  4. 只需将方法直接添加到服务类中,就像任何其他服务方法一样
  5. ...比这些更好的解决方案?

为了清楚起见,这就是我对 #2 或 #3 的意思。

public class TicketService {
  public void acceptTicket(Ticket ticket) {
    ...
  }

  ...

  public static class Helper {
    public static Dictionary<string, List<Ticket>> groupByName(List<Ticket> tickets) {
      // returns …
Run Code Online (Sandbox Code Playgroud)

c# design-patterns helper

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

如何增加codeigniter验证码助手的字体大小

我正在使用codeigniter*capctha*帮助器.事情是我不能增加字母的字体大小.我试着这样做

if ($use_font == FALSE)
{
    $font_size = 6;
    $x = rand(0, $img_width/($length/2));
    $y = 0;
}
else
{
    $font_size = 20;
    $x = rand(0, $img_width/($length/1.5));
    $y = $font_size+2;
}
Run Code Online (Sandbox Code Playgroud)

但没有任何反应,如何改变字体大小,请帮忙.提前致谢.

php captcha codeigniter helper

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

如何在C#中按值获取Enum对象?

我最近遇到了一个需要按值获取Enum对象的情况(通过EF CodeFirst保存),这是我的枚举:

public enum ShipmentStatus {
  New = 0,
  Shipped = 1,
  Canceled = 2
}
Run Code Online (Sandbox Code Playgroud)

所以我需要ShipmentStatus.Shipped通过值1获得对象.

那我该怎么做呢?

c# enums object helper enumerable

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

从ActiveAdmin has_many表单助手中删除"添加新"按钮

我在活动管理编辑页面中嵌套了资源,但我想只允许管理员编辑现有资源的内容,而不是添加新的嵌套资源.我的代码看起来像这样:

  form do |f|
    f.inputs do
      f.input :author
      f.input :content
      f.has_many :comments do |comment_form|
        comment_form.input :content
        comment_form.input :_destroy, as: :boolean, required: false, label: 'Remove'
      end
    end
    f.actions
  end
Run Code Online (Sandbox Code Playgroud)

但它在输入下添加了"添加新评论"按钮.如何禁用它,只保留主窗体的f.actions按钮?

ruby forms ruby-on-rails helper has-many

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

Symfony:如何创建多个包中使用的共享 - 通用 - (助手)

我有很多辅助函数-Grouped In Classes - 用于(格式化字符串和日期,URL助手)我想要使用并在几个包中共享,我需要知道哪些我可以将这些帮助函数放在bundle之间共享的最佳实践.

我想到的是创建一个帮助程序包,并在我项目中的另一个包中使用此包,或者使用供应商帮助程序.

那么我如何才能做到这一点以及创建共享助手在多个捆绑包中使用的最佳做法是什么.

如果有任何参考我可以看看,请与我分享.

先感谢您.

php helper symfony

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

开发一个负责所有网络任务的辅助网络类是不错的做法?

我创建了以下类:

public class AsyncHttpsClientHelper {

public static final int REMOVE_CREDIT_CARD = 1;
public static final int ENABLE_AUTORENEW = 2;
// +10 final ints...

private static AsyncHttpsClientHelper instance = null;
private static Activity activity;
// Some other variables

    private AsyncHttpsClientHelper(Context context) {
        // Initiate variables
    }

    public static AsyncHttpsClientHelper getInstance(Context context) {
        // Guarantees the same instance for this class (Singleton)
    }

    public void performNetworkTask(int networkTaskType, String value)
    {
        switch (networkTaskType)
        {
            case REMOVE_CREDIT_CARD:
            {
                CupsLog.d(TAG, "path: " + Consts.ACCOUNT_REMOVE_CREDIT_CARD_PATH);
                client.post(Consts.ACCOUNT_REMOVE_CREDIT_CARD_PATH …
Run Code Online (Sandbox Code Playgroud)

android helper android-networking android-async-http

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

在沙盒环境中运行 Electron Helper 失败

我在向苹果商店提交电子应用程序时遇到问题

\n\n
ERROR ITMS-90296: "App sandbox not enabled. The following executables must include the "com.apple.security.app-sandbox" entitlement with a Boolean value of true in the entitlements property list: [( "com.smarterback.desktop.pkg/Payload/SmarterBack.app/Contents/Frameworks/SmarterBack Helper EH.app/Contents/MacOS/SmarterBack Helper EH", "com.smarterback.desktop.pkg/Payload/SmarterBack.app/Contents/Frameworks/SmarterBack Helper NP.app/Contents/MacOS/SmarterBack Helper NP", "com.smarterback.desktop.pkg/Payload/SmarterBack.app/Contents/Frameworks/SmarterBack Helper.app/Contents/MacOS/SmarterBack Helper", "com.smarterback.desktop.pkg/Payload/SmarterBack.app/Contents/MacOS/SmarterBack" )] Refer to App Sandbox page at https://developer.apple.com/devcenter/mac/app-sandbox/ for more information on sandboxing your app."\n
Run Code Online (Sandbox Code Playgroud)\n\n

所以我更改了我的 .plist 文件以启用沙箱,并且提交一切顺利,但是该修复还有另一个问题,现在我的应用程序不想启动,因为它无法找到\xe2\x80\x9cSmarterBack 助手\xe2\x80\x9d

\n\n
[8801:0907/140725.080936:FATAL:atom_main_delegate_mac.mm(50)] Unable to find helper app\n0   Electron Framework                  0x000000010c4fdde3 _ZN9brightray12MainDelegate24OverrideChildProcessPathEv + 836531\n1   Electron Framework                  0x000000010c4d3297 _ZN9brightray12MainDelegate24OverrideChildProcessPathEv + …
Run Code Online (Sandbox Code Playgroud)

macos helper codesign appstore-sandbox electron

5
推荐指数
0
解决办法
542
查看次数

Delphi 助手作用域

我在 Delphi 中重新声明 helper 时遇到问题。

HelperDecl.pas

unit HelperDecl;

interface

type
  TCustomField = Word;

  TCustomFieldHelper = record helper for TCustomField
  public
    procedure SampleMethod();
  end;

implementation

procedure TCustomFieldHelper.SampleMethod();
begin
end;

end.
Run Code Online (Sandbox Code Playgroud)

ScopeTest.pas

unit ScopeTest;

interface

uses HelperDecl;

type
  rec = record
    art: TCustomField;
  end;

implementation

uses System.SysUtils;

procedure DoScopeTest();
var
  a: TCustomField;
  r: rec;
begin
  a := r.art;
  r.art.SampleMethod(); //Here has the compiler no problems
  a.SampleMethod(); //Undeclared identifier 'SampleMethod'
end;

end.
Run Code Online (Sandbox Code Playgroud)

但是我只为我的本地数据类型定义了一个助手(是的,它是从 Word 派生的)!中的助手SysUtils是 的助手Word,而不是我的自定义数据类型!放开我的数据类型!

当我uses System.SysUtils; …

delphi helper delphi-xe5

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