小编Akm*_*hov的帖子

EF和Automapper.更新嵌套集合

我试图更新国家实体的嵌套集合(城市).

只是简单的enitities和dto:

// EF Models
public class Country
{
    public int Id { get; set; }
    public string Name { get; set; }
    public virtual ICollection<City> Cities { get; set; }
}

public class City
{
    public int Id { get; set; }
    public string Name { get; set; }
    public int CountryId { get; set; }
    public int? Population { get; set; }

    public virtual Country Country { get; set; }
}

// DTo's
public class CountryData : IDTO …
Run Code Online (Sandbox Code Playgroud)

c# entity-framework-6 automapper-5

13
推荐指数
2
解决办法
7314
查看次数

如何绘制用def定义的函数?

我有一个功能

np.sin(x / 2.) * np.exp(x / 4.) + 6. * np.exp(-x / 4.)
Run Code Online (Sandbox Code Playgroud)

我可以使用以下代码绘制它:

x = np.arange(-5, 15, 2)
y = np.sin(x / 2.) * np.exp(x / 4.) + 6. * np.exp(-x / 4.)
plt.plot(x, y)
plt.show()
Run Code Online (Sandbox Code Playgroud)

但如果我定义函数绘图不起作用:

rr = np.arange(-5, 15, 2)

def y(o): 
    return np.sin(o / 2.) * np.exp(o / 4.) + 6. * np.exp(-o / 4.)

def h(b):
    return int(y(b))

plt.plot(rr, h)
plt.show()
Run Code Online (Sandbox Code Playgroud)

为什么会发生这种情况,如何更改代码以绘制函数?

plot matplotlib python-2.7

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

在数据库的所有表中搜索值

我需要在我的 Oracle 数据库中找到包含一些值的表。

我发现了两个查询。我尝试的第一个查询:

declare
  l_pattern varchar2(100) := '?? ?????? ??????? ????????';
  cursor cf is select table_name,column_name from user_tab_columns where data_type = 'VARCHAR2' order by table_name;

  t_str varchar2(2000) := 'select count(*) from dual where exists( select null from ';
  l_str varchar2(2000); 
  l_where_clause varchar2(2000) := ' where 1=0';
  l_last_table varchar2(100) := '';
  l_cnt number := 0;

  procedure query_ (i_txt varchar2) is
    l_txt varchar2(4000) := i_txt;
    l_ln number := length(l_txt);
    l_pieces number := ceil(l_ln/250);
  begin
   for i in 1..l_pieces loop
      dbms_output.put_line(substr(i_txt, 1+250*(i-1),least(250,l_ln-250*(i-1)))); …
Run Code Online (Sandbox Code Playgroud)

oracle find oracle10g

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