小编hyt*_*omo的帖子

将URL字符串转换为python中的普通字符串(%20到空格等)

在python中是否有任何方法可以将此 - >%CE%B1%CE%BB%20转换为:"αλ"这是它的真实表示?

提前致谢!

python string

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

Qt项目文件和PREFIX变量

我包含
__CODE__
在我的项目文件中,然后我运行
__CODE__
makefile没有说任何关于PREFIX的事情,所以我认为我做错了.有任何想法吗?

qt qmake qt-creator

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

发送短信直到成功

我正在尝试从我的申请中发送紧急短信.我必须确保SMS已成功发送.

在Android系统启动后以及在进行检查之后发送SMS.

所以我有一个处理BOOT_COMPLETED intent-filter的服务类.这个类进行检查,如果有的话,那么它会尝试通过"扩展服务"的另一个类发送一条SMS消息

在确保成功发送短信之后,两个服务(处理引导调用的服务和发送短信的服务)必须退出.

问题1:如何使用短信调用我的短信发送功能而不会使应用程序无响应消息?目前我正在使用它(我不知道它是否是正确的方法,虽然它有效):

Timer mTimer = new Timer();
//wait a small timeout prior to sending the message.
mTimer.scheduleAtFixedRate(new TimerTask() {
    @Override
    public void run() {
        this.cancel(); //I don't want to run the timer more than once
        sms_sender sms = new sms_sender();
        sms.sendSMS(phoneNumber, messageText);
    }
}, 30000, 30000); //run sendSMS() after 30 seconds
Run Code Online (Sandbox Code Playgroud)

问题2:如何实现sendSMS功能,以便在意识到上次尝试失败后每30秒重试一次?

问题3:在我意识到SMS已成功发送后,如何停止这两项服务?

这是我的代码不起作用:

public class sms_sender extends Service {

    @Override
    public IBinder onBind(Intent arg0) {
        // TODO Auto-generated method stub
        return null; …
Run Code Online (Sandbox Code Playgroud)

java eclipse sms android smsmanager

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

使用mod_rewrite删除.php扩展名并同时清除GET URL

这是我到现在为止所尝试的:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule (.*) $1.php [L]

RewriteCond %{QUERY_STRING} ^id=([0-9]{1})$
RewriteRule ^article\.php$ /article/%1 [L]
Run Code Online (Sandbox Code Playgroud)

基本上,第一组规则将URL从something.php转换为某些内容.

第二组规则应该将其中包含article.php?id = NUM​​BER的任何内容替换为/ article/NUMBER.

Apache报道:

AH00124: Request exceeded the limit of 10 internal redirects due to probable 
configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary.
Run Code Online (Sandbox Code Playgroud)

php regex apache .htaccess mod-rewrite

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

使用QPropertyAnimation调整窗口大小

我有以下问题:我想使用QPropertyAnimation调整窗口大小,以便看起来不错,但窗口也会在调整大小时立即移动,而我不想要它,我只是想调整窗口大小和不要改变它的位置价值.

所以,这是我的代码:

animation = new QPropertyAnimation(this, "geometry");
animation->setDuration(150);
animation->setStartValue(QRect(preferences::x(), preferences::y(), width, window_height_min));
animation->setEndValue(QRect(preferences::x(), preferences::y(), width, window_height_min+expand_general_to));
animation->start();
Run Code Online (Sandbox Code Playgroud)

其中width和window_height_min和expand_general_to是我自己的变量,用于处理必须完成的大小调整量.但是,preferences :: x()和preferences :: y()真正处理我的窗口的位置,那么为什么它会移动,而prefereces :: x()两次都是相同的?(在开始和结束值)?

提前感谢您的任何答案!

animation qt

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

大输入有什么意义?

在Google Code Jam中,如果您能够解决大输入问题,它可以为小输入提供2或甚至3倍的点数.

但是,我不明白这一点.如果你创建一个可以处理任何正数案例的程序,它可以处理10个输入案例和10000个输入案例.

因此,当您解决小输入的问题时,您应该能够解决大输入问题,而无需更改任何代码.

我错过了什么吗?

algorithm input

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

getter 是否应该返回对象实例的副本以避免副作用?

我想从一个类的函数返回一个值。

在我的课堂上:

public class MyClass {
   private Color color_ = new Color(0f, 0f, 0f, 1f);

   public Color getColor(){
      return this.color_;
   }
}
Run Code Online (Sandbox Code Playgroud)

所以,在我的另一个班级,我打电话

this.someOtherColorInOtherClass_=myClass.getColor();
Run Code Online (Sandbox Code Playgroud)

如果里面myClasscolor_变化,虽然,颜色someOtherColorInOtherClass_也会发生变化。

我认为这是因为在 Java 中一切都是指针。所以基本上我的 getter 函数返回一个指向 Color 的指针,因此它们都指向相同的内存位置,从而更改相同的变量。

在我的 getter 函数中,我可以做到

return new Color(this.color_);
Run Code Online (Sandbox Code Playgroud)

一切正常,因为我现在有一个新的指针可以使用。

这个问题有更好的解决方案吗?

java getter

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

从id属性中获取最后一个字符

我需要获取元素id的最后一个字符并使用它以便在同一页面中通过id查找另一个元素.

到目前为止我尝试过的:

$(".spoilerButton").each(function(){
        $currentId=($this).attr("id").slice(-1);
        $hiddenContent=$("#spoiler"+$currentId);
        $this.click(function(){
                $hiddenContent.toggle(500);
        });
});
Run Code Online (Sandbox Code Playgroud)

基本上,类spoilerButton的每个元素的id为spoilerButtonN,其中N是一个整数,有一个对应的元素,其中id spoilerN需要显示/隐藏,一旦被点击.

代码似乎没有运行$currentId=($this).attr("id").slice(-1);部分,我尝试从spoilerButton的id获取最后一个字符(N).

这样做的正确方法是什么?

javascript string jquery

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

QSystemTrayIcon,打开除mainwindow之外的其他对话框关闭应用程序

正如标题所说,如果我做这有一个选项经过那里打开一个对话框等(例如偏好)一个SystemTray中的图标,当我关闭这个对话框等,整个应用程序关闭,当我把这个>关闭(); 来自偏好对话框.以此示例代码为例:main.cpp:

#include <QtGui/QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}
Run Code Online (Sandbox Code Playgroud)

mainwindow.cpp

#include "mainwindow.h"
#include "ui_mainwindow.h"


MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    trayIcon = new QSystemTrayIcon(this);
    trayIcon->setIcon(QIcon(":/icons/error.png"));
    //replace 'error' with 'video' and recompile. The indicator isn't shown!
    trayIcon->setToolTip("Test");
    QMenu *changer_menu = new QMenu;
    Show_action = new QAction(tr("S&how"),this);
    Show_action->setIconVisibleInMenu(true);
    connect(Show_action, SIGNAL(triggered()), this, SLOT(show_me()));
    changer_menu->addAction(Show_action);
    changer_menu->addSeparator();

    Preferences_action = new QAction(tr("Preferences"), this);
    Preferences_action->setIconVisibleInMenu(true);
    connect(Preferences_action, SIGNAL(triggered()), this, SLOT(showpref()));
    changer_menu->addAction(Preferences_action);

    Quit_action = new …
Run Code Online (Sandbox Code Playgroud)

qt tray indicator

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

关于JsonSerializable的致命错误

虽然我有PHP 5.5.3和Joomla 3.1.5,但我收到此错误:

Fatal error: Interface 'JsonSerializable' not found in /var/www/joomla/libraries/joomla/registry/registry.php on line 22
Run Code Online (Sandbox Code Playgroud)

这是输出php --version:

PHP 5.5.3-1ubuntu2 (cli) (built: Oct  9 2013 14:49:24) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by Zend Technologies
Run Code Online (Sandbox Code Playgroud)

joomla3.1 php-5.5

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

垂直对齐图像右侧的文本

图像左侧有许多垂直对齐文本的示例,但是如果我尝试将文本放在图像的右侧,这些示例将不起作用。

图像左侧文本的工作示例是这样的:http : //jsfiddle.net/rVTcv/

HTML:

<div style="height:259px;" class="how-right">
    <img src="img/how-it-works/num-1.PNG" width="267px" height="259px">
    <span>JivaWay has a simple system to get you in shape in just 6 weeks.  And it's so easy to follow, even people who have never exercised before can do it.</span>
</div>
Run Code Online (Sandbox Code Playgroud)

CSS:

.how-right img {
    float:right;
    margin-left:20px;
    vertical-align:middle;
}
span {
    height: 259px;            
    display: table-cell;
    vertical-align: middle;
}
Run Code Online (Sandbox Code Playgroud)

如果我尝试通过float:right图像的属性移动到文本来移动右侧的文本,那么我不会得到预期的结果。

html css vertical-alignment css-float

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

对_imp__CryptProtectData @ 28的未定义引用

我正在尝试使用windows.h和wincrypt.h库构建一个简单的应用程序,以便加密一些字符串.

当我调用该函数时,CryptProtectData(&input, NULL, NULL, NULL, NULL, 0, &output);我得到错误:

error: undefined reference to `_imp__CryptProtectData@28'
Run Code Online (Sandbox Code Playgroud)

我在网上搜索了很多,并没有多少出现.我还意识到Chromium浏览器使用与我类似的代码来加密和解密其登录,我没有采取不同的做法.

我正在使用QtCreator IDE来编译我的代码.

我的一些代码:

  std::string plaintext="Some plain text";
  DATA_BLOB input;
  input.pbData = const_cast<BYTE*>(
      reinterpret_cast<const BYTE*>(plaintext.data()));
  input.cbData = static_cast<DWORD>(plaintext.length());

  DATA_BLOB output;
  BOOL result = CryptProtectData(&input, NULL, NULL, NULL, NULL,
                                 0, &output);
Run Code Online (Sandbox Code Playgroud)

编辑:忘了提到我已经包含了windows.h和wincrypt.h库,当然.

c++ windows encryption qt

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

使<a>链接可以通过整个<li>进行点击

请看看这个:

网站菜单

这是我的HTML:

    <nav id="mainNav">
        <ul>
            <li><a href="index.html">Home</a></li>
            <li><a href="projects.html">Our Projects</a></li>
            <li><a href="team.html">Our Team</a></li>
            <li><a href="contact.html">Contact</a></li>
        </ul>
    </nav>
Run Code Online (Sandbox Code Playgroud)

而我的css:

#mainNav ul li {
    padding-left: 10px;
}

#mainNav ul li:hover {
    background-color: rgba(0,0,0,.2);
    color: #fff;
    cursor: pointer;
}
Run Code Online (Sandbox Code Playgroud)

仅当我将光标放在文本链接上方并单击时,才会激活链接.我想能够点击较暗的"li"背景中的任何地方并激活相应的链接.这怎么可能?

html css html-lists nav

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