我想将数据从服务器推送到浏览器.我已经知道ob_flush()发送输出缓冲区的php函数了.我需要一些逻辑方面的帮助.我正在使用Facebook实时API,所以我想每次Facebook访问我的网站时将数据推送给用户.
这是我的代码,我试图将数据推送到浏览器,但它无法正常工作.
<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: text/event-stream');
ini_set("log_errors", 1);
ini_set("error_log", "php-error.log");
error_log( "LOGS STARTS FROM HERE" );
if(isset($_GET['hub_challenge'])){
echo $_GET['hub_challenge'];
}
if($_SERVER['REQUEST_METHOD'] == "POST"){
$updates = json_decode(file_get_contents("php://input"), true);
// Replace with your own code here to handle the update
// Note the request must complete within 15 seconds.
// Otherwise Facebook server will consider it a timeout and
// resend the push notification again.
print_r($updates);
ob_flush();
flush();
//file_put_contents('fb.log', print_r($updates,true), FILE_APPEND);
//error_log('updates = ' . print_r($updates, true));
}
?>
Run Code Online (Sandbox Code Playgroud) 这是两个不同的datalist与patient filenumber其他国家
<input type="list" class="form-control" name="patient" list="patient-list" placeholder="Enter Patient file number">
<datalist id="patient-list">
<option value='49'>pc123</option>
<option value='48'>pc162</option>
<option value='47'>pc183</option>
<option value='45'>pc193</option>
</datalist>
<input type="list" class="form-control" name="state" list="state-list" placeholder="Enter state">
<datalist id="state-list">
<option value='delhi'>delhi</option>
<option value='mumbai'>mumbai</option>
<option value='Haryana'>Haryana</option>
<option value='Gurgaon'>Gurgaon</option>
</datalist>Run Code Online (Sandbox Code Playgroud)
当您打开两个下拉菜单时,您会注意到input患者显示value & innerHTML两者并反转(点击它时输入输入字段内的值).在国家,input它只是简单地显示状态
这些不同行为的原因是什么?我想输入只显示innerHTML的option样态input,并在不同的数据value:innerHTML
我有两个片段类命名SessionTab和BillingTab我试图创建使用这些类的实例
SessionTab sessionTab = (SessionTab) getSupportFragmentManager().getFragments().get(1);
Run Code Online (Sandbox Code Playgroud)
但有时这些类的索引会被反转,然后它会导致 ClassCastException
如何通过传递类名而不是索引或任何方式来获取这些片段类的实例,以确保这些类的索引每次都保持不变,因此它不会导致 ClassCastException
我只是按照这里的指示而没有任何帮助?
<script type="text/javascript" src="sh/src/shCore.js"></script>
<script type="text/javascript" src="sh/scripts/shBrushJScript.js"></script>
<link href="sh/styles/shCore.css" rel="stylesheet" type="text/css" />
<!--<link href="sh/styles/shCoreDefault.css" rel="stylesheet" type="text/css" />-->
<link href="sh/styles/shThemeDefault.css" rel="stylesheet" type="text/css" />
<pre class="brush: js">
/**
* SyntaxHighlighter
*/
function foo()
{
if (counter <= 10)
return;
// it works!
}
</pre>
<script type="text/javascript">
SyntaxHighlighter.all()
</script>
Run Code Online (Sandbox Code Playgroud)
在控制台中发现一些错误,不知道用它做wt.
未捕获的ReferenceError:未定义XRegExp shCore.js:123未捕获的TypeError:无法读取未定义的shBrushJScript.js属性'Highlighter':45未捕获的TypeError:无法读取未定义的test.php属性'all':21不推荐使用Attr.specified.它的价值永远是真实的.
我刚刚阅读了本教程并尝试了这个例子.所以我从网上下载了一个视频供我自己测试.我所要做的就是调整条件下的rgb值
这里是示例中的示例代码
computeFrame: function() {
this.ctx1.drawImage(this.video, 0, 0, this.width, this.height);
let frame = this.ctx1.getImageData(0, 0, this.width, this.height);
let l = frame.data.length / 4;
for (let i = 0; i < l; i++) {
let r = frame.data[i * 4 + 0];
let g = frame.data[i * 4 + 1];
let b = frame.data[i * 4 + 2];
if (g > 100 && r > 100 && b < 43)
frame.data[i * 4 + 3] = 0;
}
this.ctx2.putImageData(frame, …Run Code Online (Sandbox Code Playgroud) 我正在努力创造一个人脸的文字云.与此类似
为了达到这个目的,我得到了一个人的黑白图像,并将最暗的像素变为黑色,最亮的像素变为白色.这是我的结果
现在我有了一个我想放置文字云的区域.现在我无法弄清楚如何在面部内放置单词以保持单词之间的边距/角度.
这是我到目前为止所做的代码
<?php
set_time_limit(0);
$src = 'person.jpeg';
$im = imagecreatefromjpeg($src);
$size = getimagesize($src);
$width = $size[0];
$height = $size[1];
$image_p = imagecreatetruecolor($width, $height);
imagecopyresampled($image_p, $im, 0, 0, 0, 0, $width, $height, $width, $height);
$white_color = imagecolorallocate($im, 255, 255, 255);
$black_color = imagecolorallocate($im, 0, 0, 0);
$font = __DIR__ . "/testfont.ttf";
$font_size = 16;
$text = "Test text";
$skip = true;
for ($x = 0; $x < $width; $x++) {
for ($y = 0; $y < $height; …Run Code Online (Sandbox Code Playgroud) 我使用twitter streaming api及johnny-five与其他一些模块http,express及socket.io用arduino uno
我的脚本在笔记本电脑上运行良好.但我的制作将在平板电脑上.我有两个平板电脑,两者都有不同的反应.在hp omni平板电脑上我收到以下错误
此外,我已arduino-uno连接端口,COM3但其显示设备已连接COM1
据我所知,这个错误是standard firmata在arduino没有上传的时候引起的.我上传了这个程序,它在笔记本电脑上运行良好
在Acer平板电脑上我没有收到任何错误程序启动完全没有任何问题,但我没有收到推文twitter streaming api
我已多次交叉检查它在笔记本电脑上运行完全正常,每次我运行它,但给出了两个不同的问题 tablets
这是我正在使用的代码
var Twitter = require('twitter');
var five = require("johnny-five");
var express = require('express')
, app = express()
, http = require('http')
, server = http.createServer(app)
, io = require('socket.io').listen(server);
server.listen(8080);
// routing
app.use(express.static(__dirname + '/http'));
app.use(function (req, res, next) {
res.setHeader('Access-Control-Allow-Origin', "http://"+req.headers.host+':80');
res.setHeader('Access-Control-Allow-Methods', …Run Code Online (Sandbox Code Playgroud) javascript node.js twitter-streaming-api arduino-uno johnny-five
在Android Q / Android 10使用USES_POLICY_DISABLE_KEYGUARD_FEATURES中keyguard_features导致安全异常。
devicePolicyManager.setKeyguardDisabledFeatures(componentName, DevicePolicyManager.KEYGUARD_DISABLE_FEATURES_NONE);
Run Code Online (Sandbox Code Playgroud)
java.lang.SecurityException: Admin ComponentInfo{ ... } 不是设备所有者或配置文件所有者,因此可能不使用策略:disable-keyguard-features
经过进一步检查,我发现 android pie 已标记为KEYGUARD_FEATURESdeprecated 并在android-q / Android 10. 有没有其他替代方法可以禁用keyguard_features
我在子域上有一个CodeIgniter项目。现在,当我访问sub.example.com它时,它会加载login page并成功登录,它会重定向到仪表板。登录并建立会话后,访问sub.example.com/login/将自动重定向到dashboard page。现在这是我的问题。成功登录后,访问sub.example.com不会重定向到任何地方,只需加载登录页面即可。但是访问sub.example.com/index.php确实将我重定向到仪表板页面。
由于某种原因,我的索引方法被调用或正常工作。
这是我的代码。
.htaccess
IndexIgnore *
php_value date.timezone Asia/Kolkata
RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L,QSA]
## Remove www from URL
RewriteCond %{HTTP_HOST} ^www\.
RewriteRule ^(.*)$ https://sub.example.com/$1 [R=301,L]
## Redirect to HTTPS
RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^sub.example.com$
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Run Code Online (Sandbox Code Playgroud)
config.php
if ($_SERVER['REMOTE_ADDR'] == "127.0.0.1") {
$config['base_url'] = "http://" . $_SERVER['SERVER_NAME'];
} else {
$config['base_url'] = "https://" …Run Code Online (Sandbox Code Playgroud) 这段代码可以完美地播放精美的歌曲,但有些时间随机转到下一首歌会手动崩溃应用程序.随机发生
updateSeekBar = new Thread() {
@Override
public void run() {
int runtime = mediaPlayer.getDuration();
int currentPosition = 0;
while (currentPosition < runtime) {
try {
sleep(500);
currentPosition = mediaPlayer.getCurrentPosition();//This is where the app crash
if (seekBar != null) {
seekBar.setProgress(currentPosition);
}
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
};
Run Code Online (Sandbox Code Playgroud)
崩溃报告
06-10 22:08:53.160 15351-15560/skydeveloper.me.musicx2 E/AndroidRuntime: FATAL EXCEPTION: Thread-6875
Process: skydeveloper.me.musicx2, PID: 15351
java.lang.IllegalStateException
at android.media.MediaPlayer.getCurrentPosition(Native Method)
at skydeveloper.me.musicx2.Player$1.run(Player.java:104)
Run Code Online (Sandbox Code Playgroud) android ×3
javascript ×3
php ×3
html ×2
java ×2
.htaccess ×1
android-10.0 ×1
arduino-uno ×1
chromakey ×1
css ×1
device-admin ×1
facebook ×1
input ×1
johnny-five ×1
json ×1
node.js ×1