小编QLa*_*nds的帖子

宏将MS Word表导出到Excel工作表

我有一个包含许多表的word文档.有谁知道如何编写宏来将这些表导出到不同的Excel工作表?

excel vba export ms-word word-vba

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

Sql Alchemy QueuePool限制溢出

我有一个返回TimeOut的Sql Alchemy应用程序:

TimeoutError:达到大小为5的QueuePool限制溢出10,连接超时,超时30

我在另一篇文章中读到,当我不关闭会话时会发生这种情况,但我不知道这是否适用于我的代码:

我在init.py中连接到数据库:

from .dbmodels import (
    DBSession,
    Base,    

engine = create_engine("mysql://" + loadConfigVar("user") + ":" + loadConfigVar("password") + "@" + loadConfigVar("host") + "/" + loadConfigVar("schema"))

#Sets the engine to the session and the Base model class
DBSession.configure(bind=engine)
Base.metadata.bind = engine
Run Code Online (Sandbox Code Playgroud)

然后在另一个python文件中我收集了两个函数中的一些数据,但是使用了我在init.py中初始化的DBSession:

from .dbmodels import DBSession
from .dbmodels import resourcestatsModel

def getFeaturedGroups(max = 1):

    try:
        #Get the number of download per resource
        transaction.commit()
        rescount = DBSession.connection().execute("select resource_id,count(resource_id) as total FROM resourcestats")

        #Move the data to an array
        resources …
Run Code Online (Sandbox Code Playgroud)

python session sqlalchemy zope connection-timeout

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

如何将QGraphicsScene/View设置为特定的坐标系

我想在多边形中绘制多边形QGraphicsScene但多边形具有纬度/经度位置.在一个equirectangular投影中,坐标来自:

                       ^
                      90
                       |
                       |
-180----------------------------------->180
                       |
                       |
                     -90
Run Code Online (Sandbox Code Playgroud)

如何设置QGraphicsScene/ QGraphicsView到这样的投影?

非常感谢,

卡洛斯.

qt projection qgraphicsview qgraphicsscene

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

在Django中为URL模式添加前缀?

我有一个DJango应用程序,在URL模式(urls.py)中有几个条目:

urlpatterns = patterns(
    '',
    # change Language
    (r'^i18n/', include('django.conf.urls.i18n')),
    url('^api/v1/', include(router.urls)),
    url(r'^api-docs/', RedirectView.as_view(url='/api/v1/')),
    url(r'^api/', RedirectView.as_view(url='/api/v1/')),
    url(r'^api/v1', RedirectView.as_view(url='/api/v1/')),

    # django default stuff
    url(r'^accounts/', include('main.registration_urls')),
    url(r'^admin/', include(admin.site.urls)),
    url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # oath2_provider
    url(r'^o/', include('oauth2_provider.urls', namespace='oauth2_provider')),

    # google urls
    url(r'^gauthtest/$',
        'main.google_export.google_oauth2_request',
        name='google-auth'),
    url(r'^gwelcome/$',
        'main.google_export.google_auth_return',
        name='google-auth-welcome'),

    # main website views
    url(r'^$', 'main.views.home'),
    url(r'^tutorial/$', 'main.views.tutorial', name='tutorial'),
    url(r'^about-us/$', 'main.views.about_us', name='about-us'),
    url(r'^getting_started/$', 'main.views.getting_started', name='getting_started'),
    url(r'^faq/$', 'main.views.faq', name='faq'),
    url(r'^syntax/$', 'main.views.syntax', name='syntax'),
    url(r'^resources/$', 'main.views.resources', name='resources'),
    url(r'^forms/$', 'main.views.form_gallery', name='forms_list'),
    url(r'^forms/(?P<uuid>[^/]+)$', 'main.views.show'),
    url(r'^people/$', 'main.views.members_list'),
    url(r'^xls2xform/$', 'main.views.xls2xform'),
    url(r'^support/$', 'main.views.support'),
    url(r'^stats/$', 'staff.views.stats'),
    url(r'^login_redirect/$', …
Run Code Online (Sandbox Code Playgroud)

python django

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

JNI Warnig期望返回类型'L'调用LocationManager.requestLocationUpdates

我正在使用Necessitas(Android中的QT).基本上,使用Andrid NDK,android活动会调用QT应用程序(.so).

我正在研究GPS的一些绑定.我想我到了那里,但是当我调用方法requestLocationUpdates(String,Long,Float,LocationListener)时,我得到了JNI警告(JNI Warnig期望返回类型'L').

以下是一些代码:

midGetSystemService = currEnv->GetMethodID(actClass,"getSystemService","(Ljava/lang/String;)Ljava/lang/Object;");

jSystemServiceObj = currEnv->CallObjectMethod(currAct,midGetSystemService,StringArg);

midRequestLocationUpdates = currEnv->GetMethodID(locManClass,"requestLocationUpdates","(Ljava/lang/String;JFLandroid/location/LocationListener;)V");


midConstListener = currEnv->GetMethodID(listenerClass, "<init>", "()V");
jListenerObj = currEnv->NewObject(listenerClass, midConstListener);


currEnv->CallObjectMethod(jSystemServiceObj,midRequestLocationUpdates,StringArg,(jlong)1000,(jfloat)10,jListenerObj);  --->Here is the warning
Run Code Online (Sandbox Code Playgroud)

知道为什么吗?

java-native-interface android android-ndk

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

Docker 镜像 ubuntu:21.10 生成 The repository 'http://security.ubuntu.com/ubuntu impish-security Release' does not have a Release file

我正在从 ubuntu:21.10 创建一个 docker 镜像

几周前一切正常,但今天我得到:

Step 3/76 : RUN apt-get update && apt-get -y upgrade
 ---> Running in 7f2afb2074e8
Ign:1 http://archive.ubuntu.com/ubuntu impish InRelease
Ign:2 http://security.ubuntu.com/ubuntu impish-security InRelease
Ign:3 http://archive.ubuntu.com/ubuntu impish-updates InRelease
Err:4 http://security.ubuntu.com/ubuntu impish-security Release
  404  Not Found [IP: 91.189.91.38 80]
Ign:5 http://archive.ubuntu.com/ubuntu impish-backports InRelease
Err:6 http://archive.ubuntu.com/ubuntu impish Release
  404  Not Found [IP: 91.189.91.39 80]
Err:7 http://archive.ubuntu.com/ubuntu impish-updates Release
  404  Not Found [IP: 91.189.91.39 80]
Err:8 http://archive.ubuntu.com/ubuntu impish-backports Release
  404  Not Found [IP: 91.189.91.39 80]
Reading package lists...
E: …
Run Code Online (Sandbox Code Playgroud)

docker ubuntu-20.10

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

使用 HTTPS 在 Apache 后面配置 Tomcat8

我在我的服务器中的 8080 端口安装了 Tomcat 8,我用安全的 Apache(使用 Proxy Pass)公开了它。

这是我的 Apache 配置:

<VirtualHost *:443>
    ServerName myserver.com

    ProxyRequests Off
    ProxyPreserveHost On

    ProxyPass           /odata/    http://172.31.36.251:8080/
    ProxyPassReverse    /odata/    http://172.31.36.251:8080/

    <Proxy *>
        allow from all
    </Proxy>

    RequestHeader set X-Forwarded-Port 443
    RequestHeader set X-Forwarded-Scheme https
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)

这里是Tomcat server.xml 配置

<Connector port="8080" protocol="HTTP/1.1"
            connectionTimeout="20000"
            redirectPort="8443" 
            address="172.31.36.251" 
            proxyName="myserver.com" 
            scheme="https" proxyPort="443"  />
Run Code Online (Sandbox Code Playgroud)

一切正常,直到这里。如果我调用我的应用程序:https : //myserver.com/odata/D3a1593adae89/odata.svc/

我得到:

<service xmlns="http://www.w3.org/2007/app" xmlns:atom="http://www.w3.org/2005/Atom" xml:base="https://myserver.com:443/D3a1593adae89/odata.svc/">
<workspace>
<atom:title>Default</atom:title>
<collection href="Maintables">
<atom:title>Maintables</atom:title>
</collection>
</workspace>
</service>
Run Code Online (Sandbox Code Playgroud)

问题: 如果在结果中看到属性xml:base,Tomcat用端口装饰地址,我真的不知道如何删除它。地址也是错误的:它应该是https://myserver.com:443/ odata /D3a1593adae89/odata.svc/ 。我一直在环顾四周,尝试将proxyPort设置为空白但什么也没有。我认为这与使用反向代理时断开的链接有关,如 …

https apache2 proxypass tomcat8

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

如何在python金字塔应用程序中获取服务主机和端口?

我正在尝试使用以下方法获取金字塔应用程序的服务主机和端口:

settings = get_current_registry().settings
Run Code Online (Sandbox Code Playgroud)

但是我怎样才能获得主持人?

我试过了:

settings.get('host')
Run Code Online (Sandbox Code Playgroud)

但我得到了 None

任何帮助深表感谢.

python settings pyramid

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

Android加载库错误 - 无法映射段

我正在使用JNI加载本机库.该库驻留在SD卡上.

我正在使用以下代码加载库:

try
        {
            File str;
            String storage;
            str = Environment.getExternalStorageDirectory();
            storage = str.getAbsolutePath();

            File f = new File(storage+"/Android/data/org.ilri.IMPACTLight/libIMPInterface.so");
            if (f.exists())
                System.load(storage+"/Android/data/org.ilri.IMPACTLight/libIMPInterface.so");
        }
        catch (SecurityException e)
        {
            Log.i(QtTAG, "Security: Can't load /mnt/sdcard/Android/data/org.ilri.IMPACTLight/libIMPInterface.so", e);
        }
        catch (UnsatisfiedLinkError e)
        {
            Log.i(QtTAG, "Link: Can't load /mnt/sdcard/Android/data/org.ilri.IMPACTLight/libIMPInterface.so", e);
        }
Run Code Online (Sandbox Code Playgroud)

但是我总是得到:

D/dalvikvm(408):试图加载lib /mnt/sdcard/Android/data/org.ilri.GPSTest/libGPSInterface.so 0x44ede2c0 I/dalvikvm(408):无法dlopen(/ mnt/sdcard/Android/data/org.ilri.GPSTest/libGPSInterface.so):无法加载库:load_segments [907]:33无法映射来自'libGPSInterface.so'@ 0x81900000(0x00003470)的段.p_vaddr = 0x00000000 p_offset = 0x00000000

我在AVD 2.2上得到了这个

任何想法如何解决这一点非常感谢!!!

谢谢,卡洛斯

java-native-interface android android-ndk

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

如何从JavaScript中读取PHP变量?

我知道有很多问题,但我不能让它发挥作用.

我的HTML(test.htm)只有这个代码

<?php
$var = 'foo';
?>
<script type="text/javascript" language="javascript">
var val = "<?=$var?>";
alert(val);
</script>
Run Code Online (Sandbox Code Playgroud)

但是当我用浏览器打开文件时,val的值是"<?=$var?>" 而不是'foo'

我怎样才能使它工作?

javascript php variables

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

芹菜-获取task_success信号中的任务ID?

我有一个实现task_success信号的应用程序,如下所示:

@signals.task_success.connect
def task_success_handler(sender=None,result=None,**kwargs):
    print("**************************C100")
    pprint.pprint(sender.name)
    print("**************************C100")
Run Code Online (Sandbox Code Playgroud)

我可以获得任务名称。有什么方法可以获取task_id

python signals celery

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

如何调用 Celery shared_task?

我正在尝试在我的应用程序(不是 Django)中使用 stream_framework但我在调用 stream_framework 共享任务时遇到问题。Celery 似乎找到了任务:

-------------- celery@M3800 v3.1.25 (Cipater)
---- **** ----- 
--- * ***  * -- Linux-4.15.0-34-generic-x86_64-with-Ubuntu-18.04-bionic
-- * - **** --- 
- ** ---------- [config]
- ** ---------- .> app:         task:0x7f8d22176dd8
- ** ---------- .> transport:   redis://localhost:6379/0
- ** ---------- .> results:     redis://localhost:6379/0
- *** --- * --- .> concurrency: 8 (prefork)
-- ******* ---- 
--- ***** ----- [queues]
 -------------- .> celery           exchange=celery(direct) key=celery


[tasks]
  . formshare.processes.feeds.tasks.test_shared_task
  . stream_framework.tasks.fanout_operation
  . stream_framework.tasks.fanout_operation_hi_priority
  . stream_framework.tasks.fanout_operation_low_priority
  . stream_framework.tasks.follow_many …
Run Code Online (Sandbox Code Playgroud)

celery celery-task stream-framework

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

如何使用jni将数据从java InputStream移动到c ++中的char *?

如何使用 JNI 将存储在 java InputStream 中的数据移动到 c++ 中的 char *?

谢谢,卡洛斯。

c++ java java-native-interface inputstream

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