小编Spa*_*kup的帖子

htaccess重写url remove子目录

我正在尝试改写

http://www.example.com/directory/folder/*

http://www.example.com/directory/*

htaccess文件在 directory

这是我的.htaccess文件:

RewriteEngine on
RewriteBase /directory/
RewriteRule ^(.*)$ folder/$1 [L]
Run Code Online (Sandbox Code Playgroud)

任何帮助将非常感激.

.htaccess

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

489次成功连接后,android蓝牙连接失败

不幸的是,我的android蓝牙有一些问题.对于我的测试环境,我使用的是带有Android 4.4.2的Nexus 4.

我的PC上有一个Java应用程序,它使用bluecove作为客户端进行SPP连接.该程序正在寻找一个特殊的服务名称,并与我的Android手机连接.然后它发送72个字节到我的Android手机,并等待答案.得到答案时,程序会睡3秒钟而不是重新开始.

在我的Android手机上,我有一个带有后台蓝牙监听器的应用程序,它在启动时启动.此应用程序基于BluetoothChat示例演示.当接收蓝牙数据时,我检查传入的数据并发回答案.

一切正常.但是在489蓝牙连接之后,Android应用程序在PC-java-app正在进行时失败并显示以下错误代码:

getBluetoothService() called with no BluetoothManagerCallback
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0x41b34ba8)
FATAL EXCEPTION: main
Process: de.tum.lme.diamantum:remote_blue, PID: 21567
java.lang.NullPointerException: FileDescriptor must not be null
    at android.os.ParcelFileDescriptor.<init>(ParcelFileDescriptor.java:174)
    at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:905)
    at android.os.ParcelFileDescriptor$1.createFromParcel(ParcelFileDescriptor.java:897)
    at android.bluetooth.IBluetooth$Stub$Proxy.createSocketChannel(IBluetooth.java:1355)
    at android.bluetooth.BluetoothSocket.bindListen(BluetoothSocket.java:349)
    at android.bluetooth.BluetoothAdapter.createNewRfcommSocketAndRecord(BluetoothAdapter.java:1055)
    at android.bluetooth.BluetoothAdapter.listenUsingRfcommWithServiceRecord(BluetoothAdapter.java:976)
    at com.test.btconn.BluetoothHandling$AcceptThread.<init>(BluetoothHandling.java:449)
    at com.test.btconn.BluetoothHandling.start(BluetoothHandling.java:216)
    at com.test.btconn.BluetoothListenerService.setupBtSockets(BluetoothListenerService.java:330)
    at com.test.btconn.BluetoothListenerService.manageBtState(BluetoothListenerService.java:249)
    at com.test.btconn.BluetoothListenerService.setBtStateDisconnected(BluetoothListenerService.java:383)
    at com.test.btconn.BluetoothListenerService.access$5(BluetoothListenerService.java:378)
    at com.test.btconn.BluetoothListenerService$2.handleMessage(BluetoothListenerService.java:421)
Run Code Online (Sandbox Code Playgroud)

因此,应用程序的ParcelFileDescriptor存在问题,该问题突然变为空.但为什么?

当改变PC-java-app上的暂停时间时,使用各种数据大小来传输和使用不同的智能手机时,也会发生上述所有情况.当使用反射"listenUsingRfcommWithServiceRecord"时,505传输后也会发生相同的情况.使用唤醒锁也没有任何改变.

顺便说一下,使用BluetoothChat样本时我也有同样的行为.

所以,有人提示,会发生什么?

更新:

如果蓝牙状态为3,则每次连接后BluetoothServerSocket都会关闭,BluetoothSocket会关闭.

java android bluetooth spp

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

你能将css规则`content`应用于子元素吗?

你可以将ccs规则内容应用于子元素吗?

css:

a:link:before, a:visited:before{
    content: " "attr(href)" ";
}
Run Code Online (Sandbox Code Playgroud)

HTML:

<a href="/home">Home</a>
Run Code Online (Sandbox Code Playgroud)

结果:

 -------------
|    /home    |
|    Home     |
 -------------
Run Code Online (Sandbox Code Playgroud)

不过我想做以下事情:

HTML:

<a href="/home"><span>home</span></a>
Run Code Online (Sandbox Code Playgroud)

使用前面的css,href值将出现在之前span.

有可能让它出现在span

我试过这个.这是一个站点地图.

css css3

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

在Linq的GroupBy中取1

我有一个返回一些记录的查询.

例如:

  • 日期是26日至2月,然后返回此日期的10条记录.
  • 日期是27日至2月,然后返回此日期的15条记录.

点击查看记录

我使用了以下查询:

 var sData = vehicle.GsmDeviceLogs
                    .Where(gs => gs.Speed > zeroSpeed && !gs.DigitalInputLevel1)
                    .OrderBy(gs => gs.DateTimeOfLog)
                    .ToList();
Run Code Online (Sandbox Code Playgroud)

现在,我只想获取每个日期的第一条记录.即

  • 日期是26 - 2月 - 1记录.
  • 日期是27日至2月1日记录.

c# linq

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

symfony2 redirectResponse

我想用POST参数创建重定向响应.例如,控制器返回一些重定向响应,该响应在http://example.com上进行重定向

...
return new RedirectResponse('http://example.com');
...
Run Code Online (Sandbox Code Playgroud)

有没有办法重定向到此URL(http://example.com)并使用RedirectResponse类将POST参数发送到此URL?

redirect http symfony

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

为命名空间创建的Google Closure Compiler不完整别名

我在Closure Compiler中遇到问题。这是我的功能:

Editor.Elements.Map = function(type, view, x, y) {
    var element = type[0].toUpperCase() + type.slice(1);
    if(typeof Editor.Elements[element] === 'function') {
        return new Editor.Elements[element](view).create(x, y);
    }
    return null;
}
Run Code Online (Sandbox Code Playgroud)

这将调用这样的类:

/**
 *  @constructor
 *  @extends {Editor.Elements.Element}
 *  @param view (object) {Editor.View}
 */
Editor.Elements.Circle = function(view) {

    Editor.Elements.Element.apply(this, arguments);

    if (!(view instanceof Editor.View)) {
        throw new Error('An Instance of Editor.View is required.');
    }

    var me = this, _me = {};

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

我收到以下警告:

JSC_UNSAFE_NAMESPACE: incomplete alias created for namespace Editor.Elements
Run Code Online (Sandbox Code Playgroud)

指的是这两行:

if(typeof …
Run Code Online (Sandbox Code Playgroud)

javascript namespaces google-closure-compiler

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

如何在wordpress主题中添加额外的CSS?

我在平板电脑和上网本上检查了我的博客,它看起来有点不好,所以我做了一个额外的CSS并添加到header.php之间:

<head>
<link media="all and (min-width: 481px) and (max-width: 768px)" type="text/css" rel="stylesheet" href="tablet.css">
</head>
Run Code Online (Sandbox Code Playgroud)

但没有任何反应.如何添加一个额外的.css来使其工作?

还尝试将此功能添加到主题functions.php,但博客崩溃.

wp_enqueue_style('my-custom-style', 'get_bloginfo('template_url') . '/css/tablet.css',false,'1.1','all and (min-width: 481px) and (max-width: 768px)');
Run Code Online (Sandbox Code Playgroud)

我应该在'template_url'中添加什么,以及实现目标的最简单方法是什么?

谢谢!

wordpress

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

选择不在数组中的随机值

如何选择不在此数组中的随机值(0到30)?

var list = new Array(1,3,4,7,8,9);
Run Code Online (Sandbox Code Playgroud)

javascript jquery

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

Symfony2:在切换区域设置期间向后Uri(推荐人)

我想实现区域设置切换器,但似乎没有运气...

下面的代码不起作用,因为(Referrer)包含旧的locale值...

如何使用新的locale值重定向到旧的Referrer URI?

- routing.yml

hello:
  pattern:  /{_locale}/hello/{name}
  defaults: { _controller: JetInformBundle:Default:index, name: 'alexander' }
  requirements:
    _locale: ^en|de|ru|uk$

about:
  pattern:  /{_locale}/about
  defaults: { _controller: JetInformBundle:Default:about }
  requirements:
    _locale: ^en|de|ru|uk$

locale:
  pattern:  /locale/{locale}
  defaults: { _controller: JetInformBundle:Locale:index }
Run Code Online (Sandbox Code Playgroud)

- DefaultController.php

<?php

namespace Jet\InformBundle\Controller;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Symfony\Component\HttpFoundation\Request;

class DefaultController extends Controller
{
    public function indexAction($name, Request $request)
    {
        $request->getSession()->set('referrer', $request->getRequestUri());
        return $this->render('JetInformBundle:Default:index.html.twig',
                             array('name' => $name));
    }

    public function aboutAction(Request $request)
    {
        $request->getSession()->set('referrer', $request->getRequestUri());
        return $this->render('JetInformBundle:Default:about.html.twig'));
    } …
Run Code Online (Sandbox Code Playgroud)

php localization referrer symfony

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