小编Kam*_*ami的帖子

强制HTML5 YouTube视频

关于Youtube API博客,他们正在尝试新的HTML5视频播放器.

显然,要在html5中播放视频,您必须使用iframe嵌入代码:

<iframe class="youtube-player" type="text/html" width="640" height="385"
  src="http://www.youtube.com/embed/VIDEO_ID" frameborder="0">
</iframe>
Run Code Online (Sandbox Code Playgroud)

但如果客户端未加入HTML5试用版,即使客户端的浏览器支持HTML5视频,播放器也会自动退回到Flash播放器中.

如果浏览器支持HTML5视频播放,如何强制HTML5视频播放,即使用户尚未参与HTML5试用?

否则如何禁用闪回后退?

编辑:

可以强制HTML播放器通过Youtube视频链接,但我需要这种功能用于嵌入式视频.

youtube video html5

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

PHP提取GPS EXIF数据

我想用php从图片中提取GPS EXIF标签.我正在使用exif_read_data()返回所有标签+数据的数组:

GPS.GPSLatitudeRef: N
GPS.GPSLatitude:Array ( [0] => 46/1 [1] => 5403/100 [2] => 0/1 ) 
GPS.GPSLongitudeRef: E
GPS.GPSLongitude:Array ( [0] => 7/1 [1] => 880/100 [2] => 0/1 ) 
GPS.GPSAltitudeRef: 
GPS.GPSAltitude: 634/1
Run Code Online (Sandbox Code Playgroud)

我不知道如何解释46/1 5403/100和0/1?46可能是46°,但其余的尤其是0/1呢?

angle/1 5403/100 0/1
Run Code Online (Sandbox Code Playgroud)

这个结构是关于什么的?

如何将它们转换为"标准"的(如维基百科的46°56'48"N 7°26'39"E)?我想将坐标传递到谷歌地图api,以在地图上显示图片位置!

php gps exif metadata

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

BigInteger到byte []

我需要将Java BigInteger实例转换为以字节为单位的值.从API中,我得到了这个方法toByteArray(),它返回一个包含这个BigInteger的二进制补码表示的byte [].

因为我的所有数字都是正128位(16字节)整数,所以我不需要2位补码形式给我128位+符号位(129位)......

有没有办法直接从BigInteger获得标准(没有2的补码形式)表示?

如果没有,我怎么能正确移位整个byte [17]数组以丢失符号位以获得一个byte [16]数组?

java byte biginteger

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

霓虹灯相当于SSE内在函数

我正在尝试使用neon intrinsics将ac代码转换为优化代码.

以下是操作超过2个操作符而不是操作符向量的c代码.

uint16_t mult_z216(uint16_t a,uint16_t b){
unsigned int c1 = a*b;
    if(c1)
    {
        int c1h = c1 >> 16;
        int c1l = c1 & 0xffff;
        return (c1l - c1h + ((c1l<c1h)?1:0)) & 0xffff;
    }
    return (1-a-b) & 0xffff;
}
Run Code Online (Sandbox Code Playgroud)

此操作的SEE优化版本已通过以下方式实现:

#define MULT_Z216_SSE(a, b, c) \
    t0  = _mm_or_si128 ((a), (b)); \ //Computes the bitwise OR of the 128-bit value in a and the 128-bit value in b.
    (c) = _mm_mullo_epi16 ((a), (b)); \ //low 16-bits of the product of …
Run Code Online (Sandbox Code Playgroud)

c arm sse multiplication neon

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

PHP - 大整数mod计算

我需要计算大数模数,如:

<?php

    $largenum = 95635000009453274121700;

    echo $largenum % 97;

?>
Run Code Online (Sandbox Code Playgroud)

它不起作用...因为$ largenum对于PHP中的int来说太大了.

知道怎么做吗?

php math integer modulo

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

使用ARM Neon内在函数进行128位旋转

我正在尝试使用Neon内在函数优化我的代码.我在128位阵列上进行了24位旋转(每个8位uint16_t).

这是我的c代码:

uint16_t rotated[8];
uint16_t temp[8];
uint16_t j;
for(j = 0; j < 8; j++)
{
     //Rotation <<< 24  over 128 bits (x << shift) | (x >> (16 - shift)
     rotated[j] = ((temp[(j+1) % 8] << 8) & 0xffff) | ((temp[(j+2) % 8] >> 8) & 0x00ff);
}
Run Code Online (Sandbox Code Playgroud)

我已经检查了关于Neon Intrinsics的gcc文档,它没有关于向量旋转的指令.此外,我试图使用这个,vshlq_n_u16(temp, 8)但所有在一个uint16_t字外移位的位都丢失了.

如何使用霓虹内在函数实现这一目标?顺便问一下,有关GCC Neon Intrinsics的更好的文档吗?

c rotation intrinsics neon

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

PHP strtotime(YYYY-mm最后一天)错误一个月

我在PHP 5.2.12中尝试以下命令:

print (date('Y-m-d', strtotime('2009-12 last day')));
Run Code Online (Sandbox Code Playgroud)

关于php.net手册:

date('m/d/y', strtotime('2009-03 last day')); # 03/31/09
Run Code Online (Sandbox Code Playgroud)

它应该显示2009年3月的最后一天(2009-03-31)!

我的回报是上个月的最后一天?为什么?:

2009-11-30
Run Code Online (Sandbox Code Playgroud)

php datetime strtotime

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

UISwitch未返回其当前状态(开/关)

以下是使用valueChanged事件链接到UISwitch的IBAction方法:

- (IBAction) sanitySwitch {
if (checkoption.on == YES) {
    NSLog(@"SanityCheck ENABLED");
    sanityCheck = YES;
} else {
    NSLog(@"SanityCheck DISABLED");
    sanityCheck = NO;
}
}
Run Code Online (Sandbox Code Playgroud)

它总是返回"SanityCheck DISABLED".UISwitch checkoption正确地链接到XIB文件中的对象,并且已经放置了正确的@propery和@syntetize设置.

iphone uiswitch

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

将BigInteger存储到Mysql中

由于mathematica约束,我将使用BigInteger类来表示值.

经过一些计算后,我想将结果(由2x BigInteger实例给出)存储到Mysql中...

存储此类对象的最佳数据类型是什么?

我在考虑使用Blob存储这些结果的二进制格式(128位)?但我想避免不必要的类型转换.

java mysql database biginteger

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

SDL_image/C++ OpenGL程序:IMG_Load()生成模糊图像

我正在尝试加载图像文件并将其用作多维数据集的纹理.我正在使用SDL_image来做到这一点.

原始图片http://i33.tinypic.com/2i1f3bp.jpg

我用这个图像是因为我发现它有各种文件格式(tga,tif,jpg,png,bmp)

代码 :

SDL_Surface * texture;

//load an image to an SDL surface (i.e. a buffer)

texture = IMG_Load("/Users/Foo/Code/xcode/test/lena.bmp");

if(texture == NULL){
    printf("bad image\n");
    exit(1);
}

//create an OpenGL texture object 
glGenTextures(1, &textureObjOpenGLlogo);

//select the texture object you need
glBindTexture(GL_TEXTURE_2D, textureObjOpenGLlogo);

//define the parameters of that texture object
//how the texture should wrap in s direction
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
//how the texture should wrap in t direction
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
//how the texture lookup should be interpolated when …
Run Code Online (Sandbox Code Playgroud)

c++ opengl sdl sdl-image

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

Objective-C调用私有方法

以下是Objective-C中私有方法的示例:

MyClass.m

#import "MyClass.h"


@interface MyClass (Private)
   -(void) privateMethod:(NSString *)arg1 and: (NSString*)arg2;
@end

@implementation MyClass

   -(void) publicMethod {
       NSLog(@"public method\n");
      /*call privateMethod with arg1, and arg2 ??? */
   }

   -(void) privateMethod:(NSString *)arg1 and: (NSString*)arg2{
       NSLog(@"Arg1 %@ and Arg2 %@", arg1, arg2);
   }

@end
Run Code Online (Sandbox Code Playgroud)

我读过有关私有接口/方法声明的内容.但是如何从其他公共方法调用它们?我试过了,[self privateMethod:@"Foo" and: @"Bar"]但看起来不对.

class-design objective-c private-methods

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

运行时的流错误

嗨,我正在尝试使用:ofstream将文本写入文件

#include <iostream>
#include <fstream>
#include <sstream>
#include <string>
#include <cstring>
#include <stdlib.h>

using namespace std;    


void init_log(ofstream* data_file, ofstream* incl_file, string algo){
    stringstream datafilename;
    datafilename << "report/data/" << algo << ".txt";
    stringstream includefilename;
    includefilename << "report/include/" << algo << ".tex";

    data_file->open(datafilename.str().c_str(), ios::app);
    incl_file->open(includefilename.str().c_str(), ios::app);
}

void write_log(ofstream* data_file, ofstream* incl_file, int size, double timesec){
    stringstream tow_data;
    tow_data << size << " " << timesec <<  endl;
    stringstream tow_incl;
    tow_incl << size << " & " << timesec << " …
Run Code Online (Sandbox Code Playgroud)

c++ fstream ofstream

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