text:
Q: Minimum Number of People Such That No Two People Know the Same Two People In a population of $n$ people, each person knows $k$ other people and if person A knows person B then person B knows person A.  However, no two people, A and C, know the same two people B and D.  What is the minimum $n$ such that this is possible for a given $k$?  Or, in other words, what's the minimum number of nodes that must exist such that it is possible to connect each node to $k$ other nodes while not allowing a circuit of length 4?
I don't have much on this problem yet besides a weak lower bound of $n\geq k^2-k+1$.
In the graphs below, an edge means that the two people it connects know each other.  In 1), this is a demonstration of what we don't want, both A and C know D and B.  In 2) these are configurations that work for k=2.  For k=2, $n=3$ and $n>4$ work.  In 3) n=10, and this is the smallest possible configuration for k=3.


text:
Q: Radius of convergence of power series $\sum_{n=0}^{\infty} \frac{(2x-5)^n}{n^2}$ Consider the below example:
$$\sum_{n=0}^{\infty}\frac{(2x-5)^n}{n^2},\qquad c_n=\frac{2^n}{n^2},\qquad R=2^{-1}=\frac{1}{2}.$$
$$\begin{align*}
\lim_{n\to\infty}\frac{c_{n+1}}{c_n} &= \lim_{n\to\infty}\frac{2^{n+1}/(n+1)^2}{2^n/n^2} \\
&=\lim_{n\to\infty}\frac{2n^2}{(n+1)^2}\\
&= \lim_{n\to\infty}\frac{2}{(1+\frac{1}{n})^2}\\
&= 2.
\end{align*}$$
How come the expression
$$\sum_{n=0}^{\infty} \frac{(2x-5)^n}{n^2}$$ does not appear to be used? Is $c_n$ derieved from that? How?
UPDATE
In another example I have:
$$\sum_{n=1}^{\infty} \frac{n^2(x-3)^{n+1}}{5^n}, \qquad c_{n+1}=\frac{n^2}{5^n}$$
If I try to express the series in
$$\sum_{n=1}^{\infty} c_n (x-a)^n$$
I get
$$\frac{n^2 (x-3)}{5^n} \cdot (x-3)^n, \qquad c_n = \frac{n^2 (x-3)}{5^n}$$
Or can the $(x-3)$
 be removed somehow?

A: If I understand you correctly, the answer is "yes". The $c_n$ are the coefficients of the power series.
Given the power series $\sum\limits_{n=1}^\infty c_n(x-a)^n$, the radius of convergence can be calculated from the limit $\lim\limits_{n\rightarrow\infty}{ |c_{n+1}|\over| c_n|}$, provided this limit exists (the radius of convergence is the reciprocal of this limit). Your series is not quite in the right form to use this, though. You need to write it as $$
\sum\limits_{n=1}^\infty { (2x- 5)^n\over n^2}=
\sum\limits_{n=1}^\infty {2^n(x-2.5)^n\over n^2}
=\sum\limits_{n=1}^\infty  {{2^n\over n^2}(x-2.5)^n };
$$  so, $c_n={2^n\over n^2}$.

For your second example,
$$\tag{1}
\sum\limits_{n=1}^\infty {n^2 (x-3)^{n+1}\over 5^n},
$$
think of the formula $\lim\limits_{n\rightarrow\infty}{ |c_{n+1}|\over| c_n|}$ as taking the limit of "the absolute value of a general coefficient of the series divided by the absolute value of the preceding coefficient". Keep in mind the coefficients are the numbers in front of the $(x-2)^k$ terms.
So for the series given in  $(1)$, the coefficients are ${n^2\over 5^n}$ and you'd evaluate $\lim\limits_{n\rightarrow\infty}{ n^2/5^{n }\over (n-1)^2/5^{n-1}}$. You would not include any expressions containing $x-3$ when using the formula.
Note that in $(1)$, you have $c_{n+1}= {n^2\over 5^n}$, as in your lecture notes  (so $c_n={(n-1)^2\over 5^{n-1}}$).
What you did in your attempt is not the correct approach. If you wanted to write the series so that $x-2$ was raised to the index power,
you'd have to reindex the series (though, there is no reason to do this):
$$
\sum\limits_{n=1}^\infty {n^2 (x-3)^{n+1}\over 5^n}
=\sum\limits_{m=2}^\infty {(m-1)^2 (x-3)^{m}\over 5^{m-1}}.
$$
Here $c_m={(m-1)^2\over5^{m-1}}$.

A: Hint:
Let $$a_{0}+a_{1}z+a_{2}z^{2}+a_{3}z^{3}+a_{4}z^{4}+\cdots$$ be a power-series, and consider the series  $$a_{1}+a_{2}z^{1}+a_{3}z^{2}+a_{4}z^{3}+\cdots$$ which is obtained by differentiating the power series term by term. The derived series has the same circle of convergence as the original series. Similarly the series $$\sum _{n =0}^{\infty }\dfrac {a_{n}z^{n+1}} {n+1},$$ obtained by integrating the original power-series term by term, has the same circle of convergence as $\sum _{n=0}^{n=\infty }a_{n}z^{n}$.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Error in the shuffle code for shuffle game of numbers if (same)
{
    MessageBoxButtons.AbortRetryIgnore("You have finished the game in " + Hits.ToString() + " hits", "End of Game", 2);
}

There is an error at MessageBoxButtons.AbortRetryIgnore - it shows non-invocable member MessageBoxButtons.AbortRetryIgnore cannot be used like a method.
What should I do to solve this problem???

A: MessageBoxButtons is an enumeration. The error occurs because you're attempting to incorrectly invoke its AbortRetryIgnore value as a method, which is not possible. You need to use MessageBox.Show:
MessageBox.Show(
    "You have finished the game in " + Hits.ToString() + " hits",
    "End of Game",
    MessageBoxButtons.AbortRetryIgnore);

A: MessageBoxButtons is an enumeration, so its members cannot be called like methods.
You are looking for this overload of MessageBox.Show. The code would look like:
MessageBox.Show("You have finished the game in " + Hits.ToString() + " hits", "End of Game", "End of Game!", MessageBoxButtons.AbortRetryIgnore);

Note that you would typically use String.Format instead of string concatenation for something like this.


text:
Q: xamarin.forms httpclient lte too slow in my Crossplatform App I work with httpClient and NativeMessageHandler.
I call an webservice through httpclient. When i call the webservice with WLAN ON it works perfectly, with no WLAN, so LTE on iPhone it works perfectly, too. But if I have LTE activated on Android, i get an Timeout in the following line, if I not set the Timeout value. But If I set Timeout, than the Post Need more than a few minutes:
client = new HttpClient(new NativeMessageHandler());
client.BaseAddress = new Uri(App.hostserveradress);
client.Timeout = TimeSpan.FromMinutes(20);
var contentReset = new StringContent(mobileJSON, Encoding.UTF8, "application/json");
var responseReset = await client.PostAsync("GetResetFotos", contentReset); **// ERROR**
var resultReset = await responseReset.Content.ReadAsStringAsync();

UPDATE:
Error from Try Catch block:
System.OperationCanceledException: The operation was canceled.
  at ModernHttpClient.NativeMessageHandler+<SendAsync>c__async0.MoveNext () [0x00422] in <51795dd1dbb344bdacae7208f448a6b3>:0
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x0001a] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x00028] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x00008] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
  at System.Runtime.CompilerServices.ConfiguredTaskAwaitable`1+ConfiguredTaskAwaiter[TResult].GetResult () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0
  at System.Net.Http.HttpClient+<SendAsyncWorker>d__49.MoveNext () [0x000ca] in <7736395a6c71409691a34accfc621095>:0

If I added the Timeout, the Post get data back, but that is too slow for LTE.
It takes a few minutes before receiving data.
This is, what I get back from PostAsync:
{StatusCode: 200, ReasonPhrase: 'OK', Version: 1.1, Content: ModernHttpClient.ProgressStreamContent, Headers:
{
Cache-Control: max-age=0, private
Date: 16.11.2017 10:34:35 +00:00
OkHttp-Received-Millis: 1510828472777
OkHttp-Selected-Protocol: http/1.1
OkHttp-Sent-Millis: 1510828472613
Server: Microsoft-IIS/8.0
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
Content-Length: 330
Content-Type: application/json; charset=utf-8
OkHttp-Received-Millis: 1510828472777
OkHttp-Selected-Protocol: http/1.1
OkHttp-Sent-Millis: 1510828472613
X-AspNet-Version: 4.0.30319
X-Powered-By: ASP.NET
}}

What is my mistake ?


text:
Q: How to throw an error message with an argument? I'm really struggling with throwing an error message that includes an argument from the function. I know I can do:
throw std::out_of_range("Empty tree");

What I am struggling with is another error I am supposed to throw, which is:
"Cannot find ceil for key <key>"

As you can see, I am supposed to include the key for which I cannot find the ceil for. I have the key as a variable in the function from which I am throwing the exception, but I have no idea how to include it in what will eventually be printed by e.what().
EDIT: This is a template function as a member of a class, so key is just type T right now. Hence why I think formatting it as a c string wasn't working.

A: The standard exceptions only take a string as an argument:
e.g. out_of_range, see apache.org docs
namespace std {
  class out_of_range : public logic_error {
  public:
    explicit out_of_range(const string&  what_arg);
  };
}

You could use any method to build the string beforehand, and then pass that as the parameter to the exception.
Example:
#include <string>
#include <sstream>
#include <stdexcept>

std::ostringstream oss;
oss << "Cannot find ceil for key " << key;
std::string errorString = oss.str();

throw std::out_of_range(errorString);

For other ways to create the string, see C++ create string of text and variables


text:
Q: iOS hide keyboard on action I have a form that submits information from two text fields to Parse when the submit button is pressed and calls this action but I cannot get the keyboard to hide when the button is pressed and can use some help. Here is my code currently:
-(IBAction)PurchaseSubmitAction:(id)sender{
    PFObject *gameScore = [PFObject objectWithClassName:@"Purchase"];
    gameScore[@"name"] = FullName.text;
    gameScore[@"phone"] = PhoneNumber.text;
    [gameScore saveInBackground];
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:.3];
    [_Purchase setAlpha:0];
    [UIView commitAnimations];
    [sender resignFirstResponder];
    NSLog(@"Load");
}

How can I have the keyboard clear? Thanks in advance.

A: Try [self.view endEditing:YES] where self is an instance of UIViewController, or keep track of the focused UITextField and use [self.trackedTextField resignFirstResponder] instead. sender in your code is an instance of UIButton which is not the firstResponder in this case.

A: Try [yourTextField resignFirstResponder];


text:
Q: Get blobs from azure storage excluding subfolders Trying to get blobs from Azure storage container using CloudBlobContainer.ListBlobs, but I want to only get blobs from the specific folder (using prefix), not the sub-folders under the main folder.
For example lets say I have this:
Folder
  Sub-Folder
    image2.jpg
  image1.jpg

If I use Folder as the prefix, I want to get image1.jpg AND exclude image2.jpg (anything under sub-folders)

A: From Reference
If you call CloudBlobContainer.listBlobs() method,it will by default return a list of BlobItems that contains the blobs and directories immediately under the container. It's the default behavior with v8.
Even if you want to match pattern ,As mentioned by @Gaurav mantri- reference

There's limited support for server-side searching in Azure Blob
Storage. Only thing you can filter on is the blob prefix i.e. you can
instruct Azure Storage service to only returns blobs names of which
start with certain characters.

But if you want to get based on file name ,below example might give an idea
var container = blobClient.GetContainerReference(containerName);
foreach (var file in container.ListBlobs(prefix: " Folder/filename.xml", useFlatBlobListing: true))
{ …}

In your case try with  Folder/filename.jpg.

Note:

*

*useFlatBlobListing: Setting this value to true will ensure that only blobs are returned (including inside any sub folders inside that
directory) and not directories and blobs.

*So, if you only want blobs, you have to set the UseFlatBlobListing property option to true.

Other references:
Ref 1,ref 2


text:
Q: Is there a way to test failover in amazonMQ? I'm testing the master-slave functionality of amazonMQ and I would like to trigger a failover under load and ensure that all messages sent are received by my subscribers.
I can't see any options in the gui or cli to trigger a failover scenario.  I have tried rebooting the broker but this affects both nodes.  Predictably this caused my test to fail as the standby broker was not available when my clients tried to reconnect.
There is some comfort in that my clients did try and reconnect to the standby broker immediately but I still can't be sure that all messages would get through if a failover scenario would occur.
Is this possible at all?


text:
Q: Querying STRUCT elements in an ARRAY (Bigquery) Hi guys need help on this example on the official documentation: I cant seem to get similar results as the one on the documentation page even after copy n pasting the code there
https://cloud.google.com/bigquery/docs/reference/standard-sql/arrays#querying_nested_arrays
output according to the page:

WITH races AS (
  SELECT "800M" AS race,
    [STRUCT("Rudisha" as name, [23.4, 26.3, 26.4, 26.1] as splits),
     STRUCT("Makhloufi" as name, [24.5, 25.4, 26.6, 26.1] as splits),
     STRUCT("Murphy" as name, [23.9, 26.0, 27.0, 26.0] as splits),
     STRUCT("Bosse" as name, [23.6, 26.2, 26.5, 27.1] as splits),
     STRUCT("Rotich" as name, [24.7, 25.6, 26.9, 26.4] as splits),
     STRUCT("Lewandowski" as name, [25.0, 25.7, 26.3, 27.2] as splits),
     STRUCT("Kipketer" as name, [23.2, 26.1, 27.3, 29.4] as splits),
     STRUCT("Berian" as name, [23.7, 26.1, 27.0, 29.3] as splits)]
       AS participants)
SELECT
  race,
  participant
FROM races r
CROSS JOIN UNNEST(r.participants) as participant;

my sample output when i run the query above:

A:
how do i get the output in the documentation? what should be the correct query?

Use below
SELECT
  race,
  TRANSLATE(FORMAT('%T', participant), '()"', '{}') AS participant
FROM races r
CROSS JOIN UNNEST(r.participants) as participant

with output


text:
Q: I'm facing valueError in my nth fibonacci number code I'm facing valueError in my nth fibonacci number code  on CodingNinjas compiler, when I ran it on repl.it, it showed the answers correctly. Can anyone help me figure out the issue with this code?
def fibonacciNumber(n):
    # Write your code here.
    list_ = [0,1]

    if n == 0:
        print(list_[0])
    elif n == 1:
        print(list_[1])
    else:
        for i in range(2, n+1):
            newval = list_[i-1] + list_[i-2]
            list_.append(newval)

        print(list_[-1])

n = int(input())
for i in range(n):
    number = int(input())
    fibonacciNumber(number)

It might be due to my approach. If anyone can suggest how can I optimize the code a bit, it'll be a great help


text:
Q: Xampp localhost index does not open i am having a problem with my xampp. Whenever i try to open my localhost, a project that i have opens. Actually i was learning laravel so i changed my system32/drivers/tec/host code into this. So do i have a problem here.
  # Copyright (c) 1993-2009 Microsoft Corp.
#
# This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
#
# This file contains the mappings of IP addresses to host names. Each
# entry should be kept on an individual line. The IP address should
# be placed in the first column followed by the corresponding host name.
# The IP address and the host name should be separated by at least one
# space.
#
# Additionally, comments (such as these) may be inserted on individual
# lines or following the machine name denoted by a '#' symbol.
#
# For example:
#
#      102.54.94.97     rhino.acme.com          # source server
#       38.25.63.10     x.acme.com              # x client host

# localhost name resolution is handled within DNS itself.
#   127.0.0.1       localhost
#   127.0.1.2      hariyalihost.dev
#
#   ::1             localhost
#   ::2     hariyalihost

127.0.0.1       localhost
127.0.1.2   hariyalihost.dev


text:
Q: migrate postfix accounts into google apps I have a postfix server (Linux) hosting a large amount of emails (120GB for 70 accounts) to be migrated into Google Apps. Only 30 accounts remain active and the remainder are archives.
What is an efficient way to migrate active accounts into Google Apps and minimize disruption? Are there scripts to read direct from the server disk then upload? What about folders and email statuses (read/flagged)?

A: Depending on the needs of your users, it's usually easier to cut over the MX records first and send your users to Apps for all new mail. Then, migrate over their old data. In this case, the downtime is very limited and they can always access the old server should they need something there.
The alternative would be to do multiple waves of migration that look something like:

*

*Migrate all data from data X - Y

*Change MX records for all users and send them to Apps

*Run a second migration from date Y - Z to pick up any of the missed data (there won't be duplicates in emails if there's some overlap)

Regarding your last point, I'm guessing your users are using at least IMAP to access the mail server as I believe Postfix is not a mail server on its own. If this is the case, you'll want to use an IMAP migration for which Google provides a tool for (GAMME). An IMAP migration will bring over folder structure as well as read/unread status but I don't believe any 'flagged' status will translate.


text:
Q: popup alert - search loop I am a beginner so the question may be strange :)
I want to test the Main Menu of the website "https://tvn24.pl/"
I am looking for elements, I put them into the list and then iterating through it opening each page found - Works fine
Now step two:
On only two pages(https://kontakt24.tvn24.pl/ and https://tvn24.pl/ ) a window pops up in which you should click the "consent" button.
It is a completely different confirmation dialog for each page (different xpath, Id, etc.)
I would like to write functions (loops)
Which will be checked for 5 seconds if the window appeared, if so, click the accept button.
I would like this function to check both cases of "alert".
If a window "A" pops up - Click Accept - end of function
If a "B" window pops up instead of "A" - Click Accept - end of function
If no window pops up, do nothing.
Attention :

*

*These popups are elements that cover the entire page.

*These are not allerts or frames - ordinary "DIV" so you can't use swith to alert or frame

*I know, I can also use a try:

Any hints?
Loop while with if, elif?
I tried something like this but it doesn't work
def alert_accept_if_with_Wait_V2(driver):
    V1_alert_window_Id = "onetrust-banner-sdk"
    V1_accept_button_Id = 'onetrust-accept-btn-handler'

    V2_alert_frame_Id = "rodoLayer"
    V2_accept_button_Xpath = './/*[@id="rodoLayer"]//a[@class="rodoFooterBtnAccept"]'

    wait = WebDriverWait(driver, timeout=5, poll_frequency=0.5)

    if wait.until(ec.presence_of_element_located((By.ID, V1_alert_window_Id))):
        wait.until(ec.element_to_be_clickable((By.ID, V1_accept_button_Id))).click()
        print(f"On page {driver.current_url} onetrust alert accepted")
    elif wait.until(ec.presence_of_element_located((By.ID, V2_alert_frame_Id))):
        wait.until(ec.element_to_be_clickable((By.ID, V2_accept_button_Xpath))).click()
        print(f"On page {driver.current_url} old alert accepted")
    else:
        print(f"On page {driver.current_url} no alert appeared ")

Another :
def alert_accept_if_with_Wait_V1(driver, max_seconds_to_wait=5):

V1 = './/*[@id="onetrust-accept-btn-handler"] '
V2 = './/*[@id="rodoLayer"]//a[@class="rodoFooterBtnAccept"]'

seconds = 0
while range(max_seconds_to_wait):
    if driver.find_element_by_xpath(V1 or V2):
        driver.find_element_by_xpath(V1 or V2).click()
        return False
    else:
        seconds += 1
    time.sleep(1)
else:
    print(f"On page {driver.current_url} no alert appeared ")

A: seconds = 0
while seconds < 3:
    V1 = driver.find_elements_by_xpath('.//*[@id="onetrust-accept-btn-handler"]')
    V2 = driver.find_elements_by_xpath('.//*[@id="rodoLayer"]//a[@class="rodoFooterBtnAccept"]')
    if len(V1) > 0:
        V1[0].click()
        print(f"On page {driver.current_url} onetrust alert accepted")
        return False
    elif len(V2):
        V2[0].click()
        print(f"On page {driver.current_url} old alert appeared")
        return False
    else:
        seconds += 1
        time.sleep(1)
else:
    print(f"On page {driver.current_url} no alert appeared ")
    return False


text:
Q: I am trying to get response using Retrofit.... onResponses() in not calling It is not Working When I fatching Data From Server :
Here is my Class ApiClass
public class ApiClient {
    public static final String BASE_URl="https://simplifiedcoding.net/demos/";
    public  static ApiInterface apiInterface= null;

    public static ApiInterface getApiClient(){
        if (apiInterface == null){

            Retrofit retrofit=new Retrofit.Builder().baseUrl(BASE_URl)
                    .addConverterFactory(GsonConverterFactory.create())
                    .build();

            apiInterface = retrofit.create(ApiInterface.class); // this line is good
        }
        return apiInterface;
    }
    public interface ApiInterface {
        @GET("marvel/")
        Call<data> getcontex();

    }

}

Here is my Main Class
 Call<data> listcall = ApiClient.getApiClient().getcontex();
            listcall.enqueue(new Callback<data>() {
                @Override
                public void onResponse(Call<data> call, Response<data> response) {
                    data d=response.body();
                    Toast.makeText(MainActivity.this, "Done ", Toast.LENGTH_SHORT).show();

                }

                @Override
                public void onFailure(Call<data> call, Throwable t) {
                    Toast.makeText(MainActivity.this, "Faield", Toast.LENGTH_SHORT).show();

                }
            });

I am seriously can't understand what's wrong. Can you help me guys?

A: I am assuming your api responds with an array of objects and you want to get a callback for that.
@GET('your url')
void getData(Callback<ArrayList<Data>> callback);

A: You are having a json array and not a json object, try changing your code like this
Call<List<data>> listcall = ApiClient.getApiClient().getcontex();
        listcall.enqueue(new Callback<List<data>>() {
            @Override
            public void onResponse(Call<List<data>> call, Response<List<data>> response) {
                data d=response.body();
                Toast.makeText(MainActivity.this, "Done ", Toast.LENGTH_SHORT).show();

            }

            @Override
            public void onFailure(Call<List<data>> call, Throwable t) {
                Toast.makeText(MainActivity.this, "Faield", Toast.LENGTH_SHORT).show();

            }
        });

and in your interface
 public interface ApiInterface {
    @GET("marvel/")
    Call<List<data>> getcontex();

}

A: Try this:-
Here is your model class
Data.java
public class Data {

    @SerializedName("name")
    @Expose
    private String name;
    @SerializedName("realname")
    @Expose
    private String realname;
    @SerializedName("team")
    @Expose
    private String team;
    @SerializedName("firstappearance")
    @Expose
    private String firstappearance;
    @SerializedName("createdby")
    @Expose
    private String createdby;
    @SerializedName("publisher")
    @Expose
    private String publisher;
    @SerializedName("imageurl")
    @Expose
    private String imageurl;
    @SerializedName("bio")
    @Expose
    private String bio;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getRealname() {
        return realname;
    }

    public void setRealname(String realname) {
        this.realname = realname;
    }

    public String getTeam() {
        return team;
    }

    public void setTeam(String team) {
        this.team = team;
    }

    public String getFirstappearance() {
        return firstappearance;
    }

    public void setFirstappearance(String firstappearance) {
        this.firstappearance = firstappearance;
    }

    public String getCreatedby() {
        return createdby;
    }

    public void setCreatedby(String createdby) {
        this.createdby = createdby;
    }

    public String getPublisher() {
        return publisher;
    }

    public void setPublisher(String publisher) {
        this.publisher = publisher;
    }

    public String getImageurl() {
        return imageurl;
    }

    public void setImageurl(String imageurl) {
        this.imageurl = imageurl;
    }

    public String getBio() {
        return bio;
    }

    public void setBio(String bio) {
        this.bio = bio;
    }

}

and interface for api service
ApiService.java
public interface ApiService {
    @GET("marvel/")
    Call<List<Data>> getHero();
}

and this is you MainActivity.java
MainActivity.java
public class MainActivity extends AppCompatActivity {

    String BaseUrl = "https://simplifiedcoding.net/demos/";
    List<Data> data = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        ApiService retrofitService = new Retrofit.Builder()
                .baseUrl(BaseUrl)
                .addConverterFactory(GsonConverterFactory.create())
                .build().create(ApiService.class);

        Call<List<Data>> call = retrofitService.getHero();

        call.enqueue(new Callback<List<Data>>() {
            @Override
            public void onResponse(@NonNull Call<List<Data>> call, @NonNull Response<List<Data>> response) {
                data = response.body();
                for (int i = 0; i < data.size(); i++) {
                    //you can get your all data like name,bio,realname,team etc...
                     Toast.makeText(MainActivity.this, "Done", Toast.LENGTH_SHORT).show();
                }
            }

            @Override
            public void onFailure(@NonNull Call<List<Data>> call, @NonNull Throwable t) {
                   Toast.makeText(MainActivity.this, "Faield", Toast.LENGTH_SHORT).show();

            }
        });

    }
}

And last dont forgot to add internet permission in AndroidManifest.xml

A: Here I have written working example for your problem. I have found that problem lies in parsing arraylist without key. See below code snippets:

*

*Your model class is
public class data {
@SerializedName("name") @Expose private String name;
@SerializedName("realname") @Expose private String realname;
@SerializedName("team") @Expose private String team;
@SerializedName("firstappearance") @Expose private String firstappearance;
@SerializedName("createdby") @Expose private String createdby;
@SerializedName("publisher") @Expose private String publisher;
@SerializedName("imageurl") @Expose private String imageurl;
@SerializedName("bio") @Expose private String bio;
public String getName() {
    return name;
}

public void setName(String name) {
    this.name = name;
}

public String getRealname() {
    return realname;
}

public void setRealname(String realname) {
    this.realname = realname;
}

public String getTeam() {
    return team;
}

public void setTeam(String team) {
    this.team = team;
}

public String getFirstappearance() {
    return firstappearance;
}

public void setFirstappearance(String firstappearance) {
    this.firstappearance = firstappearance;
}

public String getCreatedby() {
    return createdby;
}

public void setCreatedby(String createdby) {
    this.createdby = createdby;
}

public String getPublisher() {
    return publisher;
}

public void setPublisher(String publisher) {
    this.publisher = publisher;
}

public String getImageurl() {
    return imageurl;
}

public void setImageurl(String imageurl) {
    this.imageurl = imageurl;
}

public String getBio() {
    return bio;
}

public void setBio(String bio) {
    this.bio = bio;
}

}

*Then your webservice caller class is:
public class WebServiceCaller {
private static WebServiceApiInterface webApiInterface;
public static final String BASE_URl = "https://simplifiedcoding.net/demos/";

public static WebServiceApiInterface getClient() {
    if (webApiInterface == null) {
        HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
        logging.setLevel(HttpLoggingInterceptor.Level.BODY);
        OkHttpClient okclient = new OkHttpClient.Builder().addInterceptor(logging).build();
        Gson gson = new GsonBuilder()
            .setDateFormat("yyyy-MM-dd'T'HH:mm:ssZ")
            .create();

        Retrofit client = new Retrofit.Builder() // .client(okClient)
            .baseUrl(BASE_URl)
            .client(okclient.newBuilder().connectTimeout(10, TimeUnit.MINUTES).readTimeout(100, TimeUnit.SECONDS).writeTimeout(100, TimeUnit.SECONDS).addInterceptor(logging).build())
            .addConverterFactory(GsonConverterFactory.create(gson))
            .build();
        webApiInterface = client.create(WebServiceApiInterface.class);
    }
    return webApiInterface;
}

public interface WebServiceApiInterface {

    @GET("marvel/")
    Call < ArrayList < data >> getcontex();

}

}

*Now call service like below in your main activity.
public void getData() { try {
    final ProgressDialog dialog = ProgressDialog.show(this, "", "loading...");

    WebServiceCaller.WebServiceApiInterface service = WebServiceCaller.getClient();
    // Call<data> call = service.getStatusMenu("6a10c6fd0a021e8b5beda2948790d9f7FYnx", "com.r3app.wthrcomplete");

    Call<ArrayList<data>> call = service.getcontex();
    call.enqueue(new Callback<ArrayList<data>>() {

        @Override
        public void onResponse(Call<ArrayList<data>> call, Response<ArrayList<data>> response) {
            dialog.dismiss();
            if (response.isSuccessful()) {

                ArrayList<data> result = response.body();
                Toast.makeText(ScrollingActivity.this, "Done "+result.get(0).getName(), Toast.LENGTH_SHORT).show();

            } else {
                dialog.dismiss();

            }
        }

        @Override
        public void onFailure(Call<ArrayList<data>> call, Throwable t) {
            t.printStackTrace();
            Toast.makeText(ScrollingActivity.this, " "+t.getMessage(), Toast.LENGTH_SHORT).show();
            Log.v("onFailure", "onFailure");
            dialog.dismiss();

        }
    });

} catch (Exception e) {
    e.printStackTrace();
}

}


text:
Q: Unsubscribe tracking for custom unsubscribe page I am pretty new to Marketing Cloud so I am sorry if it is a dumb question. On our Account we use a custom unsubscribe link which forwards the customer to a set of cloud pages used as unsubscribe pages. This link contains the customers email and subscriber key as variables. Once on the first page the customers email is prefilled into a field an he has to click on unsubscribe. Once he does that the "UpdateSingleSalesforceObject" action is used to update his record (Email Opt Out Field) in the Sales Cloud and a triggered send is initiated to the customer service center to unsubscribe the customer in an external backend system.
Due to these unsubscribes being done via the Sales Cloud action they are not tracked in the Marketing Cloud Journey which is used to send out the mail.
Is there any way to make it so that these unsubscribes are also included in the Journey Reporting? (Information displayed when you click on a e-mail send activity of an already running journey)
Thanks for your Feedback.
Best Regards,
Felix

A: Familiarize yourself with LogUnsubEvent, and replace the UpdateSalesforceObject function with it.
LogUnsubEvent through the MC connector automatically sets the "Email Opt Out" field in Sales Cloud for you (often this is more cause for concern than anything, but for your usecase it seems to be what you want) and produces Marketing Cloud statistics at the same time. Your current solution does only the first part of the story.
https://developer.salesforce.com/docs/atlas.en-us.noversion.mc-programmatic-content.meta/mc-programmatic-content/unsubEvent.htm
Once you know the term, you can also easily google sample implementations with AMPScript, SSJS etc.
As a general rule, any custom unsubscription taking a pass on LogUnsubEvent will lead to problems with the statistics, and everything consuming those statistics (journey dashboards, einstein). So best practice in my book is to always make sure to use it as intended. Even if it means you have to deal with potential side effects or even inconsistencies (e.g. due to multiple types of unsubs from the same BU) that this general rule produces afterwards. You want to feed meaningful statistics into the system or you block product capabilities.


text:
Q: The storage engine for the table doesn't support repair. InnoDB or MyISAM? After repairing my database I received the following error:
scode_tracker.ap_visits
note     : The storage engine for the table doesn't support repair
scode_tracker.visit_length
note     : The storage engine for the table doesn't support repair

I found out that the type of table is InnoDB. The other table was MyISAM and it was repaired successfully.
After reading some topic here, the solution is to change it to MyISAM. I don't know much about InnoDB and MyISAM. I don't specify the type when I created the table. So my question is should I use MyISAM instead of InnoDB? If yes, how can I change it from InnoDB to MyISAM?

A: First is you have to understand the difference between MyISAM and InnoDB Engines. And this is clearly stated on this link. You can use this sql statement if you want to convert InnoDB to MyISAM:
 ALTER TABLE t1 ENGINE=MyISAM;

A: InnoDB works slightly different that MyISAM and they both are viable options.
You should use what you think it fits the project.
Some keypoints will be:

*

*InnoDB does ACID-compliant transaction. http://en.wikipedia.org/wiki/ACID

*InnoDB does Referential Integrity (foreign key relations) http://www.w3resource.com/sql/joins/joining-tables-through-referential-integrity.php

*MyIsam does full text search, InnoDB doesn't

*I have been told InnoDB is faster on executing writes but slower than MyISAM doing reads (I cannot back this up and could not find any article that analyses this, I do however have the guy that told me this in high regard), feel free to ignore this point or do your own research.

*Default configuration does not work very well for InnoDB needs to be tweaked accordingly, run a tool like http://mysqltuner.pl/mysqltuner.pl to help you.

Notes:

*

*In my opinion the second point is probably the one were InnoDB has a huge advantage over MyISAM.

*Full text search not working with InnoDB is a bit of a pain, You can mix different storage engines but be careful when doing so.

Notes2:
  - I am reading this book "High performance MySQL", the author says "InnoDB loads data and creates indexes slower than MyISAM", this could also be a very important factor when deciding what to use.

A: You have the wrong table set on the command. You should use the following on your setup:
ALTER TABLE scode_tracker.ap_visits ENGINE=MyISAM;


text:
Q: What it mean to be write heavy in cassandra? I am kind of confused in terms of what it means to be write heavy in cassandra. Is this relative to the read frequency on a particular cluster or something absolute.
e.g lets say in our environment if we have like 500 tps written and may be 100 queries per second.
In this case write is relatively higher then the reads. But if we look at  just the writes from cassandra perspective, is this really high ?
We have ssd in prod with around 64 gigs of ram.

A: Writes are much faster and the defaults are tuned around data models that write more than they read for denormalizing the data.
4k writes/sec per core kinda standard rule of thumb which is safe (per host). With big host like that if tuned correctly its perfectly reasonable to have ~100k-200k writes a sec (if dont run outta disk). When you introduce reads that drops significantly but its really a factor of data model and the client, it should be relatively easy to do 20k a sec with 50% reads/writes but it can definitely go higher.  With a bad data model though its all out the window.
If your doing below 1k reads+writes a sec per host you shouldn't have many issues unless your data model is an anti pattern, and even then with that load it might work out.


text:
Q: Some data points are missing when importing CSV-file into QGIS I am trying to display a delimited text layer from a .csv (utf-8) in QGIS 3.10. I have done the same thing successfully in ArcMap 10.7.1 with no problem, but when I add the delimited text layer in QGIS over 700 of the 1900+ data points do not show up.
I tried to resolve this by creating a shapefile in ArcMap and bringing that into QGIS, but exact same problem occurred.  When I open the attribute table in QGIS the data is all there, it simply isn't being displayed. I am posting some images.  The first on is the result in ArcMap, then QGIS and then I selected the missing data in ArcMap so you can get a glimpse of what the data look like.

The data were collected using WGS_1984 and the Maine/NH towns is projected in NAD83_StatePlane for NH in Feet.
Is it a CRS issue?
Are the data in the .csv messed up?
If so, why does it work in ArcMap and not QGIS?
Here is the text of the data the first line of data show up fine, the second does not show up.

id,username,lat,lng,hotspot,observed,country,county,state,municipality,postcode,observation_notes,Sample Number,Sample Location,Was the sample filtered?,Type of Filtration System,Water filtration description,Beryllium (Be) (ug/L),Chromium (Cr) (ug/L),Manganese (Mn) (ug/L),Iron (Fe) (ug/L),Nickel (Ni) (ug/L),Copper (Cu) (ug/L),Arsenic (As) (ug/L),Selenium (Se) (ug/L),Cadmium (Cd) (ug/L),Antimony (Sb) (ug/L),Barium (Ba) (ug/L),Thallium (Tl) (ug/L),Lead (Pb) (ug/L),Uranium (U) (ug/L),Lab data entered on,SEPA School Name,City,State,ZIP code,Well Type,Previous arsenic test,Year,Do you treat your water?,Image 1
103070,anonymous,43.181041,-71.999461,,2019-12-09 23:35:00+0000,United States of America,Merrimack County,New Hampshire,Bradford,3221,,2019-1259,Kitchen,No,No filter,,0,0,1.41,9.3,0.64,487.15,0.06,0.11,0.07,0.08,19.55,0,5.73,0.01,1/23/2020,Kearsarge High School,Bradford,New Hampshire,3221,I don't know,No,2019,,
102564,anonymous,44.821972,-67.20856,,2019-11-23 21:00:00+0000,United States of America,Washington County,Maine,Whiting,4691,,2019-815,Other,No,No filter,,0,0.3,1.64,8.13,0.03,0.18,0.67,0.05,0,0.03,3.11,0,0.02,0.04,12/20/2019,Machias Memorial High School,Whiting,Maine,4691,Dug well,No,2019,,

A: The ususal reason for this type of problem is mistyped or misinterprented dates. Have a look at the "Lab data entered on" column in qgis (Layer > Properties > Fields). Is it a date field or a text string? In the former case, what is the format of the date string? (The only way to find out the format may be to sort the attribute table on that field)
My guess is that qgis reads it as an dd/mm/yy date string (which is quite common in Europe), it will then read 03/04/19 as 3rd April 2019, but it will refuse 03/13/19, as it would believe that to be the 3rd day in the 13th month.
Try to reimport your data unchecking "Detect field types". That may cause some other problems as it may not read other data correctly. If that reads all your data, try to manipulate the first "Lab data entered" value so it is not a valid dd/mm/yy date and reread your data set.
As far as I know, qgis is reading the first few lines of your data set to determine the types of data, so if the first few lines can be read as valid dd/mm/yy, it will assume that format for the rest of the lines as well - that also means that the subset you gave us will be read just nicely, since qgis finds an invalid date and read the field as a string variable.
Edit: Rereading your data, I see that neither of the "Lab data entered" dates could be read as valid dd/mm/yyyy.


text:
Q: Turn off alerts on a SharePoint List We have a SharePoint solution that uses a standard task list.
We would like to turn off alerts for when items change in / are added to the task list.
Is there a way to do this in code, either when we create the site, or when we add items to the task list?

A: SPList.EnableAssignedToEmail


text:
Q: Making a highly customizable method, or a specific method that does a task? I'm not really sure how I would phrase the title right, so I apologize for the initial confusion.
This is just a small question I had about how to structure code and such and I have no idea on what to call it so I will explain it with this example:
Say I am writing a Call of Duty type game where the player can customize their weapons with certain attachment.
I have a class that defines each gun. It looks something like this:
class Gun {

int clip = 30;
int ammo = 100;
float reloadTime = 5f;
float damage = 10f;
Attachment[] attachments;
//Plus some not included attachments.

void shoot() {
  //...
}

void reload() {
  //...
}

void applyAllAttachments() {
  //Apply the list of attachments' effects
}

}

class Attachment {
void effect() {
//change the gun in some way.
}

}

Now I would like to add 4 attachments, Fast Mags (increase reload speed), Hollow Point (increase damage), Grenade Launcher (Secondary Gun) and Minigun (Replace the barrel with a minigun or something).
For the Fast Mags and the Hollow Point, it should be simple, all I have to do is change a number or a value, but for the Grenade Launcher and Minigun, which have custom, extra functions (like Unity Delegates), would it be wiser to add a function that handles external custom firing types, or would it be better to just have separate methods inside the Gun class that specifically handle to extra minigun functions?
TL;DR
If I want to add a grenade launcher attachment to a gun, should I do this:
class Gun {

int clip = 30;
int ammo = 100;
float reloadTime = 5f;
float damage = 10f;
Attachment[] attachments = Attachment[10];
//Plus some not included attachments.

void shoot() {
  //...
  customShoot();
}
void customShoot() {
    //Apply attachments custom attachment shoot methods.
}

void reload() {
  //...
}

void applyAllAttachments() {
  //Apply the list of attachments' effects
}

}

class GrenadeLauncher extends Attachment {
@Override
public void effect() {
//Spawn new grenade
}

}

Or This:
class Gun {

int clip = 30;
int ammo = 100;
float reloadTime = 5f;
float damage = 10f;
Attachment[] attachments = Attachment[10];
//Plus some not included attachments.

void shoot() {
  //...
  if (attachments.GetType() == GrenadeLauncher) {
      grenadeLauncherShoot();
  }
}
void grenadeLauncherShoot() {

}

void reload() {
  //...
}

void applyAllAttachments() {
  //Apply the list of attachments' effects
}

}

Sorry for my pseudo/java code, hope it's comprehensible.

A: The first way is better: You can create new attachments without having to modify the Gun class.
In a general manner, you shouldn't need to check for type, and your code will be cleaner if you don't.
Here, your Attachment class should be abstract (I suppose it already is), and force children to implements some functions.
public abstract class Attachment
{
    protected abstract void shoot();
}

Then the gun calls it for all Attachements:
class Gun {
    int clip = 30;
    int ammo = 100;
    float reloadTime = 5f;
    float damage = 10f;
    Attachment[] attachments = Attachment[10];
    //Plus some not included attachments.

    void shoot() {
        //...
        for(int i = 0; i < attachments.length(); ++i) {
            attachments[i].shoot();
        }
    }

    void reload() {
      //...
    }
}

class GrenadeLauncher extends Attachment {
    @Override
    public void shoot()
    {
        //Spawn new grenade
    }
}

By the way, why did you tag java and Unity? If you work with unity your code should be c# or javascript


text:
Q: Php codeigniter Api call issue I'm making API call for other developers to use, so my question might sound silly but i need the community help. So thanking in advance.
I finished an API call for a web service using this https://github.com/chriskacerguis/codeigniter-restserver. All api calls working perfectly when i test it using postman plugin for chrome.
I've forwarded my API call to an android developer and he was able to use GET methods by using direct URL. now he is asking me to provide direct URL to the POST, PUT and DELETE API call,  Which i do not know how to provide.
If for example, this is my API call to use the GET method, http://example.com/api/chemists/2 using the method chemists_GET. How do i get the direct URL to this PUT API call using this method chemists_PUT. like wise chemists_POST and chemists_DELETE method.
Kindly help me.

A: Yoyu have ki9nd of answered it yourself... with the link you gave...
You're URL's to the endpoints will be as you have them... however you will need to implement the post functions etc as defined in https://github.com/chriskacerguis/codeigniter-restserver#responses that page also described delete and put too...


text:
Q: Uploading Docker Images to AWS ECR I am trying to create a workflow where developers in my organisation can upload docker images to our AWS ECR. The following commands work :
Step-1: Get Token
aws ecr get-login-password --region <region> | docker login --username AWS --password-stdin <repo-url>

Step-2: Tag the already built image
docker tag <local-image:tag> <ecr-repo-url>:latest

Step-3: Finally Push
docker push <ecr-repo-url>:latest

Now this works absolutely fine.
However as I am trying to automate the above steps.  I will NOT have AWS CLI configured on end users machine. So Step-1 will fail for the end user
So two quick queries:

*

*Can I get the token from a remote machine and Step-2 and Step-3 can happen from client

*Can I do all the three steps in remote and I have a service that uploads the local docker image to the remote server which in turn will take care of tag - push

A: I'm hoping that the end-user will have docker installed
In that case you can make use AWS CLI docker image to obtain the token from ECR.

A: The token itself is just a temporary password so whether you use the AWS CLI on the remote server or not it will be valid for the Docker credentials.
You of also have the option of using the AWS SDK that you could package with a small application to perform this action, such as Boto3 although you would need to ensure that the host itself has the relevant programming language configured.
Alternatively if you want this to be automated you could actually look at using a CI/CD pipeline.
GitHub has Actions, BitBucket has Pipelines and GitLab has arguably the most CI/CD built into it. This would have these services perform all of the above actions for you.
As a final suggestion you could use CodeBuild within a CodePipeline to build your image and then tag and deploy it to ECR for you. This will be automated by a trigger and not require any permanent infrastructure.
More information about this option is available in the Build a Continuous Delivery Pipeline for Your Container Images with Amazon ECR as Source article.


text:
Q: Hide passwords in application properties of Spring boot application Whenever the question of hiding the fields like passwords in application properties file arises,the straight-forward answer is encrypt those details using jasypt or other encryption.
If you keep encrypted passwords and jasypt details in same file, how does that make sense? or may be keep them in different file..
Any other smarter way for this?

A: You're not supposed to save the encryption key in application.properties, after all you don't want it going to your repository. You have to provide the key to your application when you run it, either by typing it or by storing it somewhere on your server. Check this thread for examples.

A: Let's assume that you have gotten your passwords in a typical application.properties file. Using Jaspyt, you may encrypt as follows:

*

*Maven setup.... Grab the latest spring boot starter Jasypt POM, use
com.github.ulisesbocchio as the group ID.

*Create a tiny utility class (preferably outside your spring boot app) to encrypt your passwords; it's easy to use Jasypt's BasicTextEncryptor class ex:
BasicTextEncryptor pwdEncrypt = new BasicTextEncryptor();
pwdEncrypt.setPassword(your_secret_sauce)//whatever you use here will be needed in the properties file (more on that later)
String encoded = pwdEncrypt.encrypt(password_you_want_to_encrpyt);

*The String encoded is PBE-encoded by default; grab that

*In your properties file, make the following entries:
jasypt.encryptor.password=your_secret_sauce //used in your utility
password_entry_you_want_to_encrypt=ENC(encoded) //encoded grabbed from your utility class

*I'll assume that you're annotating your main class with
@SpringBootApplication. Add the following annotations as well:
@EnableEncryptableProperties
@PropertySource(name="EncryptedProperties", value = "classpath:application.properties")

A: Use jasypt to encrypt properties in application.properties file.
it's usesPBEWithMD5AndDES for the encryption.
See:
https://github.com/ulisesbocchio/jasypt-spring-boot


text:
Q: Want to put CSS arrows on adjacent divs pointing one direction I am trying to create 3 divs across with arrows in the left and centre div pointing into the div to the right. I can get the first to point into the centre but as soon as I add the code for the centre and rename the div it disappears.
I think I may need some kind of ::before operator to get it to work but not sure. Basically I would like a pink div with pink arrow pointing into a cream div with cream arrow pointing into a blue div:

Here is the code I am using:
.hero-box-pink {
  position: relative;
  background: #ab255c;
}

.hero-box-pink:after {
  left: 100%;
  top: 50%;
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
  border-color: rgba(171,37,92,0);
  border-left-color: #ab255c;
  border-width: 30px;
  margin-top: -30px;
}

.hero-box-cream {
  position: relative;
  background: #fcfbe3;
}

.hero-box-cream:after {
  left: 100%;
  top: 50%;
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
  border-color: rgba(252,251,227,0);
  border-left-color: #fcfbe3;
  border-width: 30px;
  margin-top: -30px;
}

Thanks in advance for any help with this.

A: Hope this is what you are looking for.

.container {
  display: -webkit-flex;
  display: -moz-flex;
  display: -ms-flex;
  display: -o-flex;
  display: flex;
}
.box {
  width: calc(100% /3);
  padding: 20px 40px;
  box-sizing: border-box;
  color: #fff;
}
.first-box {
  background: #88b7d5;
}
.second-box {
  background-color: tomato;
}
.third-box {
  background: skyblue;
}
.arrow_box {
  position: relative;
}
.arrow_box:after {
  left: 100%;
  top: 50%;
  border: solid transparent;
  content: " ";
  height: 0;
  width: 0;
  position: absolute;
  pointer-events: none;
  border-color: rgba(136, 183, 213, 0);
  border-left-color: #88b7d5;
  border-width: 30px;
  margin-top: -30px;
  z-index: 99;
}
.first-box.arrow_box:after {
  border-left-color: #88b7d5;
}
.second-box.arrow_box:after {
  border-left-color: tomato;
}

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat.

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmodtempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodoconsequat.

Lorem ipsum dolor sit amet, consectetur adipisicing elit. Nulla sapiente, quasi. Blanditiis ullam sint magnam, aspernatur optio vero explicabo quibusdam voluptatem beatae aliquid magni! Tempore numquam debitis, eum voluptatum atque.

A: you may also use flex properties and rotate:

body {
  display: flex;
  margin: 1em;
}
p {
  padding: 2em;
}
p:first-of-type,
p:last-of-type {
  position: relative;
  background: #AB255C;
}
p:last-of-type {
  background: #00617A;
}
p:before {
  content: '';
  background: inherit;
  position: absolute;
  top: 50%;
  margin: -1em;
  height: 2em;
  width: 2em;
  transform: rotate(45deg);
  right: 100%;
}
p:first-of-type:before {
  left: 100%;
}

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris
  luctus, metus

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris
  luctus, metus

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris
  luctus, metus

rotating a pseudo element may allow you to draw borders or shadows or both around the whole element including the arrow.

body {
  display:flex;
  margin:1em;
}
p {
  padding:2em;
}
p:first-of-type,
p:last-of-type {
  position:relative;
  background:#AB255C;
  box-shadow:0 0 0 3px gray,0 0 5px 5px
}
p:last-of-type {
  background:#00617A;
}
p:before {
  content:'';
  background:inherit;
  position:absolute;
  top:50%;
  margin:-1em -1.2em;
  height:2em;
  width:2em;
  transform:rotate(45deg);
  right:100%;
  box-shadow:-3px 3px gray, -5px 5px 5px
}
p:first-of-type:before {
  left:100%;
  box-shadow:3px -3px gray, 5px -5px 5px

}

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris
  luctus, metus

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris
  luctus, metus

Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris
  luctus, metus

Here a demo to play with or to fork


text:
Q: Angular.Js input[date] validation Here is my form:
<form name="user_submission" novalidate="novalidate" method="post">
        <input type="date" name="date_of_birth" ng-focus="save_data()" ng-model-options="{timezone: 'UTC'}" ng-pattern="/^(19\d{2}|[2-9]\d{3})-(0?[1-9]|1[012])-(0?[1-9]|[12][0-9]|3[01])$/" ng-model="step_content.date_of_birth" required ng-maxlength="10" ng-minlength="10"  >

                    Wrong format!
                    Wrong Date!
                    Wrong Date!
                    Wrong Date!
</form>

Here is what I get from above form: ( which perfect )

I need to confine the Year to 'yyyy' however no matter what I do still I can type more than 4 digits.

I tried a directive for it:
// Usage: <input limit-to="4" type="number" >

app.directive("limitTo", [function() {
    return {
        restrict: "A",
        link: function(scope, elem, attrs) {
            var limit = parseInt(attrs.limitTo);
            angular.element(elem).on("keydown", function() {
                if (this.value.length == limit) return false;
            });
        }
    }
}]);

However when I add the limitTo to the date field I simply can't enter a full year which I think Angular overrides the 'yyyy' by adding a number from right and then removing a 'y' from left so limitTo=10 simply is not going to work.
I am out of option.
Any help or direction would be greatly appreciated.
Thanks in advance.

A: I gave up and written my own directive, I am not removing this question in case someone has the same issue.
Here is a directive that I made, a bit permeative but it does the job. Tested in Chrome, Safari, and Firefox.
Here is the Plunker address: https://plnkr.co/edit/XwNR618DM8IULxu9KLMe
( I couldn't sort out the address for plunker in template so I embedded in the Plunker because of the embedding the template focus directive is not working. If you implement this with the following code, your cursor should move from one textfield to another one upon completing it. )
    app.directive('multiSelectDate', function () {

        return {
            restrict: 'EA',
            scope: {
                datasource: '='
            },
            controller: function ($scope) {

                $scope.date = {
                    day: [],
                    month: [],
                    year: []
                };

                if (typeof $scope.datasource != 'undefined' && $scope.datasource != '') {
                    var sources = $scope.datasource.split('/');

                    if (typeof sources == 'object') {
                        $scope.date = {
                            day: [sources[0][0], sources[0][1]],
                            month: [sources[1][0], sources[1][1]],
                            year: [sources[2][0], sources[2][1], sources[2][2], sources[2][3]],
                        };
                    }
                }

                $scope.only_one_allowed = function(array) {
                    var val = [];
                    angular.forEach(array, function(value, index){
                        if (typeof value != 'undefined') {
                            if (value.length > 1) {
                                val[index] = value.split('')[1];
                            } else {
                                val[index] = value
                            }
                        }
                    });
                    return val;
                };

                $scope.only_number_allowed = function(array, type) {

                    if (type == 'year') {
                        var year_1st_digit = /1|2/;
                        var year_2nd_digit = /0|9/;
                        var year_rest_digit = /[0-9]/;

                        if (!year_1st_digit.test(array[0])) {
                            array[0] = '';
                        }
                        // Should be 0 or 9
                        if (!year_2nd_digit.test(array[1])) {
                            array[1] = '';
                        }
                        if (!year_rest_digit.test(array[2])) {
                            array[2] = '';
                        }
                        if (!year_rest_digit.test(array[3])) {
                            array[3] = '';
                        }

                    } else if (type == 'month') {

                        var month_1st_digit = /[0-1]/;
                        var month_2nd_digit = /[0-9]/;

                        // Shouldn't be more than 1 or less than 0
                        if (!month_1st_digit.test(array[0])) {
                            array[0] = '';
                        }

                        // Shouldn't be more than 2 or less than 0
                        if (!month_2nd_digit.test(array[1])) {
                            array[1] = '';
                        }

                        // if the month[0] is undefined and second digit has value change the first digit to 0
                        if (( typeof array[0] == 'undefined' || array[0] == '' ) && parseInt(array[1]) >= 0) {
                            array[0] = 0;
                        }

                        // date.array must have only one digit
                        if (parseInt(array[0], 10) != array[0]) {
                            array[0] = '';
                        }

                        if (parseInt(array[1], 10) != array[1]) {
                            array[1] = '';
                        }

                        if (parseInt(array[0], 10) == array[0] && parseInt(array[1], 10) != array[1]) {
                            array[1] = 0;
                        }

                    } else {

                        var day_1st_digit = /[0-3]/;
                        var day_2nd_digit = /[0-9]/;

                        // Shouldn't be more than 1 or less than 0
                        if (!day_1st_digit.test(array[0])) {
                            array[0] = '';
                        }

                        // Shouldn't be more than 2 or less than 0
                        if (!day_2nd_digit.test(array[1])) {
                            array[1] = '';
                        }

                        // if the day[0] is 3 then second digits must be less than 1
                        if (parseInt(array[0]) == 3 && parseInt(array[1]) > 1) {
                            array[1] = 1;
                        }

                        // if the day[0] is undefined and second digit has value change the first digit to 0
                        if (( typeof array[0] == 'undefined' || array[0] == '' ) && parseInt(array[1]) >= 0) {
                            array[0] = 0;
                        }

                        // date.array must have only one digit
                        if (parseInt(array[0], 10) != array[0]) {
                            array[0] = '';
                        }

                        if (parseInt(array[1], 10) != array[1]) {
                            array[1] = '';
                        }

                        if (parseInt(array[0], 10) == array[0] && parseInt(array[1], 10) != array[1]) {
                            array[1] = 0;
                        }

                    }

                    return array;
                };

                $scope.update_date = function () {

                    var day = '';
                    var month = '';
                    var year = '';

                    if (typeof $scope.date.day != 'undefined') {
                        var dirty_day = $scope.only_one_allowed($scope.date.day);
                        dirty_day = $scope.only_number_allowed(dirty_day, 'day' );
                        $scope.date.day = dirty_day;
                        day = dirty_day.join('');
                    }

                    if (typeof $scope.date.month != 'undefined') {
                        var dirty_month = $scope.only_one_allowed($scope.date.month);
                        dirty_month = $scope.only_number_allowed(dirty_month, 'month' );
                        $scope.date.month = dirty_month;
                        month = dirty_month.join('');
                    }

                    if (typeof $scope.date.year != 'undefined') {
                        var dirty_year = $scope.only_one_allowed($scope.date.year);
                        dirty_year = $scope.only_number_allowed(dirty_year, 'year' );
                        $scope.date.year = dirty_year;
                        year = dirty_year.join('');
                    }

                    $scope.datasource = day + '/' + month + '/' + year
                }
            },
            templateUrl: '/multiSelectDate.html',
            link: function (scope, element, attrs) {

                var start_year = attrs.startYear;
                if (scope.date.year.length != 4 && typeof start_year != 'undefined') {
                    scope.date.year = [start_year[0], start_year[1], start_year[2], start_year[3]];
                }

   scope.$watch('datasource', function(){

                var sources = scope.datasource.split('/');

                if (typeof sources == 'object') {
                    if (sources.length == 3) {
                        scope.date = {
                            day: [sources[0][0], sources[0][1]],
                            month: [sources[1][0], sources[1][1]],
                            year: [sources[2][0], sources[2][1], sources[2][2], sources[2][3]]
                        };
                    }

                }
            })

            }
        }
    });

Here is the template: (/multiSelectDate.html)

    <input type="text" focus ng-model="date.day[0]" class="dl_float" size="1" ng-keyup="update_date()">
    <input type="text" focus ng-model="date.day[1]" class="dl_float" size="1" ng-keyup="update_date()"> /
    <input type="text" focus ng-model="date.month[0]" class="dl_float" size="1" ng-keyup="update_date()">
    <input type="text" focus ng-model="date.month[1]" class="dl_float" size="1" ng-keyup="update_date()"> /
    <input type="text" focus ng-model="date.year[0]" class="dl_float" size="1" ng-keyup="update_date()">
    <input type="text" focus ng-model="date.year[1]" class="dl_float" size="1" ng-keyup="update_date()">
    <input type="text" focus ng-model="date.year[2]" class="dl_float" size="1" ng-keyup="update_date()">
    <input type="text" focus ng-model="date.year[3]" class="dl_float" size="1" ng-keyup="update_date()">

Here is the focus:
// <input focus type="text" />

    app.directive('focus', function () {
        return {
            restrict: 'A',
            link: function ($scope, elem, attrs) {
                elem.bind('keyup', function (e) {
                    if (e.keyCode == 8) {
                        if (typeof elem.prev() != 'undefined' && elem.prev().size() > 0) {
                            elem.prev()[0].focus();
                            elem.prev()[0].value = '';
                        }
                    } else {
                        if (typeof elem.next() != 'undefined' && elem.next().size() > 0) {
                            var val = elem[0].value;
                            if (!isNaN(parseFloat(val)) && isFinite(val)) {
                                elem.next()[0].focus();
                            }
                        }
                    }

                });
            }
        }
    });

Here is a sample CSS:
.dl_float {
  font-size: 14px !important;
  width: 19px;
}

Here how to use it:
<multi-select-date datasource="date_of_birth" start-year="1945" ></multi-select-date>

Here how you can see the result
{{date_of_birth}}

Here how initiate it if you need to in your controller:
$scope.date_of_birth = '11/01/1950';


text:
Q: HTML Simplest hide/show and class filter I have searched far and wide for this but can't quite find what I need.
I have a list as such:

Apple

Banana

Carrot

Drink

All I need is 3 buttons that toggle variables true and false that will show/hide the list items with the corresponding class for each variable. Then a search box that will filter out the list items without the (not case sensitive) string in them. For instance checking the box labelled "a" will only show "Apple" and "Banana" but typing in "b" into the search box will only show "Banana".
This is what I have tried so far:
<button onClick="toggle(a)">A</button>
<button onClick="toggle(b)">B</button>
<button onClick="toggle(c)">C</button>

Apple

Banana

Carrot

Drink

Then the Javascript:
var a, b, c;
function toggle(i) {
    if (i) {i = false
    }else {i = true};
};

if (a) {
    document.getElementsByClassName('a').style.visibility='shown';
}else {
    document.getElementsByClassName('a').style.visibility='hidden';
};

if (b) {
    document.getElementsByClassName('b').style.visibility='shown';
}else {
    document.getElementsByClassName('b').style.visibility='hidden';
};

if (c) {
    document.getElementsByClassName('c').style.visibility='shown';
}else {
    document.getElementsByClassName('c').style.visibility='hidden';
};

I have not yet figured out how to take a string from a text box.
How would I do this as simply as possible. "Simplest" being with the least code and vanilla javascript with no surplus features. I do not need animation or fancy graphics, just a show and hide based on the criteria. I will also note I'm reasonably new to JS and just cannot understand JQuery at all.
Thanks in advance.
Olie.
Also: If I have missed another question requesting the same info then do tell me.

A: I have created toggle buttons for your three classes, and an input that sets visibility based on the content of your list items.
Javascript
var hiddenClass = [];
var buttons = document.getElementsByClassName('toggleBtn');
for(var i = 0; i < buttons.length; i++){
  buttons[i].addEventListener('click', function(){
    var self = this;
    var elements = document.getElementsByClassName(self.value);
    toggleButtonState(self);
    for(var i = 0; i < elements.length; i++) {
      var element = elements[i];

      var isHidden = false;
      var classes = element.className.split(' ');
      for(var j = 0; j < classes.length; j++){
        if(hiddenClass.indexOf(classes[j]) !== -1) isHidden = true;
      }

      var vis = elements[i].style.visibility;
      if(vis === 'hidden' && !isHidden){
        setVisibility(element, 'visible');
      } else {
        setVisibility(element, 'hidden');
      }
    }
  });
}

var input = document.getElementById('classFilter');

input.addEventListener('input', function(){
  var food = document.getElementsByClassName('food');
  for(var i = 0; i < food.length; i++){
    var ele = food[i];
    if(ele.innerHTML.toLowerCase().indexOf(input.value.toLowerCase()) === -1) {
      setVisibility(ele, 'hidden');
    }else {
      isHidden = false;
      var classes = ele.className.split(' ');
      for(var j = 0; j < classes.length; j++){
        if(hiddenClass.indexOf(classes[j]) !== -1) isHidden = true;
      }

      if(!isHidden) setVisibility(ele, 'visible');
    }
  }
});

function setVisibility(element, visibility){
  element.style.visibility = visibility;
}

function setVisibilityByClass(name, visibility) {
  var elements = document.getElementsByClassName(name);
  for(var i = 0; i < elements.length; i++){
    setVisibility(elements[i], visibility);
  }
}

function toggleButtonState(element){
  var on = element.className.indexOf('on') !== -1;
  if(on){
    element.className = 'toggleBtn off';
    if(hiddenClass.indexOf(element.value) === -1) hiddenClass.push(element.value);
  }
  if(!on){
    element.className = 'toggleBtn on';
    hiddenClass = hiddenClass.filter(function(x) { return x !== element.value });
  }
}

Html

  <input type="button" class="toggleBtn on" value="a" />
  <input type="button" class="toggleBtn on" value="b"   />
  <input type="button" class="toggleBtn on" value="c"   />

  <input type="text" id="classFilter"  />

Apple

Banana

Carrot

Drink

CSS
  .off {
    background-color: grey;
  }

Got a fiddle working, had to change the listeners a bit to work in their environment: https://jsfiddle.net/b9jp7m1g/1/

A: Hope this helps. How I hide and show DOM elements that can be or impact several different areas is as follows:
1)  I create a CSS as follow:
.hideDom {
    display: none;
}

2) Then within the code area I toggle that css "on" and "off" to hide and show the DOM element(s) as follows:
$('someSelector').removeClass("hideDom");

to hide and
$('someSelector').addClass("hideDom");

to show. So for example, if I wanted to hide several DOM elements when "condition1" occurs, else show the elements. I would put a class on all those elements say 'cssCondition1' and perform the following:
switch(condition){
   case "condition1":
      $('.cssCondition').addClass("hideDom");
      break;
   default:
      $('.cssCondition').removeClass("hideDom");
      break;
}

In your specific example, if you wanted to hide everything but the banana:
$('.b').addClass("hideDom");

A: Here is an example of how you can do this cleanly in an HTML 5 way, using only native JavaScript. This doesn't use class names, but keys off the actual lowercased data. It will also shows a basic example of how jQuery uses the $ as a function name, plus how it works from a native JS POV. Here is my jsfiddle for this demo.
HTML:
<button data-key="a">A</button>
<button data-key="b">B</button>
<button data-key="c">C</button>
<button data-key="d">D</button>
<button data-key="all">Show All</button>

Apple

Banana

Carrot

Drink

JavaScript:
/* This is a basic example of how jQuery works,
 * but with native JavaScript & without jQuery:
 */
function $(str) {
  if (str.indexOf(' ') > -1) {
    var results = document.querySelectorAll(str);
  } else if (str[0] === '#') {
    var results = document.getElementById(str.replace('#',''));
  } else if (str[0] === '.') {
    var results = document.getElementsByClassName(str.replace('.',''));
  } else {
    var results = document.getElementsByTagName(str);
  }
  return results;
}

// So you can use dollar sign function names, as shortcuts, as shown below:
function showAll(liTags) { // This is useful for the next button click.
  if (!liTags) {
     liTags = $('li');
  }
  for (var i=0; i<liTags.length; i++) {
    var liTag = liTags[i];
    liTag.style.visibility = 'visible';
  }
}

function clickHandler() {
  var key = this.dataset.key; // Gets the data-key attribute.
  var liTags = $('li');
  showAll(liTags);

  if (key !== 'all') {
    // Hide all but current one.
    for (var i=0; i<liTags.length; i++) {
      var liTag = liTags[i];
      var text = liTag.innerText.toLowerCase();
      if (text.indexOf(key) > -1) {
        liTag.style.visibility = 'visible';
      } else {
        liTag.style.visibility = 'hidden';
      }
    }
  }
}

(function init() {
   var results = $('button');
   for (var i=0; i<results.length; i++) {
       results[i].addEventListener("click", clickHandler);
   }
})(); // Self-loading function, which runs only 1x on Page Load.


text:
Q: Which relationship is more natural? Have a quick question on how to best structure something for my Java project:
I'm a user. I can work at one or more places. At those workplaces, I have one or more roles. For each of these roles, I work a shift.
I either came up with:
My workplaces have shifts, my shifts have exactly 1 position (what position did I work when I worked my shift? It varies day to day..)
or
Workplaces have positions, each position has shifts
I think the 2nd is more natural but keep going back and forth / unsure of what has more of an advantage both now and for the future. It's hard for me as I can argue both I guess?
Thanks!

A: It might make the most sense to look at how you'll use those structures in your code. If you're writing a scheduling app, then putting shifts higher might make more sense because they're a scheduling artifact. If you're doing a HR app, then putting positions higher might make sense because you're worried about managing people and their roles.
An entity-relationship diagram would help, although you've pretty much got it laid out already.
But it's actually both. A workplace "has a" list of positions, but also "has a" list of shifts. Shifts will have additional information, like start and end time. And a shift "has a" position that describes what to do during that shift.
Another way to think of it is, a shift "realizes" a position. That is, it makes it real by adding scheduling information.
Here's another alternative: Positions and shifts are top-level entities, and they "have a" reference to a workplace.
You might bust out a simple Entity-Relationship diagram, and then decide which of the relationships (and in what direction) you want to model in your code. Some of the relationships you can rely on queries and joins to pull from your database.


text:
Q: Desandro's new masonry example giving me "Uncaught ReferenceError: container is not defined" I've been designing a freelance web design portfolio for my company. Which is static on s3 @ http://drootech.com.s3-website-us-west-1.amazonaws.com/dtindex.html
Originally I had been customizing the older version of masonry (using jQuery/Javascript to create a responsive portfolio) with the ability to filter out various content types by category (design, engineering, etc.)
It seems to be working fine, however I am getting an error in my console "Uncaught ReferenceError: container is not defined"
Here's the code:
$(function (){
var columns = 3,
    setColumns = function() { columns = $( window ).width() > 640 ? 3 : $(window).width() > 320 ? 2 : 1; };

setColumns();
$(window).resize(setColumns);
    var $container = $('#portfoliocontainer');
    $container.imagesLoaded(function(){
      var msnry = new Masonry( container, {
        itemSelector : '.item',
    columnWidth:  function( containerWidth ) { return containerWidth / columns;
    }
      });
});

});
Any kind of help or light on the situation would be greatly appreciated, I'm not sure why I'm getting the error.
EDIT I fixed the error with the following code.
// responsive masonry function
$(function msnry(){
var columns = 3,
setColumns = function() { columns = $( window ).width() > 640 ? 3 : $(window).width() >    320 ? 2 : 1; };
setColumns();
$(window).resize(setColumns);

    // layout Masonry again after all images have loaded
    var $container = $('#portfoliocontainer').masonry();
    var msnry;
    $container.imagesLoaded( function(){
    var container = document.querySelector('#portfoliocontent')
    msnry = new Masonry( container, {
    itemSelector : '.item',
    columnWidth:  function( containerWidth ) { return containerWidth / columns;}
      });
});
$('.expandi').click(function(){
    $('.expand').slideDown('fast');
    $(this).siblings('ul').toggle();
});
$('.engineeringiC').click(function(){
    if($('div.item').hasClass('designshwr')){
    masonry.hide(($this));
    $container.masonry('reloadItems');
}
});
});
    $("#seemore").click(function (){
        //$(this).animate(function(){
            $('html, body').animate({
                scrollTop: $("#mrkting").offset().top - 85
                 }, 2000);
        //});
    });
    $("#home").click(function (){
        //$(this).animate(function(){
            $('html, body').animate({
                scrollTop: $(".masthead").offset().top - 85
                 }, 2000);
        //});
    });
$("#info").click(function (){
        //$(this).animate(function(){
            $('html, body').animate({
                scrollTop: $("#mrkting").offset().top - 85
                 }, 2000);
        //});
    });
    $("#portfolio").click(function (){
        //$(this).animate(function(){
            $('html, body').animate({
                scrollTop: $("#portfolioo").offset().top - 85
                 }, 2000);
        //});
    });
    $("#menui").click(function (){
        //$(this).animate(function(){
            $('#navbar').addClass('slicknav');
            $('#navbar').slideDown('fast');
        //});
    });
    $("#socialmedia").click(function (){
            $("#myModal").modal('show');
    });
  $(window).scroll(function(){
  if ($(this).scrollTop() > 1080) {
  $('#contentnav').fadeIn('fast');
  $('#contentnav').addClass('dynamicnav');
}
if ($(this).scrollTop() > 400) {
   $('#navbar').slideUp('fast');
   $('#navbarm').slideDown('fast');
} if ($(this).scrollTop() < 1080) {
   $('#contentnav').removeClass('dynamicnav');
}

});
What I'm attempting to do with the code above when you click the div engineeringiC is hide everything that has the class "designshwr".
$('.engineeringiC').click(function(){
    if($('div.item').hasClass('designshwr')){
    masonry.hide(($this));
    $container.masonry('reloadItems');
}
});

But I'm having a really difficult time making it work. Any thoughts, or suggestions? P.S. Ignore the expandi function that's something I need to rewrite.


text:
Q: Create a new  if it exceeds a certain width? In my MVC site, I have a these lines of code:

@Model.Question

    @using (Html.BeginForm("Index", "Result", FormMethod.Post))
    {

                @foreach (string answer in Model.Answers)
                {
                    <input type="radio" name="answer" value="@answer" />@answer
                }

            <input class="btn btn-success" direction="false" type="submit" name="Back" value="Back" />
            <input class="btn btn-success" type="submit" />

    }

(Ignore the currently poorly implement first button in the footer)
The <input type="radio... returns the same amount of radio buttons as answers from a database. My problem is that for one question, there are a lot of answers and it starts making the page scroll sideways, as shown in the image below
What I want to happen is for the radio buttons to start on a new line, possibly in another , when it starts to go too far sideways. Possibly done when it hits the border of a surrounding div I could create? Or when it exceeds a certain pixel width? I am not quite sure how to approach this at all. Thanks in advance!

A: Instead of using tables for your job, it is better to use DIV with fixed width (or percentage width) and floating them left so they stick together in one line. When there will be too much elements for one line, they will automatically jump to a new line. This will also work if you will change width of your browser.
CSS part:
.elements {
  border: 1px solid red;
}

.elements:before,
.elements:after{
  display: table;
  content: " ";
}

.elements:after {
  clear: both;
}

.element {
  float: left;
  min-height: 1px;
  border: 1px solid blue;
  margin: 2px;
}

HTML Part:

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

    <input type="radio" name="radio" value="" /> Radio

https://jsfiddle.net/4xvdcw9b/2/

A: If using table is not necessary you can try this approach:

                    @foreach (string answer in Model.Answers)
                    {

<input type="radio" name="answer" value="@answer" />@answer

                    }

with this styles:
ul
{
   max-width:300px;
list-style-type: none;
}

li
{
   display: inline;
}


text:
Q: How to interrupt last command in node.js? I'm poking around with node.js and I ran a command like this:
myEvilString

So it should output the string's value, however, it turns out myEvilString is a really really long string and now my node console doesn't stop outputing the string.
Is there a way to interrupt node.js's console so that it stops outputing my string? I tried ctrl+c (bash's equivalent) but it didn't work.
note: I don't want to close the terminal because I already have some analysis made on that file and don't want to lose my variables

A: Go to Task manager -> Processes
Right click on node.exe -> End Process


text:
Q: Should every app with GCM support have "android.permission.WAKE_LOCK" All the apps I've seen which have GCM support have
android.permission.WAKE_LOCK

I would like to know the reason behind this.
What happens if an app which supports GCM doesn't have this permission?

A: According to the Google documentation it is optional:

The android.permission.WAKE_LOCK permission so the application can keep the processor from sleeping when a message is received. Optional—use only if the app wants to keep the device from sleeping.

Source: https://developer.android.com/google/gcm/client.html


text:
Q: How to import highlightjs VS Code extensions are typically written with Typescript. I'm implementing an extension for printing and I'd like to use highlightjs to do syntax colouring.
So in we bring it
npm i highlightjs -s

and the inevitable
npm i @types/highlight.js -s

at which point we find that we have code completion in VS Code and we can write things like
import * as hljs from 'highlight.js';
...
let text = editor.document.getText();
let html = hljs.highlightAuto(text);

and it compiles and runs... until we do something that triggers an attempt to load highlight.js. At this point an error occurs.

Error: Cannot find module 'highlight.js' extensionHostProcess.js:331
    at Function.Module._resolveFilename
  (internal/modules/cjs/loader.js:602:15)

A stickybeak in ../node_modules/highlightjs reveals that we have highlight.pack.js and highlight.pack.min.js but no highlight.js
Very confusing.  Can anyone tell me how to resolve this?

A: The problem is that highlightjs and highlight.js packages both exist, but @types/highlight.js must be paired with the highlight.js package.


text:
Q: NodeJS read icecast stream metadata I have researched this and found that I cannot find data on our how to read live metadata from Icecast streams.
What I would like to do is something like this. Note this script may not work - it's just a concept:
var http = require('http');
var fs = require('fs');
http.createServer(function(req, res) {
    res.writeHead(200, {
        'Content-Type': 'audio/mp3'
    });
    var rs = fs.createReadStream('ICECAST STREAM');
    rs.pipe(res);
})

However, when you try this script it won't work due to it can't read a remote stream.
Another issue is how do I get it to read metadata in the stream? I want to do some triggering when the metadata equals a certain tag.
Update script
var http = require('http'),fs   = require('fs'),request = require('request');
var icecast = require('icecast-stack');
var url = 'http://stream.radiomedia.com.au:8003/stream'; // URL to a known Icecast stream
var stream = icecast.createReadStream(url);

http.createServer(function(request, response) {
    response.writeHead(200, {
        'Content-Type': 'audio/mpeg',
        'Content-Length': 15000
    });
// Fired when the `net.Stream` has it's 'connect' event.
stream.on('connect', function() {
  console.error("Radio Stream connected!");
});

// Fired after the HTTP response headers have been received.
stream.on('response', function(res) {
  console.error("Radio Stream response!");
  console.error(res.headers);
});

// When a 'metadata' event happens, usually a new song is starting.
stream.on('metadata', function(metadata) {
  var title = icecast.parseMetadata(metadata).StreamTitle;
  if(title === "SkypeTherapy.pro - Ad 1 [2b]"){
  console.error("advert");
  }
  else{
      console.error(title);
  }

});

// Proxy the raw audio stream to 'stdout', redirect to a file!
//stream.pipe(process.stdout);
http.get(url, res => res.pipe(fs.createReadStream('some.mp3')));
})
.listen(2000);

However the script does not play and instead just prints data in the console.


text:
Q: Listen to or hear a song? What sounds natural in the sentences below:

Hey! Did you "listen to/hear" this song?
Yes I "listened to/heard" it.
Have you "listened to/heard" this song before?
Yes I have "listened to/heard" this song before.

What will be used in the sentences above "listen to/hear"?

A: 'Hearing' is an event;
 it is something which happens to us as a natural process.
'Listening' is an action; it is something we do consciously.
Sometimes (as in your case) we can use either hear or listen to, depending on whether we want to emphasise the event or the action:

*

*Did you hear this song on the radio yesterday?

Have you ever heard this song?
(emphasis on the event)

*

*Did you listen to this song on the radio yesterday?

Have you ever listened to this song?
(emphasis on the action)
You can read more here.


text:
Q: How to fix Web Installer "The error code is 2727" I've already checked out some of the other posts related to this question, but none seem to help.
Here's the situation: I am create an API and using Web Installer to install. When the program is in a stable state, I am able to build everything and install just fine. However, if I make a change to any file that is (seemingly?) not a .cs file, then the installer has this issue.
Example: I add a service reference to an existing service via the "Add Service Reference" option, the Web.Config is auto-edited, the installer won't install.
Example: I add/edit a seemingly random file, the installer won't install due to Error 2727"
The project builds fine, everything compiles, I don't understand what the problem with the package could be.
The exact text shown is "The installer has encountered an unexpected error installing this package. This may indicate a problem with this package. The error code is 2727."
What I've tried:

*

*Creating a new web installer project

*Adding/Removing file from what the web installer builds (e.g.
source files from project, debug symbols from project, etc.)

Thank you in advance for anything you might have to offer!

A: The answer to this is that for the web installer, the only files needed to add are:

*

*Primary Output from Project

*Content Files from Project

This is working for me now, hopefully this helps whoever comes across this in the future.


text:
Q: Computed observable not updating UI I have a problem with a computed variable in my knockout web. Here's my code:
function ViewModel() {
    var self = this;
    self.seatsRaw = ko.observableArray([]);
    self.selectedSeatId = ko.observable();
    self.session = ko.observable();
    self.seats = ko.computed(function(){
        var seatsComplete= self.seatsRaw().slice(0);
        for (var i = 0; i < seatsComplete.length; i++) {
            if (self.selectedSeatId()) {
                seatsComplete[i].selected = seatsComplete[i].id == self.selectedSeatId();
            } else if (self.session () && Number(self.session ().seat) > 0) {
                seatsComplete[i].selected = seatsComplete[i].id == self.sesion().seat;
            } else {
                seatsComplete[i].selected = false;
            }
        }
        return seatsComplete;
    });
    self.selectSeat = function(data,event) {
    self.selectedSeatId($(this).id);
    };
}

So, I just receive an array with seats and I want to add a field to each object in array to show in the UI as "selected".
I read from ajax the info for session and seats raw, and when I update them I don't see any change in my UI.
Why is happening? And then, what I need to do to update my UI?
Thanks!
EDIT

Seat is not a ViewModel... should it be?

A: Thanks for providing some extra context. I'll try to explain a bit better what I meant in the comments.

Seat is not a ViewModel... should it be?

Even when a Seat is just a plain object, it's also kind of a viewmodel... Here's what's happening in your code (as far as I can tell):
When you're creating the new array in your computed, it gets filled with the same objects the previous array had. The knockout renderer doesn't see a reason to re-render the list items.
Check out this example. From the logs you see everything "working correctly", but knockout won't update. After this example, I'll show what happens if we make selected observable.

var seats =[
  { id: 1, selected: false },
  { id: 2, selected: true },
  { id: 3, selected: false }
];

var ViewModel = function() {
  var self = this;
  this.rawSeats = ko.observableArray(seats);

  this.selectedSeatId = ko.observable(2);
  this.selectSeat = function(data, event) {
    self.selectedSeatId(data.id)
  }

  this.seats = ko.computed(function() {
    var selectedId = self.selectedSeatId();
    self.rawSeats().forEach(function(seat) {
      seat.selected = seat.id === selectedId;
    })

    console.log(self.rawSeats());
    return self.rawSeats();

  });

  }

ko.applyBindings(new ViewModel());
.selected { background: yellow }

Now, with observable properties:

var seats =[
  { id: 1, selected: ko.observable(false) },
  { id: 2, selected: ko.observable(true) },
  { id: 3, selected: ko.observable(false) }
];

var ViewModel = function() {
  var self = this;
  this.rawSeats = ko.observableArray(seats);

  this.selectedSeatId = ko.observable(2);
  this.selectSeat = function(data, event) {
    self.selectedSeatId(data.id)
  }

  this.seats = ko.computed(function() {
    var selectedId = self.selectedSeatId();
    self.rawSeats().forEach(function(seat) {
      seat.selected(seat.id === selectedId);
    })

    return self.rawSeats();

  });

  }

ko.applyBindings(new ViewModel());
.selected { background: yellow }


text:
Q: How to make the responsive file override the original css file totally in specified breakpoints? I just found out that specifying a separate css file for responsive design can make some trouble as some rules in the responsive file can not override the original ones sometimes at the specified breakpoints.
I tried some workarounds like using !important in stubborn rules and this solved my problem, but i know that using !important is known as a very bad practice!
Is there another way that is considered a better practice still keeps my file separate???

A: Your resposive css file need to link after style.css
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="stylesheet" type="text/css" href="responsive.css">


text:
Q: Executable not running over RDP I have an executable written in C#. It is a simple console application, just listens for HID device events.
Here is the befuddling problem: When I start the executable when I am working on the computer physically then it works just fine, but when I am logged into the computer through RDP crashes with the following error:

I use DLLs provided by the manufacturer of the HID device


text:
Q: How to handle resources like images in your own node package I am developing a webapp with NodeJS and webpack. It uses also ReactJS as a dependency. So let's call it simple ui webapp.
In my package.json I reference a package as a dependency which I want to use in the app. This package is not from npm, but it is developed by myself and resides on the same filesystem, local, which totally works fine. I am developing this package, lets call it ui-elements and the webapp in parallel, because I know I have to use the ui-elements in 10 about following webapp-style projects.
Back to the problem: The package gets imported when I npm install, so I have my local package inside the node_modules dir. Good.
This ui-elements-package is also bundled with webpack and contains some React components that use images as background images. Now, when I run ./node_modules/.bin/webpack inside the package folder (while developing the ui-elements package) the file-loader emits the resources into the res/ folder, like I want it to be in the webpack.config.js from the ui-elements package.
But since I want to use the ui-elements package inside my webapp, the resources reside deep inside the node_modules/ dir (node_modules/ui-elements/res).
My question:
How should my webpack.config.js in the webapp project be altered, to get the image resolving by the browser working?
And, am I thinking too complicated? I just want to build and use a package (containing some ui elements with background images), that i can reuse in React webapps. Is there a better approach?
I will paste the extracts of the webpack configs of both projects:
ui-elements
webpack.config.js
const path = require('path');

module.exports = {
  entry: './src/index.js',
  output: {
    filename: 'index.js',
    libraryTarget: 'commonjs2',
    path: __dirname
  },

  module: {
    rules: [
      {
        test: /\.jsx?$/,
        include: path.resolve(__dirname, 'src'),
        exclude: path.resolve(__dirname, 'node_modules'),
        use: [
          'babel-loader'
        ]
      },
      {
        test: /\.css$/,
        use: [
          'style-loader',
          'css-loader'
        ]
      },
      {
        test: /\.(jpe?g|png|gif|svg)$/i,
        use: [
          {
            loader: 'file-loader',
            options: {
              name: 'res/img/[name].[ext]'
            }
          }
        ]
      }
    ]
  },
  resolve: {
    extensions: ['.js', '.jsx'],
    modules: [
      path.resolve(__dirname, 'src'),
      path.resolve(__dirname, 'node_modules')
    ],
  }
};

webapp
webpack.config.js
const path = require('path');

module.exports = {
  entry: './index.js',
  output: {
    filename: 'webapp.bundle.js',
    path: path.resolve(__dirname, 'dist')
  },

  module: {
    rules: [
      {
        test: /\.jsx?$/,
        exclude: path.resolve(__dirname, 'node_modules'),
        use: [
          'babel-loader'
        ]
      },
      {
        test: /\.css$/,
        use: [
          'style-loader',
          'css-loader'
        ]
      }
    ]
  },
  resolve: {
    /*
     * this entry makes me use a local working tree of the
     * ui-elements package, which makes working easier, i don't
     * have to switch projects, rebuild the package and update my
     * dependencies in this webapp project
     */
    /*
    alias: {
      "ui-elements": path.resolve(__dirname, 'libDev'),
    },
    */
    extensions: ['.js', '.jsx'],
    modules: [
      path.resolve(__dirname, 'src'),
      // path.resolve(__dirname, 'libDev'),
      path.resolve(__dirname, 'node_modules')
    ],
  }
};


text:
Q: achartengine: line chart with threshold I use achartengine in my Android application and has been able to draw few line charts. Now I need to draw some kind of threshold line which basically an extra line in red that will run at certain Y value across the graph.
I read other questions regarding threshold lines but mostly about bar chart to have different color above and below threshold line. I need it for line chart and I don't need different color above and below the threshold line.
I can definitely draw it as another line, but I don't want legend for this shows up while I still want legend for others show up. Is there any way to do this? I don't know if there is built-in functionality to draw the threshold line. Or at least a way to hide legend for only one line.
Any input, suggestion or direction will be very appreciated. Thank you.

A: Got it. If anyone needs to do the same thing, this is what I do:
if(i == theIndexForThresholdLine) {
    renderer.getSeriesRendererAt(i).setShowLegendItem(false);
}

That will turn off legend only for that item.