我正在创建一个DialogFragment来显示有关我的应用程序的一些帮助消息.一切工作正常,除了一两件事:有一个在,显示DialogFragment窗口顶部的黑色条纹,那我相信是留给冠军,这是我不想用.
这是特别痛苦的,因为我的自定义DialogFragment使用白色背景,所以这种变化太臭名昭着,不能放在一边.
让我以更加图形化的方式向您展示:

现在我的DialogFragment的XML代码如下:
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:id="@+id/holding"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/dialog_fragment_bg"
>
<!-- Usamos un LinearLayout para que la imagen y el texto esten bien alineados -->
<LinearLayout
android:id="@+id/confirmationToast"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<TextView android:id="@+id/confirmationToastText"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:text="@string/help_dialog_fragment"
android:textColor="#AE0000"
android:gravity="center_vertical"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/confirmationButtonLL"
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="center_horizontal"
>
<Button android:id="@+id/confirmationDialogButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginBottom="60dp"
android:background="@drawable/ok_button">
</Button>
</LinearLayout>
</LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)
以及实现DialogFragment的类的代码:
public class HelpDialog extends DialogFragment {
public HelpDialog() {
// Empty constructor required for DialogFragment
} …Run Code Online (Sandbox Code Playgroud) 我正试图在eclipse cdt中为STL对象添加漂亮的打印.我试着按照这里描述的步骤:
http://sourceware.org/gdb/wiki/STLSupport
我检查了python文件夹,但我似乎无法完成这个...
我创建了一个gdbinit并为我的调试配置选择,但每当我尝试开始调试时,我都会收到以下错误:
Error while executing Python code.
!STACK 0
java.lang.Exception: /home/lizardking/workspace/eu.sofia.kpi.cpp.x86.testapp/.gdbinit:6: Error in sourced command file:
Error while executing Python code.
at org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl$RxThread.processMIOutput(AbstractMIControl.java:824)
at org.eclipse.cdt.dsf.mi.service.command.AbstractMIControl$RxThread.run(AbstractMIControl.java:662)
Run Code Online (Sandbox Code Playgroud)
如果我尝试在python shell中执行gdbinit的内容,我会收到此错误:
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
import sys
sys.path.insert(0, '/home/Documents/python')
from libstdcxx.v6.printers import register_libstdcxx_printers
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named libstdcxx.v6.printers
Run Code Online (Sandbox Code Playgroud)
似乎我没有这样的模块......我对Python没有任何线索所以我甚至不知道Python中的"模块"是什么....
有人可以帮我这个吗?能够看到真正的调试信息对我来说非常重要,或者对它来说非常重要.或者我甚至可以从控制台调试并从gdb获得不错的输出,因为如果我打印一个字符串,例如我得到无用的输出....
问候,亚历克斯
我正在尝试从日志文件中的一个非常简单的烧瓶应用程序中保存应用程序日志消息.当我使用嵌入式Flask服务器运行应用程序时,这完美无缺,但在gUnicorn中运行时根本无法正常工作,基本上,没有应用程序输出重定向日志文件(在我的Flask应用程序中指定的那个)或者运行gunicorn时的STDOUT.
那就是说,这是我的Flask应用程序:
@app.route('/')
def index():
app.logger.debug('Into /!!!!')
print 'Will this print?'
return 'Flask is running!'
if __name__ == '__main__':
#Setup the logger
file_handler = FileHandler('test.log')
handler = logging.StreamHandler()
file_handler.setLevel(logging.DEBUG)
handler.setLevel(logging.DEBUG)
file_handler.setFormatter(Formatter(
'%(asctime)s %(levelname)s: %(message)s '
'[in %(pathname)s:%(lineno)d]'))
handler.setFormatter(Formatter(
'%(asctime)s %(levelname)s: %(message)s '
'[in %(pathname)s:%(lineno)d]'))
app.logger.addHandler(handler)
app.logger.addHandler(file_handler)
app.run(debug=True)
Run Code Online (Sandbox Code Playgroud)
现在如果我启动应用程序:
python app.py
Run Code Online (Sandbox Code Playgroud)
我得到了预期的输出:
* Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
* Restarting with stat
--------------------------------------------------------------------------------
DEBUG in app [app.py:23]:
Into /!!!!
--------------------------------------------------------------------------------
2015-03-11 09:36:18,375 DEBUG: Into /!!!! [in app.py:23]
Will this …Run Code Online (Sandbox Code Playgroud) 我正在尝试将Flask中的消息记录到文件和stdout.我一直在阅读官方的Flask文档并想出了这个:
from flask import Flask
import logging
from logging import Formatter, FileHandler
app = Flask(__name__)
@app.route('/')
def hello_world():
app.logger.debug('second test message...')
return 'Hello World!'
if __name__ == '__main__':
#Setup the logger
file_handler = FileHandler('output.log')
handler = logging.StreamHandler()
file_handler.setLevel(logging.DEBUG)
handler.setLevel(logging.DEBUG)
file_handler.setFormatter(Formatter(
'%(asctime)s %(levelname)s: %(message)s '
'[in %(pathname)s:%(lineno)d]'
))
handler.setFormatter(Formatter(
'%(asctime)s %(levelname)s: %(message)s '
'[in %(pathname)s:%(lineno)d]'
))
app.logger.addHandler(handler)
app.logger.addHandler(file_handler)
app.logger.error('first test message...')
app.run()
Run Code Online (Sandbox Code Playgroud)
有几个问题:
output.log生成文件只有第一个日志消息有效:
app.logger.error( '测试...')
而且只有在stdout ......视图中的那个"/"甚至不打印到stdout ......我做错了什么?
这是启动应用程序并转到/的输出:
2015-03-08 11:33:27,183 ERROR: first test message... [in /home/mosquito/python_projects/flask_tst/flask_tst.py:31] …Run Code Online (Sandbox Code Playgroud) 请原谅我的无知,但我想知道是否有办法为PostgreSQL中的表指定元数据,我不希望它作为该表中的字段.例如,如果我想为该表添加一个描述字段,创建时间等...
我知道我可以使用额外的表来做到这一点,但说实话,我宁愿不要这样做.我已经深入研究了官方的PostgreSQL文档,但除了查看information_schema.tables之外什么都没有,我想我不允许修改任何东西.
有线索吗?否则,我想我将不得不再创建一些表来处理这个问题.
谢谢!
对于Python来说,我是一个新手,因此我事先请求原谅:).也就是说,我正在尝试制作一个脚本,除其他外,安装一些Linux软件包.首先我想解释为使用subopen 这里.虽然这最终可以工作,但我偶然发现了python-apt API,因为我不是一个大粉丝或重新发明轮子,我决定尝试一下.
当尝试使用python-apt查找有关安装软件包的示例/教程时出现问题.在搜索文档时,我发现了包含一些安装包的方法的PackageManager类.我尝试了一些简单的代码来实现这个目的:
apt_pkg.PackageManager.install("python")
Run Code Online (Sandbox Code Playgroud)
这似乎不那么容易,安装方法需要apt_pkg.PackageManager而不是普通的String.因此,看起来更多,我发现这个看起来很有希望的例子,但我有点不愿意使用,因为我不太了解那里发生的一些事情.
那么,有没有人试图使用python-apt安装包,还是应该使用普通的子打开方式?
谢谢!
我想知道你是否有人知道如何在Java中显示一个漂亮的进度条,主要是使用Swing,虽然我不介意使用第三方库.
我一直在看JProgressBar教程,但没有一个是指造型吧.阅读API我找到了一个返回ProgressBarUI对象的getUI方法,但是我没有看到很多方法来自定义那个.
我想要的是添加圆角,改变背景和前景色,宽度,长度,通常.
谢谢!
我试图隐藏JTable的网格线但没有结果.即使尝试更改网格线的颜色也不起作用.这是我的代码:
// build the table
tableView = new JTable(ttm);
//Specifify the selection Listener and model
listSelectionModel = tableView.getSelectionModel();
listSelectionModel.addListSelectionListener(new SharedListSelectionHandler(tableView));
tableView.setSelectionModel(listSelectionModel);
//Add a mouse listener to our table and implement double click event
tableView.addMouseListener(new MouseAdapter(){
public void mouseClicked(MouseEvent e){
//If double click in a message show the Message Details window
if (e.getClickCount() == 2){
showMessageDetail();
}
}
} );
// set my own renderer
CustomCellRenderer mtr = new CustomCellRenderer();
tableView.setDefaultRenderer(Object.class, mtr);
// table properties
tableView.setGridColor(Color.black);
tableView.setShowGrid(false);
//tableView.setShowVerticalLines(false);
//tableView.setShowHorizontalLines(false);
tableView.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
//hide …Run Code Online (Sandbox Code Playgroud) 我们目前正在构建一个Web应用程序(Django,Ember),我们发现大多数潜在客户都需要对应用程序进行零星的离线访问.
我们需要的不仅仅是"呈现"应用程序,以便用户可以导航,缓存清单中的内容等等(我想我们最终也需要),但我们必须让用户尽可能多地操作,就好像他们是线上.显然有一些功能不可用,但应该可以使用应用程序的基本用法.
也就是说,我希望听到一些关于之前遇到过这种情况的人的想法.我看到这个的方式,我们需要:
1.-检查我们是否经常在线/离线,或让用户指定他们何时离线(如智能手机中的飞行模式).
2.-所有数据都应该转储到IndexedDB中,从那时起我们就使用IndexedDB处理与数据相关的任何事情.
3.-当用户重新联机时,Synch进程必须尝试将数据从脱机用户转储到db online.虽然这可能看起来很危险,但我不希望很多用户同时离线,而其他在线用户正在使用该应用程序,所以我希望这个同步过程不会成为真正的噩梦,我也不会期待有竞争条件.
好吧,显然可以选择创建一个桌面独立应用程序......但我会尽量避免这种情况......
谢谢!
django offline offline-mode offline-caching offline-browsing
我正在尝试在JLabel中加载动画GIF.
虽然这有效:
URL urlsd;
try {
urlsd = new URL("http://pscode.org/media/starzoom-thumb.gif");
ImageIcon imageIcon = new ImageIcon(urlsd);
JLabel progress = new JLabel(imageIcon);
progress.setBounds(5, 20, 66, 66);
contentPane.add(progress);
} catch (MalformedURLException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
另一方面,这不,并且我不想从URL获取GIF,因为我已经拥有GIF.加载结果只显示GIF的第一帧:
try {
ImageIcon imageIcon = new ImageIcon(ImageIO.read(ClassLoader.getSystemResourceAsStream("res/images/progress_indicator.gif")));
JLabel progress = new JLabel(imageIcon);
imageIcon.setImageObserver(progress);
progress.setBounds(5, 20, 66, 66);
contentPane.add(progress);
} catch (MalformedURLException e) {
e.printStackTrace();
}
Run Code Online (Sandbox Code Playgroud)
我想这肯定是有原因的,但我找不到它.
谢谢!亚历克斯
java ×3
python ×3
swing ×3
flask ×2
logging ×2
android ×1
animated-gif ×1
apt ×1
c++ ×1
django ×1
eclipse ×1
eclipse-cdt ×1
gdb ×1
gdb-python ×1
gridlines ×1
gunicorn ×1
jlabel ×1
jprogressbar ×1
jtable ×1
offline ×1
offline-mode ×1
postgresql ×1