小编Tua*_*Anh的帖子

golang sqlx“缺少目标名称......”

将 sqlx 与 postgresql 一起使用时出现错误:“缺少目标名称 rec_created_by”

type Client struct {
    ClientID                    string          `json:"client_id"   db:"id"`
    Name                        string          `json:"name"    db:"name"`
    Version                     int16           `json:"version" db:"version"`
    IsActivated                 bool            `json:"is_activated"    db:"is_activated"`
    RecCreatedBy                string          `json:"rec_created_by"  db:"rec_created_by"`
    RecCreatedByUser            *User           `json:"rec_created_by_user" db:"-"`
    RecCreated                  *time.Time      `json:"rec_created" db:"rec_created"`
    RecModifiedBy               string          `json:"rec_modified_by" db:"rec_modified_by"`
    RecModifiedByUser           *User           `json:"rec_modified_by_user"    db:"-"`
    RecModified                 *time.Time      `json:"rec_modified"    db:"rec_modified"`
    CultureID                   string          `json:"culture_id"  db:"culture_id"`
    ...
}
func (c *Client) Get(id string) error {
    db, err := sqlx.Connect(settings.Settings.Database.DriverName, settings.Settings.GetDbConn())
    if err != nil {
        log.Fatal(err)
    }
    defer db.Close()
    _client := Client{} …
Run Code Online (Sandbox Code Playgroud)

go sqlx

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

WEB API ODATA错误"找不到与请求匹配的HTTP资源"

我正在使用WEB API ODATA和Telerik OpenAccess

这是OpenAccessBaseApiController.cs

public abstract partial class OpenAccessBaseApiController<TEntity, TContext> : ODataController
    where TContext : OpenAccessContext, new()
{
    protected IOpenAccessBaseRepository<TEntity, TContext> repository;

    public virtual IQueryable<TEntity> Get()
    {
        var allEntities = repository.GetAll();
        return allEntities;
    }


    /// <summary>
    /// Creates a new entity based on the provided data
    /// </summary>
    /// <param name="entity">The new entity to be created</param>
    /// <returns>HTTP Status:
    /// - Accepted when operation is successful or 
    /// - MethodNotAllowed if the operation is disabled for this entity or …
Run Code Online (Sandbox Code Playgroud)

wcf-data-services odata asp.net-web-api

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

更新到2.3.9 - 执行脚本RunApp时出错:org/codehaus/groovy/runtime/typehandling/ShortTypeHandling

我是2.3.7到2.3.9的更新grails,它有错误

执行脚本RunApp时出错:org/codehaus/groovy/runtime/typehandling/ShortTypeHandling.

这是run-app --stacktrace --verbose:

|加载Grails 2.3.9

|配置类路径

.

|环境设置为开发

.................................

|包装Grails应用程序

...........

|编译1个源文件

[groovyc]将1个源文件编译为Z:\ future13_grails\cerp\target\classes

.....................................错误

|

执行脚本RunApp时出错:org/codehaus/groovy/runtime/typehandling/ShortTypeHandling

java.lang.NoClassDefFoundError:org/codehaus/groovy/runtime/typehandling/ShortTypeHandling

在org.grails.plugins.tomcat.TomcatServer.(TomcatServer.groovy:81)

在org.grails.plugins.tomcat.InlineExplodedTomcatServer.(InlineExplodedTomcatServer.groovy)

在org.grails.plugins.tomcat.TomcatServerFactory.createInline(TomcatServerFactory.groovy:38)

在org.codehaus.groovy.grails.project.container.GrailsProjectRunner.runInline(GrailsProjectRunner.groovy:183)

org.codehaus.groovy.grails.project.container.GrailsProjectRunner.runApp(GrailsProjectRunner.groovy:119)at org.codehaus.groovy.grails.project.container.GrailsProjectRunner $ runApp $ 0.call(Unknown Source)

在org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)

在org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)

...

错误| 执行脚本RunApp时出错:org/codehaus/groovy/runtime/typehandling/ShortTypeHandling

这是BuildConfig.groovy

... plugins {//仅用于构建系统的插件':tomcat:7.0.52.1'

    // plugins for the compile step
    compile ':scaffolding:2.0.3'
    compile ':cache:1.1.1'
    compile ":spring-security-core:2.0-RC2"
    compile ":searchable:0.6.6"

    // plugins needed at runtime but not for compilation
    runtime ':hibernate:3.6.10.15' // ':hibernate4:4.3.5.3' for Hibernate 4
    runtime ':database-migration:1.4.0'
    runtime ":jquery:1.10.2"
    runtime ':resources:1.2.8'
    // Uncomment these (or …
Run Code Online (Sandbox Code Playgroud)

grails

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

如何将Element innerHtml更改为Dart SDK 0.7.1

我正在使用dart-message https://github.com/mkozhukh/dart-message.它有功能......

MessageBox(String text, String header, String css){
    _box = new DivElement();
    ...
    _box.onClick.listen(_clickHandler);

    if (header != null)
      html.write("<div class='dhtmlx_popup_title'>$header</div>");
    html.write("<div class='dhtmlx_popup_text'><span>$text</span></div>");
    html.write("<div class='dhtmlx_popup_controls'>");
  }

String addButton(String text, String result){
    if (html != null){
      html.write("<div class='dhtmlx_popup_button' result='$result' ><div>$text</div></div>");
    } else
      throw new Exception(".addButton must be used before .show"); 
  }

 _clickHandler(Event event){
    String result = event.target.attributes["result"];
    if (result == null)
      result = event.target.parent.attributes["result"];
    hide(result); //<=== ERROR result alway return null
  }
Run Code Online (Sandbox Code Playgroud)

Future<String> show(){
    if (html != null){
      //finalize html …
Run Code Online (Sandbox Code Playgroud)

dart dart-webui

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

RFC2898DeriveBytes vs Golang PBKDF2

这是我的C#Rfc2898DeriveBytes

using System;
using System.Text;
using System.Security.Cryptography;

public class Program
{
    public static void Main()
    {
        byte[] saltBytes = Encoding.Unicode.GetBytes("47687");
        Console.WriteLine(Convert.ToBase64String(saltBytes));

        byte[] passBytes = Encoding.Unicode.GetBytes("123456");
        Console.WriteLine(Convert.ToBase64String(passBytes));

        Rfc2898DeriveBytes k1 = new Rfc2898DeriveBytes(passBytes, saltBytes, 1000);
        byte[] hashbyte = k1.GetBytes(32);

        Console.WriteLine(Convert.ToBase64String(hashbyte));
    }
}
Run Code Online (Sandbox Code Playgroud)

结果为NAA3ADYAOAA3AA == MQAyADMANAA1ADYA aOyDnGG22ebqGmMvY7zQwdT + UKF6hUUmAt2Uc0jj2io =

我的golang代码是

package main

import (
    "crypto/sha1"
    "fmt"
    "golang.org/x/crypto/pbkdf2"
    b64 "encoding/base64"
)

var (
    PasswordSecuritySalt       = "47687"
    PasswordSecurityIterations = 1000
    PasswordSecurityKeylen     = 32
)

func HashPassword(str string) string {
    hashedPassword := pbkdf2.Key([]byte(str), []byte(PasswordSecuritySalt), PasswordSecurityIterations, …
Run Code Online (Sandbox Code Playgroud)

.net go

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

为什么我的Delphi过滤器不起作用?

test := TFDMemTable.Create(nil);
test.CopyDataSet(TempUnplannedDemand, [coStructure, coRestart, coAppend]);
test.First;
    while not test.Eof do
    begin
      ShowMessage(DateTimeToStr(test.FieldByName('demand_date').AsDateTime) +
                ' - ' +
                IntToStr(test.FieldByName('level').AsInteger));
      test.Next;
    end;
Run Code Online (Sandbox Code Playgroud)

将显示
24/03/2017 - 1
24/03/2017 - 0
24/03/2017 - 1
24/03/2017 - 1

  test.IndexFieldNames := 'level';

  //test.SetRangeStart;
  //test.FieldByName('level').AsInteger := 0;
  //test.SetRangeEnd;
  //test.FieldByName('level').AsInteger := 0;
  //test.ApplyRange;

  //test.SetRange([0],[0]);

  test.Filter := 'level=0';
  test.Filtered := True;

  test.First;
  while not test.Eof do
  begin
      ShowMessage(DateTimeToStr(test.FieldByName('demand_date').AsDateTime) +
                ' - ' +
                IntToStr(test.FieldByName('level').AsInteger));
      test.Next;
    end;
Run Code Online (Sandbox Code Playgroud)

将显示
24/03/2017 - 1
24/03/2017 - 0
24/03/2017 - 1
24/03/2017 …

delphi

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