text:
Q: Shouldn't string references work for action names of an intent filter in the AndroidManifest? Originally my AndroidManifest.xml contained an activity which I reached through its custom action name.
<activity
 android:label="HERE I AM"
 android:name="TestController">
 <intent-filter>
  <action android:name="com.company.project.TestActivity" />
  <category android:name="android.intent.category.DEFAULT" />
 </intent-filter>
</activity>

With this manifest startActivity(new Intent("com.company.project.TestActivity")); started my Activity without any problems.
But I was not satisfied with this coding style. Earlyer I was severeal times told not to use in-line defined string constants because it wolud lead to less maintainable code. And it really is a point.
So first I declared a public static final String MY_ACTION = "com.company.project.TestActivity"; in my App.java class (the one I used for ) and reached my component through this named constant this way:
startActivity(new Intent(App.MY_ACTION));
This seemed much better but I still had to maintain two instances of the same string. At http://developer.android.com/reference/android/R.styleable.html#AndroidManifestAction_name a read

... This may also be a reference to a resource (in the form "@[package:]type:name") or theme attribute (in the form "?[package:][type:]name") containing a value of this type.

So I guessed It would be fine to have this string defined JUST ONCE. I put <string name="MY_ACTION">com.company.project.TestActivity</string> in my strings.xml and modified my App:
public class App ...
    public static String MY_ACTION;

    @Override
    public void onCreate() {
        super.onCreate();
        MY_ACTION = getString(R.string.MY_ACTION);
    ...

And everything was still O.K.
... until I changed my AndroidManifest.xml to use  <action android:name="@string/MY_ACTION" /> instead of <action android:name="com.company.project.TestActivity" />.
After this change to my biggest surprise the application broke down at runtime complaining about not finding the Activity for my intent. The string reference was probably not parsed correctly. :(
Maybe the problem is that R.string is config dependant...? But hey I cannot be so insane to choose such a string reference whose value may change from config to config! And developer.android.com told me it's O.K. to use references at action names! I experienced this behavior at API levels 6, 7, end 8. Is it just a simple bug in the android system? Or do I misunderstand something?
I am totally puzzled, please help me. Thanks in advance.

A: I had the same problem today, and went searching for an answer elsewhere.  It appears according to Dianne Hackborne that what we are trying to do is not allowed.  You apparently must use the literal strings in intent filters.
http://android.bigresource.com/Track/android-zKGKHraw9/


text:
Q: Using a variable for BIBER DATE value produces blank date in output I'm using MikTex with biber
\usepackage[backend=biber,natbib=true,style=numeric,sorting=none]{biblatex}

and I want to use a variable for the date value, but it does not provide any output. I set up the biber category and variables as below in file QMSbiblatex.tex
\addtocategory{MILinternal}{ref__MIL_QAM_QualityAssuranceManual}
\newcommand{\RepsSopQualityAssuranceManualNumber}{MIL-QAM-9001}
\newcommand{\RepsSopQualityAssuranceManualTitle}{REPS Quality Assurance Manual - ISO 9001}
\newcommand{\RepsSopQualityAssuranceManualDate}{2017-07-13}

then define the reference in references.bib as
@Electronic{ref__MIL_QAM_QualityAssuranceManual,
  author       = {\RepsSopQualityAssuranceManualNumber},
  organization = {{\RepsCitationOrganization}},
  title        = {{\RepsSopQualityAssuranceManualTitle}},
  date         = {\RepsSopQualityAssuranceManualDate},
}

which does NOT include the date in the reference but
@Electronic{ref__MIL_QAM_QualityAssuranceManual,
  author       = {\RepsSopQualityAssuranceManualNumber},
  organization = {{\RepsCitationOrganization}},
  title        = {{\RepsSopQualityAssuranceManualTitle}},
  date         = {2017-07-13},
}

outputs the reference with the date as expected.
Any thoughts on why using a variable does not work in the DATE field but is fine in the other fields?

A: To understand why this does not work as you hoped we first need to understand how .bib files work. Question mark or bold citation key instead of citation number has a great explanation of the work BibTeX and Biber do. In short (but please also read Paul Stanley's answer, it is great), Biber (and BibTeX, but I'll just say Biber from now on) parse the .bib file and produce output usable for LaTeX. For biblatex the output produced by Biber (the backend) is a structured, LaTeX-readable, predigested and enhanced version of the entry data.
The Biber-digested version of the entry
@book{appleby,
  author    = {Humphrey Appleby},
  title     = {On the Importance of the Civil Service},
  location  = {London},
  publisher = {Routledge},
  date      = {1980-04-06},
}

might look like this
\entry{appleby}{book}{}
  \name{author}{1}{}{%
    {{uniquename=0,uniquepart=base,hash=dd90e644e3018ab2c6a7ffa2a58522d0}{%
       family={Appleby},
       familyi={A\bibinitperiod},
       given={Humphrey},
       giveni={H\bibinitperiod},
       givenun=0}}%
  }
  \list{location}{1}{%
    {London}%
  }
  \list{publisher}{1}{%
    {Routledge}%
  }
  \strng{namehash}{dd90e644e3018ab2c6a7ffa2a58522d0}
  \strng{fullhash}{dd90e644e3018ab2c6a7ffa2a58522d0}
  \strng{bibnamehash}{dd90e644e3018ab2c6a7ffa2a58522d0}
  \strng{authorbibnamehash}{dd90e644e3018ab2c6a7ffa2a58522d0}
  \strng{authornamehash}{dd90e644e3018ab2c6a7ffa2a58522d0}
  \strng{authorfullhash}{dd90e644e3018ab2c6a7ffa2a58522d0}
  \field{sortinit}{A}
  \field{sortinithash}{d77c7cdd82ff690d4c3ef13216f92f0b}
  \field{extradatescope}{labelyear}
  \field{labeldatesource}{}
  \field{labelnamesource}{author}
  \field{labeltitlesource}{title}
  \field{day}{6}
  \field{month}{4}
  \field{title}{On the Importance of the Civil Service}
  \field{year}{1980}
  \field{dateera}{ce}
\endentry

Note that some fields have been processed by Biber. In particular the name Humphrey Appleby has been split into its two components and Biber has produced a name hash. Appleby, Humphrey in the .bib entry would have produced exactly the same result. Similarly, the date = {1980-04-06}, has been parsed and decomposed into its date parts (\field{year}{1980}, \field{month}{4}, \field{day}{6}, ...).
It is important to note that Biber and BibTeX are not LaTeX, they do not understand or resolve LaTeX macros.
title     = {\foo},

would just come out as
  \field{title}{\foo}

(Biber actually knows about some LaTeX macros, namely some that resolve to Unicode characters, but that does not help us here.)
The macros are just passed through and are only used (expanded) when the data is used in the document. In particular that means that the
date         = {\RepsSopQualityAssuranceManualDate},

in  your .bib file can not be resolved and parsed by Biber, since the information
\newcommand{\RepsSopQualityAssuranceManualDate}{2017-07-13}

is only available in the .tex document and can not be accessed by Biber. So Biber just sees \RepsSopQualityAssuranceManualDate which is not a valid date and discards it with a complaint in the .blg file.

WARN - Entry 'ref__MIL_QAM_QualityAssuranceManual' (test.bib):
       Invalid format '\RepsSopQualityAssuranceManualDate' of date field 'date' - ignoring

A similar thing would happen to name fields. If we had written
author    = {\appleby},

in the .bib and defined
\newcommand*{\appleby}{Humphrey Appleby}

in the .tex file, we would have ended up with
  \name{author}{1}{}{%
    {{uniquename=0,uniquepart=base,hash=0213062b7acb78617f5861ef3be11354}{%
       family={\appleby},
       familyi={y\bibinitperiod}}}%
  }

in the .bbl. This shows that Biber did not parse the name as consisting of the family name "Appleby" and given name "Humphrey". Instead it consists of only the family part \appleby (which expands to "Humphrey Appleby"). All features that rely on biblatex knowing the given and family name part will not work as expected, the "Humphrey Appleby" will be treated as an atomic unit. In author-year citations for example we would get "Humphrey Appley 1980" and not "Appleby 1980".
This shows that you can't use TeX macros/variables to fill fields in your .bib entries, that have to be parsed by Biber.

So what can you do?
That very much depends on your use case.
The first question is probably whether you need an entry like this at all. It seems a little odd that bibliographic data of a work you cite would change in a way that requires you to modify the data on the fly from within the document.
A second attempt could be to invert the flow of information. Depending on what use case you have in mind, it might be enough to just type the data once in the .bib file and retrieve certain bits with \citetle{ref__MIL_QAM_QualityAssuranceManual}, \citeauthor{ref__MIL_QAM_QualityAssuranceManual}, \citedate{ref__MIL_QAM_QualityAssuranceManual}, or maybe even \citefield{ref__MIL_QAM_QualityAssuranceManual}{title}, \citelist{ref__MIL_QAM_QualityAssuranceManual}{organization}, ... etc. The \cite... commands are not expandable, though, so if you need the data in an expandable fashion, you need to take a slightly different approach (it should still be possible, if you are interested, you should probably ask a new question, though, this answer is long enough already).
If you need to create an entry with data on the fly from the document, you can always just use filecontents.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber,natbib=true,style=numeric,sorting=none]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
  author    = {Humphrey Appleby},
  title     = {On the Importance of the Civil Service},
  location  = {London},
  publisher = {Routledge},
  date      = {1980-04-06},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\cite{appleby}
\printbibliography
\end{document}

.bib files know @strings that can be used to store repeated or possibly changing info. @strings can even be taken from a different .bib file, so you could do something like
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber,natbib=true,style=numeric,sorting=none]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{\jobname-entry.bib}
@book{appleby,
  author    = {Humphrey Appleby},
  title     = {On the Importance of the Civil Service},
  location  = {London},
  publisher = {Routledge},
  date      = mydate,
}
\end{filecontents}
\begin{filecontents}{\jobname-strings.bib}
@string{mydate = {1980-06-05}}
\end{filecontents}

\addbibresource{\jobname-strings.bib}
\addbibresource{\jobname-entry.bib}

\begin{document}
\cite{appleby}
\printbibliography
\end{document}

You could also manipulate field data with a sourcemap. Due to the way sourcemaps work, macros will be expanded in the \replace step, so you could even use a macro here.
\documentclass[british]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber,natbib=true,style=numeric,sorting=none]{biblatex}

\newcommand*{\applebydate}{1980-07-08}
\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
      \step[fieldsource=date,
            match=\regexp{\A\\applebydate\Z},
            replace=\applebydate]
    }
  }
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
@book{appleby,
  author    = {Humphrey Appleby},
  title     = {On the Importance of the Civil Service},
  location  = {London},
  publisher = {Routledge},
  date      = {\applebydate},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\begin{document}
\cite{appleby}
\printbibliography
\end{document}

redpajama_set_name: RedPajamaStackExchange


text:
Q: How does Infection Bio War calculate infection spreading (infecting)? I was playing Infection Bio War, but it certainly has a different way of calculating how the infection expands than other games in the genre. When you open the stats tab while all states are infected, the game shows you like 10x more states with over 90% or under 10% infected people then the other states.
How do the infections spread from across countries?
How does this differ from how the infection spreads inside a state?

A: After some in-game testing and file opening, I can give these results:
Infection spreading across countries:

*

*If in a country 50% or more percent of the live people are infected (this number starts at 50% in most states, but may move from 30% to 60% and is different country to country), the infection will spread to all surrounding countries, which will have 1 more infected person.

*The percentual limit of people needed for infection spreading to the surrounding states may vary due to: purchased upgrades, country climate (temperature, driness), wealthiness, percent of dead people.

*All states which have an airport or a dock have a chance of sending a plane/boat with an infected passenger. This chance is equal to the percent of infected people in that country.

*When a boat/plane is sent, it does not change the number of people in the state it was sent from, nor of the state it lands in.

*If an infected boat/plane lands in any country, it infects 1 healthy person from that country (if there is any).

*Countries without live people can't infect nearby states nor send ships/airplanes.
Infection sprreading inside a state:

*

*Every game tick (about one second) the number of infected people is recalculated by this formula:
I(new) = I + (I * H * v) / A
where I stands forr Infected, H for Healthy, A for Alive and v is the variable.

*

*The variable v is a number from 0 to 1. It is affected by purchased upgrades, number of infected surrounding states, country climate, wealthiness and urbanity and is different in every state. At the beginning of the game it is in between 0.1 and 0.2 in all countries, but can change rapidly. The number can't exceed 1.0.


text:
Q: How is a Green Lantern ring able to have its possessor fly and make objects at the same time? How is the ring able to perform more than one operation at a time? Has an operating manual ever appeared?

A: Depending on the skill and willpower of the wearer, it can do almost anything.

The rings use pure energy supplied by a Power Battery, which in most cases takes the form of bright green light. This energy is the green light of willpower of the Emotional Electromagnetic Spectrum. A green lantern ring has the ability to affect and use fundamental forces of the known universe, including electromagnetic energies such as gravity, radiation, heat, light, and powerful blasts of concussive force. The ring can also create fields of force formed from an unknown energy that is bound by the users' will. The limitations of such use are the skill, knowledge and imagination of the user.
  -DC Wikia

Hence, it is possible to do any number of simultaneous actions, as long as the ring is powered and the user is skilled enough.


text:
Q: Why does my formula in a table crash Excel? I have a table defined in Excel.  It has about 20 columns and 20,000 rows.
In one column, I'd like to put the following formula
=IF([@[Customer End]]=[@[Effective End]],1,0)
Basically, for that contract, if the contract start date equals the overall customer date, put a 1.  This is to call out which contracts signify the beginning & end of the relationships.
But as soon as I put in this formula, my Excel hangs.  It's particularly odd because I was able to successfully do it for the start dates.  Excel worked a bit but was able to process it.  But Excel just gives up when I do it for the end dates.
If you can offer any guidance, I would much appreciate it.  Thank you!


text:
Q: How to get the Version of an event appended to a stream I am writing to an EventStore stream using the C# API AppendToStreamAsync() call. I see that while this returns a WriteResult, the version of the newly appended event isn't returned. I can't rely on NextExpectedVersion as there are potentially multiple clients writing to this stream.
I could subscribe to the stream and wait for "my" event to turn up,
but have I missed something else, the documentation is pretty light and doesn't even mention the returned type.
What is regarded as the best way to get this number?

A: The version is not needed, because before you write the stream you know the version of your aggregate (stream), so when the write is successful you known the version.
Before you write a new event to a stream you have to read the stream to rehydrate the aggregate. Then you know the version. Because when an other writer has written to the same stream you must first have the new state. (If you stil have the aggregate in memory, you can query from the current version in your aggregate)
If the optimistic locking is not needed you can give the ANY version when writing the stream. (This can be done when the stream is just a logging stream)


text:
Q: PHP - Search engine ordering by best results I'm developing a search engine and I use the following code for my query:
SELECT * FROM books WHERE MATCH(titulo, description) AGAINST ('mark the android' IN BOOLEAN MODE)

I get many results but what i want to get them ordered by best results prior to less coherent results.
How can I accomplish this?
Thanks

A: What you want to do is drop the IN BOOLEAN MODE and order by that MATCH ... AGAINST ... since it returns a number that represents relevancy.
SELECT * FROM books
WHERE MATCH(titulo, description) AGAINST ('mark the android')
ORDER BY MATCH(titulo, description) AGAINST ('mark the android') DESC

if you want to see the numbers to have a feel of what the numbers are you can simply select it too like this
SELECT *,MATCH(titulo, description) AGAINST ('mark the android') as relevancy FROM books
WHERE MATCH(titulo, description) AGAINST ('mark the android')
ORDER BY MATCH(titulo, description) AGAINST ('mark the android') DESC


text:
Q: Integral over a ball.
Let for $0<t<t_0$
  $$e(t)=\int_{B(x, R(t_0-t))}v(x,t)dx$$
  Given that $v(x,t)$ is a differentiable function prove that
  $$e'(t)=\int_{B(x, R(t_0-t))}v_t-R\int_{\partial B(x, R(t_0-t))}vdS$$

I know that I have to do some change of variable. But I don't see which. Somebody can give a hint?
Thanks!

A: This is a generalisation of Leibniz's rule for differentiation under the integral sign,
$$ \frac{d}{dt} \int_{a(t)}^{b(t)} f(x,t) \, dx = b'(t) f(b(t),t)-a'(t) f(a(t),t) + \int_{a(t)}^{b(t)} \frac{\partial f}{\partial t}(x,t) \, dx  $$
You can do yours by considering
$$ e(t+h)-e(t) = \int_{B(x,R(t_0-t-h))} v(y,t+h) \, dy - \int_{B(x,R(t_0-t))} v(y,t) \, dy \\
= \int_{B(x,R(t_0-t-h))} v(y,t+h) \, dy - \int_{B(x,R(t_0-t-h))} v(y,t) \, dy + \int_{B(x,R(t_0-t-h))} v(y,t) \, dy  - \int_{B(x,R(t_0-t))} v(y,t) \, dy $$
Mean value theorem on the integrand in the first term gives
$$ \int_{B(x,R(t_0-t-h))} v(y,t+h) \, dy - \int_{B(x,R(t_0-t-h))} v(y,t) \, dy = h \int_{B(x,R(t_0-t-h))} \frac{\partial v}{\partial t}(y,\tau) \, dy + o(h), $$
and of the second, using the mean value theorem gives
$$ \int_{B(x,R(t_0-t-h)) \setminus B(x,R(t_0-t)} v(y,t) \, dy = -Rh \int_{\partial B(x,R(t_0-\tau')} v(y,\tau') \, dy, $$
where both of $\tau,\tau'$ satisfy $t<\tau,\tau'<h$. Now divide by $h$ and take the limit as $h \to 0$.


text:
Q: Chrome uses too much ram I've noticed chrome is using quite a bit of my RAM. I've got a total of 8GB and the total consumption of Chrome is around 500mb with just 4 tabs: this one, 2 google tabs and a facebook tab. I've also noticed(using the chrome process manager) that facebook normally uses 150+ mb and the gpu process just a bit more. I've only got 3 plugins running which use about 30mb each so they're not the problem. I realise this is not too much in general, but it is is for a web browser.
I don't know if it's related anyhow but I frequently experience slow downs when surfing, especially on websites like facebook and youtube.
Is this normal?
I'm using version 25.0.1323.1 dev-m and I'm on windows 7, 64bit.
Edit: From the comments I understand that it's not something to worry about. I'll close this question and post another regarding the slows because it's not related to this one. Thanks a lot everyone.

A: My chrome is close to using 2GB with all of its processes together. (although i have 3 windows and a bunch of tabs each)
Its a pretty standard thing for chrome, and other browsers for that matter.


text:
Q: Updating an iOS app with CoreData removes all records I have updated an iOS app that has a Core Data database via the the App Store, and all my stored data got deleted.
is there a way to prevent this issue in the Xcode code?
Thanks!


text:
Q: QtCreator issue when compiling a basic QtWidgets Application in Linux I am getting an issue as below when running a basic QtWidgets Application without any modification.

:-1: error: cannot find -lGL

I am using QtCreator version 3.0.0 Based on Qt 5.2.0 (GCC 4.6.1, 32 bit).
Note: QtConsole applications run without any problem
Project file looks like below

-------------------------------------------------
#
Project created by QtCreator 2014-01-04T13:38:17
#
-------------------------------------------------
QT       += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = second TEMPLATE = app
SOURCES += main.cpp\
          mainwindow.cpp
HEADERS  += mainwindow.h
FORMS    += mainwindow.ui

main.cpp
#include "mainwindow.h"
#include <QApplication>

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();

    return a.exec();
}

mainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

}

MainWindow::~MainWindow()
{
    delete ui;
}

A: This means, you do not either have an OpenGL library installed properly on your system, or the library path is wrong.
You will need to install the following package as per documentation on your Ubuntu box:
sudo apt-get intall libglu1-mesa-dev


text:
Q: Setting UILocalNotification's applicationIconBadgeNumber When I set up the localnotification's applicationIconBadgeNumber, do I put just 1, knowing that it will be adding to the total, or do I put the total?
e.g.
UILocalNotification *localNotif2 = [[UILocalNotification alloc] init];

localNotif2.applicationIconBadgeNumber = 1;

OR
UILocalNotification *localNotif2 = [[UILocalNotification alloc] init];

localNotif2.applicationIconBadgeNumber = Total;

(However, I won't be able predict the total number of notification that the user has read at any given time in time...which will mean, if the second method is true than I'm screwed.)

A: Second is true. Always set the total value. You have to recalculate all your noitifications every time your app is opened.
Also the documentation states The application should use this property's value to increment the current icon badge number, if any., it is NOT incrementing on its own.

A: It is not possible, You can handle it from your code.


text:
Q: Using cp to replace a directory of the same name How can I make cp replace a directory of the same name without removing the existing directory first? cp's default behaviour is to copy the source directory into the destination rather than replace it:
mkdir -p test/a
mkdir a
cp -a test/a a

a is now within a, it didn't replace a. How can I make cp replace directories? I want it to work the same way it does with files.
I could of course delete the target first, but I don't want to have to run more than one command :)

A: Use a dot . after a:
cp -a test/a/. a

It actually does not replace a as you though. It just copy test/a content to directory a.

A: Asterisk does the thing ;)
cp -a test/a/* a


text:
Q: How do I group some parts of flex elements? I'm almost done with my React Native view, but I'm not sure how to group individual items in a page that contains many.
How do I moved Details directly under Header?

view
    return (
      <View style={s.container}>

            <View style={[s.header, s.flexRow]}>
          <Text style={s.carRegNr}> CV 515632 </Text>
                <Text style={s.insuranceName}> Plus </Text>
        </View>

        <View style={s.flexColumn}>
          <Text style={s.claimNrText}> Claim nr </Text>
          <Text style={s.claimNr}> 020202 </Text>
        </View>

          <View style={s.flexColumn}>
                    <Text style={s.nextSteps}> Next steps </Text>
            <Text style={s.nextStepsDetails}> Goto the repair shop </Text>
                  </View>

          <View style={[s.flexRow, {justifyContent: "flex-end"}]}>
            <CarRepairShop
              name="Best Auto"
              address1="Shiny road 1"
              address2="0101 City"
            />
            <CarRepairShop name="Rental" address1="Rental included"/>
                  </View>

        <GjeButton
          title="Close"
        />

        { /*

        <GjeButton
          title={"Set DamageClaimReceiptNr"}
          onPress={ () => this.props.setDamageClaimReceiptNr("100") }
        />

        <GjeButton
          title={"Add car registration nr"}
          onPress={ () => this.props.setCarRegNr("lkj2") }
        />
        */
        }

      </View>
    )
  }
}

styling
export default StyleSheet.create({
    container: {
        height: 10,
    flex: 1,
    padding: 30,
    flexDirection: "column",
    justifyContent: "flex-start"
    },

    header: {
        justifyContent: "space-between",
    borderColor: colors.grape,
    borderRadius: 2,
    },

    carRegNr: {
        fontWeight: "bold",
    color: colors.black,
    fontSize: 25,
    },

  groupTight: {
    flexDirection: "column",
    flex: 1,
    justifyContent: "flex-start"
  },

    insuranceName: {
    color: colors.black,
        fontSize: 23
    },

    flexRow: {
    flex: 1,
    flexDirection: "row",
        justifyContent: "space-between",
    },

    flexColumn: {
    width: "100%",
    flex: 1,
    flexDirection: "column",
    },

  nextSteps: {
    color: colors.black,
        fontSize: 15,
  },
  nextStepsDetails: {
    color: colors.black,
        fontSize: 7,
  },

    bold: {
    color: colors.black,
        fontWeight: "bold",
    },

    cont: {
        margin: 5,
        padding: 3,
    },

    claimNrText: {
    color: colors.black,
        margin: 0,
        padding: 0,
        fontSize: 30,
    },

    claimNr: {
        fontSize: 26,
    }
})

A: You can just add a parent View Element that encloses the Header and the Details Element.
<View>
    <View style={...headerStyles}>
    </View>
    <View style={...detailStyles}>
    </View>
</View>

The parent view then can have justifyContent: 'flex-start'

A: @crispychicken, Thanks for the suggestion to wrap the items in a new View tag.
It didn't work with your CSS suggestion, though.
I got it working after updating my .container styling as seen here.
style
import { colors } from "./colors"
import { fonts } from "./fonts"
import { StyleSheet } from "react-native"

export default StyleSheet.create({
  container: {
    height: 10,
    flex: 1,
    padding: 30,
    flexDirection: "column",
    justifyContent: "space-around"
  },

  header: {
    justifyContent: "space-between",
    borderColor: colors.grape,
    borderRadius: 2,
  },

  carRegNr: {
    fontWeight: "bold",
    color: colors.black,
    fontSize: 25,
  },

  groupTight: {
    flexDirection: "column",
    justifyContent: "flex-start"
  },

  insuranceName: {
    color: colors.black,
    fontSize: 23
  },

  flexRow: {
    flexDirection: "row",
    justifyContent: "space-between",
  },

  flexColumn: {
    width: "100%",
    flexDirection: "column",
  },

  nextStepsText: {
    color: colors.black,
    fontSize: 25,
    fontWeight: "bold",
  },

  nextStepsDetails: {
    color: colors.black,
    fontSize: 20,
  },

  bold: {
    color: colors.black,
    fontWeight: "bold",
  },

  cont: {
    margin: 5,
    padding: 3,
  },

  claimNrText: {
    color: colors.black,
    margin: 0,
    padding: 0,
    fontSize: 30,
  },

  claimNr: {
    fontSize: 26,
  }
})


text:
Q: Leaflet only renders tiles with 0 y coordinate for game map I have just started out with Leaflet, and I wanted to make a map for a game I play (GTA V)
I have all the necessary tiles for building a map. However, when I run my code, only 2 tiles show up, that have 0 as their y coordinate.
My code:

Javascript:
const map = L.map('map', {}).setView([0.0, 0.0], 0);

const tile = L.tileLayer('tiles/minimap_sea_{y}_{x}.png', {
    minZoom: 0,
    maxZoom: 2,
    tileSize: 1024,
    bounds: [[0, 0],[3072, 2048]],
    maxNativeZoom: 0,
    minNativeZoom: 0,
    noWrap: true
}).addTo(map);

HTML:
<!DOCTYPE html>

        <meta charset="UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet"
         href="https://unpkg.com/leaflet@1.7.1/dist/leaflet.css"
        integrity="sha512- xodZBNTC5n17Xt2atTPuE1HxjVMSvLVW9ocqUKLsCC5CXdbqCmblAshOMAS6/keqq/sMZMZ19scR4PsZChSR7A=="
        crossorigin=""/>

        <link rel="stylesheet" href="style.css">

        <title>Test Map</title>

CSS:
body {
    margin: 0;
    height: 100vh;
    width: 100vw;
}

#map {
    width: 100%;
    height: 100%;
    background-color: #888888;
}

Tile picture names:
minimap_sea_0_0.png
minimap_sea_0_1.png
minimap_sea_1_0.png
minimap_sea_1_1.png
minimap_sea_2_0.png
minimap_sea_2_1.png

I have already tried setting the bounds but that did not work either.
Solution:
I specified the coordinate system to be simple at map creation, and negated the y length of my bounds.
New code:
Javascript:
const map = L.map('map', {
    crs: L.CRS.Simple
}).setView([0.0, 0.0], 0);

const tile = L.tileLayer('tiles/minimap_sea_{y}_{x}.png', {
    minZoom: 0,
    maxZoom: 2,
    tileSize: 1024,
    bounds: [[0, 0],[-3072, 2048]],
    maxNativeZoom: 0,
    minNativeZoom: 0,
    tms: true
}).addTo(map);

A: If you make a map not covering a ~sphere (like the Earth), make sure to specify L.CRS.Simple in the map crs option:

A simple CRS that maps longitude and latitude into x and y directly. May be used for maps of flat surfaces (e.g. game maps).

const map = L.map('map', {
  crs: L.CRS.Simple
}).setView([0.0, 0.0], 0);

Otherwise at zoom 0, max and min latitudes of default EPSG3857 CRS will clamp to 256px height, 512px at zoom 1, and 1024px at zoom 2, therefore still within your y = 0 tile (1024px size).
See also the Leaflet tutorial covering this case: Non-geographical maps

A: This is probably related to leaflet confusing the zoom with the y value.  I recommend following the standard slippymap tile structure.  The tiles need to be in a directory structure that follows a zoom/x/y pattern.  It looks like you only have one zoom layer (as far as I can tell).  Lets say its zoom level 0.  Your tiles should be organized like this:
/myproj
  myjavascriptfile.js
  /tiles
    /0
      /0
         0.png
         1.png
      /1
         0.png
         1.png
      /2
         0.png
         1.png

Now you can tell the tilelayer where to find these like this:
const tile = L.tileLayer('tiles/{z}/{y}/{x}.png')

I highly recommend checking out this article on naming map tiles.


text:
Q: Is it possible to get truly portable Chrome that ignores registry policies? I work in a company that has lately deployed a GPO that disables all sync capabilities of Chrome.  Thus I cannot "login" into Chrome, have no extensions, and the bookmarks don't sync.
I managed to find an "offending" keys in registry under HK_LM/Software/Policies/Google/Chrome/* like SyncDisabled=1. Unfortunately I am not an admin so I cant delete/change these keys.
I downloaded Chrome Portable but it still seems to adhere to these policies... Is there some truly portable version of Google Chrome that ignores all registry settings? I know about Chromium, but I couldn't find a link for download (only sources for building).
Thanks.

A: I managed to locate compiled sources for latest Chromium and it works! I just downloaded zip file for win32, extracted and it works like a charm (including sync).
FYI: I've read somewhere that it only works because it loads registry keys from different "path" (e.g. Policies/Chrome vs Policies/Chromium).

A: SRWare Iron is a web browser that is based on the  "Chromium" Sourcecode.
http://www.srware.net/en/index.php
The portable version can be found here - but without some features that privacy advocates object to.
http://portableapps.com/apps/internet/iron_portable

A: There is also a Chromium portable sourceforge project.
They state that

Chromium Portable is a custom-built version of the Chromium web
  browser ― the open-source project behind Google Chrome ― optimized for
  portable use and packaged in the PortableApps.com Format, so you can
  run it from an iPod, USB flash drive, portable hard drive, CD or any
  other portable media. You can take your bookmarks, extensions, themes
  and plugins with you, and Chromium Portable will leave no personal
  information behind on the machine you run it on.

This has the advantage that you can download older builds in case you need them (for example to use it in an old machine with XP, since the new versions require W7+ to run).


text:
Q: Can we have a radially symmetric function solve the heat eqn. without symmetric boundary data?
In other words, if
  $$\begin{cases} u_t - \Delta u = 0 & \mbox{ in} \space\ \mathbb{R}^n \times (0,\infty) \\ u(x,0) = g(x) & \mbox{ on} \space\ \mathbb{R}^n \times \left\{ t = 0 \right\} \end{cases}$$
  where $u(x,t)$ is radially symmetric. Does this imply that the initial conditions must be radially symmetric?

I know as $t\to 0$ that $u$ converges to $g$, and by hypothesis $u(x,t)$ is radially symmetric wrt $x$ for all $t>0$. Is it as simple as passing the limit using the continuity of $u$, so that our initial condition, $g$ is radially symmetric.
I can't help but feel like I'm overlooking something here.
::EDIT::
We may pass the limit because otherwise we would have that $|g(x) - g(Ox)| = C$, where $O$ is an orthogonal matrix, and $C$ is some arbitrary constant. Then, since $u$ converges to $g$ as $t\to 0$, we have that for all $\epsilon > 0$, that
$$\sup_t \left\{|u(x,t) - g(x)|\right\} < \epsilon \hspace{1cm} t << 1$$
Hence,
\begin{align*}
|u(x,t) - g(x)|  &= |u(x,t) - g(Ox) + g(Ox) - g(x)| \\
&\leq |u(Ox) - g(Ox)| + |g(Ox) - g(x)| \\
&< \epsilon + C
\end{align*}
a contradiction.

A: In some sense, this can happen. For example, with $n=1$ let
$$
g(x) = \begin{cases} 0 \quad &\text{if }x\ne 1 \\ 1 &\text{if }x = 1 \end{cases}
$$
The solution of heat equation with this initial condition is $u(x,t)\equiv 0$, which is symmetric (even), while $g$ is not.
The unstated hypothesis in your question was that $u$ is continuous on $\mathbb{R}^n\times [0,\infty)$. In that case the statement is true. The proof you wrote needs work (what exactly is a contradiction at the end?). It should have been simpler:
$$
g(Ox) = \lim_{t\to 0} u(Ox, t) = \lim_{t\to 0} u(x, t) = g(x)
$$
for every orthogonal matrix $O$.


text:
Q: ERROR: Command errored out with exit status 1 I tried:
pip3 install -r requirements.txt

Here's the error I received:
 Command "python setup.py egg_info" failed with error code 1 in
 C:\Users\Admin\AppData\Local\Temp\pip-install-6c3rea1s\pycocotools\
 You are using pip version 19.0.3, however version 20.0.2 is available.
 You should consider upgrading via the 'python -m pip install --upgrade pip'
 command.

So, I tried:
pip install --upgrade pip

and
install pip3 install -r requirements.txt

That resulted in more errors:
 ERROR: Command errored out with exit status 1:      command:
 'c:\users\admin\appdata\local\programs\python\python37-32\python.exe'
 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-epmkeh4g\\pycocotools\\setup.py'"'"';
 __file__='"'"'C:\\Users\\Admin\\AppData\\Local\\Temp\\pip-install-epmkeh4g\\pycocotools\\setup.py'"'"';f=getattr(tokenize,
 '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
 '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
 egg_info --egg-base
 'C:\Users\Admin\AppData\Local\Temp\pip-install-epmkeh4g\pycocotools\pip-egg-info'
         cwd:
 C:\Users\Admin\AppData\Local\Temp\pip-install-epmkeh4g\pycocotools\
    Complete output (5 lines):  Traceback (most recent call last):
 File "<string>", line 1, in <module>     File
 "C:\Users\Admin\AppData\Local\Temp\pip-install-epmkeh4g\pycocotools\setup.py",
 line 2, in <module>        from Cython.Build import cythonize
    ModuleNotFoundError: No module named 'Cython'
    ---------------------------------------- ERROR: Command errored out
 with exit status 1: python setup.py egg_info Check the logs for full
 command output.

I deleted the folder and re-install, but the results remained the same.

A: This is a bug in pycocotools. The bug was fixed in 2017 but it seems the fix didn't get into release 2.0 in 2018 (I guess the release process is also buggy).
There is also another similar bug in setup.py — it imports numpy before installing it.
There is no simple workarounds for these bugs using requirements.txt. You need to install the required modules before installing pycocotools:
pip install Cython numpy
pip install -r requirements.txt


text:
Q: WordNet - Multiple relationships possible between two words? Can there be more tha one relationship (SYNONYMS, HOLONYM, etc) between two words in WordNet? Logically, I would say no but with different senses, is it possible?

A: You wouldn't get that from WordNet. You need context for that purpose and there is no context in WordNet. You can try Roget's which has some sort of conceptual taxonomy of words [starting from abstract concepts and becoming more specific], but in terms of coverage it's no where near WordNet. Perhaps you would require to look into ESA which provides a similarity metric based on Wikipedia. Also, have a look at the popular word2vec.


text:
Q: Idiomatic way to add an element into sub-list in full-immutable hierarchy I have the following data-structure:
var foo: Map<String, List<String>> = emptyMap()
foo += mapOf(
        "1" to listOf("a", "b"),
        "2" to listOf("a", "b"),
        "3" to listOf("a", "b")
)

Map and sub-list are both immutable. I now want to add the element c to the list of the first element in the map.
I came up with this solutions:
foo += "1" to (foo["1"] ?: emptyList()) + "c"

but is this really the idiomatic way?

Update based on @hotkeys answer
foo += "1" to foo["1"].orEmpty() + "c"

A: One alternative you could check is the approach that the incubating library kotlinx.collections.immutable uses (or just use that library). It allows you to .mutate { ... } a map, which creates an immutable copy of that map with the applied mutations:
val m = immutableHashMapOf("1" to listOf("a", "b"))

val result = m.mutate { it["1"] = it["1"].orEmpty() + "c" }

See also: .orEmpty()
There's no equivalent to .mutate { ... } in the standard library, though, but you can define your own extension for read-only Map that would do the same.

A: The declaration and assignment can be joined unless there is some problem.
Make map & list mutable, as the need is to mutate
var foo: MutableMap<String, MutableList<String>> = mutableMapOf(
        "1" to mutableListOf("a", "b"),
        "2" to mutableListOf("a", "b"),
        "3" to mutableListOf("a", "b")
)

we can use when block like below,
when {
    foo.containsKey("1") -> foo["1"]?.add("c")
    else -> foo["1"] = mutableListOf("c")

}


text:
Q: Access event object from Backbone Marionette ItemView trigger I have the code below. I want to on <Enter> of the input#editTodo, I want to save the model (Todo). I figured I need to listen to the keypress event then check that the keycode is 13, if so I save the model ...
TodoView = Backbone.Marionette.ItemView.extend({
    triggers: {
        "keypress #editTodo": "detectEnterAndSave"
    },
    initialize: function() {
        this.on("detectEnterAndSave", function(e) {
            console.log(e);
        });

But I cant seem to get the event object? If so how do I know what key is pressed?

A: events: {
    'keypress #editTodo' : 'detectEnterAndSave'
},

detectEnterAndSave : function(e) {
  if (e.which === 13) {
    // do something
  }
}


text:
Q: Set a transient property on a node neo4j Is there way to set a transient property on nodes returned by a cypher query such that it is only visible to the user running the query.
This would allow us offload some controller logic directly into Neo4j and reduce business logic queries.
Currently I have a list that is returned by
List<Post> newsFeed (Long uid) {}

Post is a relationship between a User and News node.
I have two sub-classes of the Post object:

*

*BroadcastedPost

*MentionedPost

I have two cypher queries that return the posts that a user should see.
List broadcasts obtained from
MATCH (user:PlatformUser)-[:BROADCASTED]->post RETURN post;

List mentionedPost obtained from
MATCH (user:PlatformUser)-[:MENTIONED]->post RETURN post;

I then use Java instanceof  to determine what kind of post this is. Depending on the type I am able to do some further application logic.
This however is inefficient because I should be able to combine both queries into one super query using the UNION operator
i.e List newsFeed is obtained directly by querying
MATCH (user:PlatformUser)-[:BROADCASTED]->post RETURN post UNION MATCH (user:PlatformUser)-[:MENTIONED]->post RETURN post;

However, how can I tell what kind of post this. I was hoping I could use the SET operator transiently to know which kind of post this is but I believe this is used to persist a property.

A: Neo4j 2.2 recently added authentication, which it had lacked in previous releases, but it's still only really one user; you set a login/password to secure access to the database, but adding additional users takes extra work and isn't something obvious to do out of the box.
Now what you're asking for has to do with securing per-user access to particular types of data.   Since neo4j doesn't have much of a user management feature right now, what you're asking for can't be done inside of neo4j because in order to secure this data away from Joe or Bob, the DBMS would have to know that it's dealing with Joe or Bob.
What you're trying to do is usually enforced by the application layer by people writing neo4j applications right now.  So it can be done, but it's done within your custom code and not by the database directly.


text:
Q: Deploy to device: Installation failed: AMDeviceInstallApplication returned: 0xe8000050 I have an app that I am building with MonoTouch on my PC. I get this error when using the deploy to device
/Developer/MonoTouch/usr/bin/mtouch -installdev "/SVN/myapp/bin/iPhone/Release/my.app"
Please ensure your device is connected...
Connected to: myiPad
This application has been signed with a provisioning profile which does not include any device
Connected to: myiPad
Installing application
Installation failed: AMDeviceInstallApplication returned: 0xe8000050
The application was terminated by a signal: SIGHUP

I have tried an iPhone 4 and iPad 2.
I am able to drag the my.app into either iTunes or iPhone configuration utility and install it with no error on either device. It then runs as expected.

A: The error is this:
This application has been signed with a provisioning profile which
does not include any device

Rebuild your provisioning profile to include your device.  You can do this by plugging your device and from XCode selecting "Use this for development" in the organizer.

A: Additionally you can get the same error, but with a different error code if the application is installed already, signed with a different certificate.  For example, if its installed with a testing distribution certificate, or other root certificate.
I have personal and work signing keys and this bites me every once in a while.

A: The problem was that my path was /Src/C#/App....  The deploy fails if you have a # char in your local path...
-C

A: You need to register your COM app id under the apple developer portal and then generate a provisioning profile for your device. Only then you can run on your device. Also make sure the corrospond your app id with the one you've set in your config.xml file.


text:
Q: Debug liquid tags in Octopress / Jekyll Any ideas how to see where liquid tags actually fail?
To be clearer, I'm having some trouble with a plugin and all I see on previewing my site is
Liquid Error: can't convert Array into String

On my site. How do I get more debug information? Thanks

A: Try to run rake generate with --trace for more detailed information.
rake generate --trace

Commonly, it will give exactly where the error is promoted.Then simply print some variables or  use debugger to debug.
This blog may be helpful.


text:
Q: QGIS Composer map scale turns incorrect after working properly I am working on a project with several QGIS Project files. I have one Project file with certain layers and settings which I copy every time I need to create a new Project file within this work. I have used a composer template to print maps with identical framing from these different Project files. It has worked fine for long, until these several issues appeared at once:

*

*I loaded once again the composer template but the map in the template appears blank, and does not reappear by Refreshing the View.

*I can add a new map frame to the template, but the map scale appears incorrect. For example I set the scale to 1:10'000, but it gives me a map with a scale of 1:5000. Scale bar equals to the scale of the map, not the setup in scale bar properties. There is only one map frame in composer.

*I create a completely new composer inside the current Project file, but the scale issue remains.

*Also these issues appear in all the composers which I had created earlier in other Project files under this work.

However the scale problem disappears when I create a completely new Project file. It seems that the root of the problem is in the Project file - but where to start looking for the reason? I have not changed any setup in Project file, at least not consciously. I didn't find similar issue from earlier Questions.
I am working with QGIS 2.18.11 in Windows 10 Pro. Since I started this work I have updated QGIS twice, but I am not sure at which point this issue appeared.

A: Problem was fixed by uninstalling and reinstalling QGIS.


text:
Q: Dragging a subview of a view to its parent view I've been searching for the solution for hours. While I can find similar questions, I didn't get the answer. Please help me with this. Here is the situation.
I'm developing an iPad application. I have a custom UIControl (subclass of UIControl) object C within a UIScrollView B which is within the root view A. So the parent-child relationship is like this: A -> B -> C. What I want to do is to drag my custom UIControl C to the root view A. Here is what I did.
Because C is a UIControl, I registered UIControlEventTouchDown and UIControlEventTouchDragInside events to it to track the finger movement. However, the registered methods got triggered only inside C's frame. When my finger touches inside the frame, it works. When I drag it outside C's frame to B and then A, I lost the finger movement event. I wonder what's the correct way to do this.

A: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIControl_Class/Reference/Reference.html
The UIControlEventTouchDragInside will only notice a drag event inside the bounds of the View.  You need to also add a UIControlEventTouchDragOutside to the C View, or you can be notified of all touches and find out where the touch is on the X,Y and see if the coordinate of the touch is inside your C View and then do something with it when the touches end and during the touches dragged.


text:
Q: Can't write to textbox with Javascript (Homework help)
I've tried every little combination and error checking that I can think of, and I still feel stupid being stumped with this one issue. In my HTML, I have an onCLick event for a form that once a user clicks anywhere on the form, the date is supposed to show up in a textbox at the top right of the screen. I can't seem to get my JS to work exactly how I need it to though. I can make it show me the correct value with alerts or document.write's, but it won't populate the text box. Help?
    /*function to get today's date */
function today()
{
    var today = new Date();
    var month = today.getMonth() + 1;
    var day = today.getDate();
    var year = today.getFullYear();

    if(day<10)
    {
        day= '0' + day;
    }

    if(month < 10)
    {
        month = '0' + month;
    }

    today = month + '/' + day + '/' + year;

    return today;
}

/*function to get date to load on startup */
function startform()
{
    document.getElementById("formdate").value = today();
}

And my HTML snippet for that form:
<form name="paycheck" onclick="startform()">

I have the JS and HTML files linked up because like I said, I can get the date to show other ways, just not the one I'm trying to get.
EDIT:
The input box is as follows:
<input class="date" name="formdate" size="10">

A: When selecting via id:
document.getElementById("formdate")

Just make sure to have an id assigned to the element:
<input class="date" name="formdate" id="formdate" size="10">

probably just an oversight

A: You just missed the id attribute of your textbox:
id="formdate"


text:
Q: Ubuntu 13.04. fail to start after installing nvidia drivers (Vostro laptop) Everything worked fine in 13.04 Ubuntu but then i installed nvidia-drivers-103 Now it does not load into login screen at all. I see blank purple screen during start-up and then just blank black screen appears and nothing happens after.
I booted into recovery mode and removed nvidia drivers, that did not helped. I noticed i had broken Unity environment in recovery mode (no launcher or toolbars, just wallpaper) so i followed :
Unity doesn't load, no Launcher, no Dash appears
where i reseted my unity/compiz back but this did not helped me to boot so finally i installem gdm and now i have compiz and unity fully removed and nvidia drivers too. I still cannot boot, only recovery mode works fine.
What i should try next to have Unity and Compiz happily working ? Which logs should i check and what could be wrong ?
I would expected that unity/compiz is problem but as i still cannot start my OS i guess the reason is much more deeper than i expected. How to restore original version of graphics drivers ? Obviously just removing NVidia drivers did not restored original configuration.
HW : laptop Vostro 3750, Nvidia GT 525M, Intel Mobile HM67 Chipset

A: I have a dell Latitude E6500, and got the same problems
the only solution I found was the following :

*

*Switch to console mode: Alt+Ctrl+F1

*Kill x server: sudo service lightdm stop

*Remove nvidia drivers: sudo apt-get remove --purge nvidia*

*Generate new xorg.conf file: sudo X -configure -- this will create
xorg.conf. A new file in your current dir

*Rename and move: sudo mv xorg.conf.new /etc/X11/xorg.conf

*Return to GUI: sudo start lightdm
Of course  I would prefer a better solution

A: I had the same problem on Samsung RC530. Graphics was functional until Nvidia drivers installed which messed up the drivers (I could log in in low resolution, monitor was not recognized at all). I have to say that answer provided by Alain worked. After removing Nvidia drivers in console mode and adding new configuration file everything was back to the old graphics setup.

A: Solution is to install vanilla Ubuntu 13.04 and do not touch any nvidia / compiz / tweak tools otherwise you will gonna have bad time. Default configuration runs just fine. Before you will try some major changes run clonezilla and save yourselft precious time and do full backup.
If you want to have nvidia drivers (e.g.  because of 3d games) i wish you good luck.

A: I'm on a Dell Latitude E6410 and also get the blank purple screen on bootup.
If I hit the power button, it will then show me a bit of the shutdown but then it stalls. I have been holding onto the power button the power off the laptop. If I boot up a few times, eventually I'll be able to reach the login and usually this means things will continue working (until the next boot).
There's a bunch of what look like kernel Oopses in /var/log/kern.log that seem to coincide with the startup problems. Skimming through it, I see enough "nvidia" and "nv" to think the problem is due to Nvidia drivers or kernel modules.

A: The built-in drivers on Ubuntu do not require /etc/X11/xorg.conf, but the Nvidia drivers do require it so you will need to create it.
Thankfully, Nvidia provides nvidia-xconfig to do just that.
Create /etc/X11/xorg.conf and reboot to a working system with:
sudo nvidia-xconfig
sudo reboot

The menus and other aspects of Unity including full resolution support for your displays should be restored.


text:
Q: Play playlist of audio on website using node to create a jukebox / radio app So I have some time on my hands and thought I would make myself a little jukebox / radio type app.
It would be fairly simple, just a collection of MP3's on the server, one is chosen at random, it plays, on completion, the next one is chosen and plays. The front of this would just be a super simple page that has a player and displays the metadata.
I don't really have any experience with server programming but I'm going to look in to Node, seems like it would be good for this. I've already written a little script in Python that chooses a song from a selection and plays it (using VLC at the moment) so it should be simple to port it to Node / js.
Just wondering if someone could point me in the right direction for how to link the "player" with the "playlist".
Looking in to it, I can only find solutions involving a client and server using shoutCast or ICEcast or similar - so the playlist streams audio to a shoutcast server, and the website is just a player looking at the shoutCast URL - that seems unnecessary for me, as the streaming and the site would be the same thing.
New to a lot of this :) but I have time at the moment so happy to get stuck in!
Thanks in advance

A: I've built something similar and opted to do almost all the work client-side.  There are several advantages:

*

*Less infrastructure needed (and less to go wrong)

*You can re-use normal HTTP CDNs for serving static files

*More flexibility for client changes later (like sending different content to different clients, for A/B testing)

*Potential for offline playback

No need for SHOUTcast or Icecast.  All you need to do is publish the playlist and associated files to a web server.  Client side, you can read this playlist, randomly pick an entry, and then load it via a simple new Audio().
Now, when your audio object fires its ended event, set the src property to the URL of the next item in the playlist.  (This detail is important or Safari will stop playing audio, as they assume the user didn't want to continue.)

A: I am searching for the same. I think you are right using node.


text:
Q: How can you answer a client with his/her name in Dialogflow when it's provided by an external service? I'm creating a Dialogflow agent in which the client identifies with a clientId. This uses Twilio for Whatsapp chatbot integration.
DIALOG

 - Hi, tell me your clientId
 - abcde1234

At this point I need to get the client name from an external service...
GET Authentication: Basic xxx:yyy http://xxx/clients/id/abcde1234

-> {"id":"abcde1234", "name": "John", ...}

... and answer with it:
DIALOG

 - Hi, John, how can I help you?

Is this possible with Dialogflow?

A: So in order to fetch the value of the user's input, we can create something called a session parameter. Basically, this will be a JSON object in the API request sent to your webhook API which will present throughout the lifespan of your conversation (due to the high lifetime set for the same). You can read more in depth about contexts here.

We can then set up a simple NodeJS codebase on a Cloud Function (used this only due to its simplicity of deployment, though you are free to use any cloud provider/platform of your choice).
I made some minor modifications to the boiler plate codebase present in every Dialogflow ES agent.

So for example, here's the  changes made in the index.js file
.
.
.
  function welcome(agent) {
    const globalParameters = agent.getContext('global-parameters');
    const questionNumber = globalParameters.parameters.number;
    const sampleNameFromGetCall = 'John'
    agent.add(`Welcome to my agent! ${sampleNameFromGetCall}`);
  }

and here's the package.json
{
  "name": "dialogflowfirebasefulfillment",
  "description": "This is the default fulfillment for a Dialogflow agents using Cloud Functions for Firebase",
  "version": "0.0.1",
  "private": true,
  "license": "MIT",
  "author": "Google Inc.",
  "engines": {
    "node": "16"
  },
  "dependencies": {
    "actions-on-google": "^2.2.0",
    "dialogflow": "^1.2.0",
    "dialogflow-fulfillment": "^0.5.0",
    "firebase-admin": "^11.4.1",
    "firebase-functions": "^4.1.1"
  },
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  }
}

Here's the library we used which is the library built by Google for this purpose.
https://github.com/googleapis/nodejs-dialogflow
Once I enabled the webhook fulfillment on my agent, I quickly tested it and

There's a major caveat to using this as this repo has been archived by Google and doesn't receive any updates, so you may have to figure out how to parse the incoming request in your webhook API OR you can use this library with some major changes to its codebase.
You would need to make sure the overall latency of your request isn't too much,
So, in a nutshell, yes,  we can definitely fetch a value from your Dialogflow Agent, use it to a call an API, parse that response and use that as a part of our dynamic response. The value would be stored in a JSON object called context, which will be a part of any incoming request to your webhook API.


text:
Q: Hazelcast C++ Client I'm trying using hazelcast-3.6 with hazelcast-cpp-client-3.6.
I downloaded both packages and created an empty C++ application which currently just includes HazelcastAll.h.
During build I get errors for missing files which indeed are missing from downloaded official c++ client (i.e. MapExecuteOnKeyCodec.h).
Did anyone encounter such issue?
Thanks.

A: Some required files are in hazelcast\generated-sources\. E.g. MapExecuteOnKeyCodec.h is in hazelcast\generated-sources\include\hazelcast\client\protocol\codec. You have to add hazelcast\generated-sources\include\ to the additional include directories.


text:
Q: Confusion around quantifiers in intuitionistic logic As laid out in Joel Hamkins' A question for the mathematics oracle, I am interested in considering the possibility that some arithmetic sentences might not satisfy the law of the excluded middle.
Suppose such a sentence is of the form $Q = \forall n P(n)$. I imagine that, for any given value of $n$, I might agree that $P(n) \vee ¬P(n)$ is true, and also that $¬P(n)$ should imply $¬Q$. But that seems like it should not lead me to commit to the statement $Q \vee ¬Q$.
Similarly, suppose the sentence is of the form $Q' = \exists n P'(n)$. Then, for any given value of $n$, I might agree that $P'(n) \vee ¬P'(n)$ is true, and also that $P'(n)$ should imply $Q'$. But that seems like it should not lead me to commit to the statement $Q' \vee ¬Q'$.
I'm not familiar enough with intuitionistic logic to make this reasoning precise. Could anyone please clarify what's going on?

A: The key to keep in mind is that in intuitionistic logic, and more generally in constructive logic, is that something is true only if you can prove it.
In particular in order to prove a formula of the form $A \lor B$ you have to provide a proof of $A$ or a proof $B$.
With this in mind, your assumption, namely that for each $n$ the formula $P(n) \lor \neg P(n)$ is true, would mean that you have a way, an algorithm if you like, to provide for every $n$ a proof of $P(n)$ or a proof $\neg P(n)$.
Assuming that this function/algorithm exists does not provide any information on the algorithm, in particular we do not know if this algorithm returns for every $n$ a proof of $P(n)$ or if there is a $n$ for which it returns a proof for $\neg P(n)$.
Not having this information we can neither state if $\forall n P(n)$ or not nor whether $\neg \forall n P(n)$.
Hence we are left in a situation in which we are not able to prove eithr $\forall n P(n)$ or its negation, so we cannot prove $(\forall n P(n))\lor(\neg \forall n P(n))$.
Hope this helps.


text:
Q: Group by days interval SQL I have a table with 4 columns:
ID, Date, Office, Reports

*

*"Date" shows when the reports were created.

*"Office" in which the office was created.

*"Reports" the number of reports created.

Original table
  CREATE TABLE REPORTS (
    `ID` INTEGER,
    `Date` DATE,
    `Office` VARCHAR(2),
    `Reports` INTEGER
  );

  INSERT INTO REPORTS
    (`ID`, `Date`, `Office`, `Reports`)
  VALUES
    ('1', '2020-09-01', 'AR', '3'),
    ('2', '2020-09-01', 'ES', '2'),
    ('3', '2020-09-03', 'ES', '4'),
    ('4', '2020-09-05', 'AR', '1'),
    ('5', '2020-09-05', 'OG', '1'),
    ('6', '2020-09-05', 'ES', '4'),
    ('7', '2020-09-08', 'ES', '5'),
    ('8', '2020-09-08', 'AR', '6'),
    ('9', '2020-09-15', 'OG', '7'),
    ('10', '2020-09-16', 'ES', '9');

I need to use a sql line code to get a table that shows all the dates (not showing duplicated dates), and two new columns "Reports_7_days_prev" and "Reports_7_days_after". The result should be the following table:
date       | Reports 7 prev | Reports 7 after
:--------- | -------------: | --------------:
2020-09-01 |              5 |              26
2020-09-03 |              9 |              21
2020-09-05 |             15 |              17
2020-09-08 |             26 |              18
2020-09-15 |             18 |              16
2020-09-16 |             16 |               9

The way of calculating each column is the following:

*

*"Reports 7 days prev": it should sum all the reports created on the 7 days previous to the date of each row. For example, in the row with date "2020-09-15" from the output table, the result 18 is the sum of all the values from column "Reports" within the interval of dates [2020-09-08 , 2020-09-15], corresponding to the rows with "ID" 7, 8 and 9 => (5 + 6 + 7 = 18).

*" Reports 7 days after": it should sum all the reports created on the 7 days after the date of each row. For example, in the row with date "2020-09-05" from the output table, the result 17 is the sum of all the values from column "Reports" within the interval of dates [2020-09-05 , 2020-09-12], corresponding to the rows with "ID" 4, 5, 6, 7 and 8 => (1 + 1 + 4 + 5 + 6 = 17)
I think than my SQL query should be something like:
SELECT Date,
       sum([QUERY 1]) as "Reports  7 days prev",
       sum ([QUERY 2]) as "Reports 7 days after"
FROM REPORTS
GROUP BY Date

But I cannot figure out what should I include in [QUERY 1] and [QUERY 2] to get the 7 days previous and 7 days after.
Thank you very much,

A: You can use Scalar Correlated Subqueries, but don't expect good performance:
select date
  ,(select sum(reports) from REPORTS as r2 where r2.date between r.date - 7 and r.date) as `Reports 7 prev`
  ,(select sum(reports) from REPORTS as r2 where r2.date between r.date and r.date + 7) as `Reports 7 after`
from REPORTS as r
group by date

See fiddle

A: If there's no need to do it with just one select statement you can use something like this code below.
INSERT INTO OUTPUT (Date) SELECT Date FROM REPORTS GROUP BY 1;
UPDATE OUTPUT SET PREV_7 = (SELECT SUM(Reports) FROM REPORTS WHERE Date BETWEEN OUTPUT.Date -7 AND OUTPUT.Date);
UPDATE OUTPUT SET AFTER_7 = (SELECT SUM(Reports) FROM REPORTS WHERE Date BETWEEN OUTPUT.Date AND OUTPUT.Date + 7);


text:
Q: A word for teasing someone with information they desire Is there a word (or a better sentence) to describe the following concept:
Enticing someone by letting them know you have the information they seek, yet smugly refuse to divulge it.

A: When you deliberately (apparently) promise someone favours, money, position, information . . . but then fail to deliver, it's called leading them on.

A: The verb tantalize is relevant.  Wiktionary shows two senses:
• to tease (someone) by offering something desirable but keeping it out of reach
• to bait (someone) by showing something desirable but leaving them unsatisfied
Note, in the latter of those senses, bait is used  to mean teasing, luring, or enticing someone with something they apparently desire, but keeping it out of their reach.


text:
Q: Take 1000 using LINQ Ok, my linq skills aren't great so im trying to do the following.
Say I have 6000 records (email address)
I want to add the first 1000 add to bcc, send,
take the next 1000 add to bcc, send,
take the 1000 add to bcc, send, etc....
Ive started wrinting,
string[] files = System.IO.Directory.GetFiles(@"C:\Mail\ ", "*.csv");

Parallel.ForEach(files, currentFile =>
{
    string filename = currentFile;
    StreamReader reader = new StreamReader(filename);
    var emailList = new List<String>();
    while (reader.Peek() >= 0)
    {
        emailList.Add(reader.ReadLine());
    }
    \\Here is where I need to do the linq?
    IEnumerable<string> list = emailList

    var message = new System.Net.Mail.MailMessage();
    foreach (var s in list)
    {
        MailAddress mailAddress = new MailAddress(s);
        message.Bcc.Add(mailAddress);
    }

    message.Subject = txtSubject.Text;
    message.From = new System.Net.Mail.MailAddress(txtFrom.Text);
    message.Body = txtMessage.Text;
    message.IsBodyHtml = true;
    var smtp = new System.Net.Mail.SmtpClient();

    smtp.Send(message);

A: You seem to be looking for a Batch method.  Here is one implementation:
public static IEnumerable<IEnumerable<T>> Batch<T>(this IEnumerable<T> source, int batchSize)
{
    List<T> buffer = new List<T>(batchSize);

    foreach (T item in source)
    {
        buffer.Add(item);

        if (buffer.Count >= batchSize)
        {
            yield return buffer;
            buffer = new List<T>(batchSize);
        }
    }
    if (buffer.Count > 0)
    {
        yield return buffer;
    }
}

You can now write:
foreach(var batch in emailList.Batch(1000))
{
    var message = CreateMessage();
    foreach(var email in batch)
    {
        message.Bcc.Add(email);
    }
    message.Send();
}

On a side note, rather than using a StreamReader to read the file's lines, you can use File.ReadLines to get an IEnumerable<string> representing the lines in the file.  It even has the side benefit of streaming the data rather than pulling all of the lines into memory first.

A: Move your email sending code into a separate method and call that after you have enough addresses in your initial while loop:
var emailList = new List<String>();
while (reader.Peek() >= 0)
{
    emailList.Add(reader.ReadLine());
    if(emailList.Count == 1000)
    {
        SendEmails(emailList);
        emailList = new List<String>();
    }
}
//send the rest, if any
if(emailList.Any()) SendEmails(emailList);

This is much cleaner imo anyway since your email sending method is logically separated from the way you acquire the email addresses.

A: If you want to do it with linq I believe this answer will do exactly what you are looking for, modified below where you send in group = 1000
public static IEnumerable<IEnumerable<T>> Split<T>(this IEnumerable<T> source, int group)
{
    return  source
        .Select((x, i) => new { Index = i, Value = x })
        .GroupBy(x => x.Index / group)
        .Select(x => x.Select(v => v.Value).ToList())
        .ToList();
}

Should This be a comment and not an answer.  Please let me know and I will delete and change if that is the case


text:
Q: Java SE 7 Programmer I Oracle Certification I found this sample question for the Java SE 7 Programmer I certification by Oracle, I don't understand why is the correct answer the following: feline cougar c c
class Feline {
  public String type = "f ";
  public Feline() {
    System.out.print("feline ");
  }
}
public class Cougar extends Feline {
   public Cougar() {
      System.out.print("cougar ");
   }
   void go() {
      type = "c ";
      System.out.print(this.type + super.type);
   }
   public static void main(String[] args) {
      new Cougar().go();
   }
}

When we use inheritance aren't we supposed to get a type property on class Cougar? (Meaning we would end with two type properties? One for Feline and one for Cougar?)  Why is type = "c " affecting the parent property and also the child property? I thought that would only happen if we did super.type = "c " ? Thank you for your help.

A: Both state and behavior are inherited so you end up with only one type.


text:
Q: Dependency relations in MVVM and the place of the controller I know there is plenty of questions about this, but there is a lot of seemingly conflicting information.
My assumption:
The viewmodel is an abstraction of the view,  an interface to the business logic,  if you will.
Therefor if the viewmodel is an abstraction of the view, it makes sense for it not to depend on its implementation. So the viewmodel is unaware of any view. I assume the Viewmodel is kind of a proxy for the view, exposing controls that can be manipulated by whoever owns the viewmodel. So what class owns/uses the viewmodel? The model is of course unaware of any viewmodel, as it only holds the state of the application.
So I like to introduce a controller to take care of concrete business logic. Which in my opinions allows for much more loose coupling.
This is how I imagine the dependency relationship:
sketch
So to be more concrete. How can I imagine the dependency relation between the different components? And how much sense does the introduction of a controller (for processing logic)  make and most of all how correct am I in my assumptions make?

A: Your assumption about the ViewModel is incorrect, because it actually works the other way around. The ViewModel acts in part as a View-specific proxy of the Model (and in part as a model for the non-business properties of the View, like current selection). Typically, the ViewModel will contain a class for every View in the application.

The model is of course unaware of any viewmodel, as it only holds the state of the application.

It is correct that the Model is unaware of the ViewModel, but that is not because the Model is just a data repository.
The Model is responsible for all the business logic (that what would remain the same if you put a different kind of UI on the application), but it doesn't know when the application needs which information. The Model can offer notifications that the various ViewModel classes can subscribe to as needed.
The typical flow is that either a human user takes an action in a View or an external event occurs, either of which triggers the Model to make a change to itself. Then the Model notifies the interested listeners of the change, which can trigger an update of a View.
Additionally, a user action can also trigger an update of the View, where that update retrieves the latest status from the Model (by way of the ViewModel).

A: Generally:

*

*The Model does not know about View or ViewModel.

*The View does not know about the Model, but knows about the ViewModel.

*The ViewModel does not know about the View, but knows about the Model.

How much each of these things knows about the other and how they are created, managed, and connected all depends on the layer you use to implement the MVVM abstraction itself.
Questions like:

*

*Who creates Views?

*Who creates ViewModels?

*Who initializes the Model?

will all depend on what MVVM framework you're using, or if you're rolling your own implementation.
For instance, in .NET + WPF, the View knows about the ViewModel by binding to properties/methods/commands by name and then setting the DataContext property of the View to an instance of the ViewModel. How you create that ViewModel is left up to you though. You might use an inversion-of-control (IOC) container to provide the instance, or you might create it yourself.
Regardless of whether or not you use a framework, there will always be some amount of code "above" the MVVM abstraction which will orchestrate data-flow and initialization.
Even if you do use a framework, you will eventually run into cases where you will need to add some additional code "above" to help "open a new Window/Dialog" or do some other application-specific thing. As long as the majority of the important stuff lives within the MVVM abstraction (so that your Models and ViewModels are fully testable without needing to create Views), and as long as you don't violate the relationships between the Model, View, and ViewModel, you'll be in a good spot. Every now and then though, it is good to review any code "above" the MVVM abstraction, and see if you can move any of it "into" the abstraction to maximize the benefits.
As a side note, you should definitely consider whether or not you need the MVVM abstraction in the first place. The primary benefits of MVVM are the ability to unit test Views and the ability to re-use ViewModels with different Views and even across entirely different projects/platforms. If you don't have these needs, you'll likely be better off simply keeping your View and Model layers separated (the Model should never know about the View, but the View can talk directly to the Model via methods/properties and can subscribe to updates). While this doesn't grant you a re-usable or testable abstraction over your Views, it still keeps your Model re-usable and testable, which is arguably the most important pattern in UI application development.
Edit:
To clarify on what I mean when I say "above" vs "inside" the MVVM abstraction. If code is "inside" the MVVM abstraction, it is correctly following all of the rules and guidelines of MVVM. If code is "above" the MVVM abstraction, it is either coordinating the abstraction in some way (ie: a Messenger class that allows ViewModels to communicate with each other) or it outright breaks/ignores the abstraction in some way.
To give an example of some WPF code that you might write that would be considered "above":
public class App : Application
{
    public static void TryCloseWindowForVM(IViewModel viewModel)
    {
        IView view = SomeMVVMFramework.LocateView(viewModel);

        if (view is Window window)
            window.Close();
    }
}

Here, we provide a method on the App class that allows ViewModels to call something like App.TryCloseWindowForVM(this) in order to attempt to close the Window that the View this ViewModel is associated with. This will certainly throw all sorts of errors if the View and ViewModel are not associated yet, or if the View for this ViewModel is not a Window, or maybe even if there are multiple Views for this ViewModel (which can be the case in some frameworks).
This code could also be seen as rather dirty or harmful depending on what kind of rules you are willing to break. In my own experience, you'll always end up with some of this code in order to get certain things done (though sometimes there are better ways and it's always good to research first).


text:
Q: How to deploy a web site in python I am new to python and I am developing a website in django, but would like to know how to publish this web site, I own a semi-dedicated Cloud server with Ubuntu 10.04 LTS, which software should I install to develop a server, I am also optimistically, I hope more than 200 simultaneous accesses it, or have to use a webserver and good ...

A: You can do it multiple ways:

*

*Running bare django within some kind of process supervisor

*Using reverse proxy to redirect requests to django via particular protocols like FastCGI

Running django with a process supervisor
One of multiple tools used to make sure a particular service is up is supervisord. To install it all you need to do is sudo apt-get install supervisord.
After successfull installation you should've been created a /etc/supervisord/conf.d directory where you could place all your configuration files for each service you would like to be supervised.
What does supervisord do?
Supervisord, among others, checks the current status of service process that was started by a command given in the configuration. Once it has detected the service went down, it attempts to restart it. If it fails too many times within short amount of time, the service is considered errorneous and you'll need to look into the cause of the problem yourself.
Example configuration file
[program:django-webserver]
directory = /user/foo/my-project
user = foo
command = /user/foo/.virtualenvs/my-project/bin/python /user/foo/my-project/manage.py runserver
stdout_logfile = /user/foo/my-project/logs/supervisord/webserver.out.log
stderr_logfile = /user/foo/my-project/logs/supervisord/webserver.err.log
autostart = true
autorestart = true
environment = DJANGO_SETTINGS_MODULE="myproject.settings.production"

Running the machinery
After pasting configuration above into /etc/supervisord/conf.d/ directory (e.g. myproject.conf file), you can see the current status of service using sudo supervisorctl command. You'll get a listing of all configured programs from included configuration files along with their statuses. To reload configuration you should type reload in the prompt that has appeared after entering supervisorctl.
After making sure supervisord has loaded your new configuration file, you can type start django-webserver then to make supervisor run django and take care of it. Note that django-webserver is the name you've passed in the [program:<name>] clause in supervisord configuration file.
Running django using reverse proxy
One of the reverse proxies that are, in my opinion, user-friendly is nginx. Why should you use a reverse proxy like nginx? It allows you to set up a load balancer, serve files more efficiently and more.
Nginx can be installed by typing sudo apt-get install nginx. To make nginx talk to your django-webserver you need to create configuration file like this one in /etc/nginx/sites-available directory.
server {
    listen 80;
    access_log /home/foo/myproject/nginx/access.log;
    error_log /home/foo/myproject/nginx/error.log;

    location /statics/ {
        gzip on;
        root /home/foo/myproject/collected_static;
        rewrite ^/statics/(.*)$ /$1 break;
        autoindex off;
        expires 60d;
    }

    location / {
        fastcgi_pass 127.0.0.1:8000;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_param REQUEST_METHOD $request_method;
        fastcgi_param QUERY_STRING $query_string;
        fastcgi_param CONTENT_TYPE $content_type;
        fastcgi_param CONTENT_LENGTH $content_length;
        fastcgi_param SERVER_PROTOCOL $server_protocol;
        fastcgi_param SERVER_PORT $server_port;
        fastcgi_param SERVER_NAME $server_name;

        fastcgi_pass_header Authorization;
        fastcgi_intercept_errors off;
    }
}

To make it possible for your django to communicate with nginx, you'll need to install flup using pip install flup (other alternative is e.g. gunicorn). After you've got flup installed, make sure your django server is running with following command:
python manage.py runfcgi host=127.0.0.1 port=8000 daemonize=false
The daemonize=false switch is important as it won't create a background daemon.
With django up and running, the only thing left to do is to make the actual nginx site available to the outer world: make a soft link to just-created nginx config inside /etc/nginx/sites-available directory inside /etc/nginx/sites-enabled like so:
cd /etc/nginx/sites-enabled
ln -s /etc/nginx/sites-available/myproject.conf myproject.conf

With those steps done, restart nginx using sudo /etc/init.d/nginx restart and voila.
It's a good idea to combine both steps to have supervisor take care of django process that will communicate with nginx.


text:
Q: IntelliJ and Android Gradle dependencies - unable to find module I have following directory structure:
D:\PROJECT
+---javaGradleProject1
+---javaGradleProject2
+---javaGradleProject3
\---AndroidProject
    |   build.gradle
    |   settings.gradle
    \---AndroidModule
            build.gradle

Android module depends on all of java gradle projects that are at the same level in root directory as AndroidProject.
In AndroidProject/settings.gradle I have:
include ':AndroidModule'

include 'javaGradleProject1'
project(':javaGradleProject1').projectDir = new File(rootDir, '../javaGradleProject1')

include 'javaGradleProject2'
project(':javaGradleProject2').projectDir = new File(rootDir, '../javaGradleProject2')

include 'javaGradleProject2'
project(':javaGradleProject2').projectDir = new File(rootDir, '../javaGradleProject2')

And then in AndroidProject/AndroidModule/build.gradle I have dependencies set like this:
compile project(':javaGradleProject1')
compile project(':javaGradleProject2')
compile project(':javaGradleProject3')

This structure of dependency perfectly works and project builds when I invoke
gradle build

on AndroidProject/build.gradle.
But when I try to synchronize my IntelliJ with current gradle dependency settings I receive
Error: Unable to find module with Gradle path ':javaGradleProject1'
Error: Unable to find module with Gradle path ':javaGradleProject2'
Error: Unable to find module with Gradle path ':javaGradleProject3'

and because of that my project cannot be run from Run Configurations (it does not compile at all in IDE). I was trying to add these dependencies manually by hitting F4 and module dependencies but after synchronization all of my changes are overwritten (actually, IntelliJ just removes it).
Is there anything wrong in my gradle structure?
I have tested it on IntelliJ IDEA 14.1.4 and Android Studio 1.3.

A: I was able to solve this by deleting the settings.gradle file from every Gradle project that I wanted to use as dependency (clearing the contents of this file was not enough).
NOTE: As I have little knowledge of Gradle and Android Studio, I cannot provide information about why the presence of this file does not allow Android Studio to include the Gradle project as a module.

A: Add a colon (:) before the names of your modules when you add it in settings.gradle, e.g. for the first one, change this:
include 'javaGradleProject1'
project(':javaGradleProject1').projectDir = new File(rootDir, '../javaGradleProject1')

to this:
include ':javaGradleProject1'
project(':javaGradleProject1').projectDir = new File(rootDir, '../javaGradleProject1')

Now in addition to compiling, IntelliJ / Android Studio should give you code completion.

A: In my case I had to change the external module name to lowercase only.

A: Right click project, Select

"Configure Project Subset ..."

and select your module, rebuild your project.

A: Tried all the available solutions, and in last I have commented the include ':app' in settings.gradle and this resolved the issue in my case

A: In my case non of the answers above resolved it.
Finally, I went to settings.gradle file and inside the dependencyResolutionManagement block, I changed the repositoriesMode to "PREFER_PROJECT"
repositoriesMode.set(RepositoriesMode.PREFER_PROJECT)

That was all I did and it worked like magic, maybe such can help you too, you can try it out.


text:
Q: SQL stored procedure not returning string value I have the following code of the stored procedure. I just want to return the message if already present in DB it should return message it is repeated otherwise inset data and show a message done
SQL stored Procedure
ALTER PROCEDURE [dbo].[SP_AddProjectManager]
        -- Add the parameters for the stored procedure here
        @ProjectId int,
        @EmployeeId int,
        @uid nvarchar(128)

    AS
    BEGIN
        -- SET NOCOUNT ON added to prevent extra result sets from
        -- interfering with SELECT statements.
        SET NOCOUNT ON;
        declare @Organization_Id int = (select Organization_Id from Employees where User_Account_Id = @uid);
        declare @Office_Id int = (select Office_Id from Employees where User_Account_Id = @uid);
        declare @output nvarchar(50);
        declare @dup int =(select count(*) from Project_Managers where EmployeeId=@EmployeeId and ProjectId=@ProjectId);

        if(@dup=0)
            begin
                INSERT INTO [dbo].[Project_Managers]
                       ([EmployeeId]
                       ,[ProjectId]
                       ,[User_Account_Id]
                       ,[Office_Id]
                       ,[Organization_Id]
                       ,[CreatedOn]
                       ,[UpdatedOn]
                       ,[CreatedBy]
                       ,[UpdatedBy]
                       ,[Is_active]
                       )
                 VALUES(@EmployeeId,@ProjectId,@uid,@Office_Id,@Organization_Id,GETDATE(),GETDATE(),@uid,@uid,1);
                 SET @output= 'Done';
             end
         else
             begin
                SET @output ='Repeated';
             end
         return convert(varchar(10),@output)
    END

can't return the string value it shows following err:
Msg 245, Level 16, State 1, Procedure SP_AddProjectManager, Line 43 [Batch Start Line 2]
Conversion failed when converting the varchar value 'Repeated' to data type int.

C# Code
 public static string Add_ProjectManager(ProjectManagers PM)
        {
            using (SqlCommand cmd_insertion = new SqlCommand())
            {
                conn c = new conn();
                SqlConnection _Con = c.conect();
                cmd_insertion.Connection = _Con;
                _Con.Open();
                cmd_insertion.CommandType = System.Data.CommandType.StoredProcedure;
                cmd_insertion.CommandText = "SP_AddProjectManager";
                cmd_insertion.Parameters.AddWithValue("@ProjectId", PM.ProjectId);
                cmd_insertion.Parameters.AddWithValue("@EmployeeId", PM.EmployeeId);
                cmd_insertion.Parameters.AddWithValue("@uid", PM.userId);

                SqlParameter retval = cmd_insertion.Parameters.Add("@output", SqlDbType.VarChar);
                retval.Direction = ParameterDirection.ReturnValue;
                cmd_insertion.ExecuteNonQuery();
                string status = (string)cmd_insertion.Parameters["@output"].Value;
                _Con.Close();
                cmd_insertion.Parameters.Clear();
                return status;
            }
        }

A: Use an OUTPUT param, like this...(disclaimer, not in front of a sql editor)
ALTER PROCEDURE [dbo].[SP_AddProjectManager]
        -- Add the parameters for the stored procedure here
        @ProjectId int,
        @EmployeeId int,
        @uid nvarchar(128),
        @output nvarchar(50) OUTPUT

    AS
    BEGIN
        -- SET NOCOUNT ON added to prevent extra result sets from
        -- interfering with SELECT statements.
        SET NOCOUNT ON;
        declare @Organization_Id int = (select Organization_Id from Employees where User_Account_Id = @uid);
        declare @Office_Id int = (select Office_Id from Employees where User_Account_Id = @uid);
        declare @output nvarchar(50);
        declare @dup int =(select count(*) from Project_Managers where EmployeeId=@EmployeeId and ProjectId=@ProjectId);

        if(@dup=0)
            begin
                INSERT INTO [dbo].[Project_Managers]
                       ([EmployeeId]
                       ,[ProjectId]
                       ,[User_Account_Id]
                       ,[Office_Id]
                       ,[Organization_Id]
                       ,[CreatedOn]
                       ,[UpdatedOn]
                       ,[CreatedBy]
                       ,[UpdatedBy]
                       ,[Is_active]
                       )
                 VALUES(@EmployeeId,@ProjectId,@uid,@Office_Id,@Organization_Id,GETDATE(),GETDATE(),@uid,@uid,1);
                 SET @output= 'Done';
             end
         else
             begin
                SET @output ='Repeated';
             end

    END

And you would call it something like this...
DECLARE @output varchar(50);
EXEC [dbo].[SP_AddProjectManager] 6, 66, '81873272', @output OUTPUT
SELECT @output
-- OR
PRINT @Output

Or, if you don't want output params, replace your "RETURN" statement with a "SELECT"
Your C# code, again, no editor used, so off top of my head...
public static string Add_ProjectManager(ProjectManagers PM)
{
    using (SqlCommand cmd_insertion = new SqlCommand())
    {
        using (conn c = new conn()) // Whatever this is
        {
            using (SqlConnection _Con = c.conect())
            {
                cmd_insertion.Connection = _Con;
                cmd_insertion.CommandType = System.Data.CommandType.StoredProcedure;
                cmd_insertion.CommandText = "SP_AddProjectManager";
                cmd_insertion.Parameters.AddWithValue("@ProjectId", PM.ProjectId); // .AddWithValue() is bad
                cmd_insertion.Parameters.AddWithValue("@EmployeeId", PM.EmployeeId);
                cmd_insertion.Parameters.AddWithValue("@uid", PM.userId);

                SqlParameter retval = cmd_insertion.Parameters.Add("@output", SqlDbType.VarChar);
                retval.Direction = ParameterDirection.Output;

                _Con.Open();

                cmd_insertion.ExecuteNonQuery();
                string status = retval.Value;
                _Con.Close();
                return status;
            }
        }
    }
}


text:
Q: Cron job should run every 15 minutes , but it should NOT run between 9:00 (AM) to 10:00 (AM) How to run a Cron job every 15 minutes , but it should NOT run between 9:00 (AM) to 10:00 (AM).

A: You may try:
 * 0,15,30,45 0-9,10-23 * * ?

The above CRON says to run on the hour, 15, 30, and 45 minutes past the hour, from midnight to 9am, and from 10am to midnight.  This excludes 9am-10am which was your requirement.


text:
Q: Use app name in intent filter action name I'm trying to create a BroadcastReveiver with couple of intent filters in AndroidManifest.xml. I need to use app name as a part of action name. For example:
<receiver android:name=".SomeBroadcastReceiver">
    <intent-filter>
        <action android:name="<app_name>.SOME_ACTION" />
    </intent-filter>
</receiver>

I'm pretty sure it's not possible to do this but I hope there is some another way to do something like this?
I can register receiver in Application class but then it won't keep listening when app process is not not active. Is there any way to listen these actions as long as app is installed?

A: Assuming that "app name" is what Android developers refer to as the application ID (or the older "package name" term), use manifest placeholders:
<action android:name="${applicationId}.SOME_ACTION" />


text:
Q: decryption of block cipher? Hi i have encrypted a data of size 196,662 bytes, using block cipher method AES-128 of mode electronic code book (ecb), and now the encrypted data size became 196,672 bytes. And now I have to decrypt, since the data size i have to decrypt is a multiple of 16, I tried decrypting the encrypted data at a single stretch without dividing it, but its not decrypting. Tell me if i want to change anything in my encryption and decryption method or else tell me any other equivalent solution. Thanks in advance.
Edit: Encryption code:
bufferlen = filesize;
buffer = new BYTE [ bufferlen ];
feof = false;
do {
    count = fread(buffer, 1, 16, filepointer);
    if ( count < 16 ) {
        feof = true;
    }
    cout << count;
    result = CryptEncrypt(hGenKey,NULL,feof,0,buffer,&count,bufferlen);
    if ( result == 0 ) {
        cout << "\nencrypt failed";
    }
    else {
        cout << "encrypt passed";
    }
    if(fwrite(buffer, 1, count , filepointer1)!=count) {
        cout << "\nwrite failed";
    }
} while (feof != true);

Decryption code:
bufferlen = filesize;
buffer = new BYTE [ bufferlen ];
feof = false;
do {
    count = fread(buffer, 1, 16, filepointer);
    if ( count < 16 ) {
        feof = true;
    }
    cout << count;
    result = CryptEncrypt(hGenKey,NULL,feof,0,buffer,&count,bufferlen);
    if ( result == 0 ) {
        cout << "\nencrypt failed";
    }
    else {
        cout << "encrypt passed";
    }
    if(fwrite(buffer, 1, count , filepointer1)!=count) {
        cout << "\nwrite failed";
    }
} while ( feof != true );

A: In the second to last iteration of your loop, while you are doing decryption, count will be 16, however you have to set the Final flag because it contains the padding (your feof is false). Then in the next iteration count will be 0, in which case you set feof but you actually have no data to decrypt any more.

A: I would check the wikipedia article on ecb http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29
Without at least having the pseudo code for your project there isn't much else we'll be able to say.

A: This is really an answer to a comment, not the original question. In pseudo code, CBC mode looks something like:
prev_block = IV;
write_output(prev_block);
current_block = first_block;

while (more blocks to process) {
    encrypted_block = encrypt_block(current_block XOR prev_block);
    write_output(encrypted_block);
    prev_block = encrypted_block;
    current_block = next_block;
}


text:
Q: How to code an action trigger with treetop? I'm trying to have some bit of code running each time the parser recognises a token.
Let's say
grammar FooBar

  rule start
    (foo "\n")+
  end

  rule foo
    stuff_i_want:([a-z]+) {
       puts "Hi there I found: #{stuff_i_want.text_value}"
     }
  end

end

The idea here would be to have this puts action execute each time the foo token is found. Coded as is, it does not work as it is triggered only once (at the class loading time) and of course stuff_i_want.text_value does not exist then.
Any idea? Is it even possible? The lack of documentation on the library does not make it easy to tell.

A: Well, I'm not sure what I did to deserve the downvote.
Anyway, here is the solution I used:
node_extension.rb
module Crawlable

  def crawl *args
    continue = true
    continue = action(*args) if respond_to? :action

    return if !continue || elements.nil?

    elements.each do |elt|
      elt.crawl(*args)
    end
  end

end

# reopen the SyntaxNode class and include the module to add the functionality
class Treetop::Runtime::SyntaxNode

  include Crawlable

end

then all is left is to define a action(*args) method on each node you want to trigger an effect on and have to start the crawling on the top parser node (the one returned by the parse call
parse_tree = FooBarParser.new.parse "mycontent"
parse_tree.crawl # add optional parameters for context/state

The optional parameters are passed to each action method. You can also return a falsey value (false or nil) in action in order to stop the subtree crawling.
grammar FooBar

  rule start
    (foo "\n")+
  end

  rule foo
    stuff_i_want:([a-z]+) {
       def action
         puts "Hi there I found: #{stuff_i_want.text_value}"

         false
       end
     }
  end

end

A: This might be a simpler solution than the one you can up with. I can't see why you would need open up the SyntaxNode class in order to get the functionality that you want. All you need to do is traverse the nodes a little bit more (unless I'm not understanding what you're trying to accomplish).
Here's an example:
require 'treetop'

Treetop.load_from_string DATA.read

parser = FooBarParser.new

parser.parse("hello\nok\nmorestuff\n").action

__END__
grammar FooBar
  rule start
     (foo "\n")+
     {
        def action
           elements.each {|e| e.elements[0].action }
        end
     }
  end

  rule foo
    stuff_i_want:([a-z]+)
    {
       def action
          puts "Hi there I found: #{stuff_i_want.text_value}"
       end
    }
  end
end

# => Hi there I found: hello
#    Hi there I found: ok
#    Hi there I found: morestuff