小编Cla*_*tta的帖子

Internet Explorer 10中是否提供FormData对象?

我正在编写一个小的JavaScript应用程序,允许我异步上传图像.

这个脚本在每个浏览器中都很棒,除了猜猜谁,Internet Explorer ......

所以我做的第一件事就是使用Ajax的AjaxForm插件为IE9版本创建一个后备版本,这非常有用!

这是JS脚本.

$("#Uploader").change(function(e){
        var form = $("#UploaderForm");
        form.trigger('submit');
        $(this).attr('disabled','disabled');
        e.preventDefault();
});
$("#UploaderForm").submit(function(e){
        e.preventDefault();
        e.stopPropagation();
        var type="POST";var loading=$("#PhotoIsLoading");
        if(windowApi === true){
            var formData = new FormData($(this)[0]);
            $.ajax({
                url: url,
                type: type,
                xhr: function() {
                    myXhr = $.ajaxSettings.xhr();
                    if(myXhr.upload){ myXhr.upload.addEventListener('progress',progressHandlingFunction, false);}
                    return myXhr;
                },
                beforeSend: function(){loading.removeClass('isHidden_important');},
                success: function(response){
                    jres = JSON.parse(response);
                    alert("Test ok, file uploaded");
                },
                error: function(response){console.warn(response);},
                data: formData, 
                cache: false,
                contentType: false,
                processData: false
            });
            e.preventDefault();
        }else{
            $(this).ajaxSubmit({
                url: url,
                dataType: 'json',
                type: type,
                beforeSubmit: function(){loading.removeClass('isHidden_important');$(this).formSerialize();}, …
Run Code Online (Sandbox Code Playgroud)

javascript ajax html5 internet-explorer file-upload

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

NotifyIcon Windows 10 适用于调试,但不适用于发布

我在我的桌面应用程序中偶然发现了一个奇怪的错误,它是用 c#、NET 4.5 编写的,使用 Windows 窗体。我已经实现了一个简单的 NotifyIcon 系统,它监听一个特定的列表,对于添加的每个项目,它显示标题和描述。很直接。

它在调试过程中就像一个魅力,但是当我发布应用程序时,无论出于何种原因都不会显示通知。我是否在 Windows10 上缺少某些特定权限?

这是EventHandler的代码

    /// <summary>
    /// 
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="args"></param>
    private void OnLogItemAdded(object sender, Utilities.ItemAddedEventArgs args)
    {
        Event e = (Event)args.item;
        switch (e.eventType)
        {
            case EventType.Info:
                MainNotifyIcon.BalloonTipIcon = ToolTipIcon.Info;
                break;
            case EventType.Error:
                MainNotifyIcon.BalloonTipIcon = ToolTipIcon.Error;
                break;
            case EventType.Warning:
                MainNotifyIcon.BalloonTipIcon = ToolTipIcon.Warning;
                break;
            default:
                MainNotifyIcon.BalloonTipIcon = ToolTipIcon.Info;
                break;
        }
        MainNotifyIcon.Visible = true;
        MainNotifyIcon.BalloonTipTitle = e.Title;
        MainNotifyIcon.BalloonTipText = e.Description;
        MainNotifyIcon.ShowBalloonTip(3000);
    }
Run Code Online (Sandbox Code Playgroud)

就是这样,不涉及其他代码。

根据评论,应明确设置通知图标。我做到了,但仍然没有结果。Icon是项目中包含的资源图标

MainNotifyIcon.Icon = Properties.Resources.icon;
Run Code Online (Sandbox Code Playgroud)

.net c# winforms windows-10

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

在没有XNA的Windows Phone中点击并拖动手势

我想知道是否有一种Windows Phone的手势允许我点击一个按钮,然后拖动到另一个并点击它,当然没有XNA框架,因为这不是一个游戏,我不想使用它.

例如,我有两个按钮"A"和"B",如果点击A然后我在B上拖动我的手指(仍然在屏幕上),那么应该用A选择B.

我希望每个人都能理解我的问题,当然我正在用C#和XAML为Windows Phone 8做这一切.

谢谢你的回答.干杯.

c# xaml gesture windows-phone-7 windows-phone-8

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

HTML5排序DIV

HTML5拖放API有点问题.让我们编写代码,以便每个人都能理解.

<div id="draggerContainer" droppable="true">
  <div class="draggableItem" draggable="true" data-id="001">[... Stuff inside like <img> and other <div> ...] </div>
  <div class="draggableItem" draggable="true" data-id="002">[... Stuff inside like <img> and other <div> ...] </div>
  <div class="draggableItem" draggable="true" data-id="003">[... Stuff inside like <img> and other <div> ...] </div>
  <div class="draggableItem" draggable="true" data-id="004">[... Stuff inside like <img> and other <div> ...] </div>
  <div class="draggableItem" draggable="true" data-id="005">[... Stuff inside like <img> and other <div> ...] </div>
  <div class="draggableItem" draggable="true" data-id="006">[... Stuff inside like <img> and other <div> …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery html5 web

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

Laravel 4很多人都有Eloquent和复选框

我正在尝试使用Laravel 4修复我的应用程序的问题.问题是关于Eloquent和M:M的关系.

这是我的情况:我有很多用户可以选择多种服务,每种服务都可以提供专用价格.在数据库中,我有名为"services","users"和"users_services"的表.所以目前我可以保存每个用户选择的服务和价格,但我的问题是我不知道如何回复并向用户展示,我的意思是我不知道如何设置"已检查"每个选定服务的复选框以及每个服务的价格.

您可以在Paste Laravel上查看代码获取任何分支.我也把它贴在这里.

    <?php

class Service extends Eloquent {

    public static $rules = array();

    protected $guarded = array('id');

    /**
     * The database table used by the model.
     *
     * @var string
     */
    protected $table = 'services';

    /**
     * -------------------------------------
     * All Joins w/ other tables
     * -------------------------------------
     **/
    public function users()
    {
        return $this->belongsToMany('User','users_services','services_id','user_id');
    }
}

......

<?php

class User extends Eloquent {

    public static $rules = array();

    protected $guarded = array('id');

    /**
     * …
Run Code Online (Sandbox Code Playgroud)

database many-to-many laravel eloquent laravel-4

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

FormRequest方法在L5.4中验证时忽略空字段

我有这个规则的表格请求:

"password" => "confirmed"
Run Code Online (Sandbox Code Playgroud)

这个解决方案在L5.3中运行良好,因为规则本身有一个bug,如果你传递两个空字段,如

"password" => "",
"password_confirmation" => ""
Run Code Online (Sandbox Code Playgroud)

它们将被验证,因为它们都是空字符串("").即使这是一个错误,我猜,它在某种程度上是好的,因为我的应用程序在请求之后进行了其他检查,但是在L5.4中,每个空字段都被转换为仅由于新的中间件而单独null"confirmed"规则不再起作用.

我试过了:

"password" => "sometimes|confirmed"
Run Code Online (Sandbox Code Playgroud)

但它不起作用,因为密钥存在.

我的问题很简单:

是否有一个类似的验证规则,sometimes但它检查可空值?

我想保留中间件.

php validation httprequest laravel laravel-5.4

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