小编Chr*_*fer的帖子

如何访问Redis日志文件

在ubuntu服务器上使用ruby设置Redis,但无法弄清楚如何访问其日志文件.教程说它应该在这里:

/var/log/redis_6379.log
Run Code Online (Sandbox Code Playgroud)

但是甚至找不到/ var /文件夹

redis

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

Redis:如何删除超过3个月的所有密钥

我想清除超过3个月的所有密钥.这些密钥未设置过期日期.

或者,如果那是不可能的,那么我可以删除最旧的1000个键吗?

redis

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

Python PIL - 在裁剪,缩放和保存时将颜色配置文件更改为未标记的RGB

无法弄清楚为什么要在作物上更改文档配置文件,缩放并使用PIL保存.已经使用sRGB作为颜色配置文件的图像进行了测试,并且在具有未标记的RGB之后进行了测试.

def scale(self, image):
    images = []

    image.seek(0)

    try:
        im = PIL.open(image)
    except IOError, e:
        logger.error(unicode(e), exc_info=True)

    images.append({"file": image, "url": self.url, "size": "original"})

    for size in IMAGE_WEB_SIZES:
        d = cStringIO.StringIO()
        try:
            im = crop(image, size["width"], size["height"])
            im.save(d, "JPEG")
            images.append({"file": d, "url": self.scale_url(size["name"]), "size": size})
        except IOError, e:
            logger.error(unicode(e), exc_info=True)
            pass

    return images
Run Code Online (Sandbox Code Playgroud)

我试图让PIL保存缩放版本与原始图像具有相同的颜色配置文件.

编辑:根据这个可能http://comments.gmane.org/gmane.comp.python.image/3215,但仍然无法使用PIL 1.1.7工作

python

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

在iOS 11的xcode 9中 - 首次运行时加载地图图块的问题

- 更新了新发现 - 在模拟器和设备上进行了测试.从冷启动运行应用程序时,无法正确加载地图.瓷砖没有显示.

mapViewDidFinishLoadingMap没有被召唤.因此,地图不能完成会出错,但我没有错误.

如果我只是简单地退出应用程序然后再次进入,地图就可以正常加载.这意味着如果从后台打开应用程序,则会加载地图.

有什么想法有什么变化吗?在iOS 10中工作得很好.

在此输入图像描述

更新

在iOS 11 mapViewWillStartLocatingUser中被调用但不是mapViewWillStartRenderingMap.我想知道是否必须手动调用某些内容才能启动地图渲染.在iOS 9中(我测试的是什么,并且它运行得很好)mapViewWillStartRenderingMap之前被调用过mapViewWillStartLocatingUser

mapkit ios ios11

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

Django - 在视图中检测移动设备

我已经在我的模板中使用设备检测(http://djangosnippets.org/snippets/2228/)并尝试使其在视图中工作,因此如果用户来自iPhone,我可以重定向到应用商店.

所以我已经:

import re

def mobile(request):

    device = {}

    ua = request.META.get('HTTP_USER_AGENT', '').lower()

    if ua.find("iphone") > 0:
        device['iphone'] = "iphone" + re.search("iphone os (\d)", ua).groups(0)[0]

    if ua.find("ipad") > 0:
        device['ipad'] = "ipad"

    if ua.find("android") > 0:
        device['android'] = "android" + re.search("android (\d\.\d)", ua).groups(0)[0].translate(None, '.')

    # spits out device names for CSS targeting, to be applied to <html> or <body>.
    device['classes'] = " ".join(v for (k,v) in device.items())

    return {'device': device }
Run Code Online (Sandbox Code Playgroud)

然后在tools/middleware.py中创建了一个类:

from tools.context_processor import mobile

class detect_device(object): …
Run Code Online (Sandbox Code Playgroud)

django

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

Redis:如何访问特定键空间中的键

我的redis服务器中有2个键空间:

db0:keys=1,expires=0
db1:keys=36679593,expires=0
Run Code Online (Sandbox Code Playgroud)

但是,如果我跑

redis-cli KEYS '*'
Run Code Online (Sandbox Code Playgroud)

我只在db0中获取密钥.如何在db1中搜索键?

redis

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

如何以编程方式替换UITabBarController的UITabBar

由于以下问题,我需要为我的项目使用UITabBar的子类:为什么页面Push动画Tabbar在iPhone X中向上移动

我不使用情节提要。如何以编程方式完成此操作?

-更新-

我的CustomTabBarController.swift文件现在看起来像这样:

import UIKit

@objc class customTabBarController: UITabBarController {
    override var tabBar: UITabBar {
        return customTabBar
    }
}
Run Code Online (Sandbox Code Playgroud)

我的CustomTabBar.swift文件如下所示:

import UIKit

class customTabBar: UITabBar {

    override var frame: CGRect {
        get {
            return super.frame
        }
        set {
            var tmp = newValue
            if let superview = superview, tmp.maxY !=
                superview.frame.height {
                tmp.origin.y = superview.frame.height - tmp.height
            }

            super.frame = tmp
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

但这给了我以下错误:

Cannot convert return expression of type 'customTabBar.Type' to return type 'UITabBar'
Run Code Online (Sandbox Code Playgroud)

uitabbarcontroller uitabbar ios

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

通过uwsgi设置DJANGO_SETTINGS_MODULE

我试图找到最好的方法来拆分我的Django设置,并为dev和prod提供不同的设置文件。

我的wsgi文件:

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()
Run Code Online (Sandbox Code Playgroud)

在我的uwsgi.ini文件中,我有以下内容:

env = DJANGO_SETTINGS_MODULE=project.settings.local
wsgi-file = project/wsgi.py
Run Code Online (Sandbox Code Playgroud)

但是uwsgi.ini文件中的env不会传递给wsgi。如果我在wsgi文件中打印os.environ,则未设置DJANGO_SETTINGS_MODULE。

有任何想法吗?

django uwsgi

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

标签 统计

redis ×3

django ×2

ios ×2

ios11 ×1

mapkit ×1

python ×1

uitabbar ×1

uitabbarcontroller ×1

uwsgi ×1