小编CDs*_*ace的帖子

函数名称未定义

我有一堆看起来像这样的代码

if __name__ == "__main__":
    main()


def main():
    print("hello")
Run Code Online (Sandbox Code Playgroud)

但是,当我尝试运行此代码时,我收到错误

NameError:未定义名称"main"

我没有在函数"def main()"的第一行中定义名称吗?

python nameerror

0
推荐指数
2
解决办法
1028
查看次数

光滑的旋转木马永久离开屏幕

我正在尝试使用光滑的库http://kenwheeler.github.io/slick/创建一个光滑的旋转木马

Slick 正在加载并且它正在正确应用类、容器、按钮等,但幻灯片永久不在屏幕上。活动幻灯片上的 translate3d x 值始终设置在窗口之外。单击“上一个”按钮或拖动幻灯片时,我可以将其拉入屏幕,但一旦到达 0,0,0 位置,它就会立即返回到屏幕外。这是我尝试让它工作的尝试

<div class="slick-slider homepage-slider">
    <div>
        <a href="#">
            <div class="slide-content"><img src="http://placehold.it/350x150">
                <div class="slide-text">
                    <h2 class="slide-title">Slide Title</h2>
                    <div class="slide-caption">
                        <p>Slide Summary</p>
                    </div>
                </div>
            </div>
        </a>
    </div>
    <div>
        <a href="#">
            <div class="slide-content"><img src="http://placehold.it/350x150">
                <div class="slide-text">
                    <h2 class="slide-title">Slide Title</h2>
                    <div class="slide-caption">Slide summary</div>
                </div>
            </div>
        </a>
    </div>
    <div>
        <a href="#">
            <div class="slide-content"><img src="http://placehold.it/350x150">
                <div class="slide-text">
                    <h2 class="slide-title">Slide title</h2>
                    <div class="slide-caption">
                        <p>Slide summary</p>
                    </div>
                </div>
            </div>
        </a>
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

在我的 js 文件中,我正在使用

jQuery(document).ready(function() {
    jQuery('.homepage-slider').slick({
        rtl: true …
Run Code Online (Sandbox Code Playgroud)

javascript css jquery

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

C#startIndex + length> this.length

我正在试验一个奇怪的问题.我将大量数据(结构)编码为十六进制字符串,并作为varbin上传到服务器.然后我下载它,有时它无法解码.所以我决定编写一些打印件:

public static void d(String TAG, String message)
{
    int maxLogSize = 1000;
    for (int i = 0; i <= message.Length / maxLogSize; i++)
    {
        int start = i * maxLogSize;
        int end = (i + 1) * maxLogSize;
        if (end > message.Length - 1)
            end = message.Length - 1;
        //end = end > message.Count() ? message.Count() : end;
        print(message.Substring(start, end));
        print("start: " + start.ToString() + " end: " + end.ToString() + " size: " + message.Length);
    }
}
Run Code Online (Sandbox Code Playgroud)

然后在服务器响应协程的try/catch中我得到了这个: …

c#

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

2个sql查询有什么区别?

我有2个SQL查询,其中一个工作,但另一个给出错误.以下查询效果很好

select /*ordered*/ coupon_address.coupon,merchant_address.id  
from merchant_address, 
     coupon_address, 
     customers c  
WHERE merchant_address.id = coupon_address.merchant_address 
  and c.CUSTOMER_ID = 'temp1' 
  AND sdo_within_distance(c.cust_geo_location,merchant_address.store_geo_location,'distance = 1 unit=MILE') = 'TRUE';
Run Code Online (Sandbox Code Playgroud)

但是以下查询不起作用并给出错误

select /*ordered*/ coupon_address.coupon,merchant_address.id  
from  coupon_address, 
      customers c 
  JOIN merchant_address ON merchant_address.id=coupon_address.merchant_address
 WHERE c.CUSTOMER_ID = 'temp1' 
   AND sdo_within_distance (c.cust_geo_location,merchant_address.store_geo_location, 'distance = 1 unit=MILE') = 'TRUE';
Run Code Online (Sandbox Code Playgroud)

错误是

第1行的错误:ORA-00904:"COUPON_ADDRESS"."MERCHANT_ADDRESS":标识符无效

sql oracle

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

从印刷的asciiArt字符中获取一封信

我有一个asciiArt从A到Z 打印(使用#)字符的方法。它称为asciiArt.printChar (char c)

这是一个测验问题,所以我没有此方法的定义。我需要的是获取printChar方法返回的打印字符串,搜索并返回与此字符串匹配的正确字符。

c# ascii-art

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

使用Novell.Directory.Ldap.NETStandard库的C#netcore ldap身份验证

这是我第一次使用LDAP和Active Directory。我必须使用.NetCore制作一个必须通过ActiveDirectory进行身份验证的Web api(WindowsServer 2008 r2),我正在遵循Novell.Directory.Ldap.NETStandard中的示例, 但是我不明白我必须设置参数的方式。这是我在ActiveDirectory Server中创建的用户:

https://i.stack.imgur.com/A7iGq.jpg

在Novell的样本中

if (args.Length != 5)
{
    System.Console.Out.WriteLine("Usage:   mono VerifyPassword <host name>" + " <login dn> <password> <object dn>\n" + "         <test password>");
    System.Console.Out.WriteLine("Example: mono VerifyPassword Acme.com " + "\"cn=Admin,o=Acme\" secret\n" + "         \"cn=JSmith,ou=Sales,o=Acme\" testPassword");
    System.Environment.Exit(0);
}

int ldapPort = LdapConnection.DEFAULT_PORT;
int ldapVersion = LdapConnection.Ldap_V3;
System.String ldapHost = args[0];
System.String loginDN = args[1];
System.String password = args[2];
System.String objectDN = args[3];
System.String testPassword = args[4];
LdapConnection conn = new LdapConnection();

try
{ …
Run Code Online (Sandbox Code Playgroud)

c# authentication novell active-directory .net-core

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

无法分配属性或索引器“Settings.golds”——它是只读的

int playerhealth = 15;
int playerstrength = 25;
int playerluck = 2;

public int enemyhealth;
public int enemystrength;
public int enemyluck;

public int gainedgold;
public int gold;

public int desire = 100;
public int desiretaken;

int level;
  ................


Properties.Settings.Default.golds = gold;     //here's the error
Run Code Online (Sandbox Code Playgroud)

请问有人可以帮我解决这个错误吗?

无法分配属性或索引器“Settings.golds”——它是只读的

c#

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

如何找到具有类似组件的产品?

我试图找到其中至少有75%+类似组件的物品,我们有数千种产品.我的表有2列,Item和Component.例:

+------+-----------+
| Item | Component |
+------+-----------+
| AAA  | screw     |
| AAA  | metal     |
| AAA  | bar       |
| AAA  | nut       |
| ABC  | screw     |
| ABC  | metal     |
| ABC  | bar       |
| CAA  | nut       |
| CAA  | cap       |
+------+-----------+
Run Code Online (Sandbox Code Playgroud)

最终的结果我想获得3列.项目,项目2和百分比相似.所以看起来像:

+------+-------+-------------------+
| Item | Item2 | PercentageSimilar |
+------+-------+-------------------+
| AAA  | ABC   | 75%               |
| AAA  | CAA   | 25%               |
| ABC …
Run Code Online (Sandbox Code Playgroud)

sql sql-server subquery

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

输入文件类型隐藏

我想隐藏用户上传文件的浏览按钮。我该怎么做?

.fa-cloud-upload {
    position: absolute;
    top: 5%;
}
Run Code Online (Sandbox Code Playgroud)
<label class="file_upload">
     <input type="file" name="uploads" accept="image/*, video/*"/><i class="fa fa-cloud-upload" aria-hidden="true" style="font-size: 85px;"></i>
</label>
Run Code Online (Sandbox Code Playgroud)

html javascript css jquery

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

如何从字典(python)中以相反的顺序删除重复的键

在下面的例子中,我正在努力从字典中删除相同的键:

{('cat', 'tiger'): 18,
 ('tiger', 'cat'): 18,
 ('chines', 'gentleman'): 7,
 ('gentleman', 'chines'): 7}
Run Code Online (Sandbox Code Playgroud)

在这种情况下,我考虑反向顺序('cat', 'tiger'): 18('tiger', 'cat'): 18相同的键,并尝试制作如下的新字典

 {('cat', 'tiger'): 18,
  ('gentleman', 'chines'): 7}
Run Code Online (Sandbox Code Playgroud)

我正在尝试调整任何相反的顺序情况,当我有一个类似的字典,如{(('cage', 'cat'), 5),(('cat', 'cage'), 5)}要合并或删除,任何一个.

python dictionary

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