小编Gij*_*ese的帖子

PHP - 将图像放在另一个图像上

我想用php将图像放在另一个图像上.我有两张照片.一张是照片.另一个是固定大小,全白的图像.我们可以称之为框架.所以我需要的是将照片放在画面中间(白色图像),然后保存.任何人都可以帮助我吗?

php gd image image-resizing

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

未知操作:计数器未使用Vuex(VueJS)递增

我正在使用以下代码使用Vuex增加store.js中的计数器.不知道为什么,当我点击增量按钮时,它说:

[vuex]未知动作类型:INCREMENT

store.js

import Vuex from 'vuex'
import Vue from 'vue'
Vue.use(Vuex)
var store = new Vuex.Store({
  state: {
    counter: 0
  },
  mutations: {
    INCREMENT (state) {
      state.counter++;
    }
  }
})
export default store
Run Code Online (Sandbox Code Playgroud)

IcrementButton.vue

<template>
  <button @click.prevent="activate">+1</button>
</template>

<script>
import store from '../store'

export default {
  methods: {
    activate () {
      store.dispatch('INCREMENT');
    }
  }
}
</script>

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

vue.js vuex vuejs2

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

在Swift 3中以编程方式转到另一个视图

我正在使用以下代码以编程方式在swift 3中转到另一个视图.运行时没有错误.但不知道为什么不这样看

我使用的代码:

let images = self.storyboard?.instantiateViewController(withIdentifier:"Collection") as! UICollectionViewController
            self.navigationController?.pushViewController(images, animated: true)
Run Code Online (Sandbox Code Playgroud)

我想转到CollectionView.swift 在此输入图像描述

在此输入图像描述

ios swift swift3

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

数据变量不从VueJS中的方法更新

我正在使用以下代码从HTML5地理位置API获取访问者邮政编码(密码).但是,我想获取该邮政编码并将其更新为数据变量'pincode'.下面是我使用的代码,值在控制台中正确打印.但是没有更新'pincode'变量.

export default {
    data(){
        return {
      pincode: 0,
        }
    },
    methods: {
    findPincode(){
      navigator.geolocation.getCurrentPosition(function (position) {
                var geocoder = new google.maps.Geocoder();
                var latLng   = new google.maps.LatLng(
                    position.coords.latitude, position.coords.longitude);
                geocoder.geocode({
                    'latLng': latLng
                }, function (results, status) {
                    for (var i = 0; i < results[0].address_components.length; i++) {
                        var address = results[0].address_components[i];
                        if (address.types[0] == "postal_code") {
                            console.log(address.long_name) // prints 680001
                            this.pincode = Number(address.long_name) // not working
                        }
                    }
                });
            });
        }    
    }
}
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-component vuejs2

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

从我的网站下载文件时不显示大小

我在WordPress上运行一个博客.要从我的博客下载一些文件,首先我将文件上传到我的服务器文件夹/ downloads.然后我在我的帖子中链接文件.当用户单击下载按钮时,下载开始.但问题是它没有显示文件大小.它只显示下载了多少.我在下面提供了一个链接来检查.

该网站是在Wordpress中.在Godaddy上主持.

样本帖子(请查看下载链接):http://www.tekyfox.com/android/bug-fixed-moto-g-boot-animation-change-updating/

php wordpress hosting

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

删除HTML中标记之间的空格

我使用以下代码删除html中的空格.我只想删除两个标签之间的空格.但是下面的代码替换了所有的空格

IE删除">"和"<"之间的所有空格

//read the entire string
$str=file_get_contents('sample.txt');

//replace all white spaces
$str=str_replace("\n", "",$str);
$str=str_replace("\t", "",$str);
$str=str_replace(" ", "",$str);

//write the entire string
file_put_contents('sample.txt', $str);
Run Code Online (Sandbox Code Playgroud)

html php regex domdocument

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

如何在tableview底部添加新行 - 聊天消息

每次用户输入消息并单击"发送"时,我都会使用以下代码添加新消息.它很棒.但问题是,在表视图的顶部插入了新消息.我希望它插在底部.

    import UIKit

class ViewController: UIViewController, UITableViewDataSource, UITableViewDelegate {

    @IBOutlet var messagesTable: UITableView!
    @IBOutlet var messageTextBox: UITextField!

    var messageArray = [String]()

    @IBAction func sendMessage(sender: AnyObject) {

        messageArray.append(messageTextBox.text!)
        messagesTable.reloadData()
        messageTextBox.text = ""

    }


    override func viewDidLoad() {
        super.viewDidLoad()
    }


    func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return messageArray.count
    }

    func tableView(tableView: UITableView, heightForRowAtIndexPath indexPath: NSIndexPath) -> CGFloat {
        return 80
    }

    func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {


        //self.messagesTable.contentInset = UIEdgeInsetsMake(messagesTable.frame.height,0,0,0)

        let cell = NSBundle.mainBundle().loadNibNamed("AgentMessageText", owner: self, …
Run Code Online (Sandbox Code Playgroud)

uitableview ios swift

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

从VueJS中的v-for中删除重复的元素

我正在使用以下代码来显示数组中的类别.该数组可能包含重复的类别.有什么办法我只能在VueJS中选择独特的元素吗?

<li v-for="product in products">
{{product.category}}
</li>
Run Code Online (Sandbox Code Playgroud)

阵:

products: [
      { id: '1', title: 'Test 1', category: 'Test 3' },
      { id: '2', title: 'Test 2', category: 'Test 1' },
      { id: '3', title: 'Test 3', category: 'Test 2' },
      { id: '3', title: 'Test 4', category: 'Test 1' },
      { id: '5', title: 'Test 5', category: 'Test 3' }
    ]
Run Code Online (Sandbox Code Playgroud)

vue.js vue-component vuejs2

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

在 VueJS 中更改道具时重新加载组件

我正在使用以下代码来显示传递值“类别”的组件。类别根据用户交互而变化。但是,一旦加载了一个组件,它的数据不会根据 props 的变化而改变。

<button @click="selected='new'">Change</button>
<popup :category="selected"></popup>

data() {
    return {
      selected: 'test'
    }
  }
Run Code Online (Sandbox Code Playgroud)

vue.js vue-component vuejs2

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

将任务添加到 Google Cloud Tasks 时DEADLINE_EXCEEDED

DEADLINE_EXCEEDED从 Node.js 客户端将任务添加到 Google Cloud Tasks 时,我偶尔会收到错误消息。我只尝试在 for 循环中添加 17 个任务。不知道为什么这种情况偶尔会发生,有时却工作得很好!

这是详细的错误日志:

Error: 4 DEADLINE_EXCEEDED: Deadline exceeded
    at Object.callErrorFromStatus (/Users/gijo/Desktop/workspace/flying-press-server/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
    at Object.onReceiveStatus (/Users/gijo/Desktop/workspace/flying-press-server/node_modules/@grpc/grpc-js/build/src/client.js:175:52)
    at Object.onReceiveStatus (/Users/gijo/Desktop/workspace/flying-press-server/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:341:141)
    at Object.onReceiveStatus (/Users/gijo/Desktop/workspace/flying-press-server/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:304:181)
    at Http2CallStream.outputStatus (/Users/gijo/Desktop/workspace/flying-press-server/node_modules/@grpc/grpc-js/build/src/call-stream.js:115:74)
    at Http2CallStream.maybeOutputStatus (/Users/gijo/Desktop/workspace/flying-press-server/node_modules/@grpc/grpc-js/build/src/call-stream.js:154:22)
    at Http2CallStream.endCall (/Users/gijo/Desktop/workspace/flying-press-server/node_modules/@grpc/grpc-js/build/src/call-stream.js:140:18)
    at Http2CallStream.cancelWithStatus (/Users/gijo/Desktop/workspace/flying-press-server/node_modules/@grpc/grpc-js/build/src/call-stream.js:443:14)
    at Timeout.<anonymous> (/Users/gijo/Desktop/workspace/flying-press-server/node_modules/@grpc/grpc-js/build/src/deadline-filter.js:59:28)
    at listOnTimeout (internal/timers.js:549:17) {
  code: 4,
  details: 'Deadline exceeded',
  metadata: Metadata { internalRepr: Map {}, options: {} }
}
Run Code Online (Sandbox Code Playgroud)

我以为我达到了一些配额。但经检查,均未超标。

在此输入图像描述

这是我创建队列的方式(更新插入):

const client = require('./client');

module.exports = async (queue_name, concurrent) => {
  return client.updateQueue({
    queue: …
Run Code Online (Sandbox Code Playgroud)

google-cloud-platform google-cloud-tasks

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

从mysql表中删除一组逗号

每列和每行都有一组逗号.我想消除字符串前后的逗号.

例如:,,,,,东西,东西,,,,,,,,,,,

我想只消除逗号和字符串的前端和末尾,而不是之间的真实逗号.它几乎在每一行和每列中.我知道这可以通过regx来完成并替换php中的函数.

但我想在数据库本身进行更改.(没有这个不必要的逗号的新表)

在此输入图像描述

php regex mysql

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

页面在Google Adwords转化跟踪上被重定向

我已经形成了人们提交数据的地方,然后使用ajax将数据发送到服务器。我已将其设置为Google Adwords中的转换。下面是我使用的代码。

问题是,当用户提交表单时,在获得响应后,其重定向回我给出的URL。我不想重定向!

(由于此项目在VueJS中,因此提交的数据使用Vue资源)

submit() {
  let self = this
  this.$validator.validateAll().then(success => {
    if (!success) {
      return;
    }
    document.getElementById("submitQuote").value = "Submitting...";
    this.$http.post(store.state.url+'api/submit_quote.php', {
        formData: store.state.formData
      })
      .then(response => {
        console.log(response.data)
        this.submitted = true
        self.reference_id = response.data
        goog_report_conversion('https://www.example.com/') //report Google that a conversion has occured
      });
  });
}
Run Code Online (Sandbox Code Playgroud)

Google提供的代码

<!-- Google Code for Add to Cart Conversion Page
    In your html page, add the snippet and call goog_report_conversion
    when someone clicks on the chosen link or button. -->
    <script type="text/javascript">
     /* …
Run Code Online (Sandbox Code Playgroud)

javascript ajax google-adwords vue.js vue-resource

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

如何使用 Babel 和预设启动 PM2 Node JS

我的 package.json 中有以下代码用于在开发时启动脚本:

....
    "scripts": {
        "start": "nodemon src/index.js --exec babel-node --presets es2015,stage-2"
      },
....
Run Code Online (Sandbox Code Playgroud)

现在我想将它部署到生产环境中。当我运行时npm start一切正常。但是,当我关闭终端时它会关闭。那么我如何将它与PM2一起使用?

这是我尝试过的:

pm2 start src/index.js -x babel-node -p es2015,stage-2
Run Code Online (Sandbox Code Playgroud)

javascript node.js pm2

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