小编Tha*_*rif的帖子

提高严重骚乱应用的代码质量/组织

我正在使用riot.js和jquery构建一个应用程序.一切都按预期工作,但随着代码的增长,我担心在代码中的随机/意外位置触发和处理事件(.trigger/.on)无助于保持我的代码组织和快速理解.

我的问题是:

(1)我想保持这样一个应用程序的代码清洁和简化(事件命名空间是我想到的一件事)和

(2)我想让模型上的事件与演示者中DOM的事件清楚地分开.如何在基于riot.js的应用程序中实现这些目标

谢谢.

javascript jquery riot.js

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

Google Maps API v3中的Javascript错误(RefererDeniedMapError)

我们使用没有密钥的谷歌地图,由于我们的流量增加,我们必须在我们的JS调用中创建和添加API密钥.但是现在,当我们调用JS时,我们收到了这个错误:

RefererDeniedMapError:https: //developers.google.com/maps/faq#errorcodes

在文档中,我们没有看到与此错误相关的更多信息.使用相同的API密钥,我们在其他域中显示地图没有任何问题,只有我们有一个问题.

与允许的推荐人一起玩,我们已经丢弃了配置问题,我们不知道是否可以禁止我们的域名.

帐单信息也已添加.

有没有人有想法?

谢谢!

google-maps google-maps-api-3

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

input.nextInt()如何正常工作?

这是该计划

public class bInputMismathcExceptionDemo {
public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    boolean continueInput = true;
    do {
        try {
            System.out.println("Enter an integer:");
            int num = input.nextInt();

            System.out.println("the number is " + num);
            continueInput = false;
        }
        catch (InputMismatchException ex) {
            System.out.println("Try again. (Incorrect input: an integer is required)");
        } 
        input.nextLine();
    }   
    while (continueInput);

}
}
Run Code Online (Sandbox Code Playgroud)

我知道nextInt()只读整数而不是"\n",但为什么我们需要input.nextLine()读取"\n"?有必要吗??因为我认为即使没有input.nextLine(),在它返回之后try {},input.nextInt()仍然可以读取我输入的下一个整数,但实际上它是一个无限循环.

我仍然不知道它背后的逻辑,希望有人能帮助我.

java

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

如何在html中重定向到页面的特定部分

请帮我修改代码以重定向到页面的特定部分.

我完成了重定向到目标页面,但我想要的是重定向到<div>页面的特定页面.

提前致谢

html

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

如果实现了GooglePlayServicesClient.ConnectionCallbacks/OnConnectionFailedListener,则找不到主活动类

我根据谷歌文档关于位置服务开发了一个示例应用程序.运行它我找到MainActivity Class Found的崩溃,但是如果我删除位置回调的实现GooglePlayServicesClient.ConnectionCallbacks和GooglePlayServicesClient.OnConnectionFailedListener它就会启动.

我正在使用Android Studio,我确信我配置了Google Play服务和AVD(Nexus 7 Google API 19).

这是主要活动:

package com.demo.app;

import android.support.v7.app.ActionBarActivity;
import android.support.v4.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ProgressBar;
import android.widget.TextView;

import com.google.android.gms.common.ConnectionResult;
import com.google.android.gms.common.GooglePlayServicesClient;
import com.google.android.gms.location.LocationClient;
import com.google.android.gms.location.LocationRequest;

public class MainActivity extends ActionBarActivity implements
             GooglePlayServicesClient.ConnectionCallbacks,
             GooglePlayServicesClient.OnConnectionFailedListener {

  // Handles to UI widgets
  private TextView mLatLng;
  private TextView mAddress;
  private ProgressBar mActivityIndicator;
  private TextView mConnectionState;
  private TextView mConnectionStatus;

  // A request to connect to Location Services …
Run Code Online (Sandbox Code Playgroud)

android location google-play-services android-studio

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

BackgroundTransferService /请求

我有问题(实际上不是一个,而是很多问题),

我正在开发使用BackgroundTransferService进行传输录制的wav文件的Windows Phone 8应用程序,在HTC 8S上运行得差不多,但在诺基亚Lumia 920看起来很奇怪的行为,它有一些不可理解的上传限制等于0.5MB正好512 KB,带WiFi它似乎工作正常,但这个问题是过度细胞.

var transferRequest = new BackgroundTransferRequest(new Uri(url, UriKind.Absolute));
transferRequest.Tag = DateTime.Now.ToString(CultureInfo.InvariantCulture);
transferRequest.Method = "POST";
transferRequest.UploadLocation = new Uri(defect.VoiceRecordFileName, UriKind.Relative);
transferRequest.TransferPreferences = TransferPreferences.AllowCellularAndBattery;

transferRequest.Headers.Add("Content-Type", "audio/wav");

transferRequest.TransferStatusChanged += new EventHandler<BackgroundTransferEventArgs>(transferRequest_TransferStatusChanged);
transferRequest.TransferProgressChanged += new EventHandler<BackgroundTransferEventArgs>(transferRequest_TransferProgressChanged);

BackgroundTransferService.Add(transferRequest);
Run Code Online (Sandbox Code Playgroud)

当我达到TotalBytesSent = 512KB时,它会停止上传

我也检查一下

var tmp = NetworkInformation.GetInternetConnectionProfile();
var cost = tmp.GetConnectionCost();
var type = cost.NetworkCostType;
Run Code Online (Sandbox Code Playgroud)

一切似乎都很好

编辑:

服务器端的收入仅为380000字节+/- 5 KB

有时,在上传文件10次失败(仅发送380KB等)之后,它会突然上传它:D.在我离开办公室的某个时候,它在第一次完美工作,而其他时间从未发送过.

它完全不可预测的事情

解:

问题是服务器端...我有一个通用的处理程序来保存这个文件而不支持Range头文件(我认为).当我将我的项目更改为本教程启发/复制的"Asp.NET Web Api项目"时

它昨天不起作用,但今天意外开始工作:D Crazy Nokia和.NET.

我们明天会看到接下来会发生什么.

c# windows-phone-8 lumia

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

如何在DataGridView中建议附加ComboBox?

我有一个ComboBox在一个c#视窗形成应用程序,其中我已经设置AutoCompleteModeSuggestAppend,而该文本被自动附加到输入(图1).

但如果我设置AutoCompleteModeSuggestAppendDataGridView ComboBox不追加文本(图2).

如何SuggestAppend在datagridview组合框中启用?

图.1 :

自动完成组合框

图2:

自动完成DataGridViewComboBoxCell

c# combobox datagridview winforms

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

具有附件下载API支持的一次性临时电子邮件

我正在开发一个使用guerrillamail获取临时电子邮件的应用程序,然后我使用其给定的API来获取发送到此ID的电子邮件的内容.我无法实现的是,如果电子邮件包含附件,我如何使用API​​下载它,或者如果我有电子邮件源,则使用mime解析器库解析MIME?

或者,您可以推荐任何提供API支持下载附件的替代方案.

email iphone api ios

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

从AVFullScreenViewController iOS 8获取媒体链接

我想在某些内容开始播放时尝试获取视频链接(例如任何YouTube视频).

首先我抓住视频开始播放

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(videoStarted:) name:@"UIWindowDidBecomeVisibleNotification" object:nil];
Run Code Online (Sandbox Code Playgroud)

然后延迟尝试获取链接

-(void)videoStarted:(NSNotification *)notification
{
    NSLog(@"notification dic = %@", [notification userInfo]);
    [self performSelector:@selector(detectModal) withObject:nil afterDelay:2.5f];
}

-(void)detectModal
{
    CUViewController *controller = (CUViewController *)[appDelegate.window rootViewController].presentedViewController;
    NSLog(@"Presented modal = %@", [appDelegate.window rootViewController].presentedViewController);
    if(controller && [controller respondsToSelector:@selector(item)])
    {
        id currentItem = [controller item];
        if(currentItem && [currentItem respondsToSelector:@selector(asset)])
        {
            AVURLAsset *asset = (AVURLAsset *)[currentItem asset];
            if([asset respondsToSelector:@selector(URL)] && asset.URL)
                [self newLinkDetected:[[asset URL] absoluteString]];
            NSLog(@"asset find = %@", asset);
        }
    }
    else
    {
        for (UIWindow *window in [UIApplication …
Run Code Online (Sandbox Code Playgroud)

objective-c ios avplayer

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

获取3天前的日期

我有SQL脚本,从当天开始选择所有内容.

SELECT  [ClientID] from [logs] where Date > CONVERT (date, SYSDATETIME())
Run Code Online (Sandbox Code Playgroud)

日期是DateTime的类型.

如何在最近3天内获得所有信息?我想我需要从功能SYSDATETIME()结果中减去3天,但是如何?

sql sql-server

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