想用wechat sdk创建菜单
WeChat.create_menu({
"button":[
{
"type":"click",
"name":"Daily Song",
"key":"V1001_TODAY_MUSIC"
},
{
"type":"click",
"name":" Artist Profile",
"key":"V1001_TODAY_SINGER"
},
{
"name":"Menu",
"sub_button":[
{
"type":"view",
"name":"Search",
"url":"http://www.soso.com/"
},
{
"type":"view",
"name":"Video",
"url":"http://v.qq.com/"
},
{
"type":"click",
"name":"Like us",
"key":"V1001_GOOD"
}]
}]
})
Run Code Online (Sandbox Code Playgroud)
由于此错误,目前无法正常工作:
Traceback (most recent call last):
File "/base/data/home/runtimes/python27/python27_lib/versions/1/google/appengine/runtime/wsgi.py", line 267, in Handle
result = handler(dict(self._environ), self._StartResponse)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1519, in __call__
response = self._internal_error(e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1511, in __call__
rv = self.handle_exception(request, response, e)
File "/base/data/home/runtimes/python27/python27_lib/versions/third_party/webapp2-2.3/webapp2.py", line 1505, …
Run Code Online (Sandbox Code Playgroud) 可以在swift中知道结构的名称吗?我知道这可能是class
:
例
class Example {
var variable1 = "one"
var variable2 = "2"
}
Run Code Online (Sandbox Code Playgroud)
打印这个类名,我只想做:
NSStringFromClass(Example).componentsSeparatedByString(".").last!
Run Code Online (Sandbox Code Playgroud)
但我可以做类似的事struct
吗?
例
如果我有struct
:
struct structExample {
var variable1 = "one"
var variable2 = "2"
}
Run Code Online (Sandbox Code Playgroud)
我怎样才能得到名称" structExample "这个struct
?
谢谢.
以这种方式实现了一个对话框片段:
public class ProgressFragment extends DialogFragment {
@NonNull
@Override
public Dialog onCreateDialog(Bundle savedInstanceState) {
View v = getActivity().getLayoutInflater().inflate(R.layout.installation_page, null);
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
titleView = (TextView) v.findViewById(R.id.progressText);
titleView.setText("progress");
builder.setView(v);
return builder.create();
}
TextView titleView;
public TextView getTextView() {
return titleView;
}
Run Code Online (Sandbox Code Playgroud)
并且我希望能够从调用它的任何地方更新 titleView 的内容。喜欢:
ProgressFragment progressFragment = new ProgressFragment();
progressFragment.show(getSupportFragmentManager(),"");
Run Code Online (Sandbox Code Playgroud)
问题是像这样的尝试者:
((TextView)progressFragment.getDialog().findViewById(R.id.progressText)).setText("text");
Run Code Online (Sandbox Code Playgroud)
和
progressFragment.getTextView().setText("text");
Run Code Online (Sandbox Code Playgroud)
和
((TextView)progressFragment.getView().findViewById(R.id.progressText)).setText("working in this place");
Run Code Online (Sandbox Code Playgroud)
都返回空值。我该怎么做呢。谢谢
了解谷歌应用程序引擎上的大查询,并想尝试这个库,这也需要我知道有关将服务帐户凭据转换为其他格式.我试过这个命令
# Convert the key from pkcs12 to pkcs1 (PEM).
$ cat /path/to/xxxx-privatekey.p12 | openssl pkcs12 -nodes -nocerts -passin pass:notasecret | openssl rsa > /path/to/secret.pem
Run Code Online (Sandbox Code Playgroud)
在命令行,但我明白了
'cat' is not recognized as an internal or external command,
operable program or batch file.
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?
我如何在python类中声明全局变量。我的意思是:如果我有这样的课程
class HomePage(webapp2.RequestHandler):
def get(self):
myvaraible = "content"
#do something
class UserPage(webapp2.RequestHandler):
#i want to access myvariable in this class
Run Code Online (Sandbox Code Playgroud) 是否可以在模态底部工作表对话框中找到的持久底部工作表上添加叠加层?我实现了一个底部表,其中有一个框架布局并执行一些片段事务。
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/bottom_sheet"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="2sp"
android:layout_marginRight="2sp"
android:layout_marginTop="?attr/actionBarSize"
android:clickable="true"
android:orientation="vertical"
app:elevation="4sp"
app:layout_behavior="@string/bottom_sheet_behavior">
<FrameLayout
android:id="@+id/function_frame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginLeft="2sp"
android:layout_marginRight="2sp"
android:layout_marginTop="?attr/actionBarSize"
android:background="#fafafa"
android:elevation="4sp">
</FrameLayout>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
当它展开并按下后退按钮时,片段将从堆栈中删除。但是当我使用模态对话框时,对话框被关闭。
@Override
public void onBackPressed() {
Fragment fragment = getSupportFragmentManager().findFragmentById(R.id.function_frame);
if (fragment.getFragmentManager().getBackStackEntryCount() == 0) {
if (mBottomSheetBehavior.getState() == BottomSheetBehavior.STATE_EXPANDED) {
mBottomSheetBehavior.setState(BottomSheetBehavior.STATE_COLLAPSED);
return;
}
}
super.onBackPressed();
}
Run Code Online (Sandbox Code Playgroud)
所以,我发现使用持久对话框可以更好地完成工作,但我希望屏幕区域上的模式覆盖未被工作表覆盖。
使用jekyll建立了个人博客。一切在本地主机上运行良好。我不想将其部署在 github 上。由于某些原因,我更喜欢托管在谷歌应用程序引擎上。
我按照网上的一些说明并将生成的 _site 文件夹复制到我的谷歌应用程序引擎项目中。
app.yaml
看起来是这样的:
application: myblog
version: 1
runtime: python27
api_version: 1
threadsafe: yes
error_handlers:
- file: /404.html
handlers:
- url: /
static_files: _site/index.html
upload: _site/index.html
- url: /(.*)
static_files: _site/\1
upload: _site/(.*)
libraries:
- name: webapp2
version: "2.5.2"
Run Code Online (Sandbox Code Playgroud)
当我在谷歌应用程序引擎上本地运行它时,仅显示index.html和其他一些文件。其他人显示找不到页面。有什么我没有正确实施的吗?
我想java.util.zip.ZipFile
用android 阅读一个zip文件DocumentFile
插图:
使用Storage Access Framework,我可以在android系统中获取文件的uri并使用它创建一个Documentfile。该文档文件是一个包含zip文件“ data.zip”的文件夹
Data.zip有80多个条目,包括文本文件和媒体文件(> = 8mb <= 20mb)。因此,zip文件超过932mb。
使用filePAth,我可以直接使用下面的代码段读取条目:
zipFile = new ZipFile(zipPath);
ZipEntry zipEntry = zipFile.getEntry(name);
if (zipEntry != null) {
return writeByteArraysToFile(ByteStreams.toByteArray(zipFile.getInputStream(zipEntry)), ext);
}
Run Code Online (Sandbox Code Playgroud)
这在不需要存储访问框架的设备上效果很好。
对于使用SAF的设备,我正在使用DocumentFile,并且我已经阅读了以下内容:
InputStream inputStream = context.getContentResolver().openInputStream(documentFile.getUri());
BufferedInputStream bufferedInputStream = new BufferedInputStream(inputStream);
ZipInputStream zipInputStream = new ZipInputStream(bufferedInputStream);
ZipEntry entry;
while ((entry = zipInputStream.getNextEntry()) != null) {
Log.e("field", entry.getName());
if (entry.getName().contains(name)) {
File file = PBUtils.writeByteArraysToFile(ByteStreams.toByteArray(zipInputStream), ext);
zipInputStream.closeEntry();
inputStream.close();
zipInputStream.close();
bufferedInputStream.close();
return file;
}
zipInputStream.closeEntry();
}
inputStream.close();
Run Code Online (Sandbox Code Playgroud)
这不起作用,但这是问题所在:
我有一个具有缩放功能的图像视图
<com.github.chrisbanes.photoview.PhotoView
android:id="@+id/helfie_preview"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="center" />
Run Code Online (Sandbox Code Playgroud)
它在一个父级中,具有可绘制的顶角半径:
<LinearLayout
android:outlineProvider="background"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/sheet_bg"
android:orientation="vertical">
<!-- including the photoview -->
<include
android:id="@+id/preview_layout_frame"
layout="@layout/preview_snaped_helfie"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1" />
<android.support.v7.widget.RecyclerView
android:id="@+id/helfie_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:padding="20dp" />
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)
这是 sheet_bg
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/dark" />
<!--<stroke-->
<!--android:width="5dp"-->
<!--android:color="@color/white" />-->
<corners
android:topLeftRadius="35dp"
android:topRightRadius="35dp"
/>
</shape>
Run Code Online (Sandbox Code Playgroud)
我已经尝试了从clipChildren
到clipPadding
到的所有方法,以确保 ImageView 不会在线性布局的边界之外绘制,到目前为止还没有任何效果。使用 cardview 可以解决这个问题(但在某些设备上会失败,我只需要顶角半径)。
布局背景的样子
如您所见,它跨越了父级的曲线边界。
我是一个java卡初学者,从样本中复制下面的代码.不知何故,我已经能够如何部分代码工作.但仍然对以下内容感到困惑.
.所有者工作的方式以及引脚设置的方式和时间.如何使信用卡和借记卡工作
我理解平衡是如何工作的,那个方面是好的.下面是代码
wallet.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package classicapplet1;
import javacard.framework.APDU;
import javacard.framework.Applet;
import javacard.framework.ISO7816;
import javacard.framework.ISOException;
import javacard.framework.OwnerPIN;
public class Wallet extends Applet {
/* constants declaration */
// code of CLA byte in the command APDU header
final static byte Wallet_CLA = (byte) 0x80;
// codes of INS byte in the command APDU header
final static byte VERIFY = (byte) 0x20;
final …
Run Code Online (Sandbox Code Playgroud) android ×4
java ×2
python ×2
android-xml ×1
bottom-sheet ×1
cat ×1
javacard ×1
javascript ×1
jekyll ×1
openssl ×1
python-2.7 ×1
ssl ×1
struct ×1
swift ×1
wechat ×1
windows ×1