text:
Q: Android Espresso UI test - Test running failed: Instrumentation run failed due to 'java.lang.IllegalAccessError' I faced with the following problem:
When i trying to start a stand-alone UI test using Espresso i always get the following console error message without the running the test.
Test running startedTest running failed: Instrumentation run failed due to 'java.lang.IllegalAccessError'
Empty test suite.

So i tried to run command:
 gradle -q dependencies

And i obtained the following result:
androidTestCompile - Classpath for compiling the androidTest sources.
+--- com.android.support:support-annotations:23.0.1
+--- com.android.support.test:runner:0.3
|    +--- com.android.support.test:exposed-instrumentation-api-publish:0.3
|    +--- junit:junit:4.12
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    \--- com.android.support:support-annotations:22.2.0 -> 23.0.1
+--- com.android.support.test:rules:0.3
|    \--- com.android.support.test:runner:0.3 (*)
+--- com.android.support.test.espresso:espresso-core:2.1 -> 2.2
|    +--- com.android.support.test.espresso:espresso-idling-resource:2.2
|    +--- com.squareup:javawriter:2.1.1
|    +--- javax.inject:javax.inject:1
|    +--- org.hamcrest:hamcrest-library:1.3
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    +--- com.android.support.test:rules:0.3 (*)
|    +--- org.hamcrest:hamcrest-integration:1.3
|    |    \--- org.hamcrest:hamcrest-library:1.3 (*)
|    +--- com.google.code.findbugs:jsr305:2.0.1
|    +--- javax.annotation:javax.annotation-api:1.2
|    \--- com.android.support.test:runner:0.3 (*)
+--- com.android.support.test.espresso:espresso-intents:2.2
|    \--- com.android.support.test.espresso:espresso-core:2.2 (*)
+--- com.android.support.test.espresso:espresso-web:2.2
|    +--- org.ccil.cowan.tagsoup:tagsoup:1.2
|    +--- com.android.support:support-annotations:22.2.0 -> 23.0.1
|    \--- com.android.support.test.espresso:espresso-core:2.2 (*)
+--- com.android.support.test.uiautomator:uiautomator-v18:2.1.1
+--- com.android.support.test.espresso:espresso-contrib:2.2
|    +--- com.google.android.apps.common.testing.accessibility.framework:accessibility-test-framework:2.0
|    |    \--- org.hamcrest:hamcrest-core:1.3
|    +--- com.android.support:support-v4:22.2.0
|    |    \--- com.android.support:support-annotations:22.2.0 -> 23.0.1
|    +--- com.android.support:recyclerview-v7:22.2.0
|    |    +--- com.android.support:support-annotations:22.2.0 -> 23.0.1
|    |    \--- com.android.support:support-v4:22.2.0 (*)
|    \--- com.android.support.test.espresso:espresso-core:2.2 (*)
\--- com.android.support:multidex-instrumentation:1.0.1

I tried find the some solution on this topic, but without the luck.
Tests fail after Espresso 2 upgrade (failed: Instrumentation run failed due to 'java.lang.IllegalAccessError')
I don't know what exactly I should to update to make test working.
Here is the app.gradle config file
   android {
        compileSdkVersion 23
        buildToolsVersion "23.0.0"

        defaultConfig {
            applicationId "test.my.app"
            minSdkVersion 18
            targetSdkVersion 23
            versionCode 1
            versionName "1.0"
            testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
            // Enabling multidex support.
            multiDexEnabled true
        }
        buildTypes {
            release {
                minifyEnabled false
                proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            }
        }
        lintOptions {
            abortOnError false
        }
        packagingOptions {
            exclude 'LICENSE.txt'
            exclude 'META-INF/LICENSE.txt'
            exclude 'META-INF/NOTICE.txt'
        }
    }

    repositories {
        jcenter()
        mavenCentral()
        maven { url "https://repo.commonsware.com.s3.amazonaws.com" }
        maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
        maven { url "https://jitpack.io" }
    }

    dependencies {
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:23.0.1'
        compile 'com.google.android.gms:play-services:7.8.0'
        compile 'com.mcxiaoke.volley:library:1.0.18'
        compile 'com.orhanobut:logger:1.11'
        compile 'com.google.code.gson:gson:2.3.1'
        compile 'com.android.support:design:23.0.1'
        // UI TESTING DEPENDENCIES
        androidTestCompile 'com.android.support:support-annotations:23.0.1'
        androidTestCompile 'com.android.support.test:runner:0.3'
        androidTestCompile 'com.android.support.test:rules:0.3'
        //androidTestCompile 'com.android.support.test:testing-support-lib:0.1'
        androidTestCompile 'com.android.support.test.espresso:espresso-core:2.1'
        androidTestCompile 'com.android.support.test.espresso:espresso-intents:2.2'
        androidTestCompile 'com.android.support.test.espresso:espresso-web:2.2'
        androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.1'
        androidTestCompile 'com.android.support.test.espresso:espresso-contrib:2.2'
        androidTestCompile('com.android.support:multidex-instrumentation:1.0.1') {
            exclude group: 'com.android.support', module: 'multidex'
        }
        // ORM DATABASE DEPENDENCIES
        compile 'com.michaelpardo:activeandroid:3.1.0-SNAPSHOT'
        // STETHO CORE
        compile 'com.facebook.stetho:stetho:1.1.1'
        compile 'com.facebook.stetho:stetho-urlconnection:1.1.1'
        compile 'com.facebook.stetho:stetho-okhttp:1.1.1'
        // GOOGLE ANALYTICS
        compile 'com.google.android.gms:play-services-analytics:7.8.0'
        // JODA TIME FOR ANDROID
        compile 'net.danlew:android.joda:2.8.2'
        // SECURE SHARED PREFERENCES
        compile 'com.scottyab:secure-preferences-lib:0.1.3'
        // MATERIAL DIALOG
        compile 'com.avast:android-styled-dialogs:2.2.0'
        // SQL CIPHER
        compile 'com.commonsware.cwac:sqlcipher-for-android:3.3.1'
        // HTML PARSER
        compile 'org.jsoup:jsoup:1.8.3'
        // MULTIDEX SUPPORT
        compile 'com.android.support:multidex:1.0.1'
        // SECOND MATERIAL DIALOG
        compile('com.afollestad.material-dialogs:core:0.8.1.0@aar') {
            transitive = true
        }
        compile('com.afollestad.material-dialogs:commons:0.8.0.1@aar') {
            transitive = true
        }
        // ANDROID BOOTSTRAP
        compile 'com.beardedhen:androidbootstrap:2.0.0'

    }

And Sample of TEST class:
@RunWith(AndroidJUnit4.class)
public class SignInActivityTest extends ActivityInstrumentationTestCase2<SignInActivity> {

    public TestHelper tl = new TestHelper();
    public SignInActivityTest() {
        super(SignInActivity.class);
    }

    @Before
    public void setUp() throws Exception {
        super.setUp();
        injectInstrumentation(InstrumentationRegistry.getInstrumentation());
        SignInActivity lActivity = getActivity();
    }

    // Insert scenario methods here
    @Test
    public void processTest() throws InterruptedException {

        // TODO: strings which are inserted into inputs should be defined as the string constants
        // Discuss it with Jan Sedlacek.
        tl.insertTextIntoInput(R.id.login_txv_username, "test");
        tl.insertTextIntoInput(R.id.login_txv_password, "test");
    }

}

What should i to change to make this working please? I will glad for any help.

A: ActivityInstrumentationTestCase2 is deprecated you have to use ActivityTestRule instead:
@RunWith(AndroidJUnit4.class)
public class SignInActivityTest {
    @Rule
    public ActivityTestRule<SignInActivity> mActivityRule = new ActivityTestRule(SignInActivity.class);

    public TestHelper tl = new TestHelper();

    @Before
    public void setUp() throws Exception {
        //currently you don't use Activity instance in your tests
        //I just put it here as an example how to get the activity from ActivityTestRule
        SignInActivity lActivity = mActivityRule.getActivity();
    }

    // Insert scenario methods here
    @Test
    public void processTest() throws InterruptedException {
        tl.insertTextIntoInput(R.id.login_txv_username, "test");
        tl.insertTextIntoInput(R.id.login_txv_password, "test");
    }

    @After
    public void tearDown() throws Exception {
        //do some stuff if needed
    }
}

A: This is a Gradle bug with MultiDex, as discussed in Android issue 194609:

m...@felixschulze.de:
  ... it seems that the dependency 'multidex' is added to the app itself and the androidTestCompile apk :(
See:
  https://android.googlesource.com/platform/tools/base/+/studio-1.5/build-system/gradle-core/src/main/groovy/com/android/build/gradle/internal/VariantManager.java#419
...
Found a workaround, add this to your build.gradle file:

// Workaround for Multidex bug in gradle-android-plugin
// Replace Multidex dependency with some dummy dependency to avoid dex problems
// @see https://code.google.com/p/android/issues/detail?id=194609
project.getConfigurations().all { config ->
    if (config.name.contains("AndroidTest")) {
        config.resolutionStrategy.eachDependency { DependencyResolveDetails details ->
            if (details.requested.name == "multidex") {
                details.useTarget("de.felixschulze.teamcity:teamcity-status-message-helper:1.2")
            }
        }
    }
}

And, do not use MultiDexTestRunner.

A: I ran into a very similar problem.
Mine was caused by an uncaught InterruptedException in some worker thread which stopped the testing process. The stacktrace shows up in the Android Monitor...I was able to solve my problem by catching the exception.

A: This means that you have problem in Gradle file. You use wrong dependencies.
I use robotium and JUnit 4 my dependebcies:
 dependencies {
     androidTestCompile fileTree(dir: 'libs', include: 'robotium-solo-5.5.4.jar')
     androidTestCompile 'junit:junit:4.12'
     androidTestCompile 'com.android.support.test:runner:0.4'
     // Set this dependency to use JUnit 4 rules
     androidTestCompile 'com.android.support.test:rules:0.4'
 }


text:
Q: In the definition of the strong operator topology on $L(\mathcal{X}, \mathcal{Y})$, why must $\mathcal{X}$ and $\mathcal{Y}$ be Banach spaces? In Folland, the strong operator topology is defined as the topology on $L(\mathcal{X}, \mathcal{Y})$ induced by the evaluation maps $\{T \mapsto Tx\}_{x \in \mathcal{X}}$, where $\mathcal{X}, \mathcal{Y}$ are Banach spaces. In terms of convergence, we have that $T_\alpha \rightarrow T$ in the strong topology iff $T_\alpha x \rightarrow Tx$ in the norm topology of $\mathcal{Y}$ for all $x \in \mathcal{X}$. My question is, why must $\mathcal{X}, \mathcal{Y}$ be Banach spaces? The "net characterization" still holds if they are considered merely normed vector spaces, I'm pretty sure.

A: I don't think there's any reason why you can't make this definition for the bounded linear operators between normed vector spaces.   Of course any bounded linear map from normed vector space $X$ to normed vector space $Y$ extends uniquely to a bounded linear map from the completion of $X$ to the completion of $Y$, so the extra generality probably doesn't get you much.  When your spaces are complete, analysis is much more convenient (e.g. you have the Baire Category Theorem and its consequences).

redpajama_set_name: RedPajamaStackExchange


text:
Q: Remote Connection Failed connecting to Git repo EDIT: This is solved now but I don't have enough rep to answer it just yet.
I have a local git repository that I want to host on assembla.com. I'm using Git Tower, and I generated a keypair using
ssh-keygen -C xyz@gmail.com

(The gmail address is my registered email on assembla and tower)
I uploaded my public key to assembla which seemed to work, then on Git Tower I select my project, go to Settings > Remotes and enter a custom name for the project, then enter the repository URL as stated on my assembla project page:
git@git.assembla.com:abc.git

I select private Key and choose the private key generated with the above command. Tower automatically completes the username field (as "git") from the repository URL. I enter the Key Password the same as when I generated the key pair from command line and when I click add and get the following error.
Permission denied (publickey,keyboard-interactive).
fatal: The remote end hung up unexpectedly

I checked similar questions but I'm not having any luck. It seems to be an error authenticating, but I'm not sure what else to try.

A: Turns out Assembla took a LONG time to register the keys. I tried again with the same keys a few days later and it worked.


text:
Q: intellij import not working, scala I have a scala worksheet whereby im trying to import a method from another object. In intellij it does not seem to work, whereas if I import the method in sbt console it does. I'm new to Scala, and to languages on the JVM, so I apologize for not being able to define this problem better. I have attached two screenshots which show the behaviourI'm describing. Running the worksheet results in the following errors:

whereas everything works in the sbt console:

I have tried invalidating and restarting the caches as suggested in other posts but this has not worked.
EDIT: foob file as requested
package objsets

/**
  * Created by michael on 6/26/16.
  */
object foob {
 def g(x: Int): Int = 10*x
}


text:
Q: Reduce space between title and first section in a modified smfart I am looking for a hack to reduce the space between the line (that appears after the title) and the title of the first section. At the moment, my code modifies smfart somewhat atrociously as follows:
\documentclass{smfart}
\usepackage{smfthm, xpatch}
\makeatletter
\patchcmd{\@maketitle}
{\medskip
 {\abstractfont\smf@journalhead\par}\vfil
\begin{center}
 \def\baselinestretch{1.2}\large\vfil
}{\begin{center} \large \vspace{0.2cm}}{}{}
\patchcmd{\@maketitle}
{\vfil
\ifx\@empty\smfbyname\else
     {\smfbyfont\smfbyname\ifsmf@byauthor\par\vfil\else\ \fi}%
\fi
   {\edef\smfandname{{\noexpand\normalfont \smfandname}}
    \andify\authors\authors\par}
 \vfil
}{}{}{}
\makeatother
\title{\S 2. Sch\'emas et morphismes de sch\'emas}
\begin{document}
\maketitle
\section{Definition of Schemes}
\section{}
\end{document}

A: Important are only the two lines maked with %%%%%%%%%%%%%%%%%%%
\documentclass{smfart}
\usepackage{smfthm}
\makeatletter
\def\@maketitle{\cleardoublepage\thispagestyle{copyright}
    \begingroup
    \uppercasenonmath\shorttitle
    \ifx\@empty\shortauthors \let\shortauthors\shorttitle
    \else \uppercasenonmath\shortauthors \andify\shortauthors \fi
    \toks@\@xp{\shortauthors}\@temptokena\@xp{\shorttitle}%
    \edef\@tempa{\@nx\markboth{\the\toks@}{\the\@temptokena}}\@tempa
    \topskip\z@skip
    \vtop to 20 mm{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \parindent=0pt
        \hrule
        \medskip
        {\abstractfont\smf@journalhead\par}\vfil
        \begin{center}
            \def\baselinestretch{1.2}\large\vfil
            {\bfseries\smf@boldmath\MakeUppercase\@title\par}
            \vfil
            \ifx\@empty\smfbyname\else
            {\smfbyfont\smfbyname\ifsmf@byauthor\par\vfil\else\ \fi}%
            \fi
            {\edef\smfandname{{\noexpand\normalfont \smfandname}}
                \andify\authors\authors\par}
            \vfil \vrule height .4pt width .3\textwidth \vfil
        \end{center}}
        \@maketitlehook
        \par\bigskip
        \ifx\@empty\@dedicatory\else\@setdedicatory\medskip\fi
        \@setabstract\par\smallskip\@setaltabstract\par
        \vspace{\normalbaselineskip}%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \endgroup}
\makeatother
\title{\S 2. Sch\'emas et morphismes de sch\'emas}

\begin{document}
        \maketitle
        \section{Definition of Schemes}
        \section{foo}
\end{document}

If you want only reduce the space after the title, then you need only a \vspace{- ...}:
\documentclass{smfart}
\usepackage{smfthm}
\title{\S 2. Sch\'emas et morphismes de sch\'emas}

\begin{document}
    \maketitle
    \vspace*{-1.5cm}
    \section{Definition of Schemes}
    \section{foo}
\end{document}

If the abstract should be directly after the tile use:
\makeatletter
\def\@maketitle{\cleardoublepage\thispagestyle{copyright}
  \begingroup
  \uppercasenonmath\shorttitle
    \ifx\@empty\shortauthors \let\shortauthors\shorttitle
    \else \uppercasenonmath\shortauthors \andify\shortauthors \fi
    \toks@\@xp{\shortauthors}\@temptokena\@xp{\shorttitle}%
    \edef\@tempa{\@nx\markboth{\the\toks@}{\the\@temptokena}}\@tempa
    \topskip\z@skip
    \vtop to 55 mm{%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \parindent=0pt
        \hrule
        \medskip
        {\abstractfont\smf@journalhead\par}\vfil
        \begin{center}
            \def\baselinestretch{1.2}\large\vfil
            {\bfseries\smf@boldmath\MakeUppercase\@title\par}
            \vfil
            \ifx\@empty\smfbyname\else
            {\smfbyfont\smfbyname\ifsmf@byauthor\par\vfil\else\ \fi}%
            \fi
            {\edef\smfandname{{\noexpand\normalfont \smfandname}}
                \andify\authors\authors\par}
            {\bigskip\@setabstract\par\smallskip\@setaltabstract\par}
            \vfil \vrule height .4pt width .3\textwidth \vfil
        \end{center}}
        \@maketitlehook
        \par\bigskip
        \ifx\@empty\@dedicatory\else\@setdedicatory\medskip\fi
        \vspace{\normalbaselineskip}%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        \endgroup}
\makeatother


text:
Q: Difference between 'online education' and 'distance learning'
Is there any difference between 'online education' and 'distance
  learning'

A: "Online education" involves education over the Internet. This doesn't mean that the teacher and the students are geographically far apart. For all you know, the instructor might still be in the very same room. "Distance education" means that the teacher and the student are far apart. There is a "distance" factor between them. So yes, they are very different. "Distance education" needn't use the Internet either. It can be done via Postal service or through a messenger.


text:
Q: Why can't I connect to Git even though it worked before? This has been an issue for quite some time now and it really confuses me.
It all began with my university using a different vpn client.
I need to be connected to vpn to access the git server of our lab and we need to use ssh (not sure why http won´t work but thats what I´ve been told when I started working on that project).
Everything worked fine except for pushing. I could clone, pull, fetch but nor push.
Back then I´ve been working with Ubuntu 16 so I blamed it on that.
Now I´m on Ubuntu 18 and I can only sporadically connect to Git.
Just last week I was able to pull and push but now I get

fatal: Could not read from remote repository

or

Connection closed by 123.45.67.89 port xy

every time.
I´m using the same ssh-key as last week. I added the key with ssh-add and I tried restarting the ssh agent but nothing works. I reconnected to the vpn a few times but that won´t change a thing. I can access the git server with my browser though.
As far as I know I´m the only one facing such problems so it´s probably an issue on my side. I just don't get why the ssh key works every now and then even though I´m not doing anything different.
I´d be glad for every bit of advice as I´m not very versed with networks or git.
Ps: Another thing I´ve noticed: On Ubuntu 16 I´ve been able to add new ssh keys to my profile. Now I can see my ssh-keys and enter a new one but when I try to add it the website just loads and loads but nothing happens. This is very confusing for me because my account has the same permissions as it did before.

A: At least the "just loads and loads" part of your PS sounds like a possible MTU problem. It isn't unusual for a VPN to reduce your MTU and depending on the product and configuration, the MTU may or may not be properly propagated to your system. Lowering the MTU of your VPN interface would then help.
To find the interface and its current MTU value use ip link (check the list with the VPN disconnected and connected to see what changes if it isn't obvious which interface is the VPN one). The MTU usually is somewhere around 1500 bytes.
Then lower the MTU using ip link set <vpnInterfaceName> mtu <newMTUValue>. Start out with a low value (1000 should work). If it is indeed an MTU problem, your connection should then start to work. You can then progressively increase the value until you see problems again (or keep it low, if you don't mind the increased overhead).
The MTU can also be set in the network configuration GUI, where it will also apply across reboots.


text:
Q: Don't need to two function for + overload? I overloaded + operator on c++ like this:
#include <iostream>

class Cent
{
private:
    int m_nCent;

public:
    Cent(){ };
    Cent(int n);
    int getCent() const;
    void setCent(int);
    friend Cent operator+(const Cent &c1, const Cent &c2);
    friend Cent operator+(const Cent &c1, const int);
};

Cent::Cent(int n)
{
    setCent(n);
}

int Cent::getCent() const
{
    return Cent::m_nCent;
}

void Cent::setCent(int n)
{
    Cent::m_nCent = n;
}

Cent operator+(const Cent &c1, const Cent &c2)
{
    return Cent(c1.getCent() + c2.getCent());
}

Cent operator+(const Cent &c1, const int n)
{
    return Cent(c1.getCent() + n);
}

int main()
{
    Cent c1(5);
    Cent c2(4);
    Cent sum;

    sum = c1 + c2;

    std::cout << sum.getCent() << std::endl;

    sum = c1 + 7;

    std::cout << sum.getCent() << std::endl;

    sum = 9 + c1;

    std::cout << sum.getCent() << std::endl;

    return 0;
}

Based on this code, i must overload + operator with two function, a function for (Cent,int) and another for (int,Cent), i implemented only (Cent,int) case but on main i use + operator for (int,Cent) and it's work truly! What's wrong for me?
I use GCC v4.8.2 on Linux 3.13.

A: You have an implicit conversion constructor Cent(int). The 9 + c1 call will expand to Cent(9) + c1 and call the Cent, Cent overload.

A: Your class has conversion constructor
Cent(int n);

that allows to convert implicitly an object of type int to a temporary object of type Cent
If you would for example declare the constructor as
explicit Cent(int n);

then the code with the call of the operator would not be compiled.
Or if you would declare the operator the following way removing qualifier const for the first parameter
friend Cent operator+( Cent &c1, const Cent &c2);

then again the code would not be compiled.


text:
Q: Invariant Violation : scrollToIndex out of range : requested NaN but maximum is 1 (FlatLList/SwiperFlatList) When I want to distribute my data from my firebase database to my React Native mobile application in the form of a carousel with SwiperFlatList, an error is displayed
each time my class is updated, showing me as follows: "Invariant violation: scrolltoindex out of range: requested Nan but maximum is 1."
By hiding the error the carousel works well but it can be very annoying and cause problems during its build.
Here are my codes:
My Render function :
renderPost=post=>{

        return(
        <View style={styles.card}>
            <HorizontalCard title={post.title_new} desc={post.text} img={post.image} />
        </View>
        )

      }

HorizontalCard Component :
export default class HorizontalCard extends Component {
  constructor(props) {
    super(props);
  }

  static propTypes = {
    screen: PropTypes.string,
    title: PropTypes.string,
    desc: PropTypes.string,
    img: PropTypes.string,
  };

  state = {
    modalVisible: false,
  };

  setModalVisible(visible) {
    this.setState({modalVisible: visible});
  }
  render() {
     return (
       <View style={{flex: 1}}>
       <TouchableOpacity
      onPress={() => {
        this.setModalVisible(true);
      }}
      style={styles.container}>
      <Modal
      animationType="slide"
      transparent={false}
      visible={this.state.modalVisible}
      onRequestClose={() => {
        alert('Modal has been closed.');
      }}>
      <View style={{marginTop: 22}}>
        <View>
          <Text>{this.props.desc}</Text>

          <Button
          title="Fermer la fenêtre"
            onPress={() => {
              this.setModalVisible(!this.state.modalVisible);
            }} />

        </View>
      </View>
    </Modal>
      <View style={styles.card_discord}>
        <Image style={styles.card_discord_img} source={{ uri: this.props.img }} />
        <LinearGradient
          start={[1.0, 0.5]}
          end={[0.0, 0.5]}
          colors={['rgba(51, 51, 51, 0.2)', '#333333', '#333333']}
          style={styles.FadeAway}>
          <View style={styles.FadeAway}>
            <Text h4 style={styles.FadeAway_h2}>
              {this.props.title}
            </Text>
            <Text style={styles.FadeAway_p}>{this.props.desc}</Text>
          </View>
        </LinearGradient>
      </View>
    </TouchableOpacity>
       </View>

  );
  }

}

My HomeScreen component (page where the error appears) :
export default class HomeScreen extends Component {
    constructor(props) {
        super(props);
        this.ref =  Fire.shared.firestore.collection('posts')
        this.useref=
        this.state={
            dataSource : [],
        }
    }

      feedPosts = (postSnapShot) =>{
        const post = [];
        postSnapShot.forEach((doc) => {
        const {uid,text,timestamp,title_new,image} = doc.data();
        const data=Fire.shared.firestore
        .collection('users')
        .doc(uid)
        .get()
        .then(doc=>{
          post.push({
            text,
            timestamp,
            title_new,
            image,
            uid,
          })
          this.setState({
            dataSource : post,
          });
        })
        });
      }

      renderPost=post=>{

        return(
        <View style={styles.card}>
            <HorizontalCard title={post.title_new} desc={post.text} img={post.image} />
        </View>
        )

      }
    render() {
        return (
            <ThemeProvider>
                <ScrollView>
                             <SwiperFlatList
                                autoplay
                                autoplayDelay={5}
                                index={0}
                                autoplayLoop
                                autoplayInvertDirection
                                data={this.state.dataSource}
                                renderItem={({item})=>this.renderPost(item)}
                            />
                          ...
                <ScrollView>
            </ThemeProvider>
        )
    }
}


text:
Q: Java web parser with cookies? There are some html parsing libraries available,
but what do you do if you need to authenticate, and carry the cookies with each request?
And generally what if you need to press some button in order to get the content that you want to parse,
for example that button calculates something, or gets some data trough websocets etc...
Is there a technology to simulate behaviour in browser (so that all js is actually working) and parse from there...?
UPDATE
Maybe for this purpose i need to embed chromium and use traditional parsers? Tough i dont understand how do i trigger a click...

A: HtmlUnit: http://htmlunit.sourceforge.net/
public static void main(String... args) throws Exception {
    final WebClient webClient = new WebClient();
    final HtmlPage page1 = webClient.getPage("http://some_url");
    final HtmlForm form = page1.getFormByName("myform");

    final HtmlSubmitInput button = form.getInputByName("submitbutton");
    final HtmlTextInput textField = form.getInputByName("userid");

    textField.setValueAttribute("root");

    final HtmlPage page2 = button.click();

    webClient.closeAllWindows();
}


text:
Q: Python - mutability in lists I need help understanding the following code:
**Example 1**
v1 = v2 = ['h', 'e', 'l', 'l', 'o']
v1 += ['w', 'o', 'r', 'l', 'd']
print(v1==v2)  #True, v1 and v2 reference the same object

**Example 2**
v1 = v2 = ['h', 'e', 'l', 'l', 'o']
v1 = v1 + ['w', 'o', 'r', 'l', 'd']
print(v1==v2)  #False, v1 and v2 no longer reference the same object

Question:
From my understanding, a += 1 is the same as a = a + 1.
Why then, is v1 += ['w', 'o', 'r', 'l', 'd'] different from v1 = v1 + ['w', 'o', 'r', 'l', 'd']?
source: mutable objects changed in-place means what?


text:
Q: Azure Service Bus Queue - Operation is not valid due to the current state of the object I am using Azure Service Bus Queues in one of my .net core application to receive the messages from the Queue in the FIFO order. Once received the message from the Queue, then I have processed the business logic with each message. Once processed the business logic with each message then I am trying to delete the message from Queue with following line of code:
await _messageReceiver.CompleteAsync(message.SystemProperties.LockToken);

But for the few messages, I am unable to delete the messages from Queue. Because lock on the message expired even though I configured the "Lock Duration" 3 minutes on Service Bus Queue.
I am getting the following error while deleting/completing the message from Service Bus Queue:

Exception Type: System.InvalidOperationException
Exception Message: Operation is not valid due to the current state of the object.

These are properties I configured on the Azure Service Bus Queue:
Max Delivery Count =1
Lock Duration=3 minutes

A: There are a few reasons why you are not able to delete the messages in Azure Service Bus Queue.
Challenge with Lock Duration
The first challenge is Time, specifically lock duration for every message once they have been retrieved. The problem is that the messages must be displayed in the UI and then provide time for the customer to choose the messages to be resubmitted or deleted. The solution would be to ask the customer to increase the lock duration, but this is not possible due to several reasons. Firstly, increasing lock duration might not be possible due to customer integration, so we cannot depend on that.
Read more on this blog post on how to overcome the challenge.


text:
Q: Windows 10: Laptop display refuses to turn off System: Clevo P157SM (Sager NP8255-S).
I've just upgraded to Windows 10 Pro on my laptop and now the display refuses to turn off even if I lock the session or after the configured timeout (15 minutes on AC, 3 minutes on battery). It doesn't matter whether the laptop is plugged in.
The Monoff utility causes the screen to switch off, but it comes back on immediately, suggesting spurious input from an input device. Turning off the trackpad and disconnecting any external mice or keyboard do not help.
The laptop has a hotkey which switches off the display at the firmware level; a key press on the onboard keyboard turns it back on. The display stays off with this feature, eliminating the keyboard as a possible cause; however, it bypasses the OS and it doesn't allow any kind of ACPI control.
I have no trouble putting the computer to sleep—the system stays asleep unless I wake it up. The computer will wake up from external device inputs but ignores input from the onboard keyboard and trackpad (this is normal) so this eliminates external hardware as a possibility.
Any ideas on how to troubleshoot this?

Update: The issue seems to be caused by a userspace app as the monitor does turn off if left idle before I log into the machine. How do I isolate the guilty application?

A: The issue has been fixed in Windows 10 build 10586 released in November 2015. The display now turns off on its own when the machine is idle.

A: Try
powercfg /batteryreport

And
powercfg /energy

From the command line. It would tell you potential issues with your power management.
See more at http://www.hanselman.com/blog/PowerCfgTheHiddenEnergyAndBatteryToolForWindowsYoureNotUsing.aspx

A: i had the same problem and it was caused by a microsoft bluetooth laptop, i pulled out the bluetooth dongle and that did solve the problem


text:
Q: Is it a good practice when all controllers inherit from AsyncController? The title is very clear. I have an application-BaseController which inherits from "Controller"-class now.
With the new .NET Framework 4.5 and the ASP.NET MVC 4, I would like to use the new simpler async functionality which is available in C# 5. I like to use a few action methods with the async functionality (not all).
Are there any pitfalls to change the current base class from "Controller" to "AsyncController"? (worse performance for non async action methods?)
So what do you think about it?
Thanks for each answers.
Edit: With ILSpy I saw, the AsyncController-class doesn't contains any code in it (MVC 4). As @Trevor Pilley said, it is only there for backwards compatibility with MVC 3.
public abstract class AsyncController : Controller
{
}

So, we don't need us to care about "AsyncController" or "Controller" base. The "Controller"-class does handle both now in MVC 4.

A: If you are moving to MVC 4, the Controller class supports the async stuff. The AsyncController is only there for backwards compatibility with MVC 3.
AsyncController Class - "The Controller class in ASP.NET MVC 4 and higher supports the asynchronous patterns."
With that in mind, I'd say it probably doesn't make much if any difference & wouldn't worry about it.


text:
Q: Numerical solution to an equation that doesn't have an analytic form Suppose I have an equation
$$
d=\int_A^B \dfrac{dr}{\sqrt{1-\dfrac{2M}{r}}}\\
=B\sqrt{1-\dfrac{2M}{B}}-A\sqrt{1-\dfrac{2M}{A}}+M\ln\left( B\sqrt{1-\dfrac{2M}{B}} +B-M\right)-M\ln\left( A\sqrt{1-\dfrac{2M}{A}} +A-M\right),
$$
where $B>A>2M>0$.
I want to solve this equation for $B$ analytically. So far, I have tried
Solve[0.1==B*Sqrt[1-2/B]-3*Sqrt[1-2/3]+Log[B*Sqrt[1-2/B]+B-1]-Log[3*Sqrt[1-2/3]+3-1],B]

where $d=0.1, A=3, M=1$. However, Mathematica won't give a number.
Is there another way to solve this?
Thanks.

A: FindRoot works, but fun function.
inner[M_, xAB_] := Sqrt[1 - (2 M/xAB)];
expr[M_, A_, B_] :=
 B*inner[M, B] - A*inner[M, A] + M*Log[B*inner[M, B] + B - M] -
  M*Log[A*inner[M, A] + A - M]
FindRoot[expr[M, A, B] ==
  d, {{M, 1.}, {A, 3.}, {B, 2, 2, 4}, {d, 0.1}}]

mine = FindRoot[expr[1., 3., B] == 0.1, {B, 2, 2, 4}]
(* Out: {B->3.05828} *)

original=FindRoot[0.1==B*Sqrt[1-2/B]-3*Sqrt[1-2/3]+Log[B*Sqrt[1-2/B]+B-1]-Log[3*Sqrt[1-2/3]+3-1],{B,2,2,4}]
(* Out: {B->3.05828} *)

In[10]:= mine==original
Out[10]= True

PS. Tried Plot[expr[1, 3, B] == 0.1, {B, 0, 10}] to see graph of B. Whew!


text:
Q: MS Excel. Returning items that matched I have two tables: first one is the table of animals with corresponding 4-column of let say, their individual features. The second one is the table of just one row where the snake resides and has recently taken "test" to determine what features still match with the test taken, which shall be presented in the Result column of the second table.
See here

A: put this formula in cell E9 :
=IF(COUNTIFS(INDIRECT("B" & MATCH(A9;A2:A6;0)+ROW(A1) & ":E" & MATCH(A9;A2:A6;0)+ROW(A1));B9)>0;B9 & ", "; "") &  IF(COUNTIFS(INDIRECT("B" & MATCH(A9;A2:A6;0)+ROW(A1) & ":E" & MATCH(A9;A2:A6;0)+ROW(A1));C9)>0;C9 & ", ";"")  & IF(COUNTIFS(INDIRECT("B" & MATCH(A9;A2:A6;0)+ROW(A1) & ":E" & MATCH(A9;A2:A6;0)+ROW(A1));D9)>0;D9;"")

Or you can insert a helpmark cell like F9 (match_row_index) and write the formula shorter , for doing that you should set this formula in F9 :
=MATCH(A9;A2:A6;0)+ROW(A1) and write this formula in E9:
=IF(COUNTIFS(INDIRECT("B" & F9 & ":E" & F9);B9)>0;B9 & ", "; "") &  IF(COUNTIFS(INDIRECT("B" & F9 & ":E" & F9);C9)>0;C9 & ", ";"")  & IF(COUNTIFS(INDIRECT("B" & F9 & ":E" & F9);D9)>0;D9;"")


text:
Q: where in an XCode project does it set "InfoPlist.strings" as the filename to use for locationalization? where in an XCode project does it set "InfoPlist.strings" as the filename to use for locationalization?
Just trying to understand how XCode pulls things together here.  For example to set the app name specifically I can change this in "AppName_plist-Info.plist", however if I go localization it seems it then has to be set via the "InfoPlist.strings" files.
I can see in XCode where it specifies the "AppName_plist-Info.plist" file name, in the Target/BuildSettings/Packaging information area, but I don't see mention of "InfoPlist.strings", so how does Xcode/IOS know to override what is in  "AppName_plist-Info.plist" based on what's in "InfoPlist.strings"?

A: Xcode doesn't really override the name, it creates localizations in your apps bundle. iOS will look for the name of the app in de localization folder to which the language of the system is set.
These files have pre-determent names, thus you can not set them.
All the localized files will be for example in bundle.app\en.lproj for english or bundle.app\nl.lprojfor dutch.


text:
Q: Post data to an API in Form Data type in AngularJs I am new to angularjs and I want to POST the data in the form of "Form data" type, instead of query string. The code I used:
angular.module('odeskApp')
 .factory('Password', function ($http, $q) {
    return {
        update: function (pwd) {
            var deferred = $q.defer();

            $http({
                url: 'http://example.com/api/user/password',
                method: 'POST',
                data: $.param({
     'password': pwd
    }),
                headers: {
                    'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
     'X-Requested-With': 'XMLHttpRequest'
                    }
            })
                .success(function (data) {
                    $('#changePasswordAlert').html('
Successfully Done! Change password process completed.
');
     $('#changePasswordAlert .alert').mouseout(function(){ $(this).fadeOut('slow'); });
                    deferred.resolve(data); //resolve data
               })
                .error(function (err) {
     $('#changePasswordAlert').html('
Failed! Change password process failed.
');
     deferred.reject();
     $('#changePasswordAlert .alert').mouseout(function(){ $(this).fadeOut('slow'); });
    });
            return deferred.promise;
        }
    };
});

Any possible help or suggestion will be appreciated.
Thanks

A: The best way to call is you use the simple $http.post:
$http.post(url, {'password': pwd}, configs)
.then(sucessFunc, failFunc);

I abstracted the full example, to make it clean. if you want i can put the full code.
Edit: Full example
angular.module('odeskApp')
 .factory('Password', function ($http) {
    var url = 'http://example.com/api/user/password';
    // you can remove the configs if they are not needed...
    var configs = {
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
        'X-Requested-With': 'XMLHttpRequest'
      }
    };
    return {
        update: function (pwd) {
          $http.post(url, {'password': pwd}, configs)
            .then(function (data){ return data; });
        }
    };
});

This should work fine. i didn't add the Refect on fail because it will automaticly send reject to the queue of promises.
Also $http return promises so no need to use $q.
Html manipulation should not be used in a factory. that is why i removed it from my example. See some guides on angular docs.
Basicly you should have a template, that use a controller, that call this service, then use $scopes to talk messages between controller and views.
Hope this get you going.


text:
Q: Android HWUI error when fetching data and show it on list.Builder on flutter after debuging my app ... so i fetch data from server successfully and start to show it in my screen it show this error i don't know how i should do
and i have column with this name "isSurface(name=null)" i see it with debug and it not null
W/ViewRootImpl[Toast](27344): EGLdebug relayoutWindow Surface isSurface(name=null)  (appName =com.topfood.restauarnt_app) ( mSurfaceControllerIsValid =false) (mNativeObject  =0)/@0x8a6572,viewVisibility is0
W/ViewRootImpl[Toast](27344): EGLdebug relayoutWindow Surface isSurface(name=null)  (appName =com.topfood.restauarnt_app) ( mSurfaceControllerIsValid =true) (mNativeObject  =7b9a633000)/@0x8a6572,relayoutResult is7
W/ViewRootImpl[Toast](27344): EGLdebug Surface isSurface(name=null)  (appName =com.topfood.restauarnt_app) ( mSurfaceControllerIsValid =true) (mNativeObject  =7b9a633000)/@0x8a6572
D/OpenGLRenderer(27344):   HWUI Binary is  disabled


text:
Q: How to hide bottom navigation bar on a specific screen in react native? I am using React Native and React Native Navigation to build out my application. Currently, I have three bottom tabs: Home, Upload Video and Messages. Upon selection of the Upload Video tab, I want to render the Upload Video component and hide the bottom tabs on just that screen, and display a header with 'Cancel' (takes them back to the HomeView) and 'Post' buttons (this has already been done). I've had an extremely difficult time hiding the tab bar on this specific screen.
I tried following the code here (How can I hide the bottom tab bar on a specific screen (react-navigation 3.x)); however, that ended up being unsuccessful and I was not able to hide the bottom tabs on any of the screens this way.
Currently, I have this as my bottom navigator:
const BottomTabNavigator = createBottomTabNavigator({
    HomeView: {
        screen: HomeView,
    },
    VideoView: {
        screen: VideoSelectionView
    },
    Messages: {
        screen: SearchView
    }
});

Any insight would be extremely helpful, thanks.

A: on v5 you can modify options using a function and default arg navigation.:
<BottomTab.Screen
      name="Explore"
      component={Explore}
      options={({ navigation }) => {
        const { routes, index } = navigation.dangerouslyGetState();
        const { state: exploreState } = routes[index];
        let tabBarVisible = true;
        if (exploreState) {
          const { routes: exploreRoutes, index: exploreIndex } = exploreState;
          const exploreActiveRoute = exploreRoutes[exploreIndex];
          if (exploreActiveRoute.name === "RewardDetail") tabBarVisible = false;
        }
        return {
          tabBarVisible,
          title: "Explore",
          tabBarLabel: "Explore",
          tabBarIcon: ({ color, size }) => (
            <AntDesign name="search1" color={color} size={size} />
          ),
        };
      }}
    />

see my answer: https://stackoverflow.com/a/64042879/5288560

A: In React Navigation V6 add display: none in options under tabBarStyle.
Add tabBarButton: () => null, to disable icon in Tab.
<Stack.Screen
    name="Add Product"
    component={AddProduct}
    options={() => ({
      tabBarStyle: {
        display: "none",
      },
      tabBarButton: () => null,
    })}
  />

A: I've traversed the internet like never before to find a solution for this problem as the provided solution by the docs did not work in the slightest.
I had the following navigational Set-Up:

*

*Bottom Tabs

*

*A (NativeStack)

*

*1 (Screen)

*2 (Screen)

*3 (Screen)

*B (NativeStack)

*C (NativeStack)

I wanted to hide the bottom bar in Screen 1. What finally did the trick was the following snippet in the corresponding screen:
  useEffect(() => {
    navigation.getParent()?.setOptions({
      tabBarStyle: {
        display: "none"
      }
    });
    return () => navigation.getParent()?.setOptions({
      tabBarStyle: undefined
    });
  }, [navigation]);

The effect is run when the navigation prop updates and with that implicitly after the screen is being opened. With getParent() I get the bottom tabs navigator and can set the options with setOptions(...). To bring the bottom tabs back one has to manually set the options. I solved this by returning the method that resets the tabBarStyle in the call of useEffect(). This call is being made when it's time to clean-up, meaning that it will run as soon as the screen is being unmounted.
May this save same of you of the desperation I had to go through.

A: You need to specify for each TabBar screen or stack for which you need to hide tabbar,
const BottomTabNavigator = createBottomTabNavigator({
    HomeView: {
        screen: HomeView,
        navigationOptions:()=>{
          return {
            tabBarVisible:false,
          };
       }
    },
    VideoView: {
        screen: VideoSelectionView
    },
    Messages: {
        screen: SearchView
    }
});

A: Since react-navigation 5 is now being used, the above solution doesn't work anymore.
For React-Navigation 5, refer to this link.

A: Just setting the tabBarStyle to none doesn't work for me, I needed to use the property tabBarVisible too, if using hooks you can do something like that:
export function useHideBottomBar() {
    const navigation = useNavigation();

    useEffect(() => {
        navigation.getParent()?.setOptions({ tabBarStyle: { display: 'none' }, tabBarVisible: false });
        return () =>
            navigation.getParent()?.setOptions({ tabBarStyle: undefined, tabBarVisible: undefined });
    }, [navigation]);
}

A: In React navigation 5+ I used the following approach to hide a tab bar on a specific screen which was inside a stack navigator of a tab screen. In my tab navigator containing file I made a function, and then set the options property using the function which will trigger dynamically.
function getIsTabBarShown(route) {
    const routeName = getFocusedRouteNameFromRoute(route) ?? routes.DASHBOARD;

    switch (routeName) {
        case routes.MEMBERDETAILS:
            return false;
        default:
            return true;
    }
}

This function will return false when user would go to MemberDetails Page which is inside MemberNavigator Stack.
<Tab.Screen
    name="MemberTab"
    component={MemberNavigator}
    options={({ route }) => ({
        title: 'Members',
        tabBarVisible: getIsTabBarShown(route),
        tabBarIcon: ({ color, size }) =>
        <MaterialCommunityIcons name="account-group" color={color}
   size={size} />
})} />

Here is the official docs to learn more click here.

A: Refer to the documentation by clicking here

A: After searching and trying a lot of methods I changed the top element View to Modal then hid bottombar, because modal can be upper bottom bar. It's not the best but still useful.
<View>
  //code block
</View>

to->

<Modal animationType='fade' transparent={false} visible={true}>
   /code block
</Modal>

A: In Version 6 this worked for me:
To hide the bottom tab navigator from the screen:
navigation.getParent()?.setOptions({tabBarStyle: {display: 'none'}});

To show the bottom tab navigator from the screen:
navigation.getParent()?.setOptions({tabBarStyle: {display: 'flex'}});

A: just on the Screen you want to hide the bar, set tabBarVisible: false.
<Tab.Screen
    name="SignIn"
    component={SignInScreen}
    options={{
      tabBarVisible: false, //like this
      tabBarButton: (props) => null, //this is additional if you want to hide the tab element from the bottom nav
    }}
  />


text:
Q: $\exists$="Exists" gives Ёxist" (E with dots) My code is:
$\exists$="Exists" \\

is gives me
*exists sign*Ёxist"

In other words E with 2 dots and also = disappeared. I couldn't replicate this error in the new document. I took the template from this GitHub repo. $\exists$=\"Exists" didn't help. I'm doing it on overleaf with the default settings. What could be the reason?


text:
Q: apache multiviews, how to disable it I have a OS X Snow Leropard Server running and I want to disable multivewis from Apache. I could add Options -MultiViews to each .htacces file I have, but I guess there must be a global option. Disabling mod_negotiation.so renders all pages useless so this is not the option I'm looking for ..
Thanks for the help!

A: In case of Options either you have to use * or - sign with all or with none; i.e.
Options FollowSymLinks -MultiViews -Indexes

is wrong.
If you are using + or - sign, you have to use for all options i.e.
Options +FollowSymLinks -MultiViews -Indexes

A: In /etc/apache2/httpd.conf you should find the section starting <Directory "/Library/WebServer/Documents"> and remove MultiViews from the Options directive there. The same goes for any other paths if your content isn't in that directory.
As an aside, if you're able to edit the server's main config file you should never have to use .htaccess file. Doing so only slows down the server, makes tracing the configuration harder and makes any use of mod_rewrite a brain-rending disaster.

A: Considering this is OS X, one snag I ran into was my user specific declarations (in the users/username.conf subdirectory of apache2) had MultiViews turned on, overriding httpd.conf.
MultiViews was substituting /search.php for /search, messing up the "pretty" Codeigniter urls on my dev machine.


text:
Q: Click event hide 2 components Angular 4 I've 1 root component with 3 sub-componenet where I put some @input to get the click event who's call them successfully to the view, so when I click on the root I want to open a sub-component (that's work fine) but in the same time I would like the two others disappear from the view and so on for each one but separately (kind of div.hidden)...if you need more code or explanations don't hesitate....thanks in advance
Here's my root component.html:

Detail of day

 <button pButton class="daydetail" type="button" icon="fa-chevron-up" label="Click"(click)="toggleChild()"></button>

         <my-daydetail [showMePartially]="showVar"></my-daydetail>

Daily

    <my-dailyreport></my-dailyreport>

    <my-inventory></my-inventory>

Here's my root component.ts:
export class AppliV2Component   {
   showVar = false;
   hideVar = true;

  constructor(public userService: UserService) {
    }
   toggleChild() {
       this.showVar = !this.showVar;
       this.hideVar = !this.hideVar;
       }
}

First child.html:

Daily report

First child.ts:
export class MyDailyreportComponent implements OnInit {

 @Input() hideMePartially: boolean;
  constructor() { }

Second child.html:

Informations

Second child.ts:
  export class MyInventoryComponent implements OnInit {
      @Input() hideMePartially: boolean;

A: First of all, *ngIf will not hide / show the component. It will add / remove it. There's a difference. To hide component you should use [hidden]="true/false"
In your case you could do something like:

And then just create displayDetail variable of type boolean in your component typescript.
After that, you can easily create toggle method to set the displayDetail to true or false.
toggleDisplay(){
  this.displayDetail != this.displayDetail;
}

You can invoke that method in template.
<button (click)="toggleDisplay();"> Toggle Button </button>

NOTE: the CSS for [hidden] could be overwritten so you might want to add this to your component CSS
[hidden] { display: none !important;}


text:
Q: SPI max distance on flexible circuit I want to run a number of sensors up the length of a flex circuit, they all communicate via SPI and I will run chip selects individually to each device.
I need the flex circuit width to be minimal so its likely I will have tracks in close proximity running the entire length of the flex circuit.
Im concerned with how this will affect the SPI comms with increasing length.
EDIT: The SPI will run at a maximum speed of 1MHz, data will be active on both MOSI and MISO, One mircoprocessor will sit at one end of the flex circuit as master, comunnicating with the chain of sensors.
I'm not looking for an exact figure just ball park, so that i can decide o na length to test with first.
This answer SPI max distance gives the max length for cables, but i think that this is not applicable to that of a flex circuit.
How long can I go with the SPI on a flex circuit?

A: A bi-directional SPI bus (master -> slave -> master) is the most problematic to deal with. Consider the much simpler master to slave comms - both data and clock remain in time-sync on their route to the slave.
However, when the slave transmits back to the master it does so by syncing to the delayed clock it receives from the master. That delay is due to the propagation time through the channel (cable, PCB etc..). Then there is the extra delay of the data coming back i.e. two lots of propagation delay and the master might end up trying to receive data that has shifted a significant part of one clock cycle.
With a 1 MHz clock, the period is 1000 ns and if the received data from the slave has shifted more than about a quarter of this time (250 ns) then expect problems.
The velocity of propagation of free space is 300,000,000 m/s or, put differently, 3.333 ns per metre. Cable may double this figure and I wouldn't expect this to be any worse for a PCB so assuming a worst case of 7 ns per metre, you could run 250/7 metres and not hit delay problems. That's nearly a 36 metre round trip or 18 metres of cable.
I'm not saying that signal levels will be totally adequate after 18 metres but that 18 metres should not produce a show-stopping round-trip delay.
There are also reflections to consider and the rule of thumb is that they become significant if the cable length approaches one-tenth of the wavelength of the highest relevant frequency. What frequency you might ask? Well the clock is 1 MHz and it contains harmonics that are usually regarded as important up the the seventh so, the frequency in question is 7 MHz. This has a wavelength in free space of about 43 metres and if run in a "slow" cable this might be 20 metres.
For this reason (and the one-tenth rule of thumb) I wouldn't want to go further than 2 metres without paying some attention to line terminators. They can be added to SPI lines without too much difficulty but, if you don't want them then I'd say 2 metres is your limit.


text:
Q: Не работает библиотека OS python Импортирую os и написал действие, но выдает непонятную мне ошибку, можете посоветовать как убрать ошибку? Использую Visual studio code
import os
os.system('C:/Windows/system32/cmd.exe')

A: Для запуска cmd предлагаю использовать
import os
os.startfile(r'c:\Windows\system32\cmd.exe')

но какой смысл запускать shell?


text:
Q: How can I create map tiles for an irregular shaped area, like a state? I'm using Ubuntu 14.04, OSM in a Postgres database, and Tilemill to style and export to a mbtiles files. How can I generate tiles for an irregular-shaped (not rectangular) area. For example, if I want to generate tiles for the US states of Michigan or Illinois, I currently specify a rectangular bounding box based on the min and max latitude and longitude. This results in an enormous amount of unnecessary tiles being generated for, in the case of Michigan, Wisconsin and Canada.
If it can't be accomplished with my current tools, can I alter my process to incorporate a tool that allows me to use an irregular area?
Is there a tool I can use to trim the source OSM data to an irregular boundary? Even if I'm limited to a rectangular box when generating tiles, at least there will be no data and hopefully I get blank tiles or a single tile repeated over the areas with no data.


text:
Q: Why react native can`t find image in assets folder? I have a background image in src/assets folder which I try to get access to from src/screens/splash/index.js as such:
import {ImageBackground} from 'react-native';
import React from 'react';

export default function SplashScreen() {
  return (
    <ImageBackground
      source={require('../../assets/bg1.jpg')}
      resizeMode={'cover'}
      style={{flex: 1}}>
    </ImageBackground>
  );
}

Returns this error:
None of these files exist:

*

*bg1.jpg

*src\assets\bg1.jpg\index(.native|.android.js|.native.js|.js|.android.jsx|.native.jsx|.jsx|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)

If i move the image in any other folder, for example screens and change source to:
source={require('../../screens/bg1.jpg')}

its working fine.
Im baffled and wondering the reason behind it?
Is it maybe because I use react-native cli and renamed the tsx file created originally to js?
Here is a picture in case it helps understanding the problem.

A: After trying everyting was suggested in the comments, nothing has worked so far. I went ahead and continue building the app (following a tutorial) and re-compiled the application, now on an other computer and it started working!
The only change that I made since added the assets folder and the image that following the documentation integration-with-android-fragment I added few extra lines to MainActivity.java as suggested.
import android.os.Bundle;

and
  private Bundle getLaunchOptions(String message) {
    Bundle initialProperties = new Bundle();
    initialProperties.putString("message", message);
    return initialProperties;
}

Now im not 100% sure this was the solution to the problem, but I assume it must have been as no other changes has been made to the code since the error message appeared..
That is also possible that on my other computer it still wouldnt work, so the error is rooted somewhere within how my computer handeled these packadges. Unfortunately Im unable to test this theory for the next 2 weeks, but will share it whatever it concludes.


text:
Q: Looking for help getting Samba server up and running off a Knoppix live CD to rescue files off a WinXP box I have a WinXP box that is stuck in a permanent re-boot cycle that won't stop.  Thus I've grabbed an ISO of the Ultimate Boot CD, and a Knoppix Live CD and burned them.
With the UBCD, I managed to clean out a virus or two, verified the disks integrity etc. but it is still in a permanent re-boot cycle... (no safe mode, or restore points work at all).
Thus I'm now at the backup, wipe, and re-install stage... specifically the backup (across my LAN to another WinXP box).  I was hoping to setup a Samba server using the Knoppix CD, but I can't find Samba on the disk. e.g. no Samba in:
/etc/init.d/samba

Is there an easy way to start up the Samba server that I've overlooked? or is there an easier way to access the files on the hard disk?

A: Since both systems are Windows systems (meaning we're not likely going to have to deal with different format types other than NTFS or FAT), there is a much easier way to get at the data. Simply pull the problematic system's hard drive out of the case, connect it to the other functional PC, and copy/move the data you want directly. You can do this either internally by connecting the problematic system's hard drive to an available IDE port on the good system (which could be a little more complicated if the problematic system's hard drive is a PATA type hard drive where master/slave settings might be involved), or use an external hard drive enclosure so that you can connect the problematic system's hard drive to an available USB port on the good system. As long as you don't try and boot from the problematic system's hard drive (which won't boot anyway), you can still likely access the data on it with another PC. No Linux, no Samba, no bull-squat. And if you choose the internal connection method, copying/moving data is about as fast as it can get too.
Now, if you just don't want to open up both PC's cause of warranty concerns or something then you could use a "live" Linux distro to copy/move data. And it sounds like that's what you may have been trying to do with Knoppix - and not necessarily locally either. But this method is harder and can be complicated and/or very problematic especially if you involve networking with a more "advanced" or "less polished" distro like Knoppix. But if you have no choice (cause you only have one PC, for example) then I would at least suggest you use a more modern Linux distro such as Ubuntu 10 (even as old as Ubuntu 7). Unlike Knoppix, Ubuntu is nearly as simple as using Microsoft Windows especially when it comes to copying/moving files and even with most networking issues too. And if it's preparation/recovery tools that you need, I suspect Ubuntu even has Ultimate Boot CD beat as well. So stop using Knoppix and Ultimate Boot and get yourself a FREE copy of Ubuntu 10.10 desktop 32-bit version (the 32-bit version is more likely to work on anything - even 64-bit machines).
So, to sum it up, you might try attaching the problematic systems's hard drive to another functional PC and copy/move (recover) the data that way. But if you can't do that then it gets a little more complicated with Linux where I secondarily suggest using Ubuntu rather than Knoppix or even Ultimate Boot CD. Cause once you boot with Ubuntu it's really just a simple matter of copying/moving data from somewhere (like the problematic system's hard drive) to somewhere (like a USB memory stick or even over a LAN). Good luck.

A: This should help:
http://www.howtogeek.com/howto/windows-vista/use-ubuntu-live-cd-to-backup-files-from-your-dead-windows-computer/


text:
Q: Bad weight detection for unit in math mode with siunitx? Here is a (minimal) code example showing the problem.
\documentclass{article}
\usepackage{luatextra}
\usepackage[bold-style=ISO]{unicode-math}
\usepackage[noload=abbr]{siunitx}
\sisetup{decimalsymbol=comma,detect-all}

\begin{document}
\begin{itemize}
\item Text : \SI{2}{cm}.
\item Math : $\SI{2}{cm}$.
\item Bold Text : \textbf{\SI{2}{cm}}.
\item Bold Math : $\symbf{\SI{2}{cm}}$.
\end{itemize}
\end{document}

Here is the result.

The last unit should be in bold style.

A: At present I don't have a 'do X' fix for this, but I can explain why the issue arises and note that I am giving it some thought.
The 'traditional' math font set up in TeX uses a series of different font families to deliver different appearance. Inside siunitx, I use this to detect \mathsf and \mathtt (as opposed to roman text) by looking at the \fam value. Bold is handled differently as LaTeX offers \boldmath as a switch for all of the material in one math mode section, and indeed due to the way TeX works this cannot (safely) be applied inside math mode. This can be detected as  being on/off using the LaTeX internal data structures. What siunitx has never done is check for \mathbf(I will return to this below).
The Unicode math font approach is entirely different to the above: only one \fam is ever used and switching takes place by picking the correct mapping of input to output. In unicode-math this can be detected from another internal variable. However, that alone would not be enough as the way siunitx sets up the output is also aimed at the traditional set up. What the package does is effectively
\text{\unboldmath\ensuremath{<content>}}

as this avoids any 'accidental' bold text (remember \boldmath and the reverse only works around an entire math mode block). That fails to work properly with unicode-math as the font approach is entirely different.
Hindsight being a wonderful thing, I would take a different take to detecting fonts (or not) if I was starting from scratch. In particular, I'd ignore \mathsf, \mathtt, etc. entirely and just worry about the 'surrounding text' setting: really the math mode mark-up should not be interpreted as giving 'design' information. I'd also do the 'detection' in a different way, forcing only such font changes as are needed. However, the question is whether I can do that and not break too many documents.
I'm working sporadically on a third version of siunitx and this is one thing to look at for it. At present, I'm not sure if I can do what would be a very useful update from my point of view (clearer internals) whilst keeping everyone's documents unchanged (the basics are fine, it's the awkward outputs that are hard). What I will do is look at this area first in a v3 context and then in terms of what can be moved back into v2. The latter is more tricky as some of the internal set up really depends on the classical TeX math approach.


text:
Q: Difference between two versions of while loop? I have reformulated my question:
I am reading a book in which the author provides the following code sample:
while(do_something && i<imax){
   i++;
}

Where do_something is reading a file: input_file >> array[amountRead];
This lead me to wonder why he didn't simply write:
while(i<imax){
   do_something;
   i++;
}

What is difference in the above two code samples? Is it performance related?

A: You comment elsewhere:

do not understand why the author of the code wrote it that way. do_something is reading a file input_file >> array[amountRead];

In that case, the functional difference is likely much more important than the performance.  The author's existing code is guaranteed to attempt to read at least one element into the array, and further it tests the success of conversions from the stream to the type stored in the array.  The second version ignores errors in reading from the stream, both at the binary level and conversion to the array's element type, so it will always tell you i == imax at the end regardless of the number of element read.
On performance - per your original question
Your first loop always does do_something at least once, while the second one tests i<imax first and may break without ever doing do_something.  In general, the first loop will do_something an extra time, which suggests it may be slower if do_something is time consuming compared to the looping itself.
But let's make it more interesting... say imax is one more for the second loop such that do_something is called the same number of times (assuming it was going to run at least once anyway).  The first loop still runs the risk of being slower as it's obliged to consider the results of do_something in a boolean context (which in C++ may involve calling a conversion function that could take any amount of time) and conditionally branch before evaluating i<imax.
I say only "runs the risk" because given modern CPU execution pipelines the "cost" of that may or may not actually manifest as reduced performance.  If you ever care about performance, benchmark.


text:
Q: Draw UIImage as a circle without offscreen rendering In my app I have a UIImageView in a UITableViewCell. The images need to be displayed as circular images with rectangular source images. I have been setting the corner radius on the imageView's layer property, but this forces an offscreen render which is slowing performance on scrolling.
Here's what I currently have in the awakeFromNib method on the cells:
- (void)awakeFromNib
{
    [super awakeFromNib];

    self.imageBorderView.backgroundColor = [UIColor colorWithWhite:0.75f alpha:1.f];
    self.imageBorderView.layer.cornerRadius = self.imageBorderView.frame.size.width / 2;
}

Really basic stuff. Ok, so I just watched the 2011 WWDC Session 121 video, Understanding UIKit Rendering. That covered this issue as it relates to a UILabel by moving the corner radius rendering to drawRect using UIBezierPaths. I subclassed UIImageView and moved my cornerRadius drawing to drawRect only to find that drawRect is not called on a UIImageView. Here's the relevant reasoning from the docs:

The UIImageView class is optimized to draw its images to the display. UIImageView does not call the drawRect: method of its subclasses. If your subclass needs to include custom drawing code, you should subclass the UIView class instead.

So I changed the superclass to UIView and I am manually drawing a circle using UIBezierPath and the UIImage in drawRect. Here is my drawRect method:
- (void)drawRect:(CGRect)rect
{
    UIBezierPath *circularPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:self.bounds.size.height / 2.0];
    [[UIColor redColor] set];
    [circularPath fill];

    if (self.image)
    {
        [self.image drawInRect:self.bounds];
    }
}

It does exactly what I would expect, it draws the red circle (just a sanity check to make sure the path is correct), then it draws the rectangular image over the circle if one has been set.
What I can't figure out is how to crop the UIImage to the circular UIBezierPath without drawing offscreen. This means setting an object as the mask wont work.
Is there a way to mask an image to a path without rendering offscreen?

A: Call -[UIBezierPath addClip] to clip subsequent drawing to the inside of the path.
- (void)drawRect:(CGRect)rect
{
    UIBezierPath *circularPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds cornerRadius:self.bounds.size.height / 2.0];
    [circularPath addClip];
    [self.image drawInRect:self.bounds];
}

A: You are overcomplicating things, some years ago I had the same problem and the way I solved it was using  a programmatically created UITableViewCell which had a UIView in which I used QuartzCore and set the cornerRadius, afterwards I added a UIImageView inside of it (the UIView) and it always rendered it super fast without going into much detail of UIBeziers.


text:
Q: SignalR client not receiving server messages My SignalR client doesn't receive any messages from the server. What am I missing here?
Server Hub
namespace DoneITWebAPI.Hubs
{
    public interface ITypedHubClient
    {
        Task BroadcastMessage(string name, string message);
    }

    public class ServiceStatusHub : Hub<ITypedHubClient>
    {
        public void Send(string name, string message)
        {
            Clients.All.BroadcastMessage(name, message);
        }

    }
}

Controller
[Route("api/[controller]")]
[ApiController]
public class DemoController : Controller
{
    IHubContext<ServiceStatusHub, ITypedHubClient> _chatHubContext;
    public DemoController(IHubContext<ServiceStatusHub, ITypedHubClient> chatHubContext)
    {
        _chatHubContext = chatHubContext;
    }

    // GET: api/values
    [HttpGet]
    public IEnumerable<string> Get()
    {
        _chatHubContext.Clients.All.BroadcastMessage("ReceiveMessage", "test");
        return new string[] { "value1", "value2" };
    }
}

Console Client App
class Program
{
    static void Main(string[] args)
    {
        var connection = new HubConnectionBuilder()
        .WithUrl("http://localhost:64165/ServiceStatusHub")
        .Build();

        connection.On<string, string>("ReceiveMessage", (user, message) =>
        {
            GetMessage(user, message);
        });

        connection.StartAsync();

        Console.ReadKey();
    }

    public static void GetMessage(string user, string message)
    {
        //Not hitting here
    }
}

A:
My SignalR client doesn't receive any messages from the server. What am I missing here?

Based on your code, we can find that you use strongly typed hubs, and you define and name client method as ReceiveMessage on console app.
To make you can call that client method as expected , you can try to modify your hub code as below.
public interface ITypedHubClient
{
    Task ReceiveMessage(string name, string message);
}

public class ServiceStatusHub : Hub<ITypedHubClient>
{
    public void Send(string name, string message)
    {
        Clients.All.ReceiveMessage(name, message);
    }

}

And change the code in API action
_chatHubContext.Clients.All.ReceiveMessage("system", "test");

Test Result


text:
Q: How to return a multidimensional array in jquery ajax call I am calling webmethod in order to return string array in jquery. Regular one dimension string array looks like this
[WebMethod]
public static string[] GetNewRow() {
    var listOfItems = new List<string>();
    // populate the listOfItems here
    listOfItems.Add("100");
    // more here
    return listOfItems.ToArray();
}

Is it possible to return a multidimensional array?

A: an array ( [] ), in javascript, is numerically indexed. You have to use an object ( {} ) to access it with a named index. the following example is valid in javascript
var thing = { a: {'b': 10}};
thing.a['b'] = thing['a'].b + thing['a']['b'] * thing.a.b;

you might get info on JSON object, and a function "object_to_json" on your server side language. check this link for java, or json_encode for php.


text:
Q: Upper semi-continuity of intersection numbers Consider a smooth projective morphism of schemes $X \rightarrow S$ with relative dimension $n$ (the application I have in mind is with $S$ = an open subset of $\text{Spec } \mathbb{Z}$) and assume that $V$ and $W$ are two closed subscheme of $X$, flat over $S$, such that $\text{codim}(V) + \text{codim}(W) = n$.
Denote the fibers of $X,V$ and $W$ over $s \in S$ by $X_s,V_s$ and $W_s$ and write $A^{\bullet}(X_s)$ for the Chow ring of $X_s$. The proper pushforward of the structure morphism of $X_s$ induces a morphism $\text{deg} : A^{n}(X_s) \rightarrow \mathbb{Z}$.
For every $s \in S$, the intersection of $V_s$ and $W_s$ in $X_s$ gives an intersection number $\text{deg}([V_s].[W_s]) \in \mathbb{Z}$. Is there an upper semi-continuity result on the function $s \mapsto \text{deg}([V_s].[W_s]) \in \mathbb{R}$ ?
My question is related to this post : Semi-continuity of intersection numbers but the example given in the comments does not satisfy the flatness assumption.

A: In fact the intersection numbers are constant: by [Fulton, Cor. 20.3], the specialisation maps $\sigma \colon A^*(X_\eta) \to A^*(X_s)$ are ring homomorphisms if $S$ is a Dedekind scheme with generic point $\eta$ and closed point $s$. By [Fulton, §20.2] the intersection product for flat cycles is just the fibre product:
$$[V] \underset S\times [W] = \left[ V \underset S\times W \right].$$
Finally, degree of $0$-cycles is preserved under specialisation (use that a finite flat $S$-scheme is locally free). Thus, we can compare $\deg([V_s] \cdot [W_s])$ to $\deg([V_{s'}] \cdot [W_{s'}])$ by identifying both with $\deg([V_\eta] \cdot [W_\eta])$. $\square$

References.
[Fulton]  W. Fulton, Intersection theory. Ergebnisse der Mathematik und ihrer Grenzgebiete. 3. Folge. 2. Berlin: Springer (1998). ZBL0885.14002.


text:
Q: Bulk convert image-data URIs to images I have a text file of 391 image-data URIs, one on each line. I need to batch-convert them all to images, named according to their sequence (i.e. image001.png, image002.png or similar).
What do people suggest?
Windows 10 operating system. Also MacOS.

A: Found from another question - see here
This should work as it is one per line.

If you are not afraid of running a Python script, here's a quick one.
Pass in a text file where there's one base64 image per line.
This will write out a sequence of images, like image0001.png, image0002.png, ...
import fileinput
import base64

for index, line in enumerate(fileinput.input(), 1):
  if line.startswith('data:image/png;base64,'):
    with open('image{0:04}.png'.format(index), 'wb') as png:
       line = line.strip()
       png.write(base64.b64decode(line[22:] + '===='))

Save this into a file like decode.py, then run it with
python3 decode.py input.txt


text:
Q: Creating a listView refreshable I want to create a listView with items from another listView. I have a page and one button. When I press the button, I want to open a list. When I click an item from that list I want to populate the first page (with the button that I press) with that item selected and to make refresh at the list that I want to create. Also I want to store the list created (with items selected) in a table. Can someone help me with some tutorial? I searched a lot but I didn't find something that can help me to resolve this.I appreciate any help.

A: Here is a good tutorial for how to work with list views in android:
http://www.vogella.com/articles/AndroidListView/article.html
for refreshing your data, just put your new data and use notifyDataSetChanged on your list adapter


text:
Q: How to use StreamReader and read from certain parts of the text file? I'm trying to make a login system with the sign-up already completed. I want to make it where you press the login button then it uses StreamReader to read the file that has been updated with my sign-up form. The problem is that I have structured how the file is written (example: when a user enters their details it saves their details in a structure like Username: johndoe Password: Password1 using StreamWriter in my sign-up form). But when I use StreamReader it reads the whole line instead of some parts. How would I read only some parts of my text file?
Code for sign-up form:
        bool valid = true;
        List<string> errorMessages = new List<string>();

        if (string.IsNullOrWhiteSpace(txtUsername.Text))
        {
            valid = false;
            errorMessages.Add("Username cannot be left empty.");
        }
        if (string.IsNullOrWhiteSpace(txtPassword.Text))
        {
            valid = false;
            errorMessages.Add("Please enter a password.");
        }
        if (txtConfirmPass.Text != txtPassword.Text)
        {
            valid = false;
            errorMessages.Add("Passwords do not match. Please enter matching passwords.");
        }
        if (valid == false)
        {
            string message = string.Join(Environment.NewLine, errorMessages);
            MessageBox.Show(message, "Validate Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        }
        else if(valid == true)
        {
            Random rnd = new Random();
            string userID = rnd.Next(0, 100000).ToString("D6");
            //Use StreamWriter class.
            using (StreamWriter sw = new StreamWriter("Test.txt", true))
            {
                sw.Write("\n" + "UserID: " + userID + "\n");
                sw.Write("Username: " + txtUsername.Text + "\n");
                sw.Write("Password: " + txtPassword.Text + "\n");
                sw.Write("------------------------------------");

                MessageBox.Show("Details have been saved");
                frmLogin login = new frmLogin();
                login.Show();
                this.Hide();
            }
        }

Code for login form:
private void btnLogin_Click(object sender, EventArgs e)
    {
        bool valid = false;
        using (StreamReader sr = new StreamReader("Test.txt"))
        {
            if(txtboxUser.Text == sr.ReadToEnd() && txtboxPass.Text == sr.ReadToEnd())
            {
                valid = true;
                MessageBox.Show("Granted.");
            }
            else if(valid == false)
            {
                MessageBox.Show("Error");
            }
        }
    }

A: Do you want to check if the user has entered the correct username and password by traversing the txt file?
Test info structure:
UserID: 016696
Username: kkk
Password: p123

Here is a simple you can refer to.
private void btnLogin_Click(object sender, EventArgs e)
{
    string username = "";
    string password = "";
    bool ischecked = false; // check if the Username line is read
    bool loginsuccess = false; // check if succeed

    string line;

    // Read the file and display it line by line.
    System.IO.StreamReader file = new System.IO.StreamReader("Test.txt");
    while ((line = file.ReadLine()) != null)
    {
        // if true, this is password line
        if (ischecked)
        {
            // get password
            // call Trim to remove extra spaces
            password = line.Split(':')[1].Trim();

            // check username and password
            if (txtUsername.Text == username && txtPassword.Text == password)
            {
                MessageBox.Show("Login Successfully");
                loginsuccess = true; //  login in success
                break;
            }
            // reset boolean
            ischecked = false;
        }

        // read Username line, next line is the corresponding password
        if (line.Split(':')[0] == "Username")
        {
            username = line.Split(':')[1].Trim();
            // set boolean to true
            ischecked = true;
        }
    }

    file.Close();

    // login failed
    if(!loginsuccess)
    {
        MessageBox.Show("Wrong username or password");
    }
}

A: You can try to use ReadLine() method in StreamReader like the one shown below, you should keep track that 2nd line contains the user name and the 3rd line contains the password. Also, you should use a Regex to split and get the values from the text or you could use a : delimiter and trim the values before comparison.
using (StreamReader sr = new StreamReader(path))
{
    int counter = 0;
    while (sr.Peek() >= 0)
    {
        string content = sr.ReadLine();
        var userName = content.split(':')[1].trim()...
        counter++;
    }
}

Note:
The StreamReader directly reads from the file, so you have to perform string manipulation operations. Instead, you might also consider other approaches like a cache or a database operation to persist the values across pages / windows.

A: You have problems with your code, because you want to do too much in one method. You should separate your concerns
In your case: you shouldn't mix the communication with operator with the way that the input data is serialized.
If you separate the HMI from the way you save and read the input:

*

*Easier to reuse: if you need to read the saved logged in data, without having to ask it from the operator again: just read it.

*Easier to change: if you want a different HMI, you can still save in in the original format. If you want to save it in encrypted format, your HMI doesn't need to change.

*Easier to Test: you can unit test Save / Read the file, without needing the operator input.

So separate the HMI from saving / reading the file, separate from processing the login data. This will take some extra typing, but your code will be much easier to understand, much easier to test, and future changes will have less impact on existing code.
For this you'll need a class that contains the login data. Something like this:
class User
{
    public int Id {get; set;}
    public string Name {get; set;}
    public string Password {get; set;}
}

HMI for users
To display a User in the HMI, or to fetch it from the HMI. In your form class:
public User ReadUser()
{
    return new User
    {
        Id = this.CreateUserId(),
        Name = this.txtUserName.Text,
        Password = this.txtPassword.Text,
    };
}

// not sure if you need this:
public void DisplayUser(User user)
{
    this.txtUserName.Text = user.Name,
    this.txtPassword.Text = user.Password,
}

Consider to create a property:
public User User
{
    get => new User {Id = this.CreateUserId(), ...},
    set
    {
        this.txtUserName.Text = value.Name,
        ...
    }
}

If in future you want to display users differently, like in a DataGridView, or a ComboBox, there will be only once place where you'll have to implement the changes.
Serializing users
My advice would be to stick to common formats, like CSV, XML, JSon. This would make life so much easier for you, because you can use NUGET packages for this.
If you can't convince your project leader that this would be a better solution and he still wants you to user you home invented format, you need two methods:
public void Serialize(User user, string fileName)
{
     using (var textWriter = System.IO.File.CreateText(fileName, ...))
     {
          ... // see your own code
     }
}

By the way: why do you write `\n, why don't you use TextWriter.WriteLine
Deserialize a User
Currently your file has the following layout:

*

*empty line

*A line with "UserId: " + Id

*A line with "UserName: " + Name

*A line with "Password: " + Password
public User Deserialize(string fileName)
{
using (var textReader = System.IO.File.OpenText(fileName, ...))
{
string emptyLine = textReader.ReadLine();
if (emptyLine == null)
... // TODO: decide what to do if invalid file format. Exception?
     string txtId = textReader.ReadLine();
     if (txtId == null)
         ... // TODO: decide what to do if invalid file format

     int id = Int32.Parse(txtId);
     // TODO: handle invalid txtId format. Exception?

     string name = textReader.ReadLine();
     string password = textReader.ReadLine();
     // TODO: handle invalid name / password;

     return new User
     {
         Id = id,
         Name = name,
         Password = password,
     }
 }

}
Do you see, that if in future you change the format in which Users are saved, that you only need to change the two serialization methods? for instance, if you think that passwords need to be encrypted in the file, or if you think that JSON format is better.
Because of the separation of concerns, you can use the serialization of Users also in case you don't need to display it.
The separation of concerns also makes unit test easier
}
}
sw.Write("\n" + "UserID: " + userID + "\n");
sw.Write("Username: " + txtUsername.Text + "\n");
sw.Write("Password: " + txtPassword.Text + "\n");
sw.Write("------------------------------------");


text:
Q: What is the syntax of including not null value in dynamic soql and how to include a number variable in dynamic soql var s = "Select Account_vod__c from Event_Speaker_AZ__c where ";
    s = s + " Medical_Event_AZ__c =  '" + "{!Medical_Event_vod__c.Id}" + "' "
          +" AND  Join_URL_Status_Code_AZ__c = {!JoinURLStatusCode} AND Account_AZ__c != null";

I am converting this code into apex dynamic soql.
Join URL Status is a number field and I have declared JoinURLStatusCode as a Decimal.

A: Best to use bind variables instead so there is no need to format various types and avoids the SOQL injection security risk. That is possible in dynamic as well as static SOQL, though in dynamic the variables have to be simple (no dotted expressions).
But your SOQL can be implemented as static SOQL so you get the benefit of compiler checking and explicit typing, so:
SomeSObjectType medical_Event_vod__c = ...;
Decimal joinURLStatusCode = ...;

Event_Speaker_AZ__c[] results = [
    Select Account_vod__c
    from Event_Speaker_AZ__c
    where Medical_Event_AZ__c = :medical_Event_vod__c.Id
    AND Join_URL_Status_Code_AZ__c = :joinURLStatusCode
    AND Account_AZ__c != null
];

The dynamic SOQL version would be:
SomeSObjectType medical_Event_vod__c = ...;
Decimal joinURLStatusCode = ...;
Id medicalEventId = medical_Event_vod__c.Id;

SObject[] results = Database.query(''
    + ' Select Account_vod__c'
    + ' from Event_Speaker_AZ__c'
    + ' where Medical_Event_AZ__c = :medicalEventId'
    + ' AND Join_URL_Status_Code_AZ__c = :joinURLStatusCode'
    + ' AND Account_AZ__c != null'
);

A couple of places where dynamic SOQL is needed are:

*

*Where you need to change the structure of the query at runtime rather than the values

*Where you don't want a dependency to be introduced e.g. where you are writing code that works with our without some other custom object (e.g. an optional managed package)


text:
Q: Ajax.beginform when submitting it creates more than one entry in database in asp.net mvc I am using ajax.beginform in create form when I submit the form it create more than 1 entry in database first time it create 3 entries the second submit 6 rows and so on ..
Here is my index view :
@model IEnumerable<CourseSelection.Models.country>
@{
    Layout = Layout = Request.IsAjaxRequest() ? null :  "~/Views/Shared/parameterview.cshtml";
}

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/Scripts/jquery.unobtrusive-ajax.min.js")

 COUNTRIES

    <button id="sh" class="btn btn-primary" style="float:right; margin-right:5px;">
        @Ajax.ActionLink(
            "Create",
            "Create",
            "countries",
            new AjaxOptions
            {
                UpdateTargetId = "EditDivId",
                InsertionMode = InsertionMode.ReplaceWith

            })
    </button>

@{ Html.RenderAction("_i");  }

here is my create view :
@model CourseSelection.Models.country

@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/Scripts/jquery.unobtrusive-ajax.min.js")

@using (Ajax.BeginForm("Create", "countries", FormMethod.Post, new            AjaxOptions
{
UpdateTargetId = "indexdiv",
InsertionMode = InsertionMode.ReplaceWith

}))
{
@Html.AntiForgeryToken()

                    Country Name

                    <input type="text" placeholder="countryName"     class="form-control add" id="countryName" name="countryName" />

                    Passive

                    <input type="checkbox" class="form-control" value="true" id="active" name="active" style="width:34px" />
                    <input type="hidden" value="false" name="active" />

                    <input type="submit" value="Create" class="btn btn-primary" id="s" style="margin-top:6px; width:80px; height:35px;" />

                    <input type="reset" value="Cancel" class="btn btn-danger" id="hi" style="margin-top:6px; margin-left:3px; width:80px; height:35px;" />

}

and here is my controller :
public class countriesController : Controller
{
    private CourseSelectionEntities3 db = new CourseSelectionEntities3();

    // GET: countries
    public ActionResult Index()
    {
        return View(db.countries.ToList());
    }

    public PartialViewResult _i()
    {
        return PartialView("_i", db.countries.ToList());
    }

    // GET: countries/Create
    public PartialViewResult Create()
    {
        return PartialView("_c");
    }

    // POST: countries/Create
    // To protect from overposting attacks, please enable the specific properties you want to bind to, for
    // more details see http://go.microsoft.com/fwlink/?LinkId=317598.
    [HttpPost]
    [ValidateAntiForgeryToken]
    public ActionResult Create([Bind(Include = "Id,countryName,active")] country country)
    {
        if (ModelState.IsValid)
        {
            country.countryName = country.countryName.ToUpper();
            db.countries.Add(country);
            db.SaveChanges();
            return View("Index", db.countries.ToList());
        }

        return PartialView(country);
    }

}

A: It is because of @Scripts.Render("~/Scripts/jquery.unobtrusive-ajax.min.js") more than one. Remove script parts from your create partial view and even from your other view if those scripts has been rendered in your layout page (master page).
Important Note:
if those scripts has been rendered in your layout page (master page) then you don't need those scripts anywhere else.
Description:
Here is a part of code that will run when you put jquery.unobtrusive-ajax.js in your page:
$(function(){
    //...
    $(document).on("submit", "form[data-ajax=true]", function (evt) {
        var clickInfo = $(this).data(data_click) || [],
            clickTarget = $(this).data(data_target),
            isCancel = clickTarget && clickTarget.hasClass("cancel");
        evt.preventDefault();
        if (!isCancel && !validate(this)) {
            return;
        }
        asyncRequest(this, {
            url: this.action,
            type: this.method || "GET",
            data: clickInfo.concat($(this).serializeArray())
        });
    });
    //...
});

So every time you render that file, this event handler will attach to your submit button.


text:
Q: sympy compiling functions with large matrices I have been using sympy to work with systems of differential equations. I write the equations symbolically, use autowrap to compile them through cython, and then pass the resulting function to the scipy ODE solver. One of the major benefits of doing this is that I can solve for the jacobian symbolically using the sympy jacobian function, compile it, and it to the ODE solver as well.
This has been working great for systems of about 30 variables. Recently I tried doing it with 150 variables, and what happened was that I ran out of memory when compiling the jacobian function. This is on Windows with anaconda and the microsoft Visual C++ 14 tools for python. Basically during compilation of the jacobian, which is now a 22000-element vector, memory usage during the linking step went up to about 7GB (on my 8GB laptop) before finally crashing out.
Does someone have some suggestions before I go and try on a machine with more memory? Are other operating systems or other C compilers likely to improve the situation?
I know lots of people do this type of work, so if there's an answer, it will be beneficial to a good chunk of the community.

Edit: response to some of Jonathan's comments:

Yes, I'm fully aware that this is an N^2 problem. The jacobian is a matrix of all partial derivatives, so it will have size N^2. There is no real way around this scaling. However, a 22000-element array is not nearly at the level that would create a memory problem during runtime -- I only have the problem during compilation.
Basically there are three levels that we can address this at.
1) solve the ODE problem without the jacobian, or somehow split up the jacobian to not have a 150x150 matrix. That would address the very root, but it certainly limits what I can do, and I'm not yet convinced that it's impossible to compile the jacobian function
2) change something about the way sympy automatically generates C code, to split it up into multiple chunks, use more functions for intermediate expressions, to somehow make the .c file smaller. People with more sympy experience might have some ideas on this.
3) change something about the way the C is compiled, so that less memory is needed.
I thought that by posting a separate question more oriented around #3 (literal referencing of large array -- compiler out of memory) , I would get a different audience answering. That is in fact exactly what happened. Perhaps the answer to #3 is "you can't" but that's also useful information.

A: Following a lot of the examples posted at http://www.sympy.org/scipy-2017-codegen-tutorial/ I was able to get this to compile.
The key things were
1) instead of using autowrap, write the C code directly with more control over it. Among other things, this allows passing the argument list as a vector instead of expanding it. This took some effort to get working (setting up the compiler flags through distutils, etc, etc) but in the end it worked well. Having the repo from the course linked above as an example helped a lot.
2) using common subexpression elimination (sympy.cse) to dramatically reduce the size of the expressions for the jacobian elements.
(1) by itself didn't do that much to help in this case (although I was able to use it to vastly improve performance of smaller models). The code was still 200 MB instead of the original 300 MB. But combining it with (2) (cse) I was able to get it down to a meager 1.7 MB (despite 14000 temporary variables).
The cse takes about 20-30 minutes on my laptop. After that, it compiles quickly.


text:
Q: Salesforce Licence Price depending on user profile I was wondering what is the price difference between A System Admin Profile a sales manger and a CEO profile.Any link from SalesForce will be helpful !

A: With Salesforce you pay for user licences.
The profile assigned to the user does not affect the cost of the user licence.

A: Price is not for the profiles, it is related to the environment which you choose for your need.
http://www.salesforce.com/in/crm/editions-pricing.jsp
You have to define the access privilege for each user type(CEO, Admin..) in the environment.


text:
Q: Convert video.ts file into video.mp4 using ffmpeg So I tried to convert a file named video.ts into video.mp4 in Python and am getting the error:
FileNotFoundError: [WinError 2] The system cannot find the file specified
Assuming video.ts is already loaded into the program and subprocess already imported.
This is due to the line:
>>> subprocess.run(['ffmpeg', '-i', 'video.ts', 'video.mp4']) but I don't know what's the problem.
I've opened the video.ts file and it seem to be working fine. Python version (3.8.2)

A: To anyone having this problem, download ffmpeg (will usually be in a zip), extract, go inside bin directory, and copy path (eg. location of folder\ffmpeg\bin). Then type in environment variables in start menu, add this path to the variable named PATH and save. DONE!
If there's still issues, restart your program, or further, your device


text:
Q: How do i track button presses Im a building a powwershell form that triggers relays to turn on and off and wanted to keep track of which buttons are used and many times each one has been pressed.

A: You need to attach event action blocks to the buttons' Click events, increment your counters there:
# Create a hashtable to store the button counters at the start of the script
$buttonClickCounters = @{}

# define form components here etc...

# Assuming $button1 contains a System.Windows.Forms.Button:
$button1.add_Click({
  # someone clicked the button, increment counter
  $buttonClickCounters['button1']++

  # implement whatever the button is actually supposed to affect down here
})

Once the form has run, you can inspect the individual number of button clicks by inspecting the values stored in the hashtable:
$buttonClickCounters['button1'] -as [int] # this expression will now resolve to the number of times the first button was clicked


text:
Q: Are there any issues with using an ATI 5870 on an nVidia motherboard? I have an Alienware machine, so I'm not entirely sure on the make of motherboard, however, I do know it's got nforce on it and allows me to use nVidia cards in SLI.
My 8800GTX has recently died and I'm looking to buy a replacement - I'm considering the ATI 5870, but what I want to know is, if I choose this card, does it mean I will need to change motherboard just to change graphics card vendor or does it not matter?

A: It does not matter. There will be no problems in using an ATi graphics card on an nVidia chipset motherboard, or vice-versa. Just be sure that prior to installing the ATi card, you boot into Windows in safe mode, remove the existing nVidia drivers and then install the ATi drivers post installing the hardware to ensure no driver conflicts crop up.


text:
Q: Weird thing in references/bibliography page I'm writing my thesis but I have a huge problem. I'm using BibTeX to make the bibliography, but when I run my project,in the references page of my pdf created file I have beside the number of the record (I'm using plain style) a label with the record's key name
I don't know why there is this label, and I want to hide it.
How can I do?
In my main .tex file I use:
 \usepackage{cite}

    %---------------------BEGIN BIBLIOGRAFIA----------------------------

    \newpage

    \nocite{*}

    \bibliographystyle{plain}

    \bibliography{bibliography}

    %---------------------END BIBLIOGRAFIA------------------------------

And in bibliography.bib I have (at the moment) only one record:
@article{jor:1,

author = {Andreas Jordan and Regina Scholz and Peter Wust and Horst Fakhling and Roland
Felix},

title = {Magnetic fluid hyperthermia ({M}{F}{H}): Cancer treatment with
AC magnetic field induced excitation of biocompatible
superparamagnetic nanoparticles},

journal = {Journal of Magnetism and Magnetic Materials},

year = 1999,

volume = {201},

pages = {413-419}

}

A: showkeys is a debugging package so that while drafting citations and label/ref show the internal key name. For the final versions you should remove it or use
\usepackage[final]{showkeys}