小编Ant*_*ida的帖子

功能未定义javascript

出于某种原因,我的javascript代码搞砸了.当通过firebug运行时,我得到错误proceedToSecond not defined,但它被定义了!

JavaScript的:

<script type = "text/javascript">
    function proceedToSecond () {
        document.getElementById("div1").style.visibility="hidden";
        document.getElementById("div2").style.visibility="visible";
    }

    function reset_Form() {
        document.personalInfo.reset();
    }

    function showList() {
        alert("hey");
        if (document.getElementsById("favSports").style.visibility=="hidden") {
            document.getElementsById("favSports").style.visibility="visible");
        }
    }

    //function showList2() {
    //}
</script>
Run Code Online (Sandbox Code Playgroud)

HTML:

<body>
    <!--various code -->
    <input type="button" onClick="proceedToSecond()" value="Proceed to second form"/>
</body>
Run Code Online (Sandbox Code Playgroud)

html javascript forms

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

使用cython来提前输入类属性

我正在写一个python类,我想使用cython早期打字来加速执行.当我尝试cython编译以下内容时
出现错误"Syntax error in C variable declaration":

import numpy as np
cimport numpy as np

class MyClass:
    def __init__( self, np.ndarray[double, ndim=1] Redges ):
        self.Redges = Redges
        cdef double self.var1
Run Code Online (Sandbox Code Playgroud)

该错误涉及最后一行涉及的语法self.var1.我不允许直接输入类属性吗?我是否总是要将其分解为两个步骤,例如:

cdef double var1
self.var1 = var1
Run Code Online (Sandbox Code Playgroud)

完整的错误回溯是,

test.pyx:7:24:  
Syntax error in C variable declaration  
Traceback (most recent call last):  
File "setup.py", line 9, in <module>  
        ext_modules = cythonize('test.pyx'), # accepts a glob pattern  
      File "/usr/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 713, in cythonize
        cythonize_one(*args[1:])  
      File "/usr/lib/python2.7/dist-packages/Cython/Build/Dependencies.py", line 780, in …
Run Code Online (Sandbox Code Playgroud)

python class cython

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

解析webconfig时出现Windows Azure间歇性身份错误

这个问题在发布后似乎随机发生. 该网站将正常工作,然后bam,我得到这个错误解析webconfig.我只是重新发布,它再次正常工作.发布时,我选中了该框以删除现有文件,因此不应该存在垃圾.

这是一个使用.net 4.5和Azure访问控制服务(ACS)与Yahoo!集成的MVC4项目.从Yahoo重定向时会发生此错误.这种方式每次都会发生,但我发现了一个帖子(当然我现在找不到),其中4.5.1 Identity和Access Visual Studio集成存在错误.我去了以前的版本,现在只是有时候.

ID8030:无法解析'type'属性的值.
验证'<issuerNameRegistry type="System.IdentityModel.Tokens.ValidatingIssuerNameRegistry, System.IdentityModel.Tokens.ValidatingIssuerNameRegistry"><authority name="[my authority]"><keys><add thumbprint="[print]" /></keys><validIssuers><add name="[issuer]" /></validIssuers></authority></issuerNameRegistry>'元素的type属性是否正确.

在上面的错误消息中,我已替换此帖子的括号([])中的项目.

这是堆栈跟踪:

[TypeLoadException: ID8030: The value of the 'type' property could not be parsed. *** element is correct.]
System.IdentityModel.Configuration.TypeResolveHelper.Resolve(ConfigurationElementInterceptor customTypeElement, Type customType) +602659
System.IdentityModel.Configuration.IdentityConfiguration.GetIssuerNameRegistry(IssuerNameRegistryElement element) +114
System.IdentityModel.Configuration.IdentityConfiguration.LoadHandlerConfiguration(IdentityConfigurationElement element) +841
System.IdentityModel.Configuration.IdentityConfiguration.LoadConfiguration(IdentityConfigurationElement element) +117
System.IdentityModel.Configuration.IdentityConfiguration..ctor(String identityConfigurationName) +180
System.IdentityModel.Services.Configuration.FederationConfiguration.LoadConfiguration(FederationConfigurationElement element) +392
System.IdentityModel.Services.Configuration.FederationConfiguration..ctor(Boolean loadConfig) +94
System.IdentityModel.Services.FederatedAuthentication.CreateFederationConfiguration() +71
System.IdentityModel.Services.FederatedAuthentication.get_FederationConfiguration() +85
System.IdentityModel.Services.HttpModuleBase.Init(HttpApplication context) +56
System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +418
System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr …
Run Code Online (Sandbox Code Playgroud)

web-config azure federated-identity acs asp.net-mvc-4

6
推荐指数
2
解决办法
5753
查看次数

如何使用正则表达式使用前缀字符进行拆分?

我想拆分示例字符串:

〜彼得〜洛伊丝〜克里斯〜梅格〜的Stewie

在角色上~有结果

Peter
Lois
Chris
Meg
Stewie

在javascript或C#中使用标准字符串拆分函数,第一个结果当然是空字符串.我想避免忽略第一个结果,因为第一个结果可能实际上是一个空字符串.

我一直在使用正则表达式摆弄,我很难过.我敢肯定有人遇到了这个优雅的解决方案.

regex split character prefix

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

Java Flow.Subscriber - 如何取消订阅?

我正在使用 JDK 9 Flow API 创建一个用户事件系统,所以我有一个房间(它实现了Flow.Subscriber<Notification>),它可能有很多用户,每个用户都可以随时提供(调度)更新。

当用户进入房间时,我订阅房间的更新user.subscribe(this)。但是没有退订,当用户离开房间时我如何退订?

public abstract class Room implements Flow.Subscriber<Notification> {
    private Flow.Subscription subscription;

    public void addUser(User user) {
        user.subscribe(this);
    }

    public void removeUser(User user) {
        // How can I unsubscribe the user?
    }

    @Override
    public void onSubscribe(final Flow.Subscription subscription) {
        this.subscription = subscription;
        subscription.request(1);
    }

    @Override
    public void onError(final Throwable throwable) {
        // ...
    }

    @Override
    public void onNext(final Notification notification) {
        // ...
        subscription.request(1);
    }

    @Override
    public void onComplete() {
        // …
Run Code Online (Sandbox Code Playgroud)

java publish-subscribe java.util.concurrent java-9 java-flow

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

在jquery的setInterval()和setTimeout()中使用hex

我正在创建一个脚本来检查服务器是否已连接或已经消失.在查看其他人是如何完成它的时候,我意识到有些人在函数内部使用了十六进制.例如 setInterval(l,6E4)

另一个例子

setTimeout(function(){d(window.checknet.config.checkURL)},window.checknet.config.checkInterval)}a=a||{};a.checkURL=a.checkURL||window.location.href;a.checkInterval=a.checkInterval||5E3;a.warnMsg=a.msg||"No Internet connection detected, disabled features will be re-enabled when a connection is detected. ";
Run Code Online (Sandbox Code Playgroud)

这是使用十六进制 a.checkInterval=a.checkInterval||5E3;

为什么使用十六进制而不是普通的十进制数字?

math jquery scientific-notation

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

设置精灵宽度或高度而不缩放它的子项

我试图动态改变widthheightSprite对象,这是其他类似的Sprite对象的容器中.容器对象根据其子项的大小自动更改其大小,但是当我更改子对象的位置时,容器的大小保持不变,并且它的子项看起来放在容器外部.

我尝试通过使用这样的方法来解决这个问题:

if (container.width < (child.x + child.width))
{
    container.width = (child.x + child.width);
}
Run Code Online (Sandbox Code Playgroud)

但是,当我使用此代码时,容器对象的子项将被缩放.
有没有办法改变容器的大小而不缩放它的孩子?

size sprite scale actionscript-3

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

Flash Develop Debbuger - System.BadImageFormatException

自从我更新了我的Flash Develop并安装了最新版本的Air/Flex SDK后,由于以下错误,我无法再调试应用程序:

Debugger startup error. For troubleshooting see: http://www.flashdevelop.org/wikidocs/index.php?title=F.A.Q
Error details: System.BadImageFormatException: An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)
   em net.sf.jni4net.jni.JNI.Dll.JNI_GetDefaultJavaVMInitArgs(JavaVMInitArgs* args)
   em net.sf.jni4net.jni.JNI.Init()
   em net.sf.jni4net.jni.JNI.CreateJavaVM(JavaVM& jvm, JNIEnv& env, Boolean attachIfExists, String[] options)
   em net.sf.jni4net.Bridge.CreateJVM()
   em net.sf.jni4net.Bridge.CreateJVM(BridgeSetup setup)
   em FlashDebugger.DebuggerManager.Start(Boolean alwaysStart)
[Capturing traces with FDB]
...
Run Code Online (Sandbox Code Playgroud)

我使用的是Windows 7 x64,FlashDevelop v4.6.4,JDK v1.7,AIR SDK v14.

air debugging flash flashdevelop actionscript-3

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

如何拆分字符串并将每个拆分存储到变量中

function check()
{
    word=name@gmail.com
    arr=$(echo $word | tr "@" "\n")

    for x in $arr
    do
        echo "> $x"
    done
}
Run Code Online (Sandbox Code Playgroud)

输出我得到

name
gmail.com
Run Code Online (Sandbox Code Playgroud)

我想将它们中的每一个存储到单独的变量中.我怎么做?

我去吧

for x in $arr
do
    echo "> $x"
    first=$x
    second=$x
done
Run Code Online (Sandbox Code Playgroud)

在这里很丢失.请帮帮我!

string bash cut

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

OpenXML-为演示文稿中的幻灯片设置幻灯片布局

这是我用来创建演示文稿的代码。

我在这里尝试的是创建一张幻灯片并将形状插入其中并将幻灯片附加到已创建的演示文稿中。这很好用。

我的问题是如何设置插入幻灯片的布局。我的意思是这里的幻灯片布局是

slideLayoutpart.SlideLayout = new SlideLayout() {
    Type = SlideLayoutValues.VerticalTitleAndText
};
Run Code Online (Sandbox Code Playgroud)

我想将此布局设置为我的幻灯片。

我曾在此处使用幻灯片布局

Slide slide = new Slide(new CommonSlideData(new ShapeTree()));

uint drawingObjectId = 1;

// Construct the slide content.            
// Specify the non-visual properties of the new slide.
NonVisualGroupShapeProperties nonVisualProperties = slide.CommonSlideData.ShapeTree.AppendChild(new NonVisualGroupShapeProperties());
nonVisualProperties.NonVisualDrawingProperties = new NonVisualDrawingProperties() { Id = 1, Name = "" };
nonVisualProperties.NonVisualGroupShapeDrawingProperties = new NonVisualGroupShapeDrawingProperties();
nonVisualProperties.ApplicationNonVisualDrawingProperties = new ApplicationNonVisualDrawingProperties();

// Specify the group shape properties of the new slide.
slide.CommonSlideData.ShapeTree.AppendChild(new GroupShapeProperties()); …
Run Code Online (Sandbox Code Playgroud)

powerpoint openxml presentation openxml-sdk presentationml

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

Laravel Backpack 假字段和翻译

我有一个带有确定数量条目的 CRUD 实体。有一些公共字段(标题、描述),但有些条目有一些专有字段,这些字段保存在 extras 中。

我的问题是,某些字段可能是可翻译的,而其他字段则可能不可翻译。目前,让翻译在虚假领域发挥作用的唯一方法是让所有额外内容都可翻译。

class Module extends Model
{
    use CrudTrait;
    use HasTranslations;

    ...
    protected $fillable = ['title', 'description', 'extras'];
    public $translatable = ['title', 'extras'];
Run Code Online (Sandbox Code Playgroud)

这给我带来了一个问题,因为许多额外的字段是不可翻译的图像。

php translation crud laravel laravel-backpack

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

使用jQuery访问关联数组

我这里有一个关联数组 -

var dataset = {
    "person" : [    
        {"userLabels": ["Name","Role"]},
        {"tagNames": ["lName","role"]},
        {"tableClass": "width530"},
        {"colWidths": ["50%","50%"]}
    ]
}
Run Code Online (Sandbox Code Playgroud)

我尝试使用各种方法使用jQuery访问'userLabels'对象,但我失败了.我认为我在做基础知识时出错了.我希望使用jQuery访问userLabels对象,结果应该是一个数组,所以我可以执行jQuery.inArray()操作.

javascript arrays jquery associative-array

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