小编med*_*tat的帖子

插入MySQL时出现DateTime错误

我在将以下数据插入MySQL时出现错误.我该如何解决?

错误1292:日期时间值不正确:'17/07/2013 18:33:55'第1行的'TimeStamp'列

SQL语句:

INSERT INTO `wngtest`.`sitereading` (`idSiteReading`, `TimeStamp`, `SiteLocation`, `Flow`, `Temperature1`, `Temperature2`) VALUES ('1', '17/07/2013 18:33:55', 'WNGSite1', '13.1', '81', '45')
Run Code Online (Sandbox Code Playgroud)

错误1292:日期时间值不正确:'17/07/2013 18:18:53'第1行的'TimeStamp'列

SQL语句:

INSERT INTO `wngtest`.`sitereading` (`idSiteReading`, `TimeStamp`, `SiteLocation`, `Flow`, `Temperature1`, `Temperature2`) VALUES ('2', '17/07/2013 18:18:53', 'WNGSite1', '13', '80', '45')
Run Code Online (Sandbox Code Playgroud)

ERROR 1292:日期时间值不正确:'17/07/2013 18:03:54'第1行的'TimeStamp'列

SQL语句:

INSERT INTO `wngtest`.`sitereading` (`idSiteReading`, `TimeStamp`, `SiteLocation`, `Flow`, `Temperature1`, `Temperature2`) VALUES ('3', '17/07/2013 18:03:54', 'WNGSite1', '12.7', '80', '45')
Run Code Online (Sandbox Code Playgroud)

错误1292:日期时间值不正确:'17/07/2013 17:48:54'第1行的'TimeStamp'列

SQL语句:

INSERT INTO `wngtest`.`sitereading` (`idSiteReading`, `TimeStamp`, `SiteLocation`, `Flow`, `Temperature1`, `Temperature2`) VALUES ('4', '17/07/2013 17:48:54', 'WNGSite1', '12.7', …
Run Code Online (Sandbox Code Playgroud)

mysql insert

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

如何制作横向ContextMenu?

我已经打了一个Activity电话Accounts,我想添加一个横向ContextMenu.这可能看起来像剪切,复制和粘贴选项.有没有办法onLongClick在列表项上添加这个水平自定义菜单?

这是我到目前为止所得到的.

@Override      
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    LayoutInflater inflater = getLayoutInflater().from(this);
    View view = inflater.inflate(R.layout.custom_listview, null, false);
    menu.setHeaderView(view);
    menu.add("Delete");
    menu.add("Edit");
}

@Override
public boolean onContextItemSelected(MenuItem item) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
    int position = info.position;
    View v = listView.getChildAt(position);
    TextView typeTv = v.findViewById(R.id.custom_listview_type);
    TextView userTv = v.findViewById(R.id.custom_listview_user);
    TextView passTv = v.findViewById(R.id.custom_listview_password);

    if (item.getTitle().equals("Delete")) {
        db.execSQL("delete from user_added_accounts where accountType = '" + typeTv.getText().toString() …
Run Code Online (Sandbox Code Playgroud)

java android contextmenu

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

如何在 Firebase 中将 emailAndPasswordAuth 与 PhoneAuth 合并?

我正在尝试首先使用 登录用户Email and Password,然后在它之后,我也想要user's Phone Number。所以我所做的我首先使用他EmailAndPasswordAuth的一个活动(自定义登录)对用户进行了签名,然后,我在下一个活动中通过他的电话号码登录了用户。但由于它成为同一部手机上的两个帐户,我想将这些谷歌和手机凭据合并为一个帐户。

然后我尝试关注https://firebase.google.com/docs/auth/android/account-linking,但它给了我例外。

com.google.firebase.FirebaseException:用户已经链接到给定的提供者。

PhoneAuthActivity.java

String email = intent.getStringExtra("email");
    String password = intent.getStringExtra("pass");

    Toast.makeText(this, "Email" + email + "Password" + password, Toast.LENGTH_SHORT).show();// this is working

    emailCredential = EmailAuthProvider.getCredential(email, password);

    mPhoneNumberField = findViewById(R.id.field_phone_number);
    mVerificationField = findViewById(R.id.field_verification_code);

    mStartButton = findViewById(R.id.button_start_verification);
    mVerifyButton = findViewById(R.id.button_verify_phone);
    mResendButton = findViewById(R.id.button_resend);

    mStartButton.setOnClickListener(this);
    mVerifyButton.setOnClickListener(this);
    mResendButton.setOnClickListener(this);

    mAuth = FirebaseAuth.getInstance();
    mCallbacks = new PhoneAuthProvider.OnVerificationStateChangedCallbacks() {
        @Override
        public void onVerificationCompleted(PhoneAuthCredential credential) {
            Log.d(TAG, "onVerificationCompleted:" + credential);
            signInWithPhoneAuthCredential(credential);
        }

        @Override …
Run Code Online (Sandbox Code Playgroud)

android firebase firebase-authentication firebaseui

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

如何为 Flutter 中的 PopUpMenuButton 设置高度?

我正在尝试创建一个PopupMenuButton. 我已经使用了PopupMenuButton class.

PopupMenuButton(
  padding: EdgeInsets.only(right: 8.0),
  offset: Offset(-16, 0),
  child: Container(
    decoration: BoxDecoration(
        color: Colors.orange,
        borderRadius: BorderRadius.all(
          Radius.circular(16.0),
        )),
    padding: EdgeInsets.symmetric(vertical: 8.0, horizontal: 12.0),
    child: Text(
      "Category",
      style: TextStyle(color: Colors.white),
    ),
  ),
  itemBuilder: (_) => <PopupMenuItem<String>>[
    new PopupMenuItem<String>(
        //I want this context to be scrollable with some fixed height on the screen
        child: Row(
          children: <Widget>[
            Icon(Icons.arrow_right),
            Text("Dairy & Bakery")
          ],
        ),
        value: '1'),
  ],
)
Run Code Online (Sandbox Code Playgroud)

我曾尝试实施,PreferredSizeWidget但没有在PopupMenuButton.

popupmenu flutter

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

如何在 Flutter 中使下拉标签和下拉列表文本具有不同的颜色?

我正在尝试使用下拉菜单,并希望用于Colors.white所选文本和Colors.black54下拉列表的文本。但是当我尝试使用color属性并将其更改为白色时,它也会更改下拉文本的颜色。

DropdownButton<String>(
                    //this changed the color of both text, intial text as well dropdown text color
                    dropdownColor: Colors.white,
                    value: value,
                    style: TextStyle(color: Colors.white),
                    icon: CircleAvatar(
                      radius: 12,
                      backgroundColor: Colors.white,
                      child: Icon(Icons.arrow_drop_down),
                    ),
                    items: places.map((String value) {
                      return new DropdownMenuItem<String>(
                        value: value,
                        child: new Text(
                          value,
                         //I tried giving text style here , but same result 
                          style: TextStyle(color: Colors.white),
                        ),
                      );
                    }).toList(),
                    onChanged: (_) {
                      setState(() {
                        value = _;
                      });
                    },
                  )
Run Code Online (Sandbox Code Playgroud)

这是它的图片。

在此输入图像描述 在此输入图像描述

flutter flutter-layout

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

如何使用flutter中的retrofit在dio api调用中设置responseType?

我正在尝试在对 的 API 调用之一中设置响应类型bytes,但在改造中我没有找到任何设置响应类型的选项。

我使用 dio 作为 http 客户端。

  @GET(API.blah_blah)
  // I want to set the response Type I want to get, instead of json I need bytes
  Future<dynamic> getSomething();
Run Code Online (Sandbox Code Playgroud)

生成的文件中类似这样的内容。

   final _result = await _dio.request('some api url',
    queryParameters: queryParameters,
    options: RequestOptions(
        method: 'GET',
         // responseType: ResponseType.bytes,// this I have manually added
        extra: _extra,
        baseUrl: baseUrl),
    data: _data);
Run Code Online (Sandbox Code Playgroud)

retrofit flutter dio

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

使用 RestTemplate 将 JSON 映射到对象

我编写了货币转换器程序,它JSONapi.fixer.io、映射对象中读取并创建选定汇率的简单数据集。我的程序运行良好,直到我停止使用Jackson解析和映射对象并将其替换为RestTemplate. 它可以很好地读取基础货币和日期,但不能很好地读取Rates子对象。为什么?

我的代码: Currency类:

package com.github.gromo13.currencyConverter.model.util;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

@JsonIgnoreProperties(ignoreUnknown = true)
public class Currency {
    private String base;
    private String date;
    private Rates rates;

    public Currency() {

    }

    public String getBase() {
        return this.base;
    }

    public void setBase(String base) {
        this.base = base;
    }

    public String getDate() {
        return this.date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public Rates getRates() {
        return this.rates;
    }

    public void …
Run Code Online (Sandbox Code Playgroud)

java spring json spring-mvc resttemplate

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