问:
How to define clean-css properties in Grunt to prevent 0% from being converted to 0
I am minifying my css file using the cssmin plugin in Grunt.
I have noticed the the background property getting optimised.
Gruntfile.js

```<code>cssmin: {
    options: {
      // ...
    },
    target: {
        files: [{
            expand: true,
            cwd: './htdocs/css/src',
            src: '**/*.css',
            dest: './htdocs/css/dist',
            ext: '.min.css'
        }]
    }
}
</code>```

.carousel {
    background: linear-gradient(70deg, #c12365 0%, #c72570 1%, #c12365 calc(0% + 1px), #c12365 40%, #404040 calc(20% + 1px), #404040 75%, #404040 calc(75% + 1px), #404040 100%);
    overflow: visible;
}
```

<p>The code I have written for achieve the background
But after running the grunt task runner the min file which gets generated has got optimised to </p>

<pre class="lang-css prettyprint-override"><code>.carousel{background:linear-gradient(70deg, #c12365 0, #c72570 1%, #c12365 calc(0 + 1px), #c12365 40%, #404040 calc(20% + 1px), #404040 75%, #404040 calc(75% + 1px), #404040 100%);overflow:visible}
</code>```

Note: cssmin converted the 0% value to 0 which makes the background different.

I have even read the document and tried to set the all level 1 and level 2 properties to false by as a option parameter

```<code>options: {
    level: {
        1: {
            all: false // set all values to `false`
        },
        2: {
            all: false // set all values to `false`
        }
    }
}
</code>```

Still not getting the desired result.

Can some1 help me out here

答:
Set the zeroUnits option to false in your cssmin task.

For instance:

cssmin: {
  options: {
    compatibility: {
      properties: {
        zeroUnits: false   // <------
      }
    }
  },
  target: {
    files: [{
      expand: true,
      cwd: './htdocs/css/src',
      src: '**/*.css',
      dest: './htdocs/css/dist',
      ext: '.min.css'
    }]
  }
}
```

<hr>

<p><strong>Result:</strong></p>

<pre class="lang-css prettyprint-override"><code>.carousel{background:linear-gradient(70deg,#c12365 0%,#c72570 1%,#c12365 calc(0% + 1px),#c12365 40%,#404040 calc(20% + 1px),#404040 75%,#404040 calc(75% + 1px),#404040 100%);overflow:visible}
</code>```

Note: the 0% values have been preserved.

Body:
I am minifying my css file using the cssmin plugin in Grunt.
I have noticed the the background property getting optimised.
Gruntfile.js

cssmin: {
    options: {
      // ...
    },
    target: {
        files: [{
            expand: true,
            cwd: './htdocs/css/src',
            src: '**/*.css',
            dest: './htdocs/css/dist',
            ext: '.min.css'
        }]
    }
}

.carousel {
    background: linear-gradient(70deg, #c12365 0%, #c72570 1%, #c12365 calc(0% + 1px), #c12365 40%, #404040 calc(20% + 1px), #404040 75%, #404040 calc(75% + 1px), #404040 100%);
    overflow: visible;
}

The code I have written for achieve the background
But after running the grunt task runner the min file which gets generated has got optimised to

.carousel{background:linear-gradient(70deg, #c12365 0, #c72570 1%, #c12365 calc(0 + 1px), #c12365 40%, #404040 calc(20% + 1px), #404040 75%, #404040 calc(75% + 1px), #404040 100%);overflow:visible}

Note: cssmin converted the 0% value to 0 which makes the background different.

I have even read the document and tried to set the all level 1 and level 2 properties to false by as a option parameter

options: {
    level: {
        1: {
            all: false // set all values to `false`
        },
        2: {
            all: false // set all values to `false`
        }
    }
}

Still not getting the desired result.

Can some1 help me out here

Body:
Set the zeroUnits option to false in your cssmin task.

For instance:

cssmin: {
  options: {
    compatibility: {
      properties: {
        zeroUnits: false   // <------
      }
    }
  },
  target: {
    files: [{
      expand: true,
      cwd: './htdocs/css/src',
      src: '**/*.css',
      dest: './htdocs/css/dist',
      ext: '.min.css'
    }]
  }
}

Result:

.carousel{background:linear-gradient(70deg,#c12365 0%,#c72570 1%,#c12365 calc(0% + 1px),#c12365 40%,#404040 calc(20% + 1px),#404040 75%,#404040 calc(75% + 1px),#404040 100%);overflow:visible}

Note: the 0% values have been preserved.


来源: stackexchange

问:
VerifyError: Verifier rejected class ... 'this' arg must be initialized
after third-party library upgrade I got a new crash on app launch:

```<code>java.lang.VerifyError: Verifier rejected class ly.img.android.e: void ly.img.android.e.<init>(java.lang.String, boolean) failed to verify: void ly.img.android.e.<init>(java.lang.String, boolean): [0x5C] 'this' arg must be initialized (declaration of 'ly.img.android.e' appears in base.apk!classes2.dex)
    at ly.img.android.b.<clinit>(Unknown Source:46)
    at ly.img.android.c.b(Unknown Source:0)
    at ly.img.android.PESDK.initSDK(Unknown Source:0)
    at ly.img.android.IMGLYAutoInit.onCreate(IMGLYAutoInit.java:41)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2092)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2066)
    at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)
</code>```

Yes, I know that there are a lot of similar problems there but I didn't find any solution or advise for me.

So, maybe someone there can provide hint or advise for me what's wrong there. Thanks

答:
I have a suggestion
Maybe it will help    </p>

```<code>android {

    defaultConfig {
       ...
        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}
</code>```

<p>and </p>

```<code> implementation 'com.android.support:multidex:1.0.0'
</code>```

ContentLicense: CC BY-SA 4.0

Body:
after third-party library upgrade I got a new crash on app launch:

java.lang.VerifyError: Verifier rejected class ly.img.android.e: void ly.img.android.e.<init>(java.lang.String, boolean) failed to verify: void ly.img.android.e.<init>(java.lang.String, boolean): [0x5C] 'this' arg must be initialized (declaration of 'ly.img.android.e' appears in base.apk!classes2.dex)
    at ly.img.android.b.<clinit>(Unknown Source:46)
    at ly.img.android.c.b(Unknown Source:0)
    at ly.img.android.PESDK.initSDK(Unknown Source:0)
    at ly.img.android.IMGLYAutoInit.onCreate(IMGLYAutoInit.java:41)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2092)
    at android.content.ContentProvider.attachInfo(ContentProvider.java:2066)
    at android.app.ActivityThread.installProvider(ActivityThread.java:6983)
    at android.app.ActivityThread.installContentProviders(ActivityThread.java:6528)

Yes, I know that there are a lot of similar problems there but I didn't find any solution or advise for me.

So, maybe someone there can provide hint or advise for me what's wrong there. Thanks

Body:
I have a suggestion
Maybe it will help

android {

    defaultConfig {
       ...
        // Enabling multidex support.
        multiDexEnabled true
    }
    ...
}

and

 implementation 'com.android.support:multidex:1.0.0'


问:
Query to check index on a table
I need a query to see if a table already has any indexes on it.</p>

答:
Simply you can find index name and column names of a particular table using below command

SP_HELPINDEX 'tablename'

It works for me

ContentLicense: CC BY-SA 3.0

Title: Query to check index on a table


问:
D3DXCreateTextureFromFile does not create texture
D3DXCreateTextureFromFile does not work for me, i get the D3DXERR_INVALIDDATA error when i use XorString and the D3DERR_INVALIDCALL when i don't.

if (Globals::User::g_pAvatar == nullptr)
{
    auto s_avatarFile = Globals::g_sAppdataFolder + "\\avatar.jpg";
    auto avatarFile = s_avatarFile.c_str();

    if (!fileExists(avatarFile))
    {
        download(Globals::User::g_sAvatarUrl.c_str(), avatarFile);
        D3DXCreateTextureFromFile(Globals::g_pD3DDevice, XorStr(avatarFile), Globals::User::g_pAvatar);
    }
    else if (fileExists(avatarFile)) {
        HRESULT hr = D3DXCreateTextureFromFile(Globals::g_pD3DDevice, XorStr(avatarFile), Globals::User::g_pAvatar);
        switch (hr) {
        case D3D_OK:
            break;
        case D3DERR_NOTAVAILABLE:
            MessageBox(0, "D3DERR_NOTAVAILABLE", "dx9", MB_OKCANCEL | MB_ICONHAND);
            break;
        case D3DERR_OUTOFVIDEOMEMORY:
            MessageBox(0, "D3DERR_OUTOFVIDEOMEMORY", "dx9", MB_OKCANCEL | MB_ICONHAND);
            break;
        case D3DERR_INVALIDCALL:
            MessageBox(0, "D3DERR_INVALIDCALL", "dx9", MB_OKCANCEL | MB_ICONHAND);
            break;
        case D3DXERR_INVALIDDATA:
            MessageBox(0, "D3DXERR_INVALIDDATA", "dx9", MB_OKCANCEL | MB_ICONHAND);
            break;
        case E_OUTOFMEMORY:
            MessageBox(0, "E_OUTOFMEMORY", "dx9", MB_OKCANCEL | MB_ICONHAND);
            break;
        }
    }
}
```

答:
The D3DX9 library is very old, and it used the filename extension to determine which codec to use for loading the image. Since you told it jpg it will only try to load it using jpeglib.

The D3DX10 and D3DX11 libraries use Windows Imaging Component (WIC) which relies on a file inspection technique, so it wouldn't care what the physical file-name is. You can find a modern DDSTextureLoader, WICTextureLoader, and ScreenGrab for legacy DX9 here which does not require D3DX9 at all.

D3DX9 includes codecs for BMP, JPG, PNG, TGA, HDR, and PPM/PFM. D3DX10/D3DX11 via WIC supports BMP, GIF, JPG, PNG, TIFF, and HDPhoto (JPEG-XR). They both included support for DDS as well.

DirectXTex includes a codec for TGA and HDR because they are common source texture formats, but are not supported by any built-in WIC codec. The DirectXTex implementation of HDR recognizes both ?RADIANCE and ?RGBE headers, but D3DX9 only supported ?RADIANCE.

Note that D3DX9, D3DX10, and D3DX11 are all deprecated (see Microsoft Docs) along with the DirectX SDK itself.


问:
How can I center a splash image and text below that in Android?
I have a splash screen looking like this. How can I change the XAML so that the image and the text are moved up.  Currently they are in the area surrounded by the red outline and I would like to move them up to the area surrounded by the blue outline?

```<code><ImageView
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:src="@drawable/splash_image"
    android:layout_gravity="center"
    android:layout_marginBottom="20.0dp"
   />

<TextView
    android:id="@+id/txtAppVersion"
    android:text="XXX"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textColor="#fff"
    android:textSize="30sp"
    android:layout_gravity="center"
    android:layout_marginBottom="100.0dp"/>
</code>```

答:
You can put both the ImageView and TextView in a vertical Linear Layout and use set the gravity to center. Then you can move the layout in vertical direction by using android:translationY="-xxdp"(Replace the xx with your value). Remember to put a '-' (minus) sign if you want to move it up.

```<code>    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_gravity="center"
        android:translationY="-xxdp">

      <ImageView
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:src="@drawable/splash_image"
        android:layout_gravity="center"/>

      <TextView
        android:id="@+id/txtAppVersion"
        android:text="XXX"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#fff"
        android:textSize="30sp"
        android:layout_gravity="center"/>

    </LinearLayout>
</code>```

Hope this helps

Body:
I have a splash screen looking like this. How can I change the XAML so that the image and the text are moved up.  Currently they are in the area surrounded by the red outline and I would like to move them up to the area surrounded by the blue outline?

<ImageView
    android:layout_width="100dp"
    android:layout_height="100dp"
    android:src="@drawable/splash_image"
    android:layout_gravity="center"
    android:layout_marginBottom="20.0dp"
   />

<TextView
    android:id="@+id/txtAppVersion"
    android:text="XXX"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:textColor="#fff"
    android:textSize="30sp"
    android:layout_gravity="center"
    android:layout_marginBottom="100.0dp"/>

Body:
You can put both the ImageView and TextView in a vertical Linear Layout and use set the gravity to center. Then you can move the layout in vertical direction by using android:translationY="-xxdp"(Replace the xx with your value). Remember to put a '-' (minus) sign if you want to move it up.

    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:layout_gravity="center"
        android:translationY="-xxdp">

      <ImageView
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:src="@drawable/splash_image"
        android:layout_gravity="center"/>

      <TextView
        android:id="@+id/txtAppVersion"
        android:text="XXX"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textColor="#fff"
        android:textSize="30sp"
        android:layout_gravity="center"/>

    </LinearLayout>

Hope this helps


问:
Multiple documents update in couchbase
What is the best way to update multiple documents in couchbase in one go?

Means I have to update similar kind of information in multiple couchbase documents. The simple way is fetching all these documents in java and then updating them, which is not a good solution.

Does couchbase provide some kind of functionality or API, which can be used? Given that, the document structure of all these documents is the same.

We have searched the couchbase website but nothing is available.

Thanks.

答:
When We want to update multiple document in couchbase it's possible but when something happened in between the transaction (any exception) then couchbase not supporting rollback mechanism.

For this you have to use :
Couchbase Transactions

For Spring boot developers:
Spring Boot data with Couchbase Transactions

Title: Multiple documents update in couchbase


问:
How Apache Kafka maintain order when it sends multiple messages to broker in parallel?
By default, max.in.flight.requests.per.connection == 5, means Kafka will send up to 5 messages to broker in parallel. How can it manage the order if those message go into the same partition in parallel?

答:
Kafka cannot guarantee ordering of those messages if you set retries > 0.

If you want to have ordering guarantees you need to set this value to max.in.flight.requests.per.connection == 1.

The explanation is given in the Kafka doc on producer configs retries:

Allowing retries without setting max.in.flight.requests.per.connection to 1 will potentially change the ordering of records because if two batches are sent to a single partition, and the first fails and is retried but the second succeeds, then the records in the second batch may appear first.


问:
React Navigation 5 , Moving screen to different navigator
still try to understand about multiple navigator here.

Basically i have 2 navigator, one rootnavigator for login page, and the appnavigator for any screen after login, below is the app.js

import * as React from 'react';
import { Button } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

import LoginScreen from './src/pages/auth/Login';
import HomeScreen from './src/pages/auth/Home';
import MemoryScreen from './src/pages/games/Memory';

const AppStack = createStackNavigator();
const RootStack = createStackNavigator();

function HomeNavigator() {
  return (
    <AppStack.Navigator mode="modal" initialRouteName="Login" screenOptions={({ route, navigation }) => ({
      headerStyle: {
        backgroundColor: '#f4511e',
      },
      headerRight: () => (
        <Button
          onPress={() => navigation.navigate('Login')}
          title="Logout"
          color="#fff"
        />
      ),
      headerTintColor: '#fff',
      headerTitleStyle: {
        fontWeight: 'bold',
      },
    })}>
      <AppStack.Screen
        name="Home"
        component={HomeScreen}
        options={{
          title: 'Simple Scorecard',
        }}
      />
      <AppStack.Screen
        name="Memory"
        component={MemoryScreen}
        options={{
          title: 'Memory Games',
        }} />
    </AppStack.Navigator>
  );
}

export default function App() {
  return (
    <NavigationContainer>
      <RootStack.Navigator initialRouteName="Login">
        <RootStack.Screen
          name="Login"
          component={LoginScreen}
          options={{
            title: 'Simple Scorecard',
          }} />
        <RootStack.Screen name="App" component={HomeNavigator} />
      </RootStack.Navigator>
    </NavigationContainer>
  );
}```
</div>
</div>
</p>

<p>From login page i try to move to home screen like below . (Login.js)</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>import React, { Component } from 'react';
import { Button, TextInput, View, StyleSheet } from 'react-native';

export default class Login extends Component {
    constructor(props) {
        super(props);
        this.state = {
            username: '',
            password: '',
        };
    }

    onLogin({ navigation }) {
        const { username, password } = this.state;
        // navigation.navigate('HomeNavigator', {
        //     screen: 'Home',
        //   })
        this.props.navigation.navigate('HomeNavigator', {
            screen: 'Home',
          })
    }

    render() {
        return (
            <View style={styles.container}>
                <TextInput
                    value={this.state.username}
                    onChangeText={(username) => this.setState({ username })}
                    placeholder={'Username'}
                    style={styles.input}
                />
                <TextInput
                    value={this.state.password}
                    onChangeText={(password) => this.setState({ password })}
                    placeholder={'Password'}
                    secureTextEntry={true}
                    style={styles.input}
                />

                <Button
                    title={'Login'}
                    style={styles.input}
                    onPress={this.onLogin.bind(this)}
                />
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: '#ecf0f1',
    },
    input: {
        width: 200,
        height: 44,
        padding: 10,
        borderWidth: 1,
        borderColor: 'black',
        marginBottom: 10,
    },
});</code>```

Problem is, i can't navigate to home page, error notice below :

The action 'NAVIGATE' with payload {"name":"HomeNavigator","params":{"screen":"Home"}} was not handled by any navigator.

Do you have a screen named 'HomeNavigator'?

May i know how to solve this?
Thanks

答:
Replace this line

```<code> onLogin({ navigation }) {
    const { username, password } = this.state;
    // navigation.navigate('HomeNavigator', {
    //     screen: 'Home',
    //   })
    this.props.navigation.navigate('HomeNavigator', {
        screen: 'Home',
      })
}
</code>```

by

```<code> onLogin({ navigation }) {
    const { username, password } = this.state;
    // navigation.navigate('HomeNavigator', {
    //     screen: 'Home',
    //   })
    this.props.navigation.navigate('App', {
        screen: 'Home',
      })
}
</code>```

OR you can do vice versa:-
change

```<code> <RootStack.Screen name="App" component={HomeNavigator} />
</code>```

to this

```<code> <RootStack.Screen name="HomeNavigator" component={HomeNavigator} />
</code>```

You call it by what is in name, not in component.

But I will recommend you to see this example because that can be optimal way to switch before and after login.

Hope it helps!!!

Body:
still try to understand about multiple navigator here.

Basically i have 2 navigator, one rootnavigator for login page, and the appnavigator for any screen after login, below is the app.js

import * as React from 'react';
import { Button } from 'react-native';
import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';

import LoginScreen from './src/pages/auth/Login';
import HomeScreen from './src/pages/auth/Home';
import MemoryScreen from './src/pages/games/Memory';

const AppStack = createStackNavigator();
const RootStack = createStackNavigator();

function HomeNavigator() {
  return (
    <AppStack.Navigator mode="modal" initialRouteName="Login" screenOptions={({ route, navigation }) => ({
      headerStyle: {
        backgroundColor: '#f4511e',
      },
      headerRight: () => (
        <Button
          onPress={() => navigation.navigate('Login')}
          title="Logout"
          color="#fff"
        />
      ),
      headerTintColor: '#fff',
      headerTitleStyle: {
        fontWeight: 'bold',
      },
    })}>
      <AppStack.Screen
        name="Home"
        component={HomeScreen}
        options={{
          title: 'Simple Scorecard',
        }}
      />
      <AppStack.Screen
        name="Memory"
        component={MemoryScreen}
        options={{
          title: 'Memory Games',
        }} />
    </AppStack.Navigator>
  );
}

export default function App() {
  return (
    <NavigationContainer>
      <RootStack.Navigator initialRouteName="Login">
        <RootStack.Screen
          name="Login"
          component={LoginScreen}
          options={{
            title: 'Simple Scorecard',
          }} />
        <RootStack.Screen name="App" component={HomeNavigator} />
      </RootStack.Navigator>
    </NavigationContainer>
  );
}

From login page i try to move to home screen like below . (Login.js)

import React, { Component } from 'react';
import { Button, TextInput, View, StyleSheet } from 'react-native';

export default class Login extends Component {
    constructor(props) {
        super(props);
        this.state = {
            username: '',
            password: '',
        };
    }

    onLogin({ navigation }) {
        const { username, password } = this.state;
        // navigation.navigate('HomeNavigator', {
        //     screen: 'Home',
        //   })
        this.props.navigation.navigate('HomeNavigator', {
            screen: 'Home',
          })
    }

    render() {
        return (
            <View style={styles.container}>
                <TextInput
                    value={this.state.username}
                    onChangeText={(username) => this.setState({ username })}
                    placeholder={'Username'}
                    style={styles.input}
                />
                <TextInput
                    value={this.state.password}
                    onChangeText={(password) => this.setState({ password })}
                    placeholder={'Password'}
                    secureTextEntry={true}
                    style={styles.input}
                />

                <Button
                    title={'Login'}
                    style={styles.input}
                    onPress={this.onLogin.bind(this)}
                />
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        alignItems: 'center',
        justifyContent: 'center',
        backgroundColor: '#ecf0f1',
    },
    input: {
        width: 200,
        height: 44,
        padding: 10,
        borderWidth: 1,
        borderColor: 'black',
        marginBottom: 10,
    },
});

Problem is, i can't navigate to home page, error notice below :

The action 'NAVIGATE' with payload {"name":"HomeNavigator","params":{"screen":"Home"}} was not handled by any navigator.

Do you have a screen named 'HomeNavigator'?

May i know how to solve this?
Thanks

Body:
Replace this line

 onLogin({ navigation }) {
    const { username, password } = this.state;
    // navigation.navigate('HomeNavigator', {
    //     screen: 'Home',
    //   })
    this.props.navigation.navigate('HomeNavigator', {
        screen: 'Home',
      })
}

by

 onLogin({ navigation }) {
    const { username, password } = this.state;
    // navigation.navigate('HomeNavigator', {
    //     screen: 'Home',
    //   })
    this.props.navigation.navigate('App', {
        screen: 'Home',
      })
}

OR you can do vice versa:-
change

 <RootStack.Screen name="App" component={HomeNavigator} />

to this

 <RootStack.Screen name="HomeNavigator" component={HomeNavigator} />

You call it by what is in name, not in component.

But I will recommend you to see this example because that can be optimal way to switch before and after login.

Hope it helps!!!


问:
How to design Login use MVVM+Databinding in android studio?
I am a newcomer and have no programming experience. Now I use CODELABS.developer.google.com and developer.android.com to learn java +android, but I have encountered problems when designing the "login" module. This problem has taken me 3 days. I search for solutions on Google every day, but I still haven't solved it.

Error:

```<code>C:\Users\Admin\AndroidStudioProjects\exmaple\app\build\generated\data_binding_base_class_source_out\debug\out\com\exmaple\databinding\FragmentEmailEditBinding.java:15: ����: �Ҳ�������
import com.exmaple.ViewModel;
                  ^
  ����:   �� ViewModel
  λ��: ����� com.exmaple

C:\Users\Admin\AndroidStudioProjects\exmaple\app\build\generated\data_binding_base_class_source_out\debug\out\com\exmaple\databinding\FragmentEmailEditBinding.java:33: ����: �����ViewModel.Login������
  protected ViewModel.Login.EmailAuthViewModel mEmailAuthViewModel;
                           ^
</code>```

LoginActivity.java

```<code>public class LoginActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        FragmentEmailEditBinding binding = DataBindingUtil.setContentView(this,R.layout.fragment_email_edit);
        EmailAuthViewModel emailAuthViewModel = new ViewModelProvider(this).get(EmailAuthViewModel.class);
        binding.getEmailAuthViewModel();
        binding.setLifecycleOwner(this);

        FragmentManager fragmentManager = getSupportFragmentManager();
        EmailAuthFragment emailAuthFragment = new EmailAuthFragment();
        fragmentManager.beginTransaction()
                .add(R.id.frag_signIn,emailAuthFragment).commit();
    }
}
</code>```

fragment_email_edit.xml

```<code><layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <data>
        <variable
            name="emailAuthViewModel"
            type="com.example.ViewModel.Login.EmailAuthViewModel" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="8dp">

        <EditText
            android:id="@+id/fieldEmail"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:hint="@string/hint_email"
            android:inputType="textEmailAddress"
            android:text="@={emailAuthViewModel.email}"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintBottom_toTopOf="@id/fieldPassword"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.25"
            app:layout_constraintVertical_chainStyle="packed" />

        <EditText
            android:id="@+id/fieldPassword"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:hint="@string/hint_password"
            android:inputType="textPassword"
            android:text="@{emailAuthViewModel.password}"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/fieldEmail"
            app:layout_constraintVertical_bias="0.25"
            app:layout_constraintVertical_chainStyle="packed" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>
</code>```

EmailAuthViewModel.java

```<code>public class EmailAuthViewModel extends ViewModel {

    public MutableLiveData<String> email = new MutableLiveData<>();
    public MutableLiveData<String> password = new MutableLiveData<>();

    public EmailAuthViewModel(MutableLiveData<String> email, MutableLiveData<String> password) {
        this.email = email;
        this.password = password;
    }
}
</code>```

EmailAuthModel.java

```<code>class EmailAuthModel {

}
</code>```

答:
Did you try renaming your package "ViewModel" to "viewmodel"? Because "ViewModel" is the name of one of the default classes.

And I also found a strangeness in your package, In the error "com.exmaple" but in your layout file use "com.example".

Body:
I am a newcomer and have no programming experience. Now I use CODELABS.developer.google.com and developer.android.com to learn java +android, but I have encountered problems when designing the "login" module. This problem has taken me 3 days. I search for solutions on Google every day, but I still haven't solved it.

Error:

C:\Users\Admin\AndroidStudioProjects\exmaple\app\build\generated\data_binding_base_class_source_out\debug\out\com\exmaple\databinding\FragmentEmailEditBinding.java:15: ����: �Ҳ�������
import com.exmaple.ViewModel;
                  ^
  ����:   �� ViewModel
  λ��: ����� com.exmaple

C:\Users\Admin\AndroidStudioProjects\exmaple\app\build\generated\data_binding_base_class_source_out\debug\out\com\exmaple\databinding\FragmentEmailEditBinding.java:33: ����: �����ViewModel.Login������
  protected ViewModel.Login.EmailAuthViewModel mEmailAuthViewModel;
                           ^

LoginActivity.java

public class LoginActivity extends AppCompatActivity {
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);

        FragmentEmailEditBinding binding = DataBindingUtil.setContentView(this,R.layout.fragment_email_edit);
        EmailAuthViewModel emailAuthViewModel = new ViewModelProvider(this).get(EmailAuthViewModel.class);
        binding.getEmailAuthViewModel();
        binding.setLifecycleOwner(this);

        FragmentManager fragmentManager = getSupportFragmentManager();
        EmailAuthFragment emailAuthFragment = new EmailAuthFragment();
        fragmentManager.beginTransaction()
                .add(R.id.frag_signIn,emailAuthFragment).commit();
    }
}

fragment_email_edit.xml

<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">
    <data>
        <variable
            name="emailAuthViewModel"
            type="com.example.ViewModel.Login.EmailAuthViewModel" />
    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_margin="8dp">

        <EditText
            android:id="@+id/fieldEmail"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:hint="@string/hint_email"
            android:inputType="textEmailAddress"
            android:text="@={emailAuthViewModel.email}"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintBottom_toTopOf="@id/fieldPassword"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toTopOf="parent"
            app:layout_constraintVertical_bias="0.25"
            app:layout_constraintVertical_chainStyle="packed" />

        <EditText
            android:id="@+id/fieldPassword"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_margin="8dp"
            android:hint="@string/hint_password"
            android:inputType="textPassword"
            android:text="@{emailAuthViewModel.password}"
            app:layout_constraintBottom_toBottomOf="parent"
            app:layout_constraintEnd_toEndOf="parent"
            app:layout_constraintStart_toStartOf="parent"
            app:layout_constraintTop_toBottomOf="@+id/fieldEmail"
            app:layout_constraintVertical_bias="0.25"
            app:layout_constraintVertical_chainStyle="packed" />
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

EmailAuthViewModel.java

public class EmailAuthViewModel extends ViewModel {

    public MutableLiveData<String> email = new MutableLiveData<>();
    public MutableLiveData<String> password = new MutableLiveData<>();

    public EmailAuthViewModel(MutableLiveData<String> email, MutableLiveData<String> password) {
        this.email = email;
        this.password = password;
    }
}

EmailAuthModel.java

class EmailAuthModel {

}


问:
CGI/FastCGI Request variable error?
Hi I recently updated mysites working file to a CGI/FastCGI server.
It have some request variable section to process.

oldsite.com/myfile.php?link=http://google.com [Working fine in apache]

oldsite.com/myfile.php?link=http://google [Working fine in apache]

oldsite.com/myfile.php?link=http://google.com [Not Working in CGI/FastCGI ]

oldsite.com/myfile.php?link=http://google [Working in CGI/FastCGI ]

any one know what was wrong in  CGI/FastCGI???

答:
I would allege that you also enabled mod_security. Look into the error.log. It would tell you the exact error condition. (Add the error message to your question!)

The ?link= parameter is not a significant name in the CGI environment. It might however be blacklisted by the mod_security CoreRules. (Run into the very same URL blocking issue before.)

Title: CGI/FastCGI Request variable error?


问:
Auto generating files by flutter run
Each time I run my project GitKraken detects 6 files which I didn't add as you can see

What is the reason for regenerating these files each time I run the project and how to solve it?

答: You should add **/android/.gradle to your .gitignore. For a detailed example for flutter check https://stackoverflow.com/a/55991978/6704033

Title: Auto generating files by flutter run


问:
Replacing one percent symbol with two in Python?
I'm trying to clean up strings containing percent symbols. What I intend do is replace each % with %%!

When I use my_string.replace("%", "%%"), it works out fine in Python 3.
However, when I do the same in Python 2.7 and print the result (using the future print function), it simply prints the original string. I guess this happens, because %% is commonly used to escape the percent symbol in strings?

What would be a viable workaround for Python 2.7? I'm parsing FFmpeg commands, and single percent symbols are forbidden, since FFmpeg uses %dto indentify number sequences in filenames of image sequences.

Thanks.

答:
Using python 2.7 this is an example to replace % by %%:

```<code>import string
str = "replace % "
str = string.replace(str, "%","%%")
print "Result:",str
</code>```

The result is:

```<code>Result: replace %%
</code>```

Body:
Using python 2.7 this is an example to replace % by %%:

import string
str = "replace % "
str = string.replace(str, "%","%%")
print "Result:",str

The result is:

Result: replace %%


问:
How to remove this cronjob in ubuntu
I'm running a webserver with PLESK and installed an extension 'kernel care' which I later on deleted. However, it installed a cronjob which sends me a mail every 4 hours:

```<code>Cron <root@server> /usr/bin/kcarectl --auto-update
Unknown Kernel (Ubuntu 3.13.0-042stab123.9)
</code>```

I ssh into the server and run crontab -l as root but don't see the specific cronjob. However, in /etc/cron.d there is a file kcare-cron and if I cat this file it shows

```<code>16 */4  * * * root /usr/bin/kcarectl --auto-update
</code>```

So thats the one I want to delete. Can I just delete the file kcare-cron?

答:
If you check file

```<code>/etc/cron.allow
</code>```

and see if accounts other than root exist, if there is then su to those accounts and try all the suggested actions above.

Title: How to remove this cronjob in ubuntu

Body:
I'm running a webserver with PLESK and installed an extension 'kernel care' which I later on deleted. However, it installed a cronjob which sends me a mail every 4 hours:

Cron <root@server> /usr/bin/kcarectl --auto-update
Unknown Kernel (Ubuntu 3.13.0-042stab123.9)

I ssh into the server and run crontab -l as root but don't see the specific cronjob. However, in /etc/cron.d there is a file kcare-cron and if I cat this file it shows

16 */4  * * * root /usr/bin/kcarectl --auto-update

So thats the one I want to delete. Can I just delete the file kcare-cron?

Body:
If you check file

/etc/cron.allow

and see if accounts other than root exist, if there is then su to those accounts and try all the suggested actions above.