小编Ven*_*raj的帖子

昨天在postrgesql中的记录

我有一个应用程序,我使用MySQL.我的报告延长了过去24小时的记录.我使用了查询:

WHERE (DATE_SUB(CURDATE(), INTERVAL 1 DAY) <= FROM_UNIXTIME(`workorder`.`CREATEDTIME` / 1000))
Run Code Online (Sandbox Code Playgroud)

现在我必须使用PostgreSQL并且不知道如何报告过去24小时.你们有人可以帮忙吗?

postgresql

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

推送拒绝,未检测到Cedar支持的应用

我知道这个问题已被问过好几次了.但我无法阻止自己在这里发布.我很性感.我正在尝试使用以下命令将应用程序从git推送到heroku

ubuntu@ip-1x2-xx-xx-xxx:~/vexxx$ git push heroku master
Run Code Online (Sandbox Code Playgroud)

我收到以下错误.

Counting objects: 8, done.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (8/8), 1015 bytes, done.
Total 8 (delta 0), reused 0 (delta 0)


 !     Push rejected, no Cedar-supported app detected

To git@heroku.com:fast-fortress-3889.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:fast-fortress-3889.git'
Run Code Online (Sandbox Code Playgroud)

我正在尝试使用node.js框架

UPDATE

我的app文件夹名称中有两个文件名vxxxx /

1.README.md

2.venkat1.js

在venkat1.js里面

    #!/usr/bin/env node
var fs = require('fs');
var outfile = "hello.txt";
var out = "A startup is …
Run Code Online (Sandbox Code Playgroud)

git heroku

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

OpenCL - 为什么使用READ_ONLY或WRITE_ONLY缓冲区

OpenCL,在那里标记缓冲区任何性能优势READ_ONLY还是WRITE_ONLY

kernel是我经常看到的(a READ_ONLY和b是WRITE_ONLY):

__kernel void two_buffer_double(__global float* a, __global float* b)
{
    int i = get_global_id(0);
    b[i] = a[i] * 2;
}
Run Code Online (Sandbox Code Playgroud)

kernel似乎更好,因为它使用较少的全局内存(a是READ_WRITE):

__kernel void one_buffer_double(__global float* a)
{
    int i = get_global_id(0);
    a[i] = a[i] * 2;
}
Run Code Online (Sandbox Code Playgroud)

不要READ_ONLYWRITE_ONLY标志就是为了要帮助调试和捕获错误?

flags buffer kernel opencl pyopencl

5
推荐指数
3
解决办法
4213
查看次数

在linux或windows中更改目录中的所有文件名和扩展名

我有成千上万的文件扩展名,像这样

3_bedroom_villas_in_chennai.html__201308050010_
3_bedroom_villas_in_chennai.html__201308080012_
3_bedroom_villas_in_chennai.html__201308100012_
3_bedroom_villas_in_chennai.html__201308110034_ and so on.....
Run Code Online (Sandbox Code Playgroud)

在目录中.我想将所有这些改为以下内容

3_bedroom_villas_in_chennai__201308050010_.html
3_bedroom_villas_in_chennai__201308080012_.html
3_bedroom_villas_in_chennai__201308100012_.html
3_bedroom_villas_in_chennai__201308110034_.html
Run Code Online (Sandbox Code Playgroud)

当我尝试使用以下命令在Windows中执行此操作时

ren *.* *.html
Run Code Online (Sandbox Code Playgroud)

我得到了以下内容

A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found.
A duplicate file name exists, or the file
cannot be found. and so on...
Run Code Online (Sandbox Code Playgroud)

因为我知道它会尝试将所有内容更改为单个文件名

3_bedroom_villas_in_chennai.html and so on... 
Run Code Online (Sandbox Code Playgroud)

在Windows或Linux上做任何方法?

linux windows file-management file-rename

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

在向数据库插入值时删除记录

我的数据库具有车辆的位置日志,这意味着每个坐标都将存储在数据库中.现在对于车辆1,假设表中有30个条目,意味着30个位置.现在当第31个条目到来时,我想要删除FIRST条目,这意味着每辆车的最大位置日志数应为30.

现在插入查询是

mysqli_query($con,
    "INSERT INTO $location_history
    VALUES('$id','$lat','$lng','$pwd','$v1','$v2','$v3','$v4','$status' )")
or die("Count not insert to location history!");
Run Code Online (Sandbox Code Playgroud)

php mysql

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

未捕获的TypeError:undefined不是函数

我收到了Uncaught TypeError: undefined is not a function 错误,它的数量甚至超过了3000倍.如下图所示.

Jquery错误

jquery错误未定义

我还列出了我在网站上使用的其他js文件,其顺序与我在下面提到的顺序相同.

1.3.2/jquery.min.js
1.7.2/jquery-ui.min.js
ui.stars.min.js
jquery.qtip-1.0.0-rc3.min.js
jquery.fancybox-1.2.6.pack.js
Run Code Online (Sandbox Code Playgroud)

我尝试将版本更改 jquery.min.js为1.9.1.但我仍然得到错误.我也在用

<script src="cufon/cufon-yui.js" type="text/javascript"></script>
<script type="text/javascript">
    //statement
</script>
Run Code Online (Sandbox Code Playgroud)

这是我的自定义JavaScript,也包含在网站上

$(document).ready(function () {
  /* Executed on DOM load */
  $("#slogan-addbutton").fancybox({
    'zoomSpeedIn': 600,
    'zoomSpeedOut': 500,
    'easingIn': 'easeOutBack',
    'easingOut': 'easeInBack',
    'hideOnContentClick': false,
    'padding': 15
  });
/* Listening for keyup events on fields of the "Add a note" form: */
    $('.pr-body,.pr-author').live('keyup',function(e){
        if(!this.preview)
            this.preview=$('#fancy_ajax .note');

        /* Setting the text of the preview to the contents of the …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

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

如何使用selenium python点击google上的第一个结果

我试图点击谷歌搜索结果的第一个结果.这是我的代码,我进入chennai craiglist,从csv文件中读取.所以我相信有机结果中的第一个链接将是chennai.craiglist.org.但我很安静,不知道如何做到这一点.

from selenium import webdriver
    from selenium.webdriver.common.by import By
    from selenium.webdriver.support.ui import Select
    from selenium.common.exceptions import NoSuchElementException
    import unittest, time, re

    class Browse(unittest.TestCase):
    def setUp(self):
    self.driver = webdriver.Firefox()
    self.driver.implicitly_wait(30)
    self.base_url = "http://google.com/"

    filename = 'test.csv'
    line_number = 1
    with open(filename, 'rb') as f:
        mycsv = csv.reader(f)
        mycsv = list(mycsv)
        self.cityname=mycsv[line_number][0]
        self.username=mycsv[line_number][1]
        self.password=mycsv[line_number][2]
        self.verificationErrors = []

def test_browse(self):
    driver = self.driver
    driver.get(self.base_url + "/")
    driver.find_element_by_id("gbqfq").send_keys(self.cityname)
Run Code Online (Sandbox Code Playgroud)

我想知道这条线后会发生什么?

UPDATE

现在我给的是

driver.find_elements_by_xpath(".//*[@id='rso']//div//h3/a")[:1].click()
Run Code Online (Sandbox Code Playgroud)

我不确定它是否会起作用.

python selenium selenium-webdriver

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

致命错误:调用未定义的函数tally()

我有一个PHP测验的以下代码.

if(isset($_POST['submit'])) {

    //Check to make sure that the name field is not empty
        if(($_POST['q_1'] == '') ||  ($_POST['q_2'] == '') || ($_POST['q_3'] == '') || ($_POST['q_4'] == '') || ($_POST['q_5'] == '')) {
            $nameError = 'Please choose an option';
            $hasError = true;
        }
        else {
                for ($i=1; $i<=$types; $i+=1)
                    {
                        $nowval[$i] = 0;
                    }
                for ($i=1; $i<=$questions; $i+=1)
                    {
                        $qvar = "q_$i";
                        //echo $qvar;
                        tally($_POST[$qvar]);// LINE THAT CAUSES ERROR
                    }
                $dominant = 1;
                $domval = $nowval[1];
                for ($i=2; $i<=$types; …
Run Code Online (Sandbox Code Playgroud)

php fatal-error

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

无法将输出写入csv bs4 python

我正在尝试将以下代码的输出写入csv文件.数据被覆盖.所以最后我只能看到输出文件中从网站上删除的最后数据.

from bs4 import BeautifulSoup
import urllib2
import csv
import re
import requests
for i in xrange(3179,7000):
    try:
        page = urllib2.urlopen("http://bvet.bytix.com/plus/trainer/default.aspx?id={}".format(i))
    except:
        continue
    else:
        soup = BeautifulSoup(page.read())
        for eachuniversity in soup.findAll('fieldset',{'id':'ctl00_step2'}):
            data = i, re.sub(r'\s+',' ',''.join(eachuniversity.findAll(text=True)).encode('utf-8')),'\n'
    print data  
    myfile = open("ttt.csv", 'wb')
    wr = csv.writer(myfile, quoting=csv.QUOTE_ALL)
    wr.writerow(data)
Run Code Online (Sandbox Code Playgroud)

我是新来的.我不知道我哪里错了.

UPDATE

from bs4 import BeautifulSoup
import urllib2
import csv
import re
import requests
with open("BBB.csv", 'wb') as myfile:
    writer = csv.writer(myfile, quoting=csv.QUOTE_ALL)
    for i in xrange(3179,7000):
        try:
            page = urllib2.urlopen("http://bvet.bytix.com/plus/trainer/default.aspx?id={}".format(i))
        except Exception: …
Run Code Online (Sandbox Code Playgroud)

python csv beautifulsoup

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

没有类BS4 python的刮擦表

我有以下代码试图从一个表中抓取数据,该表没有来自具有许多其他不必要表的网页的类。

from bs4 import BeautifulSoup
import urllib2
import re
wiki = "http://www.maditssia.com/members/list.php?p=1&id=Engineering%20Industries"
header = {'User-Agent': 'Mozilla/5.0'}
req = urllib2.Request(wiki,headers=header)
page = urllib2.urlopen(req)
soup = BeautifulSoup(page)
title = ""
address = ""
contact = ""
phone = ""
description=""
email=""
table = soup.find("table")
#print table.text
#print re.sub(r'\s+',' ',''.join(table.text).encode('utf-8'))
for row in table.findAll("tr"):
   cells = row.findAll("td")
   if len(cells) >= 7:
    title = cells[0].find(text=True)
    address = cells[1].find(text=True)
    contact = cells[2].find(text=True)
    phone = cells[3].find(text=True)
    email= cells[4].find(text=True)
    description= cells[5].find(text=True)
    data = title + "," + …
Run Code Online (Sandbox Code Playgroud)

python beautifulsoup web-scraping python-2.7

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

未捕获的TypeError:无法读取未定义的属性"position"

我正在研究可拖动的物品.我试图存储可拖动div的最终位置,一旦停止被拖动.当我有以下javascript代码时工作正常.

function make_draggable(elements)
 {
  /* Elements is a jquery object: */
  elements.draggable({
    containment: 'parent',
    start: function (e, ui) {
      ui.helper.css('z-index', ++zIndex);
    },
    stop: function (e, ui) {
      /* Sending the z-index and positon of the note to update_position.php via AJAX GET: */
      $.get('ajax/update_position.php', {
        x: ui.position.left,
        y: ui.position.top,
        z: zIndex,
        id: parseInt(ui.helper.find('span.data').html())
      });
    }
  });
}
Run Code Online (Sandbox Code Playgroud)

每次用户停止拖动div时,我都不希望更新数据库.所以我想添加一个确认按钮(当用户停止拖动时出现)以进行AJAX调用.所以我尝试了以下代码

var $button = $("#button");

function make_draggable(elements) {
    /* Elements is a jquery object: */
    elements.draggable({
        containment: 'parent',
        start: function (e, ui) {
            ui.helper.css('z-index', …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery jquery-ui

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

CSS3动画不适用于Mozilla Firefox

我试图使用CSS3使鸟的拍打效果keyframes.它在谷歌浏览器上工作正常.它似乎不适用于Mozilla Firefox.

这是我的小提琴

css html5 mozilla css3 css-animations

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

抓住ajax得到错误

我有以下javascript函数ajax $.get.

function make_draggable(elements)
{
    /* Elements is a jquery object: */

    elements.draggable({
        containment:'parent',
        start:function(e,ui){ ui.helper.css('z-index',++zIndex); },
        stop:function(e,ui){

            /* Sending the z-index and positon of the note to update_position.php via AJAX GET: */


            $.get('ajax/update_position.php',{
                  x     : ui.position.left,
                  y     : ui.position.top,
                  z     : zIndex,
                  id    : parseInt(ui.helper.find('span.data').html())
            });

        }
    });
}
Run Code Online (Sandbox Code Playgroud)

但遗憾的是我的申请无效.我想抓住ajax错误.任何帮助都会非常有帮助.

javascript ajax jquery get

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