小编Kal*_*ico的帖子

Sublime Text 不允许我保存文件

如何在 Mac 上解决此问题?

无法保存 /test.py 错误:只读文件系统

在此处输入图片说明

sublimetext sublimetext3

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

保护ajax表单POST

我想知道如何通过AJAX开发一个安全的表单帖子.

例如,我有:

我的HTML表单.

我的JavaScript处理提交.

提交网址为"post_data.php"

发布的数据是:

id=8&name=Denis
Run Code Online (Sandbox Code Playgroud)

PHP验证变量id和name是否为POSTED及其数据类型.如果可以的话,继续在数据库上做一些事情.

我的问题是,我如何阻止某人在我的网站之外创建自己的html表单,或者其他什么,并将错误的数据发布到我的PHP脚本中?

想象一下,数据确实存在于我的数据库中,这可能很糟糕.

谢谢

forms security ajax post

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

Openconnect无法连接到网关

我无法从ubuntu 14.04系统通过openconnect VPN客户端进行连接。我曾经在1个月前连接到此VPN,但从那时起,我还没有对VPN客户端设置进行任何更改。

这是我在日志中得到的错误。

POST https://69.195.x.x/
Attempting to connect to server 69.195.x.x:443
SSL negotiation with 69.195.x.x
SSL connection failure: A TLS packet with unexpected length was received.
Failed to open HTTPS connection to 69.195.x.x
GET https://69.195.x.x/
Attempting to connect to server 69.195.244.x:x
SSL negotiation with 69.195.x.x
SSL connection failure: A TLS packet with unexpected length was received.
Failed to open HTTPS connection to 69.195.x.x
Run Code Online (Sandbox Code Playgroud)

我有一些正在使用Windows AnyConnect客户端的队友,并且能够通过Windows计算机连接到VPN。

任何帮助都是非常可观的。

openssl ubuntu-14.04 openconnect

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

如何在此图表中添加逗号js

我正在使用Chart.js,这里是我想要发生的事情. 我的示例图

我需要在这些值上附加逗号来表示千位.例如:1,000

animation: {
    duration: 500,
    easing: "easeOutQuart",
    onComplete: function (label) {
        var ctx = this.chart.ctx;
        ctx.font = Chart.helpers.fontString(Chart.defaults.global.defaultFontFamily, 'normal', Chart.defaults.global.defaultFontFamily);
        ctx.textAlign = 'center';
        ctx.textBaseline = 'bottom';
        this.data.datasets.filter(dataset => !dataset._meta[Object.keys(dataset._meta)[0]].hidden).forEach(function (dataset) {
            for (var i = 0; i < dataset.data.length; i++) {
                var model = dataset._meta[Object.keys(dataset._meta)[0]].data[i]._model,                 
                    scale_max = dataset._meta[Object.keys(dataset._meta)[0]].data[i]._yScale.maxHeight;
                                    ctx.fillStyle = '#000';
                var y_pos = model.y - 5;
                // Make sure data value does not get overflown and hidden
                // when the bar's value is too close to max …
Run Code Online (Sandbox Code Playgroud)

ajax jquery chart.js chart.js2

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

使用jQuery从Kendo UI网格中删除行

我正在使用Kendo UI网格并删除行,正在使用带有自举程序的自定义按钮,当我单击它时,使用ajax,我会调用Web api方法来删除该行,如果成功删除,则将该行从中删除DOM。(我没有使用kendo的destroy命令)

我的问题是,如果我尝试过滤已删除的那一行,它会再次出现在网格中,而且似乎根本没有被删除。

这是我的Kendo UI网格:

var table = $("#grid").kendoGrid({                
    dataSource: {
        transport: {
            read: {
                url: "/api/customers",
                dataType: "json"
            }
        },
        pageSize: 10
    },               
    height: 550,
    filterable: true,
    sortable: true,
    pageable: {
        refresh: true,
        pageSizes: true,
        buttonCount: 5
    },
    columns: [{
        template: "<a href='' class='btn-link glyphicon glyphicon-remove js-delete' title='Delete' data-customer-id= #: Id #></a>",
        field: "Id",
        title: "&nbsp;",
        filterable: false,
        sortable: false,
        width: 50,
        attributes: {
            style: "text-align: center" 
        }
    }, {
        field: "Name",
        title: "Name",
        width: 100,
    }, { …
Run Code Online (Sandbox Code Playgroud)

javascript jquery kendo-ui kendo-grid

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

动态设置 mat-expansion-panel 的高度

我正在尝试使用 a mat-expansion-panel,但是,对于我正在处理的项目,我需要在每个面板上设置的标题长度可能会很长,并且在大多数情况下无法预测。目前,如果标题文本的长度太长,则会超出面板的范围。

我知道我可以设置[collapsedHeight][expandedHeight]属性来调整此行为,但是,我正在尝试寻找一种不会对值进行硬编码的解决方案。

这是StackBlitz演示我正在谈论的内容。其中,第一个扩展面板显示了当标题内容太长并且未设置时会发生[collapsedHeight]什么[expandedHeight]。第二个扩展面板显示了当我将其设置为静态值 - 时会发生什么190px

实现这一目标的最佳方法是什么?

javascript css angular-material angular

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

我在发送邮件时遇到问题:TypeError: __init__() got an unexpected keyword argument 'context'

我想在 Synology NAS 上制作一个 python 脚本。备份完成后,脚本将发送一封邮件。我不知道为什么在 pycharm 中在 Windows 上工作的脚本不能在 Synology 上工作......它的上下文 = 上下文问题。它的 Synology NAS 安装了 python 和 python 模块。Python查看所有文件路径但他无法发送邮件

    message = MIMEMultipart("alternative")
    message["Subject"] = "Backup zrobiony dnia: " + str(datetime.now())
    message["From"] = sender_email
    message["To"] = receiver_email

    # Create the plain-text and HTML version of your message
    text = """\
            Hi,
            How are you?"""

    def modification_date(filename):
        t = os.path.getmtime(filename)
        return datetime.fromtimestamp(t)

    html = """\
    <html lang="PL">
    <head>
    <style>table,td,th{border:2px solid black;}</style>
    </head>
      <body>
        <h1 style="text-align: center">Witam tu serwer Synology z …
Run Code Online (Sandbox Code Playgroud)

python linux synology

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

如何在其他元素下方时保持particles.js 交互

我使用particle.js作为背景。我已经设法使用 z-index 放置在背景上。我在 github isseus 页面上尝试了一个建议。z-index 和这个:

"interactivity": {
    "detect_on": "canvas",
Run Code Online (Sandbox Code Playgroud)

此位已添加到默认粒子配置中。

问题类似于:这个问题。他说他解决了,但看他的 codepen 链接似乎不一样。颗粒上面没有内容。

我的当前版本:Github 问题 = 交互性工作在第一个内容框的正上方和正下方。我尝试了多次编辑元素的宽度和 z-index。还尝试为其他内容使用额外的 div。

我怎样才能让交互性在双方工作?

html javascript css particle.js

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

Spark任务不可序列化

我已经尝试了所有在StackOverflow上发现的该问题的解决方案,但是尽管如此,我还是无法解决。我有一个“ MainObj”对象,该对象实例化了“ Recommendation”对象。当我调用“ recommendationProducts”方法时,总是出现错误。这是该方法的代码:

def recommendationProducts(item: Int): Unit = {

val aMatrix = new DoubleMatrix(Array(1.0, 2.0, 3.0))

def cosineSimilarity(vec1: DoubleMatrix, vec2: DoubleMatrix): Double = {
  vec1.dot(vec2) / (vec1.norm2() * vec2.norm2())
}

val itemFactor = model.productFeatures.lookup(item).head
val itemVector = new DoubleMatrix(itemFactor)

//Here is where I get the error:
val sims = model.productFeatures.map { case (id, factor) =>
  val factorVector = new DoubleMatrix(factor)
  val sim = cosineSimilarity(factorVector, itemVector)
  (id, sim)
}

val sortedSims = sims.top(10)(Ordering.by[(Int, Double), Double] {
  case (id, similarity) => …
Run Code Online (Sandbox Code Playgroud)

serialization scala exception serializable apache-spark

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

带有在线 MySql/Sql 数据库的 Xamarin Android 应用程序

我想知道如何将 android 应用程序与在线数据库连接。

我在互联网上阅读了很多,但我仍然在空中。我不知道哪种方法最好。

  1. 我从 google 看到了一些东西,比如Sql google cloud

  2. 我阅读了很多关于 Azure 的内容。

我看到所有这些服务都不是完全免费的。

我希望我的 android 应用程序从用户手机与这个数据库通信,但我不想在这个应用程序的代码隐藏中公开 sql 查询。所以我需要这个应用程序在某处发送请求并从那里执行这些查询。

因为这是我的第一个 Android 应用程序,我不知道在这种情况下如何进行。我想使用 Xamarin。

所以用户必须插入一些数据或从数据库中读取一些数据。

你能给我一些关于我的情况的例子吗?

先感谢您。

c# mysql database android xamarin

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

在Flutter应用中添加image_picker插件后,Gradle Build失败

当我运行应用程序而不添加图像选择器作为依赖项时,它运行良好。但是,当我添加插件并运行时,它给了我gradle构建失败的错误。

Resolving dependencies...                                    5.0s
Gradle task 'assembleDebug'...
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
registerResGeneratingTask is deprecated, use registerGeneratedResFolders(FileCollection)
D8: Program type already present: android.support.v4.app.INotificationSideChannel

         *********************************************************
WARNING: This version of image_picker will break your Android build if it or its dependencies aren't compatible with AndroidX.

         This warning prints for all Android build failures. The real root cause of the error may be unrelated.
         *********************************************************
FAILURE: Build failed …
Run Code Online (Sandbox Code Playgroud)

android gradle dart build.gradle flutter

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

如何在角度javascript中打印列表?

请查看我的代码:

const DISH = {
  name: 'Uthappizza',
  image: '/assets/images/uthappizza.png',
  category: 'mains',
  label: 'Hot',
  price: '4.99',
  description: 'A unique combination of Indian Uthappam (pancake) and Italian pizza, topped with Cerignola olives, ripe vine cherry tomatoes, Vidalia onion, Guntur chillies and Buffalo Paneer.',
  comments: [
    {
      rating: 5,
      comment: "Imagine all the eatables, living in conFusion!",
      author: "John Lemon",
      date: "2012-10-16T17:57:28.556094Z"
    },
    {
      rating: 4,
      comment: "Sends anyone to heaven, I wish I could get my mother-in-law to eat it!",
      author: "Paul …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs

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

谷歌地图首次加载失败,有时刷新时加载失败

所以我将谷歌地图添加到我的网站。在第一页加载时 - 它不会加载。刷新时 - 有时它也不会加载。

代码:

html:

    <div id="map">
    </div>   
    
    <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script> 
    <script async defer src="https://maps.googleapis.com/maps/api/js?key=AIzaSyDKxMTYIeZepn8E6EULm9eFZCixv960J2s&callback=initMap">
    </script>
    <script src="script.js"></script>
Run Code Online (Sandbox Code Playgroud)

jQuery:

function initMap() {};
$(document).ready(function () {
  initMap = function() {
    var myLatLng = {
      lat: 40.1511,
      lng: -2.150609
    };
    var map = new google.maps.Map(document.getElementById('map'), {
      zoom: 16,
      center: myLatLng,
      disableDefaultUI: true,
      styles: [
          ....    
      ]
    });
    var marker = new google.maps.Marker({
      position: myLatLng,
      map: map,
      title: '........',
    });
  }
});
Run Code Online (Sandbox Code Playgroud)

PS google 功能位于单独的“script.js”文件中。

jquery google-maps-api-3

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