小编Ner*_*ros的帖子

没有来自glDrawElements的显示

当我使用glDrawArrays时,我在屏幕中间得到一个三角形,正如预期的那样.但是当我尝试使用glDrawElements时,根本没有任何问题.

我已经尝试了各种各样的事情,比如重新排序gl调用,移动属性指针,甚至硬编码顶点和索引似乎什么都不做,如我的代码所示.

此代码运行一次:

// Initialise GLFW
if( !glfwInit() )
{
        fprintf( stderr, "Failed to initialize GLFW\n" );
        //return -1;
}

glfwOpenWindowHint(GLFW_FSAA_SAMPLES, 4); // 4x antialiasing
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MAJOR, 3); // We want OpenGL 3.3
glfwOpenWindowHint(GLFW_OPENGL_VERSION_MINOR, 3);
glfwOpenWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_COMPAT_PROFILE); //We don't want the old OpenGL

// Open a window and create its OpenGL context
if( !glfwOpenWindow( mApplication->getWindowWidth(), mApplication->getWindowHeight(), 0,0,0,0, 32,0, GLFW_WINDOW ) )
{
        fprintf( stderr, "Failed to open GLFW window\n" );
        glfwTerminate();
        //return -1;
}

// Initialize GLEW
glewExperimental=true; // Needed in …
Run Code Online (Sandbox Code Playgroud)

c++ opengl

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

wordpress由id摘录

我正在使用选项框架

我无法弄清楚为什么这不起作用

$x = of_get_option('post_number');
$content_post = get_post($x);
echo $content_post->post_excerpt;
Run Code Online (Sandbox Code Playgroud)

它很奇怪,因为

echo of_get_option('post_number');
Run Code Online (Sandbox Code Playgroud)

完美运作并输出一个数字

并根据get_post我的代码应该工作但回声不产生任何东西,甚至没有错误信息

所以我必须以某种方式错误地解决get_post(),任何线索?


编辑

var dump http://pastebin.com/ZEgQ5WPn 显示post_content已满,但post_excerpt为空

我如何重新制作摘录?


编辑[已解决]

我决定手写覆盖摘录,但我的选项丢失,然后我发现了这一点

和使用

add_post_type_support( 'page', 'excerpt' );
Run Code Online (Sandbox Code Playgroud)

马尼亚写出摘录

wordpress

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

c ++ python 3绑定

我试图在C++中绑定python3.

使用时:

Py_SetProgramName(argv[0]);
Run Code Online (Sandbox Code Playgroud)

它给出了这个错误:

error C2664: 'Py_SetProgramName' : cannot convert parameter 1 from 'char *' to 'wchar_t *'
Run Code Online (Sandbox Code Playgroud)

即使这是文档示例显示的方式.

我也试过这个:

Py_SetProgramName((wchar_t*)argv[0]);
Run Code Online (Sandbox Code Playgroud)

但显然这是错误的做法.

那么我该如何解决这个问题呢,在C++中绑定Python 3还有其他好的资源吗?

c++ python

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

SQL最受欢迎

我有一个mysql表,其中包含与其订单相关的项目.


CREATE DATABASE IF NOT EXISTS `sqltest`;
USE `sqltest`;

DROP TABLE IF EXISTS `testdata`;
CREATE TABLE `testdata` (
  `orderID` varchar(10) DEFAULT NULL,
  `itemID` varchar(10) DEFAULT NULL,
  `qtyOrdered` int(10) DEFAULT NULL,
  `sellingPrice` decimal(10,2) DEFAULT NULL
)

INSERT INTO `testdata`(`orderID`,`itemID`,`qtyOrdered`,`sellingPrice`) 
values ('1','a',1,'7.00'),('1','b',2,'8.00'),('1','c',3,'3.00'),('2','a',1,'7.00'),('2','c',4,'3.00');
Run Code Online (Sandbox Code Playgroud)

预期结果:

A =(1 + 1)2

B = 2

C =(2 + 4)6 < - 最受欢迎


如何为每个项目添加所有数量并得出最高的数量?

它应该是相当紧张的前进,但我是SQL的新手,我无法解决这个问题:S

解决方案需要是mysql和/或php.

我想每个商品ID都需要某种临时的tally变量,但是看起来它可能会因太多商品而变得混乱.


回答:

(感谢nuqqsa)

SELECT itemID, SUM(qtyOrdered) AS total FROM testdata GROUP BY itemID ORDER BY total DESC LIMIT 1;
Run Code Online (Sandbox Code Playgroud)

php mysql

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

htaccess htpasswd 无提示

我正在尝试使用“.htaccess”和“.htpasswd”保护文件夹。

我使用http://www.tools.dynamicdrive.com/password/来生成文件。

将它们复制到相应的文件夹中。

当我尝试访问受保护的文件夹时,收到登录提示。

输入错误的登录详细信息,将被发送到错误页面。

都好。

现在,在没有任何更改的情况下,我重新访问该页面并尝试再次登录以访问受保护的文件夹,它只是抛出一个错误,没有登录框。

如果我删除 .htaccess,我可以再次进入该文件夹而不会出现错误。

替换 .htacces 后,我再次收到错误,仍然没有登录框。

我尝试重新生成一组新的文件、用户/通行证组合,并对 .htaccess 进行轻微修改,只是为了尝试获取某种形式的响应。

我检查了任何字节标记,两个文件都是干净的 UTF-8。

这是怎么回事?为什么我不再收到提示?

顺便说一句,日志应该在哪里?我找到的只是一些访问日志,其中没有任何有用的内容。


服务器上的站点位置

/home/labvccom/
Run Code Online (Sandbox Code Playgroud)

/home/labvccom/public_html/admin/.htaccess

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /htpasswords/.htpasswd
AuthGroupFile /dev/null
require valid-user
Run Code Online (Sandbox Code Playgroud)

/home/labvccom/htpasswords/.htpasswd [用户:admin | 通行证:密码]

admin:02yd6IWnPes66
Run Code Online (Sandbox Code Playgroud)

这是我在没有登录提示的情况下抛出错误时得到的页面

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@labvc.com.au and inform them of the time the error occurred, and anything you …
Run Code Online (Sandbox Code Playgroud)

authentication .htaccess prompt .htpasswd

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

幻影php回声?

我得到这个错误:

Parse error: syntax error, unexpected T_ECHO in /home/labvc/public_html/AT/site/getimages.php on line 26
Run Code Online (Sandbox Code Playgroud)

从这段代码:

<?php

echo '<br />';
echo '<div id=gallery>';

function getDirTree($dir,$p=true) {
    $d = dir($dir);$x=array();
    while (false !== ($r = $d->read())) {
        if($r!="."&&$r!=".."&&(($p==false&&is_dir($dir.$r))||$p==true)) {
                $x[$r] = (is_dir($dir.$r)?array():(is_file($dir.$r)?true:false));
        }
    }

    foreach ($x as $key => $value) {
        if (is_dir($dir.$key."/")) {
                $x[$key] = getDirTree($dir.$key."/",$p);
        }
    }

    ksort($x);
    return $x;
}

$tree = getDirTree("./res/gallery/painting/");

foreach($tree as $element => $eval) {
    if (is_array($eval)) {
        foreach($eval as $file => $value) {
                if (strstr($file, "png")||strstr($file, …
Run Code Online (Sandbox Code Playgroud)

php

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

jQuery text() 和 val() 返回 null

编辑:似乎我没有在我的文本区域上使用“id”,所以这个问题已经解决,但我仍然遇到一些有关 text() 的问题

var e = $('textarea#cost-'+i).val(); // e = 1 (for first iteration)
alert($('p#subtotal-'+i).text()); // alert 'subtotal' which is the text in my p#subtotal-1
$('p#subtotal-'+i).text().replaceWith(e); // <- this is the problem, i think
alert($('p#subtotal-'+i).text()); // no alert box at all
Run Code Online (Sandbox Code Playgroud)

这次我确保他们都有身份证。


以下代码生成一个警报框,其中没有任何内容。如果我将其更改为 val() 它会显示“未定义”


$('textarea.costbox').live('blur',function() {
for(var i in items) {
alert('iteration '+i);
alert('textarea#cost-'+i);
var e = $('textarea#cost-'+i).text();
alert('cost '+e);
}
});
Run Code Online (Sandbox Code Playgroud)
<textarea name="cost-1" class="costbox"></textarea>
Run Code Online (Sandbox Code Playgroud)

此代码的想法是在值更改时更新小计。这是拼图的最后一块。

当我在 Chrome 中检查时,所有 HTML 看起来都很正常。我的其余所有代码都工作正常。

这应该与 Modernizer1.7 和 jQuery1.5.1 一起运行,基于最近的 HTML5Boilerplate。

这是相同基本事物的另一个示例 - …

null jquery text

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

标签 统计

c++ ×2

php ×2

.htaccess ×1

.htpasswd ×1

authentication ×1

jquery ×1

mysql ×1

null ×1

opengl ×1

prompt ×1

python ×1

text ×1

wordpress ×1