我正在尝试用Python中的https://www.spoj.pl解决Krypto问题,这涉及控制台输入.
我的问题是,输入字符串有多行但在程序中需要作为一个单独的字符串.如果我只是使用raw_input()并粘贴(用于测试)控制台中的文本,那么Python威胁就像我在每一行之后按下Enter键 - >我需要在循环中多次调用raw_input().
问题是,我不能以任何方式修改输入字符串,它没有任何符号标记结束,我不知道有多少行.
那我该怎么办?
与我的其他问题相关,我认为更重要的问题是,如何QImage使用OpenGL 渲染?
我认为代码必须看起来像这样,但我不确定我还需要什么,除此之外convertToGLFormat(img).
glEnable(GL_TEXTURE_2D);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glGenTextures(1, &offscreenBufferTexture);
glBindTexture(GL_TEXTURE_2D, offscreenBufferTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imgGL.width(),
imgGL.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
imgGL.bits());
glBegin(GL_QUADS);
glTexCoord2d(0,0); glVertex2d(0, 0);
glTexCoord2d(1,0); glVertex2d(windowSize.width(), 0);
glTexCoord2d(1,1); glVertex2d(windowSize.width(), windowSize.height());
glTexCoord2d(0,1); glVertex2d(0, windowSize.height());
glEnd();
glDisable(GL_TEXTURE_2D);
Run Code Online (Sandbox Code Playgroud)
此外,我认为你可以使用快速和脏glDrawPixels()(虽然你不应该),像
glDrawPixels(imgGL.width(), imgGL.height(), GL_RGBA,
GL_UNSIGNED_BYTE, imgGL.bits());
Run Code Online (Sandbox Code Playgroud)
但无论哪种方式,我都看不到图像,只是一个白色正方形的大小.我在这里遗漏了一些东西.
我正在尝试设置我的eclipse插件开发目标并多次收到以下错误:
!ENTRY org.eclipse.e4.ui.css.swt 4 0 2015-01-30 15:15:06.879
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.e4.ui.css.swt [955]
Unresolved requirement: Require-Bundle: org.eclipse.e4.ui.css.core; bundle-version="0.9.0"
-> Bundle-SymbolicName: org.eclipse.e4.ui.css.core; bundle-version="0.10.100.v20140424-2042"; singleton:="true"
org.eclipse.e4.ui.css.core [1134]
Unresolved requirement: Require-Bundle: org.apache.batik.css; bundle-version="1.7.0"
-> Bundle-SymbolicName: org.apache.batik.css; bundle-version="1.7.0.v201011041433"
org.apache.batik.css [1177]
Unresolved requirement: Import-Package: org.w3c.dom.events; version="[3.0.0,4.0.0)"
Run Code Online (Sandbox Code Playgroud)
这是否意味着这些插件都无法解析,或者只是不是最后一个插件,或者org.w3c.dom.events这是由于捆绑版本的不匹配造成的org.eclipse.e4.ui.css.core?
所以我已经创建了一个自定义ArrayAdapter来填充我的Lists,它只是覆盖了getView(int position,View v,ViewGroup parent).
如果我像这样使用它:
public class MyActivity extends ListActivity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setListAdapter(adapter);
}
}
Run Code Online (Sandbox Code Playgroud)
Everthing工作正常,我的列表正确显示所有条目.
现在,如果我尝试在XML布局中的<ListView />上使用相同的Adapter类,如下所示:
ListView lv = (ListView) v.findViewById(R.id.list);
MyAdapter a = new MyAdapter (lv.getContext(), R.layout.list_item, entries);
lv.setAdapter(a);
Run Code Online (Sandbox Code Playgroud)
它只显示List的第一个条目.
我已经尝试使用adapter.add手动添加项目(entry.get(i)); 并调用adapter.notifyDataSetChanged(); 事后没有帮助.
e:这是XML布局:
<?xml version="1.0" encoding="utf-8"?>
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="1dp">
<TextView
android:id="@+id/bc_path"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="3dp"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceSmall"/>
<TextView
android:id="@+id/bc_name"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="3dp"
android:textStyle="bold"
android:textAppearance="?android:attr/textAppearanceMedium"
android:background="@drawable/title_gradient"/>
<TextView
android:id="@+id/bc_genre"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:padding="3dp"
android:background="@drawable/location_gradient"
android:textColor="#ffffff"/>
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal" …Run Code Online (Sandbox Code Playgroud) android android-arrayadapter android-layout android-listview
android ×1
c++ ×1
command-line ×1
eclipse-jdt ×1
glteximage2d ×1
java ×1
multiline ×1
opengl ×1
osgi-bundle ×1
python ×1
qimage ×1
qt ×1
user-input ×1