小编Raj*_*epe的帖子

C#fileName显示空格有问题

假设我有一个名为:

string reportName = "Facebook Network Performance Summary Report (By Region, By Content)";
Run Code Online (Sandbox Code Playgroud)

我想将该文件名显示为excel

以下是我导出文件的代码

Response.AddHeader("Content-Disposition", "attachment; filename=" reportName + ".xls");
Response.AddHeader("Content-Length", l.ToString());
Response.ContentType = "application/vnd.ms-excel";
Response.BinaryWrite(f);
Run Code Online (Sandbox Code Playgroud)

不幸的是,当我阅读reportName的第一个空格时,它只显示Facebook而没有其他内容.

是否有任何用于ASP.NET或其他方法的wexisting API来处理fileNAme的空间?

c# file-io file

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

总是 -bash: gomobile: 命令未找到

我已经安装了 gomobile

/Users/GaryChan/go/bin/gomobile
Run Code Online (Sandbox Code Playgroud)

我的项目是

/Users/GaryChan/go/src/abc.com/project
Run Code Online (Sandbox Code Playgroud)

当我尝试在以下位置运行构建 android SDK 时

/Users/GaryChan/go/src/abc.com/project/sdk
Run Code Online (Sandbox Code Playgroud)

并运行:

export ANDROID_HOME=/Users/GaryChan/Library/Android/sdk/ndk-bundle/


gomobile bind -target=android  abc.com/project/sdk
Run Code Online (Sandbox Code Playgroud)

我去安装去移动但无济于事。当我在我的 Mac 终端执行 gomobile 时,cmd 总是提示 -bash: gomobile: command not found

然后我无法导出SDK。我该怎么办 ?

https://godoc.org/golang.org/x/mobile/cmd/gomobile

更新 :

Go 版本是:go 版本 go1.11.1 darwin/amd64

macos terminal gomobile

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

Android进度对话框仅更新消息,而不是条形和行

我将实现FTP下载功能.它可以工作,但是当涉及报告进度时,我只发现只有消息改变而不是数字和条形改变

我的屏幕截图如下

在此输入图像描述

以下是我的代码:

public void buttonExit(View v) {
    System.exit(1); 
}

public void doClick(View v){

    //ftp

    filename = null;
    filename = "giant.mp4";

    pd = new ProgressDialog(this);
    pd.setTitle("EOrder");
    pd.setMessage("Downloading file. Please wait...");
    pd.setIndeterminate(true);
    pd.setMax(100);
    pd.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
    pd.setProgress(0);
    pd.setCancelable(false);
    pd.show();

    ad = new AlertDialog.Builder(this);
    ad.setTitle("EOrder");
    ad.setMessage("Download Finish");
    ad.setNeutralButton("OK", null);

    new FTPDownload().execute(filename);
}

class FTPDownload extends AsyncTask<String , String , Void>{

    boolean running = true;

    Date today = Calendar.getInstance().getTime();    
    Format formatter = new SimpleDateFormat("yyyy-MM-dd_HH:mm:ss");
    String reportDate = formatter.format(today);


    String fileAndroid = reportDate + "_" + …
Run Code Online (Sandbox Code Playgroud)

user-interface android progressdialog android-asynctask

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

Android:ImageTIew onTouch Drag被ScrollView ontouch Event拦截

我正在使用scrollview中的imageview控制器.在实现和测试方面,我发现滚动总是覆盖onTouch事件而不是imageView(dragImage).

我尝试使用它来启用滚动

scv.setOnTouchListener(null);    
Run Code Online (Sandbox Code Playgroud)

这要禁用

scv.setOnTouchListener( new OnTouchListener(){ 
    @Override
    public boolean onTouch(View v, MotionEvent event) {
        return true; 
    }
});
Run Code Online (Sandbox Code Playgroud)

它显示了hatImage只拖动了一个非常小的动作而不是在我想要的地方拖动.当我触摸ImageView而不是scrollView时,你能告诉我禁用滚动的更好方法吗?

以下是我的工作:

public static class PlaceholderFragment extends Fragment   {



private static final String ARG_SECTION_NUMBER = "section_number";

    /**
     * Returns a new instance of this fragment for the given section number.
     */
    public static PlaceholderFragment newInstance(int sectionNumber) {
        PlaceholderFragment fragment = new PlaceholderFragment();
        Bundle args = new Bundle();
        args.putInt(ARG_SECTION_NUMBER, sectionNumber);
        fragment.setArguments(args);            
        return fragment;
    }




    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle …
Run Code Online (Sandbox Code Playgroud)

android ontouchlistener android-imageview android-scrollview

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

随机生成java唯一数字

我将实现独特的随机数生成器.但是在运行时,它有时会生成与之前相同的数字.在这种情况下如何确保生成的数字不重复?

以下是我的代码

    int refno = 0;

    SecureRandom r = new SecureRandom();
    refno = r.nextInt(999999999);
Run Code Online (Sandbox Code Playgroud)

java random int

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

Android游标错误:确保在从中访问数据之前正确初始化了Cursor

我将实现该方法来检索字符串的记录,但是当涉及到执行时,它会像Log cat所说的那样变成运行时错误.您能否告诉我们如何正确初始化光标?

logcat的

07-08 10:10:34.620: D/result(8036): true
07-08 10:10:34.660: D/memalloc(8036): ion: Unmapping buffer  base:0x57c06000 size:466944
07-08 10:10:34.660: D/memalloc(8036): ion: Unmapping buffer  base:0x57d6c000 size:466944
07-08 10:10:34.660: D/memalloc(8036): ion: Unmapping buffer  base:0x57cbb000 size:466944
07-08 10:10:34.710: D/debug(8036): Order 87318702
07-08 10:10:34.710: D/pcDbHelper(8036): pcDbHelper com.example.recordandmovie.PhotoDbAdapter@412cad30
07-08 10:10:34.841: W/CursorWindow(8036): Window is full: requested allocation 1249663 bytes, free space 398939 bytes, window size 2097152 bytes
07-08 10:10:34.931: W/CursorWindow(8036): Window is full: requested allocation 1249663 bytes, free space 398939 bytes, window size 2097152 bytes
07-08 10:10:34.941: D/debug …
Run Code Online (Sandbox Code Playgroud)

sqlite android cursor

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