小编Dav*_*vid的帖子

如何在Excel 2013中正确显示.csv文件?

Excel 2013似乎无法正确读取CSV文件(Excel 2010会这样做).每次打开.csv文件时,我的所有数据都会显示在第一列中.

我知道我可以去DATA,Convert然后选择commas,但这个设置没有保存,每次打开这种文件时我都厌倦了.

如何设置Excel 2013,一劳永逸地以漂亮的方式显示CSV文件(以逗号分隔)?

csv excel office-2013

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

向上拖动ScrollView,然后在React Native中继续滚动

我想要什么(GIF)

这是关于我想要实现的(降低质量的)GIF。

在此处输入图片说明

我想要什么(文字)

我有一个scrollview位于屏幕一半的。

我想要的是将其scrollview向上拖动,然后在到达某个位置时将其发送drag touch eventscrollview自身,以便它可以继续滚动。

我的尝试

  • 将滚动视图全屏显示在前景中,并在其顶部添加半屏填充contentContainerStyle。效果很好,但是我无法单击它后面的视图。有没有一种方法可以单击滚动视图的空白区域
  • 我还尝试检测滚动位置,以便相应地向上移动视图

    <ScrollView onScroll={event => moveScrollViewUpIfNeeded(event)}>
        ...
    </ScrollView>
    
    Run Code Online (Sandbox Code Playgroud)

    但是当我在iOS模拟器上进行测试时无法正常工作。事件甚至没有触发。React Native Docs指出onScroll需要scrollEventThrottle工作。但是,scrollEventThrottle在iOS上可用。就我而言,我也想在Android上使用它。
    而且,如果我成功实现了这一点,那么我将面临另一个UI问题:向上拖动ScrollView时,如何在视图尚未到达所需位置时阻止它滚动?

因此,能否请您给我一些实现此目标的提示:)?

谢谢,

mobile-application reactjs react-native react-native-scrollview

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

如何实现Websockets?

  • 如何实现Websockets?
  • 这项新技术背后的算法是什么(与Long-Polling相比)?
  • 在表现方面,他们怎么能比Long-Polling更好?

我问这些问题,因为这里我们有一个Jetty websocket实现的代码示例(服务器端).

如果我们等待足够长的时间,将发生超时,从而导致客户端上出现以下消息.

这肯定是我在使用长轮询时遇到的问题.它会停止进程以防止服务器过载,不是吗?

javascript websocket

14
推荐指数
2
解决办法
6813
查看次数

使用R在一个.csv文件中写入不同的数据帧

我有3个数据框,我希望它们写在一个.csv文件中,一个在其他文件之上,而不是在同一个表中.因此,一个csv文件中有3个不同的表.它们都有相同的尺寸.

问题write.csv:它不包含" 追加 "功能

问题write.table:csv文件来自write.tableExcel 2010,不像那些来自write.csv

这是<code> write.csv </ code>

这是<code> write.table </ code>

发布我已经阅读过了,我找不到解决问题的方法:

方案?

csv r file append dataframe

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

如何在iOS控制中心中使用停止按钮而不是快速使用暂停按钮

我想构建一个电台应用程序,因此我想使用控制中心中的“停止”按钮而不是“暂停”按钮,就像Apple Radio在本地音乐应用程序中一样:

在此处输入图片说明

这是我在RadioPlayer类中所做的:

private var shoutcastStream = NSURL(string: "http://shoutcast.com:PORT/;stream.mp3")

var playerItem:AVPlayerItem?
var player:AVPlayer?

let commandCenter = MPRemoteCommandCenter.sharedCommandCenter()

override init() {

    super.init()

    do {

        // Allow background audio
        try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
        do {
            try AVAudioSession.sharedInstance().setActive(true)
        } catch _ as NSError {

        }

        // Disable Next, Prev and Pause
        commandCenter.pauseCommand.enabled = false
        commandCenter.nextTrackCommand.enabled = false
        commandCenter.previousTrackCommand.enabled = false

        // Enable Play
        commandCenter.playCommand.enabled = true
        commandCenter.playCommand.addTarget(self, action: #selector(RadioPlayer.play))

        // Enable Stop
        commandCenter.stopCommand.enabled = true
        commandCenter.stopCommand.addTarget(self, action: #selector(RadioPlayer.stop))

    } catch _ as NSError {

    } …
Run Code Online (Sandbox Code Playgroud)

ios control-center swift

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

在iOS设备的锁屏上添加自定义专辑封面

我正在构建一个流播shoutcast音频的iOS应用程序.

我想在设备锁屏上显示自定义图像(无论是哪首歌,我都希望显示相同的图像).

下面的代码向我展示了锁屏上的当前标题,但没有显示专辑艺术,就像下面的图像一样.

有可能首先(我认为,Mixcloud实现了它)?如果是的话,这有什么问题?来源于此.

Class playingInfoCenter = NSClassFromString(@"MPNowPlayingInfoCenter");
if (playingInfoCenter) {
    NSMutableDictionary *songInfo = [[NSMutableDictionary alloc] init];
    UIImage * albumImage = [UIImage imageNamed: @"icon_HD.png"];
    MPMediaItemArtwork * albumArt = [[MPMediaItemArtwork alloc] initWithImage:albumImage];
    [songInfo  setObject:titre.text          forKey:MPMediaItemPropertyTitle];
    [songInfo  setObject:artiste.text        forKey:MPMediaItemPropertyArtist];
    [songInfo  setObject:albumArt            forKey:MPMediaItemPropertyArtwork];
    [[MPNowPlayingInfoCenter defaultCenter] setNowPlayingInfo:songInfo];
}
Run Code Online (Sandbox Code Playgroud)

https://lh6.googleusercontent.com/-yV8VbLatlxg/UoD7Pq-Hv1I/AAAAAAAALVg/UEwKUp00k2U/s1600/iOS-7-lock-screen-music-controls.png

iphone mpmediaitem ios

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

如何通过SSH创建远程存储库?

我有一个已在共享服务器上发布的网站。现在我想使用 git 来处理它(实现一些新功能)。我可以通过 ssh 使用 git。

如何通过 SSH 创建远程存储库,然后获取一个 url 将其拉到我的计算机上,以便我可以在本地工作区上工作。

我试过

git init
git add *
Run Code Online (Sandbox Code Playgroud)

但是当我git ls-remote --get-url获取网址时,它显示:

fatal: No remote configured to list refs from.
Run Code Online (Sandbox Code Playgroud)

该命令git remote什么也不返回。

git ssh

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

Laravel seeder 仅插入随机数量的数据然后失败

我有这个播种机功能。它获取所有插入的用户,然后为每个用户生成一个随机数(从 0 到 12)的个人资料图片。

public function run()
{
    foreach (App\User::all() as $user) {

        echo "Generating profile pic for $user->name ($user->id)... ";
        $profile_pics = factory(App\Image::class, rand(0, 12))->create();

        echo count($profile_pics) . " generated. ";
        echo " Saving... ";

        foreach ($profile_pics as $pp) {
            $user->profile_pics()->save(App\Image::find($pp->id));
        }

        echo "Saved\n";

    }
}
Run Code Online (Sandbox Code Playgroud)

当我运行它时,一些第一个随机用户的个人资料图片被正确插入。但失败后。

Generating profile pic for Amara Abbott I (1)... 5 generated.  Saving... Saved
Generating profile pic for Major Crist (2)... 12 generated.  Saving... Saved
Generating profile pic for Imelda Hettinger IV (3)... 3 …
Run Code Online (Sandbox Code Playgroud)

php laravel laravel-seeding

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

键盘可见时更改Y原点时的奇怪UIView行为

语境:

我有一个包含UITextView的UIView.我想在键盘可见时移动UIView.所以我的想法是改变Y的位置.

问题:

有时,当键盘仍然可见时,UIView会返回其初始Y位置.即使我关注输入,它也不会再回来了.我真的不知道为什么.

插图(gif):

https://d17oy1vhnax1f7.cloudfront.net/items/2K0z3P1j1x2f0X2X1B2v/ci.gif

PS:键盘在Gif中出现3次.它循环,所以很难区分结束.

我做了什么,首先我添加了通知观察员:

NotificationCenter.default.addObserver(self, selector: #selector(self.keyboardWillChangeFrame), name: NSNotification.Name.UIKeyboardWillChangeFrame, object: nil)
Run Code Online (Sandbox Code Playgroud)

然后我定义了键盘切换处理程序:

func keyboardWillChangeFrame(notification: NSNotification) {

    let info = notification.userInfo!
    let keyboardFrame: CGRect = (info[UIKeyboardFrameEndUserInfoKey] as! NSValue).cgRectValue

    self.keyboardInfo["isVisible"] = self.view.frame.size.height - keyboardFrame.origin.y != 0
    self.keyboardInfo["height"] = keyboardFrame.size.height
    self.keyboardInfo["animationDuration"] = info[UIKeyboardAnimationDurationUserInfoKey] as! Double
    self.keyboardInfo["animationCurve"] = info[UIKeyboardAnimationCurveUserInfoKey] as! UInt

    if self.keyboardInfo["isVisible"] as! Bool {
        self.moveCommentInputUp()
    } else {
        self.moveCommentInputDown()
    }

}
Run Code Online (Sandbox Code Playgroud)

之后,我已经定义了在注释输入视图中向上/向下移动的方法:

func moveCommentInputUp() {

    print("Moving up... ", self.commentFormView.frame.origin.y, " to ", self.view.frame.size.height - (self.keyboardInfo["height"] …
Run Code Online (Sandbox Code Playgroud)

uiview ios swift

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

Google Oauth-2.0使用哈希而不是问号返回网址

我使用此表单请求Google离线令牌

    <form action="https://accounts.google.com/o/oauth2/auth" methode="POST">

        <input type="hidden" name="access_type" value="offline" />
        <input type="hidden" name="client_id" value="XXX" />
        <input type="hidden" name="scope" value="https://www.googleapis.com/auth/analytics https://www.googleapis.com/auth/analytics.edit https://www.googleapis.com/auth/analytics.manage.users https://www.googleapis.com/auth/analytics.manage.users.readonly https://www.googleapis.com/auth/analytics.readonly" />
        <input type="hidden" name="response_type" value="code token gsession" />
        <input type="hidden" name="redirect_uri" value="http://example.com/analytics" />
        <input type="hidden" name="approval_prompt" value="force" />

        <button>Get or Refresh token</button>

    </form>
Run Code Online (Sandbox Code Playgroud)

谷歌怎么回信给我一个URL:

http://example.com/analytics#access_token=XXX&token_type=Bearer&expires_in=3600&code=YYY&authuser=0&num_sessions=1&prompt=consent&session_state=ZZZ
Run Code Online (Sandbox Code Playgroud)

请注意我们在主网址部分后面有一个哈希码#而不是问号?.

我期望用PHP获得上面的变量,$_GET但我不能因为那个哈希码.

我的问题是如何获得带问号的网址?

google-analytics oauth-2.0

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