小编bra*_*les的帖子

vim:用no行替换一个线条图案

我试图在vim上实现一个简单的替换但是无法正确.我需要在整个文件中删除与模式匹配的所有行.模式是"东西*",意思是"东西"后跟任何东西,直到行尾.我试图:%s/pattern*\n//g:%s/pattern*$//g没有成功.有任何想法吗?

干杯!

regex vim

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

使用jsonp错误的jQuery ajax请求

我正在编写一个应用程序,我需要从另一台服务器访问客户端的一些json数据.由于跨域问题,我计划使用jsonp.jQuery允许我使用$ .getJSON()方法执行此操作,但是,我无法判断方法是否已失败(即服务器没有响应或其他内容).所以我尝试使用$ .ajax来获取JSON数据.但它不起作用,我不知道该尝试什么.这是一个显示我的问题的示例:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
 <html>
 <head>
      <meta http-equiv="Content-type" content="text/html; charset=utf-8">
      <title>TEST</title>
      <script type="text/javascript" src="scripts/jquery-1.5.1.min.js"></script>
      <script type="text/javascript">
           $(document).ready(function() {
        $('#button_detect').click(function(){
            var feedApiAjax = 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&q=';
            var feedApiGetJSON = 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=?&q=';
            var feedUrl = 'http://www.engadget.com/rss.xml';

            $.ajax({
                url: feedApiAjax + feedUrl,
                datatype: 'jsonp',
                success: function(data) {
                    console.log('$.ajax() success');
                },
                error: function(xhr, testStatus, error) {
                    console.log('$.ajax() error');
                }
            });

            $.getJSON(
                feedApiGetJSON + feedUrl,
                function(data) {
                    console.log('$.getJSON success');
                });
        });
    });
      </script>
 </head>
 <body>
      <div id="button_detect">CLICK ME!!!!</div>
 </body>
Run Code Online (Sandbox Code Playgroud)

如果您使用此代码创建一个网页并单击"Click Me"div,您将看到$ .getJSON请求正在运行而$ …

ajax jquery json jsonp

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

iOS/Android 2.2中的Javascript无效日期

我有这个字符串,包含我需要解析的日期以获取Date javascript对象.它可以工作,如果我在PC浏览器中执行代码,但如果我在iOS(尝试过的iPhone 4.3)和Android 2.2模拟器中运行网页,则会给我一个无效的日期.

<body>
<head>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
</head>
<html>
<script type="text/javascript">
$(document).ready(function(){
  var date = new Date('2011-03-04T08:14:00+01:00');
  $('#test').html(date.toString());
});
</script>
<div id="test"></div>
</html>
</body>
Run Code Online (Sandbox Code Playgroud)

有人知道可能有什么问题吗?我总是可以手动解析日期(考虑到它总是采用相同的格式),但无论如何它对我来说似乎是个问题.

干杯!

javascript android date ios

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

在WinForms中居中滚动的PictureBox

我正在开发WinForms应用程序,无法解决问题。我需要在表单中显示图像。因为图像可以任意大,所以我需要在包含图像的图片框上滚动条,以便用户可以完全看到它。我四处搜寻,发现实现此目的的最佳方法是将PictureBox添加为面板的子控件,并使面板可自动调整大小和可自动滚动。我以编程方式进行了此操作,因为使用设计器后,我无法将图片框作为面板的子控件插入。我现在面临的问题是我似乎无法居中和滚动图片框同时显示。如果将图片框的锚点放在上,左,下,右,则不会显示滚动条,并且显示的图像很奇怪,如果将锚点放回到左上角,则图像不会居中。

有什么办法可以同时做这两者?这是我的面板和图片框的代码:

this.panelCapturedImage = new System.Windows.Forms.Panel();
this.panelCapturedImage.SuspendLayout();
this.panelCapturedImage.AutoScroll = true;
this.panelCapturedImage.AutoSize = true;
this.panelCapturedImage.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.panelCapturedImage.Controls.Add(this.pictureBoxCapturedImage);
this.panelCapturedImage.Location = new System.Drawing.Point(0, 49);
this.panelCapturedImage.Name = "panelCapturedImage";
this.panelCapturedImage.Size = new System.Drawing.Size(3, 3);
this.panelCapturedImage.TabIndex = 4;

this.pictureBoxCapturedImage.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.pictureBoxCapturedImage.Location = new System.Drawing.Point(0, 0);
this.pictureBoxCapturedImage.Name = "pictureBoxCapturedImage";
this.pictureBoxCapturedImage.Size = new System.Drawing.Size(0, 0);
this.pictureBoxCapturedImage.SizeMode = System.Windows.Forms.PictureBoxSizeMode.CenterImage;
this.pictureBoxCapturedImage.TabIndex = 0;
this.pictureBoxCapturedImage.TabStop = false;

this.panelCapturedImage.Controls.Add(this.pictureBoxCapturedImage);
Run Code Online (Sandbox Code Playgroud)

这是我设置图像的位置:

public Image CapturedImage
{
    set 
    { 
        pictureBoxCapturedImage.Image = value;
        pictureBoxCapturedImage.Size = value.Size;
    }
}
Run Code Online (Sandbox Code Playgroud)

.net c# scrollbar picturebox winforms

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

无法安装Windows 7小工具

我正在为Windows 7开发一个非常简单的小工具.我创建了一个index.html文件和一个gadget.xml文件,将它们压缩为zip,将扩展名更改为小工具.当我双击.gadget文件时,我会看到一个窗口,告诉我是否确定要安装小工具,因为它来自不受信任的发布者.我点击"安装",一切似乎都没问题.但是,未安装小工具.我看了一下事件查看器并没有发现任何东西,它只是默默地失败了.谁知道我可能做错了什么?这是gadget.xml文件:

<?xml version="1.0" encoding="utf-8" ?>
<gadget>
<name>Elecciones 2011</name>
<namespace>gnuine.com</namespace>
<version>1.0.0.0</version>
<author name="whatever">
    <info url="hiddenforpublicpublish" />
</author>
<copyright>2011</copyright>
<description>Description</description>
<hosts>
    <host name="sidebar">
        <base type="HTML" apiVersion="1.0.0" src="index.html" />
        <platform minPlatformVersion="1.0" />
        <permissions>Full</permissions>
    </host>
</hosts>
</gadget>
Run Code Online (Sandbox Code Playgroud)

windows-desktop-gadgets windows-7

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