小编oca*_*nal的帖子

如何在Sublime Text 2/3中更改匹配括号的样式?

它只是强调匹配的括号,是否有可能使其更有用,如更改括号颜色或突出显示括号线?

sublimetext sublimetext2 sublimetext3

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

如何在android中获取当前的wifi连接信息

我正试图找出scanResult当前连接的wifi网络.

这是我的代码

public boolean IsCurrentConnectedWifi(ScanResult scanResult) 
{
    WifiManager mainWifi = (WifiManager) getSystemService(Context.WIFI_SERVICE);
    WifiInfo currentWifi = mainWifi.getConnectionInfo();
    if(currentWifi != null)
    {
        if(currentWifi.getSSID() != null) 
        {
            if(currentWifi.getSSID() == scanResult.SSID)
            return true;
        }
    }  
    return false;
}
Run Code Online (Sandbox Code Playgroud)

我没有问题得到scanresult.

总是我得到currentWifi是null.

我错在哪里或有没有其他方法可以做到这一点?

android

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

应用程序在后台运行一段时间后,位置跟踪会停止

我创建了一个简单的应用程序,它可以跟踪用户位置,并在每次更新位置时创建本地通知.

我启用了下面的背景模式,

在此输入图像描述

let locationManager = CLLocationManager()

open override func viewDidLoad() {
       locationManager.delegate = self;
       locationManager.desiredAccuracy = kCLLocationAccuracyBest;
       locationManager.distanceFilter = 10
       locationManager.allowsBackgroundLocationUpdates = true
       locationManager.startUpdatingLocation()
}

open func locationManager(_ manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
       let notification = UILocalNotification()
       notification.alertBody = "location updated"
       notification.fireDate = Date()
       UIApplication.shared.scheduleLocalNotification(notification)
}
Run Code Online (Sandbox Code Playgroud)

我设置字符串NSLocationAlwaysUsageDescription并请求许可.用户授予第一次加载应用时始终使用的权限.


当应用程序处于前台时它运行良好,当背景仍然工作至少在5-40分钟的时间范围内,可以通过电池或其他打开的应用程序进行更改.

问题是为什么它停止工作,它不会继续工作?

我从未在Apple文档中看到时间限制.

core-location cllocationmanager ios swift

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

MySQL中的重音不敏感搜索查询

有没有办法让搜索查询重音不敏感?

列和表的排序规则是utf8_polish_ci,我不想更改它们.

例如:toruń

select * from pages where title like '%torun%'
Run Code Online (Sandbox Code Playgroud)

它找不到"toruń".我怎样才能做到这一点?

mysql search diacritics

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

RenderBody()和RenderSection()必须在每个子布局上?

我有三个简单的布局,

_Layout.cshtml(这是基础布局)

@RenderSection("something", required: false)
@RenderBody()
Run Code Online (Sandbox Code Playgroud)

_Main.cshtml

@{
    Layout = "~/Views/Shared/_Layout.cshtml";
}
@section something {
   Hey I'm actually on the _Main layout.
}
Run Code Online (Sandbox Code Playgroud)

Index.cshtml

@{
    Layout = "~/Views/Shared/_Main.cshtml";
}
Run Code Online (Sandbox Code Playgroud)

当我尝试在动作中渲染索引视图时,我收到此错误,

尚未为布局页面"〜/ Views/Shared/_Main.cshtml"调用"RenderBody"方法.

但是等等,_Main.cshtml有一个父布局已经有了RenderBody().所以我错了,我RenderBody()是否应该呼吁每个孩子的布局?

asp.net asp.net-mvc razor asp.net-mvc-4 razor-2

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

如何在php.ini文件中更改session_save_path?

我在godaddy上有一个共享主机.

我尝试使用此行更改php.ini文件中的会话保存路径,

sessions.save_path = "/session"
Run Code Online (Sandbox Code Playgroud)

我使用sessions.save_path()函数控制了会话保存路径.它/tmp在更改之前和之后返回php.ini

是否可以在共享主机上更改会话保存路径?
我哪里错了?

session shared-hosting

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

如何在XMLHttpRequest中获取响应URL?

有一个页面(url),我通过XMLHttpRequest请求它,但是我没有得到请求的URL的响应,它正在将请求发送到另一个页面,

请求---> page.php
从> directedpage.php获取响应

问题是如何获得响应网址?(示例中为directedpage.php)

javascript ajax response xmlhttprequest

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

如何在php中删除标点符号

除了这些字符外,如何删除标点符号 . = $ ' - %

php string strip

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

如何在文本框中插入图像

有没有办法在文本框中插入图像?我正在开发一个聊天应用程序.我想用图标图像更改值":)",":("等.但我找不到如何在文本框中插入图像?

谢谢.

c# textbox winforms

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

几秒钟后,Android视图寻呼机会自动更改页面

我已经使用android视图寻呼机显示图像和文本现在我想要的是,如果用户没有更改图像,那么它应该开始在几秒钟后自动更改图像,当用户再次开始使用他的手指然后图像不应该自动更改?

我试图使用处理程序来创建延迟,但它对我不起作用?

请帮助任何人

public class SimpleImageViewerActivity  extends Activity implements ViewPager.OnPageChangeListener{
    private Handler handler;
    ViewPager myPager;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.imageslideshow);
        MyPagerAdapter adapter = new MyPagerAdapter();
        myPager = (ViewPager) findViewById(R.id.slideShowPager);
        myPager.setAdapter(adapter);
        myPager.setCurrentItem(0);

        handler = new Handler();
    myPager.setOnPageChangeListener(this);
    }

    private class MyPagerAdapter extends PagerAdapter {

        public int getCount() {
            return 5;
        }

        public Object instantiateItem(View collection, int position) {

            LayoutInflater inflater = (LayoutInflater) collection.getContext()
                    .getSystemService(Context.LAYOUT_INFLATER_SERVICE);

            int resId = 0;
            switch (position) {
            case 0:
                resId = R.layout.farleft;
                break;
            case …
Run Code Online (Sandbox Code Playgroud)

android android-sdk-2.1 android-viewpager

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