小编Cec*_*oCQ的帖子

使用HttpWebRequest时保持会话

在我的项目中,我使用的是C#app客户端和tomcat6 Web应用程序服务器.我在C#客户端中编写了这个代码段:

public bool isServerOnline()
{
        Boolean ret = false;

        try
        {
            HttpWebRequest req = (HttpWebRequest)HttpWebRequest.Create(VPMacro.MacroUploader.SERVER_URL);
            req.Method = "HEAD";
            req.KeepAlive = false;
            HttpWebResponse resp = (HttpWebResponse)req.GetResponse();
            if (resp.StatusCode == HttpStatusCode.OK)
            {
                // HTTP = 200 - Internet connection available, server online
                ret = true;
            }
            resp.Close();
            return ret;

        }
        catch (WebException we)
        {
            // Exception - connection not available
            Log.e("InternetUtils - isServerOnline - " + we.Status);
            return false;
        }
}
Run Code Online (Sandbox Code Playgroud)

每次我调用此方法时,我都会在服务器端获得一个新会话.我想这是因为我应该在我的客户端使用HTTP cookie.但我不知道该怎么做,你能帮助我吗?

c# httpwebrequest session-cookies

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

Firebase动态链接始终返回CANCELED

我正在为我的应用使用动态链接.

我一步一步地按照教程,我可以通过点击Facebook上发布的链接打开应用程序.

但是当我调用getInvitation时,我总是将CANCELED作为AppInviteInvitationResult的状态.

    AppInvite.AppInviteApi.getInvitation(mGoogleApiClient, this, false).setResultCallback(
            new ResultCallback<AppInviteInvitationResult>() {
                @Override
                public void onResult(@NonNull AppInviteInvitationResult result) {
                    if (result.getStatus().isSuccess()) {
                        // Extract deep link from Intent
                        Intent intent = result.getInvitationIntent();
                        String deepLink = AppInviteReferral.getDeepLink(intent);

                        // [END_EXCLUDE]
                    } else {
                        Log.d("StartActivity", "getInvitation: no deep link found.");
                    }
                }
            });
Run Code Online (Sandbox Code Playgroud)

进入调试,我可以看到result.getStatus()返回CANCELED,但点击舔正确打开应用程序.

哪里我错了?

编辑:我正在使用的链接是:https://wft4z.app.goo.gl/? link = https://aqld.it/testlink/112972&al=aqld://test/about?params%3D17363&apn= com.project.mydeeplink

清单上的过滤器:

android deep-linking firebase firebase-dynamic-links

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

Android CoordinatorLayout 和嵌套片段问题

我有这个布局的主要活动:

<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_below="@id/toolbar_container">

    <android.support.design.widget.AppBarLayout
        android:id="@+id/appbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:fitsSystemWindows="true"
        android:elevation="0dp"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar">

        <android.support.design.widget.CollapsingToolbarLayout
            android:id="@+id/collapsing_toolbar"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fitsSystemWindows="true"
            app:titleEnabled="false"
            app:contentScrim="?attr/colorPrimary"
            app:layout_scrollFlags="scroll|enterAlways">

            <android.support.v7.widget.Toolbar
                android:id="@+id/toolbar"
                android:layout_width="match_parent"
                android:layout_height="?attr/actionBarSize"
                app:layout_collapseMode="pin"
                app:popupTheme="@style/ThemeOverlay.AppCompat.Light">

                <ImageView
                    android:layout_gravity="center"
                    app:srcCompat="@drawable/ic_logo_toolbar"
                    android:layout_width="100dp"
                    android:layout_height="?attr/actionBarSize" />

            </android.support.v7.widget.Toolbar>

        </android.support.design.widget.CollapsingToolbarLayout>

    </android.support.design.widget.AppBarLayout>

    <android.support.v4.widget.NestedScrollView
        android:id="@+id/myScrollingContent"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:layout_behavior="@string/appbar_scrolling_view_behavior"
        android:fillViewport="true">

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent">

            <RelativeLayout
                android:id="@+id/container_RL"
                android:layout_width="match_parent"
                android:layout_height="match_parent" />

        </FrameLayout>

    </android.support.v4.widget.NestedScrollView>

    <com.roughike.bottombar.BottomBar
        android:id="@+id/bottom_bar"
        android:layout_width="match_parent"
        android:layout_height="@dimen/bottom_bar_height"
        android:layout_gravity="bottom"
        android:background="@color/white"
        app:bb_activeTabColor="@color/colorPrimary"
        app:bb_behavior="shifting|shy"
        app:bb_inActiveTabColor="@color/black_54"
        app:bb_tabXmlResource="@xml/bottom_bar" />
</android.support.design.widget.CoordinatorLayout>
Run Code Online (Sandbox Code Playgroud)

我将 container_RL 替换为:

detailsFragment = DetailsFragment.newInstance(storeId);
getSupportFragmentManager().beginTransaction().replace(R.id.container_RL, detailsFragment).commit();
Run Code Online (Sandbox Code Playgroud)

现在工作正常。工具栏和底栏随着滚动行为正确移动。但是如果我在片段中添加一个 FloatingActionMenu :

<?xml …
Run Code Online (Sandbox Code Playgroud)

android android-fragments material-design android-coordinatorlayout

6
推荐指数
0
解决办法
617
查看次数

C#获取用户图片(阿凡达)

我指的是C# - 如何获取当前的用户图片,但我从未找到过解决方案.(我正在研究Win7 OS)

对于某些用户,图片位于

C:\ Users \用户名\ AppData \本地的\ Temp\UserName.bmp

(其中UserName是用户昵称)对于其他用户,此路径抛出FileNotFoundException,但图片存在.

在哪里可以找到有关路径或真实图片的信息?有一个包含此信息的注册表?

c# image windows-7

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

iText样式将HTML解析为PDF

我有iText的问题.

我已经关注此链接:如何将html页面导出为pdf格式?

我的片段:

    String str = "<html><head><body><div style=\"width:100%;height:100%;\"><h3 style=\"margin-left:5px;margin-top:40px\">First</h3><div style=\"margin-left:15px;margin-top:15px\"><title></title><p>sdasdasd shshshshdffgdfgd</p></div><h3 style=\"margin-left:5px;margin-top:40px\">The dream</h3><div style=\"margin-left:15px;margin-top:15px\"></div></div></body></head></html>";
    String fileNameWithPath = "/Users/cecco/Desktop/pdf2.pdf";


    com.itextpdf.text.Document document =
            new com.itextpdf.text.Document(com.itextpdf.text.PageSize.A4);
    FileOutputStream fos = new FileOutputStream(fileNameWithPath);
    com.itextpdf.text.pdf.PdfWriter pdfWriter =
            com.itextpdf.text.pdf.PdfWriter.getInstance(document, fos);

    document.open();

    document.addAuthor("Myself");
    document.addSubject("My Subject");
    document.addCreationDate();
    document.addTitle("My Title");

    com.itextpdf.text.html.simpleparser.HTMLWorker htmlWorker =
            new com.itextpdf.text.html.simpleparser.HTMLWorker(document);
    htmlWorker.parse(new StringReader(str.toString()));

    document.close();
    fos.close();
Run Code Online (Sandbox Code Playgroud)

工作正常.

但是不考虑将标签样式转换为h3和div.

在此输入图像描述

但是,如果我将我的html复制到http://htmledit.squarefree.com/,一切都是正确的.

我怎么解决这个问题?

html java pdf itext

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

iOS如何加载多个应用内商品

有没有办法在itunes connect仪表板上的应用内结算部分加载多个项目(例如使用像Android这样的.csv文件)?

itunesconnect ios in-app-billing

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

使用Windows搜索文件API

可能重复:
使用C#查询Windows文件索引服务

我如何以编程方式使用Windows搜索文件引擎?我正在使用Windows 7.

例:

在此输入图像描述

c# search file windows-7

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

Android默认选择器

在我的应用程序中,我使用此行夸大了ListView:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent" android:gravity="center"
    android:orientation="horizontal" android:layout_height="wrap_content"
    android:id="@+id/rootrow_layout" android:clickable="true"
    android:focusable="true" android:focusableInTouchMode="true">
    <LinearLayout android:layout_height="fill_parent"
        android:id="@+id/containerHistory" android:layout_width="fill_parent"
        android:layout_weight="1">
        <LinearLayout android:layout_weight="1"
            android:orientation="vertical" android:layout_gravity="center"
            android:layout_height="wrap_content" android:layout_width="wrap_content"
            android:layout_marginLeft="2dip">
            <LinearLayout android:id="@+id/LinearLayout02"
                android:layout_height="wrap_content" android:layout_width="fill_parent">
                <TextView android:textSize="16sp" android:gravity="left"
                    android:padding="5dp" android:layout_width="fill_parent"
                    android:text="Unknown location " android:id="@+id/historyLocation"
                    android:layout_height="wrap_content" android:textColor="#000000"></TextView>
            </LinearLayout>
            <LinearLayout android:id="@+id/LinearLayout03"
                android:layout_height="wrap_content" android:layout_width="fill_parent">
                <TextView android:layout_weight="1" android:textSize="12sp"
                    android:gravity="left" android:padding="5dp" android:layout_width="fill_parent"
                    android:text="Complete" android:typeface="serif" android:id="@+id/historyDate"
                    android:layout_height="wrap_content" android:textColor="#000000"></TextView>
            </LinearLayout>
            <LinearLayout android:id="@+id/LinearLayout04"
                android:layout_height="wrap_content" android:layout_width="wrap_content"></LinearLayout>
        </LinearLayout>
    </LinearLayout>
    <LinearLayout android:orientation="vertical"
        android:layout_marginRight="2dip" android:id="@+id/linearLayout1"
        android:layout_height="match_parent" android:layout_width="wrap_content">
        <CheckBox android:id="@+id/check" android:layout_gravity="center"
            android:layout_height="fill_parent" android:layout_width="wrap_content"></CheckBox>
    </LinearLayout>

</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

现在我将在我的根布局上添加一个事件(OnClickListener).我可以得到事件,但我看不到默认选择器(例如我有Galaxy S2,点击列表我有蓝色背景).

我可以在LinearLayout点击事件上设置默认选择器吗? …

android selector android-linearlayout

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