走过海棠暮

文章 0 评论 0 浏览 24

走过海棠暮 2024-10-23 03:56:19

利用缓冲区溢出的传统攻击会溢出堆栈缓冲区;您溢出了缓冲区。当一个缓冲区都位于堆栈上时,更容易看到对一个缓冲区的写入会破坏另一个缓冲区。尝试使用 stackalloc 而不是 new char 来强制分配到堆栈中。

The traditional attack that exploits a buffer overflow overflows a stack buffer; you are overflowing a heap buffer. It is a lot easier to see a write to one buffer smashing another buffer when they're both on the stack. Try using stackalloc instead of new char to force the allocation into the stack.

C# 创建缓冲区溢出

走过海棠暮 2024-10-23 02:39:13

这可能会有所帮助 -

class Node {
    Vector children;
    String value;   // Name of the node….

    public Node(String value, Vector children) {
        this.children = children;
        this.value = value;
    }

    public String toString() {
        return value;
    }
}

并且 -

  Node[] nodeArray = generateRootNode(); 

  TreeModel model = new TreeModel() {

  Node[] sillyTree = nodeArray;

                public Vector getChildren(Object parent) {
                    Node n = (Node) parent;
                    Object[] nodes = null;
                    Vector v = new Vector();
                    if (parent == null) {
                        nodes = sillyTree;
                    } else {
                        v = n.children;
                    }
                    if (nodes != null) {
                        for (int iter = 0; iter < nodes.length; iter++) {
                            v.addElement(nodes[iter]);
                        }
                    }
                    return v;
                }

                public boolean isLeaf(Object node) {
                    boolean returnValue = false;
                    try {
                        Node n = (Node) node;
                        returnValue = n.children == null || n.children.size() == 0;
                    } catch (ClassCastException ex) {
                        // It means its a child node or a leaf...
                            returnValue = true;
                    }
                    return returnValue;
                }
            };

This might help -

class Node {
    Vector children;
    String value;   // Name of the node….

    public Node(String value, Vector children) {
        this.children = children;
        this.value = value;
    }

    public String toString() {
        return value;
    }
}

And -

  Node[] nodeArray = generateRootNode(); 

  TreeModel model = new TreeModel() {

  Node[] sillyTree = nodeArray;

                public Vector getChildren(Object parent) {
                    Node n = (Node) parent;
                    Object[] nodes = null;
                    Vector v = new Vector();
                    if (parent == null) {
                        nodes = sillyTree;
                    } else {
                        v = n.children;
                    }
                    if (nodes != null) {
                        for (int iter = 0; iter < nodes.length; iter++) {
                            v.addElement(nodes[iter]);
                        }
                    }
                    return v;
                }

                public boolean isLeaf(Object node) {
                    boolean returnValue = false;
                    try {
                        Node n = (Node) node;
                        returnValue = n.children == null || n.children.size() == 0;
                    } catch (ClassCastException ex) {
                        // It means its a child node or a leaf...
                            returnValue = true;
                    }
                    return returnValue;
                }
            };

在lwuit中动态创建树视图节点

走过海棠暮 2024-10-23 02:03:40

祝你好运,找到一个匹配 URL 的正则表达式,但假设你有一个。

然后,

preg_match_all($url_regexp, $source, $matches, PREG_OFFSET_CAPTURE);

查看 $matches,您将获得每个 URL 及其位置。迭代这些以找到最接近您的子字符串位置的值。确保考虑到匹配项和子字符串的长度。

Good luck finding a regexp to match URLs, but suppose you have one.

Then,

preg_match_all($url_regexp, $source, $matches, PREG_OFFSET_CAPTURE);

Take a look in $matches and you will have every URL plus its position. Iterate over these to find which is closest to your substring position. Make sure that you account for the length of the matches and your substring.

如何在最接近子字符串的字符串中找到 url(使用 stripos 后)? (PHP)

走过海棠暮 2024-10-22 23:46:51

如果 jQuery 是您正在使用的唯一 Javascript 库,那么请继续使用 $,这不会有什么坏处。

如果您使用多个 Javascript 库(老实说,我不会推荐,但是嘿,这取决于您),那么您有以下几种选择

  1. : jquery.com/jQuery.noConflict/" rel="nofollow">noConflict 模式,并将其引用为 jQuery
  2. noConflict 模式下使用 jQuery,并通过以下方式限制 $ 的使用范围闭包,像这样:

(function($) {
    // bunch of code using $ to refer to jQuery here
})(jQuery);

If jQuery is the only Javascript library you're using, then go ahead and use $, it won't hurt.

If you're using more than one Javascript library (which honestly, I wouldn't recommend, but hey, up to you), then you have a couple of options:

  1. Use jQuery in noConflict mode, and reference it as jQuery.
  2. Use jQuery in noConflict mode, and scope the usage of $ via closures, like so:

(function($) {
    // bunch of code using $ to refer to jQuery here
})(jQuery);

jQuery 或 $,问题情况

走过海棠暮 2024-10-22 23:40:06

我已经在 Firefox 3.6、Chromium 8、Opera 11 (ubuntu 10.10)

temp.html 中进行了测试:

<style>
    body { background-color: blue; }
</style>

 <body>
    Hello
</body>

index.html:

<html>
<head>
    <script>
        function test(){
            // your new <style> tag
            var stl = document.createElement("style");
            // its content
            stl.innerHTML = "body { background-color: red}";

            // getting iframe
            var myIframe = document.getElementById("myiframe");

            // apply new CSS to iframe
            myIframe.contentWindow.document.
                    getElementsByTagName('head')[0].appendChild(stl);
        }
    </script>
</head>
<body>
    <iframe id="myiframe" src="temp.html"></iframe>
    <button onclick="test()">
</body>
</html>

当我单击按钮时,iframe 中的背景变为红色。

PS如果重复的话抱歉。我现在才打开您帖子中指向另一个主题的链接

I've tested in Firefox 3.6, Chromium 8, Opera 11 (ubuntu 10.10)

temp.html:

<style>
    body { background-color: blue; }
</style>

 <body>
    Hello
</body>

index.html:

<html>
<head>
    <script>
        function test(){
            // your new <style> tag
            var stl = document.createElement("style");
            // its content
            stl.innerHTML = "body { background-color: red}";

            // getting iframe
            var myIframe = document.getElementById("myiframe");

            // apply new CSS to iframe
            myIframe.contentWindow.document.
                    getElementsByTagName('head')[0].appendChild(stl);
        }
    </script>
</head>
<body>
    <iframe id="myiframe" src="temp.html"></iframe>
    <button onclick="test()">
</body>
</html>

When I click the button, background in iframe becomes red.

P.S. Sorry if it is repeating. I've only now opened the link in your post to another topic

创建<样式>JavaScript 中的标签,然后访问 cssRules

走过海棠暮 2024-10-22 21:44:37

您可以将其安装在本地或将其部署到站点本地(例如公司范围)存储库。
如果您使用的依赖项 maven 在配置的存储库中找不到,它甚至会为您提供所需的命令:

然后,使用以下命令安装它:
mvn install:install-file -DgroupId=mygid -DartifactId=myaid -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file

或者,如果您托管自己的存储库,则可以在那里部署该文件:
mvn 部署:部署文件 -DgroupId=mygid -DartifactId=myaid -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

请注意:这样您只能将 .jar 添加到您的存储库中,将不会有 pom 一起指定临时依赖项。因此,如果您的第三方库有自己的依赖项,您必须将它们手动添加到您的 pom.xml 中,因为不会自动解析。

You can install it local or deploy it to your site-local (e.g. company-wide) repository.
If you use a dependency maven cannot find in the configured repositories, it even gives you the required commands:

Then, install it using the command:
mvn install:install-file -DgroupId=mygid -DartifactId=myaid -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file

Alternatively, if you host your own repository you can deploy the file there:
mvn deploy:deploy-file -DgroupId=mygid -DartifactId=myaid -Dversion=1.0 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]

Please note: This way you only add the .jar to your repository, there will be no pom along with it to specify transient dependencies. So if your third-party library has dependencies of it's own you'll have to add them manually to your pom.xml as there will be no automatic resolution.

是否有任何插件可以启用非 Maven 依赖项加载/使用?

走过海棠暮 2024-10-22 20:21:16

使用 proxy.headerLighttpd 1.4 的另一个非解决方案

(从 1.4.46 版本开始提供,使用版本 1.4.53 进行测试):

$HTTP["url"] =~ "(^/DeviceB/)" {   
  proxy.server = ( "" => ("" => ( "host" => "192.168.1.20", "port" => 80 )))
  proxy.header = (
    "map-urlpath" => ( "/DeviceB" => "" )
  )
}

不幸的是,map- urlpath 只能替换 URL 的前缀,但这涵盖了大多数情况,包括这种情况。
有关详细信息,请参阅 mod_proxy文档

Another, non-workaround solution for Lighttpd 1.4

Using proxy.header (available since version 1.4.46, tested using version 1.4.53):

$HTTP["url"] =~ "(^/DeviceB/)" {   
  proxy.server = ( "" => ("" => ( "host" => "192.168.1.20", "port" => 80 )))
  proxy.header = (
    "map-urlpath" => ( "/DeviceB" => "" )
  )
}

Unfortunately, map-urlpath is only able to replace the prefix of the URL, but that covers most cases including this one.
For details refer to the documentation of mod_proxy.

lighttpd 作为反向代理

走过海棠暮 2024-10-22 19:52:58

以 的方式使用最新的 jquery 库会

$("#inputnum").keyup(function(e){
  if (e.keyCode != '13') {
    $("#outputarea").slideUp('slow');
  };
});

导致每次在软件键盘或硬件键盘上键入任何字母时,使用“#outputarea”选择的项目都会向上滑动。可能想尝试一下 jquery lib?跨浏览器兼容性是我不断关注它的主要原因。

Using the newest jquery lib in the style of

$("#inputnum").keyup(function(e){
  if (e.keyCode != '13') {
    $("#outputarea").slideUp('slow');
  };
});

causes the item selected with "#outputarea" to be slid up every time - as soon as I type any letter on the software keyboard or a hardware keyboard. Might want to give the jquery lib a shot? Cross-browser compatibility is the main reason I keep going back to it.

当键盘打开时android浏览器计时器

走过海棠暮 2024-10-22 19:14:57

使用 ABAddressBookRegisterExternalChangeCallback 收听地址簿中的更新。


您还可以收听 @"ABCDataBaseChangedExternallyNotification" 通知,甚至更深入的 "__ABDataBaseChangedByOtherProcessNotification" Darwin 通知,但这些都未记录。不要依赖他们。 ABAddressBookRegisterExternalChangeCallback 完全没问题。

Use ABAddressBookRegisterExternalChangeCallback to listen to updates in the Address Book.


You may also listen to the @"ABCDataBaseChangedExternallyNotification" notification, or even deeper, the "__ABDataBaseChangedByOtherProcessNotification" Darwin notification, but these are all undocumented. Don't rely on them. ABAddressBookRegisterExternalChangeCallback is perfectly fine.

在 iOS 中更新/修改地址簿联系人后的通知

走过海棠暮 2024-10-22 15:54:12

你不能。 iPhone 不支持 Flash。你可以正常查看html/xml/js,但Flash不会显示。

You can't. The iPhone does not support Flash. You can view the html/xml/js just fine, but the Flash will not display.

在 iPhone 上使用动作脚本

走过海棠暮 2024-10-22 12:34:17

有几点:

  1. xmlHttp.onreadystatechange=stageChanged2; 行中,stateChanged2 被错误地拼写为 stageChanged2
  2. xmlHtpp.setRequestHeader(...) 行中,xmlHttp 被错误拼写为 xmlHtpp
  3. 为了阻止表单提交,您需要在
    标签的onsubmit事件属性中返回false,而不是在提交按钮的onclick 事件属性。
  4. 结合 #3,您的 checkStr() 函数在进行 AJAX 调用后不会返回 false。添加 return false; 作为该函数的最后一行。

作为一个不相关的注释,我注意到您的 action="login.php" 错误地位于 div 标记而不是表单标记上,除非出于某种原因是故意的。


您使用任何类型的调试工具吗?这里的两个问题来自拼写错误。例如,在 Firefox 中,错误控制台立即向我显示了这些内容。


对于 AJAX,您可能需要考虑 JavaScript 库,例如 jQuery。它考虑了浏览器的差异并简化了整个过程。这些天我很少看到像您一样手动编码的 AJAX 请求。

Several things:

  1. In the line xmlHttp.onreadystatechange=stageChanged2;, stateChanged2 is misspelled as stageChanged2.
  2. In the line xmlHtpp.setRequestHeader(...), xmlHttp is misspelled as xmlHtpp.
  3. In order to prevent the form from submitting, you need to return false in <form> tag's onsubmit event attribute, not in the submit button's onclick event attribute.
  4. In conjunction with #3, your checkStr() function doesn't return false after it makes the AJAX call. Add return false; as the last line of that function.

As an unrelated note, I noticed that your action="login.php" is mistakenly on the div tag instead of the form tag, unless for some reason that's intentional.


Are you using any sort of debugging tool? Two of the problems here are from misspellings. In Firefox, for example, the Error Console showed me these right away.


For AJAX, you might want to consider a JavaScript library such as jQuery. It accounts for differences in browsers and simplifies the whole process. These days I rarely see AJAX requests manually coded like you have.

修复ajax登录表单中的错误

走过海棠暮 2024-10-22 08:48:04

尝试:

Ext.Msg.show({
    cls: "my-progress-class"
});

并定义一个 CSS 规则来显示您的自定义“请稍候”图像:

.my-progress-class {
    background: url(image/wait.png) 50% 50% no-repeat;
}

Try:

Ext.Msg.show({
    cls: "my-progress-class"
});

And define a CSS rule to show your custom "please wait" image:

.my-progress-class {
    background: url(image/wait.png) 50% 50% no-repeat;
}

如何为 extjs 消息框定义自定义动画 UI

走过海棠暮 2024-10-22 05:54:40

选择一个方法并按 Ctrl+Alt+H 打开其调用层次结构,其中将显示该方法的位置正在被呼叫。

Select a method and hit Ctrl+Alt+H to open its Call Hierarchy which will show you where the method is being called from.

查找 Eclipse 中某个函数的所有出现位置

走过海棠暮 2024-10-22 03:19:32

你可以使用一点ERB。

# config.yml
config
    :path1: /a/b/c
    :path2: /a/<%= id %>/c
    :path3: <%= path3 %>

id = "23"
path3 = "hello/world"

t = ERB.new(File.read("config.yml"))
c = YAML.load(t.result(binding).to_s)

c["config"][:path2]
# => /a/23/c
c["config"][:path3]
# => /hello/world

You can use a bit of ERB.

# config.yml
config
    :path1: /a/b/c
    :path2: /a/<%= id %>/c
    :path3: <%= path3 %>

and

id = "23"
path3 = "hello/world"

t = ERB.new(File.read("config.yml"))
c = YAML.load(t.result(binding).to_s)

c["config"][:path2]
# => /a/23/c
c["config"][:path3]
# => /hello/world

YAML 配置 - 替换字符串中符号的最佳方法

走过海棠暮 2024-10-22 02:49:07

对 android 源码做了一些研究,我现在倾向于同意 Commonsware 的观点,即我的代码是正确的。我实际上在三周前重新设计了它,使用 packagemanager.resolveActivity 而不是intent.resolveactivity:

this.pm = context.getPackageManager();

    try {
        Intent homeintent = new Intent(Intent.ACTION_MAIN);
        homeintent.addCategory(Intent.CATEGORY_HOME);
        homeintent.addCategory(Intent.CATEGORY_DEFAULT);// seems not needed here since This is a synonym for
                                // including
        // the CATEGORY_DEFAULT in your supplied Intent per doc

        this.resolveInfo = pm.resolveActivity(homeintent, PackageManager.MATCH_DEFAULT_ONLY);

        ActivityInfo activityInfo = resolveInfo.activityInfo;

        userHomeLauncherPackage = activityInfo.packageName;
        userHomeLauncherClass = activityInfo.name;

        userHomeLauncherName = activityInfo.loadLabel(pm).toString();

        if (userHomeLauncherClass.contains("ResolverActivity"))
        userHomeLauncherName = "";

    } catch (Exception e) {
        throw new Exception(e);
    }

它没有帮助,所以仍然偶尔会出现这些错误...

基于源代码,

ComponentName Intent.resolveActivity (PackageManager pm)

ActivityInfo Intent.resolveActivityInfo (PackageManager pm, int flags)

调用 android.app.ContextImpl 类中定义的相同方法:

ResolveInfo info =pm.resolveActivity(this, PackageManager.MATCH_DEFAULT_ONLY)

其定义如下:

        @Override
    public ResolveInfo resolveActivity(Intent intent, int flags) {
        try {
            return mPM.resolveIntent(
                intent,
                intent.resolveTypeIfNeeded(mContext.getContentResolver()),
                flags);
        } catch (RemoteException e) {
            throw new RuntimeException("Package manager has died", e);
        }
    }

所以此时我得出的结论是我对此无能为力:(

did some research with android source and i tend to agree now with Commonsware that my code is right. I actually redesigned it 3 weeks ago to use packagemanager.resolveActivity instead of intent.resolveactivity:

this.pm = context.getPackageManager();

    try {
        Intent homeintent = new Intent(Intent.ACTION_MAIN);
        homeintent.addCategory(Intent.CATEGORY_HOME);
        homeintent.addCategory(Intent.CATEGORY_DEFAULT);// seems not needed here since This is a synonym for
                                // including
        // the CATEGORY_DEFAULT in your supplied Intent per doc

        this.resolveInfo = pm.resolveActivity(homeintent, PackageManager.MATCH_DEFAULT_ONLY);

        ActivityInfo activityInfo = resolveInfo.activityInfo;

        userHomeLauncherPackage = activityInfo.packageName;
        userHomeLauncherClass = activityInfo.name;

        userHomeLauncherName = activityInfo.loadLabel(pm).toString();

        if (userHomeLauncherClass.contains("ResolverActivity"))
        userHomeLauncherName = "";

    } catch (Exception e) {
        throw new Exception(e);
    }

It did not help so still getting these errors occasionally...

Based on the source code,

ComponentName Intent.resolveActivity (PackageManager pm)

or

ActivityInfo Intent.resolveActivityInfo (PackageManager pm, int flags)

call the same method defined in android.app.ContextImpl class:

ResolveInfo info = pm.resolveActivity(this, PackageManager.MATCH_DEFAULT_ONLY)

and it is defined like:

        @Override
    public ResolveInfo resolveActivity(Intent intent, int flags) {
        try {
            return mPM.resolveIntent(
                intent,
                intent.resolveTypeIfNeeded(mContext.getContentResolver()),
                flags);
        } catch (RemoteException e) {
            throw new RuntimeException("Package manager has died", e);
        }
    }

so at this point i came to conclusion that I cannot do anything about this :(

解决意图活动的问题 -resolveActivityInfo()

更多

推荐作者

爱人如己

文章 0 评论 0

萧瑟寒风

文章 0 评论 0

云雾

文章 0 评论 0

倒带

文章 0 评论 0

浮世清欢

文章 0 评论 0

撩起发的微风

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文