text:
Q: Has anything been made which takes place after Return of the Jedi? After Star Wars VI was made, AFAIK everything since then that has been made for TV/cinema has been set before Star Wars IV.
Prequels as far as the eye can see...
Has anything been made which takes place after Star Wars VI?

A: In the Expanded Universe yes, there have been stories told that fill out 40-50 years after RotJ. This has all been declared to no longer be official canon and there are new movies being created that will essentially tell the next tales in the story. This is because virtually every square inch of story has been told about the primary characters, including some of them dying. So really it left no wiggle room to tell story in the new films without stepping on toes left, right and center. Disney/Lucasfilm decided to clean the slate and make all the books/comics/video games etc to no longer be official cannon.

A: Short answer: No.
According to Leland Chee, the keeper of the Star Wars continuity:

The only relevant official continuities are the current versions of the films alone.

Longer answer: no, yes, and yes.
Since a reorganization made on April 25, 2014, there have been three levels of Star Wars canon. These levels are:

*

*Canon - Episodes 1-6. Star Wars: The Clone Wars, Star Wars Rebels, information on the StarWars.com Databank, and all officially-licensed source material released starting with "A New Dawn" (released September 2, 2014.) Episodes 7+ will presumably fall under this category as well, but as of today, nothing on the list above occurred after the destruction of the second Death Star.

*Legends - All of the previous Extended Universe material. Books, comics, games, and RPG sourcebooks. At this point, Legends is essentially unofficial and non-canon, but is considered a valid "inspiration resource". If you follow DC, the relationship of pre-Crisis to post-Crisis timelines is a good analogy. The EU fills several decades after episode 6, including both Luke and Leia's children, a new Jedi order, new Sith, and other threats to the galaxy.

*Non-canon: Essentially everything else. "What-if" stories, crossover appearances, game statistics, etc. There's all kinds of garbage in this category.

(Text mostly adapted from Wikipedia.)

A: Plutor's answer is the most technically correct, but there are several further divisions in the Expanded Universe.
Like he noted, all the 'old stuff' (e.g. that published prior to April 25, 2014) is considered "Legends". The current canon works begin with the novel A New Dawn, and anything published after it is in the new continuity, such as the upcoming novels Tarkin and Lords of the Sith.
As for the old EU works post-Return of the Jedi, they fell into several major divisions.
New Republic Era
5.5 ABY (years After Battle of Yavin) to 22 ABY
Starting with Luke Skywalker and the Shadows of Mindor and ending with Survivor's Quest, this era contains many of the X-Wing series, several stand-alone trilogies such as The Jedi Academy Trilogy and The Black Fleet Crisis, numerous self-contained novels such as The Crystal Star and Planet of Twilight, but most notably, the novels that are somewhat widely considered the best in the entire EU, Timothy Zahn's Thrawn Trilogy (IMO, the biggest "Must-Read" for the hardcore Star Wars fan).
In this era, the fledgling New Republic continues beating back the Empire, putting down several resurgences, and many of the EU's most loved characters are introduced here.
New Jedi Order Era
24.5 ABY to 36 ABY
Starting with the e-book novella Boba Fett: A Practical Man, and ending with The Dark Nest Trilogy, this era contains mostly the lenghty New Jedi Order series, which covers 5 years by itself, and met with fairly mixed reviews - a lot of love/hate for it.
In this era, the New Republic faces a massive extragalactic invasion and the Jedi Order as a whole is shaken to its foundations. Several beloved characters face major changes or even death during this era.
Legacy Era
40 ABY to 45 ABY
Starting with the Legacy of the Force series and ending with Crucible, the latest chronologically published novel, this era primarily contains Legacy and the Fate of the Jedi series(es).
In this era, a new arising of the Sith from an unexpected place and an ancient terror change the course of the galaxy. At this point, the main characters are primarily EU constructions, with Luke, Leia, and Han being major role players, but not the central focus. The final book does not really close out the storyline, but is not a direct cliffhanger.
Legacy/Cade Skywalker Era
130 ABY to 138 ABY
Though this does not appear in any novels, there is a significant comic series (Star Wars Legacy) primarily dealing with Cade Skywalker, a direct descendant of Luke Skywalker, though unknown exactly to what generation. Much of the series deals with a reborn Sith empire known as the One Sith, very different from the Sith structure under Darth Bane. Lead by Darth Krayt, this empire causes conflict across the galaxy that Cade is caught up in. By this time, all the characters from the other post-Rotj EU are dead, although no backstory is given, so only the loosest connection to the beginning of the Legacy era is given.

A: As of 2015, Disney's new canon contains events post-ROTJ, notably, events of Episode VII ("The Force Awakens") dealing with the conflict between Resistance and First Order (and the fate of Luke, Leia and Han 20 years later).
There are several new canon works (mostly books) spanning the 20 years between Episode VI and VII, such as Aftermath novels and direct TFA prequel works.


text:
Q: What are the performance impacts of declaring variables before  tag? What's the best practice regarding declaring variables at the top of the doc? Is there a performance impact if variable such as $GET or $POST are declared before the html tag?

A: No, there is no performance impact, why would there be? Your PHP script is completely independent of the HTML code (it is just text for PHP).
However, you should really consider separating your coded logic and your HTML code in order to achieve greater maintainability. You can use any php template engine for that purpose.

A: *

*You don't really declare Superglobals in PHP.  PHP populates them for you before your scripts execute.

*I presume you mean doing something like $var = $_GET['var'];.  You will not be able to measure the negligible amount of time that PHP takes to re-assign the value from the Superglobal to the variable.

redpajama_set_name: RedPajamaStackExchange


text:
Q: r - Subsetting time-series data.frame based on time and threshold How would you subset a time-series data.frame based on time and a threshold value?
I have this data:
year <- seq(2000, 2009, 1)
v1 <- sample(1:10, 10, replace=T)
df <- data.frame(year, v1)

That looks like this:
> df
  year v1
1  2000  9
2  2001  4
3  2002  5
4  2003  4
5  2004  5
6  2005  3
7  2006  3
8  2007  3
9  2008  9
10 2009  6

I want to subset the data by groups of sequential years for which the summed score on v1 exceeds the value of 10.
On this example data the first subset should hold observations of the year 2000 & 2001. The second subset should hold the observations of year 2002, 2003 and 2004.
The real data has about 8 million observations covering 120 years.

A: You can implement a customized cumsum using Reduce function, reset the sum when the total exceeds 10 and at same time increment a count as group variable:
library(data.table)
transpose(Reduce(function(x, y) if(x[1] > 10) c(y, x[2]+1) else c(x[1] + y, x[2]),
                 init = c(0, 1), df$v1, accumulate = T))[[2]][-1]

# here the init parameter will take two parameters, the first one keep track of the cumsum,
# and the second one serves as a group variable, when the sum exceeds 10, reset the sum to
# zero and increase the group variable by one

# [1] 1 1 2 2 2 3 3 3 3 4

It takes around 20 seconds to run over 10 million observations vector:
v = sample(1:10, 10000000, replace = T)
system.time(transpose(Reduce(function(x, y) if(x[1] > 10) c(y, x[2]+1) else c(x[1] + y, x[2]), init = c(0, 1), v, accumulate = T))[[2]])

#   user  system elapsed
# 19.509   0.552  20.081


text:
Q: Причина - Exception in thread "main" java.lang.NullPointerException? подскажите пожалуйста, почему вылезает:Exception in thread "main" java.lang.NullPointerException?
package com.jdbc;

import java.sql.Connection;
import java.sql.Driver;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public abstract class Main {
    private static final String URL = "jdbc:mysql://localhost:3306/mysql?useSSL=false&serverTimezone=UTC";
    private static final String LoginName = "root";
    private  static final String Password = "rootroot";

    public  Main() {
    }

    public static void main(String[] args) throws SQLException {
        Connection connection = null;
        Driver driver = new FabricMySQLDriver ( );
        try {
            DriverManager.registerDriver(driver);
        }
        catch (SQLException ex) {
            System.out.println ("Не удалось зарегистрировать драйвер!");
            return;
        }
        try {
            connection = DriverManager.getConnection(URL, LoginName, Password);
            System.out.println("code");
        }
        catch (SQLException ex){
            System.out.println("Не удалось создать соединение!");

        }
        finally {
            if (connection !=null) {
                connection.close ();
            }
        }
              executeUpdate();
            createCustomerTable();

    }

    private static void executeUpdate() {
    }

    public static void executeUpdate(String query) throws SQLException {
        Connection connection = null;
        assert false;
        Statement statement = getStatement (connection);
        /* Для Insert, Update, Delete */
        statement.executeUpdate (query);
    }

    private static Statement getStatement(Connection connection) throws SQLException {
        return connection.createStatement ( );
    }

    private static void createCustomerTable() throws SQLException {
        String customerTableQuery = "CREATE TABLE customers " +
                "(id INTEGER PRIMARY KEY, name TEXT, age INTEGER)";
        String customerEntryQuery = "INSERT INTO customers " +
                "VALUES (73, 'Brian', 33)";
        executeUpdate (customerTableQuery);
        executeUpdate (customerEntryQuery);
    }

}

A: Измените немного тут, при условии что соединение возможно и верна авторизация
 public static void executeUpdate(String query) throws SQLException {
    Connection connection = null;
    try {
        connection = DriverManager.getConnection(URL, LoginName, Password);
        Statement statement = getStatement (connection);
        /* Для Insert, Update, Delete */
        statement.executeUpdate (query);
    }
    catch (SQLException ex){
        System.out.println("Не удалось создать соединение!");

    }

}


text:
Q: SQL count and sum some row I am getting a calculation error in my code
SELECT dep_id,
   dept_info.name AS dept_name,
   count(dep_id) AS totalInovators,
   count(user_id) AS totalIdea,
   sum(POINT) AS totalpoint
FROM user_info
JOIN dept_info ON user_info.dep_id =dept_info.id
JOIN user_idea ON user_info.id=user_idea.user_id
GROUP BY dep_id
ORDER BY dep_id DESC

My output result:

Expected result:

With my table user_info :

My user_idea :

My dept_info :

A: I suspect that you are joining along different dimensions.  If so, a quick-and-easy solution uses count(distinct):
select d.id, d.name as dept_name, count(distinct u.id) as totalInovators,
       count(*) as totalIdea, sum(i.point) as totalpoint
from user_info u join
     dept_info d
     on u.dep_id = d.id join
     user_idea i
     on u.id = i.user_id
group by d.id
order by d.id desc

A: Below the query that solve your problem:
select
    user_info.dep_id,
    dept_info.name,
    count(*) as totalInovators,
    sum(ideas_count) as totalIdea,
    sum(point) as totalpoint
from
    -- first we aggregate table user_idea
    (select user_id, count(*) ideas_count from user_idea group by user_id) ideas
    -- and after join rest of required tables
    join user_info on ideas.user_id = user_info.id
    join dept_info on dept_info.id = user_info.dep_id
group by user_info.dep_id,  dept_info.name;

Working code here: SQLize.online


text:
Q: Passing Arrays back to main body I am pondering upon available functions in the net for my optimization project.. I have stumbled upon an available code by Bateesh and i found it very useful. But I want to slightly modify his code such that
**instead from printing the output, it will be transferred in my main body to be used in the next process.
How do i do it? I have new in C++ so any suggestions will help. I am currently reading about passing arrays but i am dazed by the new ideas.
Thank you.
    // Program to print all combination of size r in an array of size n
#include <stdio.h>
#include <stdlib.h>
void combinationUtil(int arr[], int n, int r, int count, int data[], int i);

// Needed for qsort.  See http://w...content-available-to-author-only...s.com/reference/cstdlib/qsort/
int compare (const void * a, const void * b)
{
    return ( *(int*)a - *(int*)b );
}

// The main function that prints all combinations of size r
// in arr[] of size n. This function mainly uses combinationUtil()
void printCombination(int arr[], int n, int r)
{
    // A temporary array to store all combination one by one
    int data[r];

    // Sort array to handle duplicates
    qsort (arr, n, sizeof(int), compare);

    // Print all combination using temprary array 'data[]'
    combinationUtil(arr, n, r, 0, data, 0);
}

/* arr[]  ---> Input Array
   n      ---> Size of input array
   r      ---> Size of a combination to be printed
   index  ---> Current index in data[]
   data[] ---> Temporary array to store current combination
   i      ---> index of current element in arr[]     */
void combinationUtil(int arr[], int n, int r, int index, int data[], int i)
{
    // Current cobination is ready, print it
    if (index == r)
    {
        for (int j=0; j<r; j++)
            printf("%d ",data[j]);
        printf("\n");
        return;
    }

    // When no more elements are there to be put
    if (i >= n)
        return;

    // current is included, put next at next location
    data[index] = arr[i];
    combinationUtil(arr, n, r, index+1, data, i+1);

    // Remove duplicates
    while (arr[i] == arr[i+1])
        i++;

    // current is excluded, replace it with next (Note that
    // i+1 is passed, but index is not changed)
    combinationUtil(arr, n, r, index, data, i+1);
}

// Driver program to test above functions
int main()
{
    int arr[] = {1, 2, 1, 3, 1};
    int r = 3;
    int n = sizeof(arr)/sizeof(arr[0]);
    printCombination(arr, n, r);
    return 0;
}

A: You can return an array by changing the return type to std::vector<std::string> in function printCombination. Since combinationUtil() is called recursive hence it would be good idea to pass a reference of std::vector<std::string> variable from printCombination function and let it be filled by combinationUtil(). Finally you can return that variable from printCombination and make it available to main().

A: Do not use arrays at all
I am not going to answer the question you asked, as I consider raw arrays bad in most situations. Even more so if they are passed around (and that is what you are asking for).
C++ does, however, provide alternatives to raw arrays (std::array and std::vector comes to mind). I would recommend to prefere these over raw arrays unless you are writing a container yourself. They are quite solid performance wise.

Do use C++ standard library functions
If I understand you correctly, you are trying to display all possible permutations of the unique values in a given collection of numbers. You could do this using some C++ library functions:
#include <algorithm>
#include <iostream>
#include <vector>

int main()
{
  // Create vector
  std::vector<int> v { 1, 2, 1, 3, 1 };

  // Sort vector
  std::sort(v.begin(), v.end());

  // Move all duplicate entries to the end of the vector
  auto it = std::unique(v.begin(), v.end());

  // Trim vector so that the duplicates are no longer contained
  v.resize(std::distance(v.begin(), it));

  // Iterate as long as the function can rearrange the objects as a
  // lexicographicaly greater permutation
  do
  {
    // Print all elements in the vector
    for(auto i : v)
      std::cout << i << " ";

    // Add new line character and flush output
    std::cout << std::endl;

  } while(std::next_permutation(v.begin(),v.end()));

  return 0;
}

Output:
1 2 3
1 3 2
2 1 3
2 3 1
3 1 2
3 2 1


text:
Q: How to merge (REMEMBER merge not combine!) these two queries I have these two linq queries:
var combo1 = from c in db.comments
             join p in db.picture on c.targetpictureid equals p.idpictures
             join u in db.users on c.iduser equals u.iduser
             select new TCommentDTO
             {
                 idcomments=c.idcomments,
                 comment1 = c.comment1,
                 targetpictureid = c.targetpictureid,
                 ctime = c.ctime,
                 iduofpic=p.iduser,
                 iduofcommentor=c.iduser,
                 profilepicofcommentor=u.profilepic,
                 usernameofcommentor=u.username,
                 picFilename=p.picFilename,
                 picTitle=p.picTitle
             };

var combo2 = from f in db.followers
             join u in db.users on f.iduser equals u.iduser
             select new TfollowerDTO
             {
                idfollowers = f.idfollowers,
                iduser = f.iduser,
                targetiduser = f.targetiduser,
                startedfollowing = f.startedfollowing,
                unoffollower = u.username,
                ppoffollower = u.profilepic,
                status = u.status
             };

I am using web API that returns JSON. I want to merge the output of these two queries.
I want to rewrite this code in such a way that comments and follower data should be merged (not combined) with respect to time based on ctime and startedfollowing. If a user has a new comment, the comment should come first and if the follower is first, the follower data should come first.I can not use Union() and Concat() because firstly both classes have different members and secondly i dont want both json object to be combined.
Something like this:
{ //comments data },
{ //follower data},
{ //comments data },
{ //comments data },
{ //comments data },
{ //follower data}

So how to do this task?

A: What about:
public class TDtoWrapper
{
    public DateTime SortKey {get;set; }
    public Object Member {get;set;}
}

var result1 = from c in combo1
              select new TDtoWrapper { SortKey = c.ctime, Member = c }

var result2 = from c in combo2
              select new TDtoWraller { SortKey = c.startedfollowing, Member = c }

var result = result1.Concat(result2).Orderby(x => x.SortKey).Select(x => x.Member);

if you can rewrite the origninal queries, you can ommit the Dto class and write
var combo1 = from c in db.comments
             join p in db.picture on c.targetpictureid equals p.idpictures
             join u in db.users on c.iduser equals u.iduser
             select new
             {
                SortKey = c.ctime,
                Member = (object) new TCommentDTO
                {
                  idcomments=c.idcomments,
                  comment1 = c.comment1,
                  targetpictureid = c.targetpictureid,
                  ctime = c.ctime,
                  iduofpic=p.iduser,
                  iduofcommentor=c.iduser,
                  profilepicofcommentor=u.profilepic,
                  usernameofcommentor=u.username,
                  picFilename=p.picFilename,
                  picTitle=p.picTitle
                 }
             };

var combo2 = ...

var result = from c in combo1.Concat(combo2)
             orderby c.SortKey
             select c.Member;


text:
Q: Is returning different output based on authentication credentials RESTful? I have a REST API which allows the developer to fetch a certain resource:
/api/projects
/api/project/4
...

The API requires authentication. The authentication token is added to the HTTP headers.
Is it RESTful to return a different output based on which user is authenticated?
Thanks!

A: REST doesn't define anything in that respect.
You should keep authentication logic and authorization logic independent of your RESTful architecture.
There are indeed requirements whereby you want to change what is returned based on different attributes / parameters e.g.:

*

*authentication type

*time of day

*user location

*device type...

You would achieve that by using a filter in front of your REST service. Filters / interceptors are explained here.
You would then send an authorization request to a decision point that determines what can be returned based on the identity (or other attributes) of the user.
For instance you could have a logic to return projects to a user if and only if they belong to the same region. The REST endpoint would still be /api/projects but the content returned would differ based on the authZ logic. Have a look at XACML and ALFA to implement that layer.
HTH


text:
Q: Checking if name is on member list OK so the list is working but the problem is the checker. Here is the situation: there is a list of Member names, first the user will input a name. second, the program will check if the name is on the list. If the name is on the list it will display "OK", If the name is not on the list it will display "MEMBER DOES NOT EXIST". My problem is that the checker searches for the name but if the first member is already not equal to the name inputted by the user, "Member does not exist" will be displayed and the program just stops searching.
for example:
Memberlist

*

*mike

*albert

*fred
Input: mike
Output:OK
but if
Input: albert
Output: Member does not exist
here is my code so far.
    class Node
    {
        protected String info;
        protected Node next;
        public Node(String value)
        {
            info = value;
            next = null;
        }
     }

     class LinkedList
     {
         private Node head;
         private Node head1;
         private Node head2;
         private int count;
         public LinkedList()
         {
         head = null;
         count = 0;
         }
         public void checker(String name)
         {

           for(Node cur = head; cur != null; cur = cur.next)
           {
              if(cur.info.equals(name))
              {

                 System.out.print("OK ");
                 return;
              }
              else
              {
                 System.out.print("member does not exist");
              }
           }
          }

It is not the whole code but my problem is mainly the checker

A: in the first iteration of the for loop, you check whether the value equals to name. otherwise "Member not exists"
You must finish the loop and then only you can print member does not exists.
       for(Node cur = head; cur != null; cur = cur.next)
       {
          if(cur.info.equals(name))
          {

             System.out.print("OK ");
             return;
          }
       }

       System.out.print("member does not exist");

is the right way.

A: you could do something as basic as:
int nameExist;
  for(Node cur = head; cur != null; cur = cur.next)
  {
     if(cur.info.equals(name))
     {
         nameExist++;
     }
  }
  if(nameExist>0){
      System.out.print("ok");
  }
  else{
      System.out.print("member does not exist");
  }


text:
Q: heroku 2 errors while trying to get my discord bot up and running so I've received 2 errors whole trying to get my bot to run on heroku
021-10-26T08:02:07.109272+00:00 app[worker.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-26T08:02:07.109272+00:00 app[worker.1]:     at Module.load (internal/modules/cjs/loader.js:950:32)
2021-10-26T08:02:07.109272+00:00 app[worker.1]:     at Function.Module._load (internal/modules/cjs/loader.js:790:12)
2021-10-26T08:02:07.109273+00:00 app[worker.1]:     at Module.require (internal/modules/cjs/loader.js:974:19)
2021-10-26T08:02:07.109273+00:00 app[worker.1]:     at require (internal/modules/cjs/helpers.js:93:18)
2021-10-26T08:02:07.109273+00:00 app[worker.1]:     at Object.<anonymous> (/app/node_modules/discord.js/src/rest/RESTManager.js:4:20)
2021-10-26T08:02:07.109273+00:00 app[worker.1]:     at Module._compile (internal/modules/cjs/loader.js:1085:14)
2021-10-26T08:02:07.109273+00:00 app[worker.1]:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
2021-10-26T08:02:07.228855+00:00 heroku[worker.1]: Process exited with status 1
2021-10-26T08:02:07.425786+00:00 heroku[worker.1]: State changed from up to crashed

now i am not really sure what these errors mean so any help is welcomed


text:
Q: Android: unable to change color of part of the text in textview Hi iam trying to change part of the text in textview to some color but iam unble to achieve it
i tried fromHtml , spannable and different methoda but its still not working.
My tries are as below:
try1
    Spannable wordtoSpan = Spannable.Factory.getInstance().newSpannable("text 6 Months(180 days) or 8,000 kilometers.");

    wordtoSpan.setSpan(new ForegroundColorSpan(Color.BLUE), 5, 15, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);

    tv.setText(wordtoSpan);

try2
    String str = "@Second @Service:6 Months(180 days) or 8,000 kilometers.";

    String[] str_array = str .split(" ");

    boolean isExists = false;
    for (int i = 0; i < str_array.length; i++) {
             for (int j = 0; j < i; j++) {
                 if (str_array[j].equals(str_array[i])) {
                     isExists = true;
                 }
             }
             if (str_array[i].startsWith("@") && !isExists) {
                 str  = str .replace(str_array[i],
                         "" + str_array[i]
                                 + "");
             } else if (str_array[i].contains("#")) {
                 str  = str .replaceAll(str_array[i],
                         "" + str_array[i]
                                 + "");
             }
         }

         tv.setText(Html.fromHtml(str));
    }

try3
myTextView.setText(Html.fromHtml(text + "" + CepVizyon.getPhoneCode() + "

"
            + getText(R.string.currentversion) + CepVizyon.getLicenseText()));

try4
public class MainActivity extends Activity {

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

        //method1
        TextView tv = (TextView) findViewById(R.id.service);
        tv.setText(Html.fromHtml("" + "give your string here long long longlong" + "" + ""));

        //method 2
        //SpannableStringBuilder WordtoSpan = new SpannableStringBuilder("give your string here long long longlong");
        //WordtoSpan.setSpan(new BackgroundColorSpan(Color.YELLOW),0,5,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        //tv.setText(WordtoSpan);

    }

Any help is really appreciated.Thank you

A: Try like this. The below code is perfectly working for me, i have tested it.
TextView ttt = (TextView) findViewById(R.id.textView11);
String styledText = "This is simple.";
ttt.setText(Html.fromHtml(styledText), TextView.BufferType.SPANNABLE);

and here is output.

A: Try this it is running in my app perfectly.. May be it help you too
SpannableStringBuilder WordtoSpan = new SpannableStringBuilder(give your string here);
WordtoSpan.setSpan(new BackgroundColorSpan(Color.YELLOW),starting Index, and the index of text from which you want to highlight you text,Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
TextView.setText(WordtoSpan);


text:
Q: How do install Ubuntu over Windows7? I have successfully installed Ubuntu 12.04 but I didn't see the windows outlined by the numbered installation walk-through:
http://www.ubuntu.com/download/desktop/install-desktop-long-term-support
I was never given an option to install Ubuntu over Windows and wipe it out. How do I achieve this? I am running a new Dell XPS with Windows 7 Premium.

A: There should be an option "Replace Windows with Ubuntu".
If there isn't one you can do it manually by choosing option "Something else" so you can erase Windows partition and make an Ubuntu one. There are numerous guides on how to do that.

A: In accordance with your question, there are two possible options you may select from while in Installation type step:
1. Erase disk and install Ubuntu: This will erase entire Hard disk and install Ubuntu.
2. Something else: This will show you the partitions or volumes available on your hard disk. You can select the volume in which Windows is installed, format and delete the partition and install Ubuntu.
Both these ways will help you get rid of Windows and have only Ubuntu in your system.


text:
Q: @angular/common/http HttpClient of post method awalys return error? i use @angular/common/http
HttpClient Module of post method
const httpOptions: object = {
           headers: new HttpHeaders({
                Authorization: this.token,
               'Content-Type': 'application/json; charset=utf-8',
              }),
    };
    HttpClient.post(url, JSON.stringify(json), httpOptions)
        .subscribe(res => {
          console.log('success', res);
        },(error: any) => {
         // It always comes back here, even if it's successful
          console.log('fail', error);
        });
      }


text:
Q: MATLAB interview questions? I programmed in MATLAB for many years, but switched to using R exclusively in the past few years so I'm a little out of practice.  I'm interviewing a candidate today who describes himself as a MATLAB expert.
What MATLAB interview questions should I ask?
Some other sites with resources for this:

*

*"Matlab interview questions" on Wilmott

*"MATLAB Questions and Answers" on GlobaleGuildLine

*"Matlab Interview Questions" on CoolInterview

A: Ask questions about his expertise and experience in applying MATLAB in your domain.
Ask questions about how he would approach designing an application for implementation in MATLAB.  If he refers to recent features of MATLAB, ask him to explain them, and how they are different from the older features they replace or supplement, and why they are preferable (or not).
Ask questions about his expertise with MATLAB data structures.  Many of the MATLAB 'experts' I've come across are very good at writing code, but very poor at determining what are the best data structures for the job in hand.  This is often a direct consequence of their being domain experts who've picked up MATLAB rather than having been trained in computerism.  The result is often good code which has to compensate for the wrong data structures.
Ask questions about his experience, if any, with other languages/systems and invite him to expand upon his observations about the relative strengths and weaknesses of MATLAB.
Ask for top tips on optimising MATLAB programs.  Expect the answers: vectorisation, pre-allocation, clearing unused variables, etc.
Ask about his familiarity with the MATLAB profiler, debugger and lint tools.  I've recently discovered that the MATLAB 'expert' over in the corner here had never, in 10 years using the tool, found the profiler.
That should get you started.

A: I. I think this recent SO question
    on indexing is a very good question
    for an "expert".

I have a 2D array, call it 'A'. I have
  two other 2D arrays, call them 'ix'
  and 'iy'. I would like to create an
  output array whose elements are the
  elements of A at the index pairs
  provided by x_idx and y_idx. I can do
  this with a loop as follows:
for i=1:nx
     for j=1:ny
         output(i,j) = A(ix(i,j),iy(i,j));
     end
end

How can I do this without the loop? If
  I do output = A(ix,iy), I get the
  value of A over the whole range of
  (ix)X(iy).

II. Basic knowledge of operators like element-wise multiplication between two matrices (.*).
III. Logical indexing - generate a random symmetric matrix with values from 0-1 and set all values above T to 0.
IV. Read a file with some properly formatted data into a matrix (importdata)
V. Here's another sweet SO question

I have three 1-d arrays where elements
  are some values and I want to compare
  every element in one array to all
  elements in other two.
For example:
a=[2,4,6,8,12]
b=[1,3,5,9,10]
c=[3,5,8,11,15]

I want to know if there are same
  values in different arrays (in this
  case there are 3,5,8)

Btw, there's an excellent chance your interviewee will Google "MATLAB interview questions" and see this post :)

A: Possible question:
I have an array A of n R,G,B triplets. It is a 3xn matrix. I have another array B in the form 1xn which stores an index value (association to a cluster) for each triplet.
How do I plot the triplets of A in 3D space (using plot3 function), coloring each triplet according to its index in B? (The goal is to qualitatively evaluate my clustering)
Really, really good programmers who are MATLAB novices won't be able to give you an efficient (== MATLAB style) solution. However, it is a very simple problem if you do know your MATLAB.

A: This is a bit subjective, but I'll bite... ;)
For someone who is a self-professed MATLAB expert, here are some of the things that I would personally expect them to be able to illustrate in an interview:

*

*How to use the arithmetic operators for matrix or element-wise operations.

*A familiarity with all the basic data types and how to convert effortlessly between them.

*A complete understanding of matrix indexing and assignment, be it logical, linear, or subscripted indexing (basically, everything on this page of the documentation).

*An ability to manipulate multi-dimensional arrays.

*The understanding and regular usage of optimizations like preallocation and vectorization.

*An understanding of how to handle file I/O for a number of different situations.

*A familiarity with handle graphics and all of the basic plotting capabilities.

*An intimate knowledge of the types of functions in MATLAB, in particular nested functions. Specifically, given the following function:
function fcnHandle = counter
  value = 0;
  function currentValue = increment
    value = value+1;
    currentValue = value;
  end
  fcnHandle = @increment;
end

They should be able to tell you what the contents of the variable output will be in the following code, without running it in MATLAB:
>> f1 = counter();
>> f2 = counter();
>> output = [f1() f1() f2() f1() f2()];  %# WHAT IS IT?!

A: We get several new people in the technical support department here at MathWorks.  This is all post-hiring (I am not involved in the hiring), but I like to get to know people, so I give them the "Impossible and adaptive MATLAB programming challenge"
I start out with them at MATLAB and give them some .MAT file with data in it.  I ask them to analyze it, without further instruction.  I can very quickly get a feel for their actual  experience.
http://blogs.mathworks.com/videos/2008/07/02/puzzler-data-exploration/
The actual challenge does not mean much of anything, I learn more from watching them attempt it.
Are they making scripts, functions, command line or GUI based?  Do they seem to have a clear idea where they are going with it?  What level of confidence do they have with what they are doing?
Are they computer scientists or an engineer that learned to program.  CS majors tend to do things like close their parenthesis immediately, and other small optimizations like that.  People that have been using MATLAB a while tend to capture the handles from plotting commands for later use.
How quickly do they navigate the documentation?  Once I see they are going down the 'right' path then I will just change the challenge to see how quickly they can do plots, pull out submatrices etc...
I will throw out some old stuff from Project Euler.  Mostly just ramp up the questions until one of us is stumped.

A: Floating Point Questions
Given that Matlab's main (only?) data type is the double precision floating point matrix, and that most people use floating point arithmetic -- whether they know it or not -- I'm astonished that nobody has suggested asking basic floating point questions. Here are some floating point questions of variable difficulty:

*

*What is the range of |x|, an IEEE dp fpn?

*Approximately how many IEEE dp fpns are there?

*What is machine epsilon?

*x = 10^22 is exactly representable as a dp fpn. What are the fpns xp
and xs just below and just above x ?

*How many dp fpns are in [1,2)? How many atoms are on an edge of a
1-inch   sugar cube?

*Explain why sin(pi) ~= 0, but cos(pi) = -1.

*Why is if abs(x1-x2) < 1e-10 then  a bad convergence test?

*Why is if f(a)*f(b) < 0 then a bad sign check test?

*The midpoint c of the interval [a,b] may be calculated as:
 c1 = (a+b)/2, or
 c2 = a + (b-a)/2, or
 c3 = a/2 + b/2.

Which do you prefer? Explain.

*Calculate in Matlab: a = 4/3;  b = a-1;  c = b+b+b;  e = 1-c;
Mathematically, e should be zero but Matlab gives e = 2.220446049250313e-016 = 2^(-52), machine epsilon (eps). Explain.

*Given that realmin = 2.225073858507201e-308, and Matlab's u = rand gives a dp fpn uniformly distributed over the open interval (0,1):
Are the floating point numbers [2^(-400), 2^(-100), 2^(-1)]
= 3.872591914849318e-121, 7.888609052210118e-031, 5.000000000000000e-001
equally likely to be output by rand ?

*Matlab's rand uses the Mersenne Twister rng which has a period of
 (2^19937-1)/2, yet there are only about 2^64 dp fpns. Explain.

*Find the smallest IEEE double precision fpn x, 1 < x < 2, such that x*(1/x) ~= 1.
Write a short Matlab function to search for such a number.
 Answer: Alan Edelman, MIT

*Would you fly in a plane whose software was written by you?

Colin K would not hire me (and probably fire me) for saying "that
Matlab's main (only?) data type is the double precision floating
point matrix".
When Matlab started that was all the user saw, but over the years
they have added what they coyly call 'storage classes': single,
(u)int8,16,32,64, and others. But these are not really types
because you cannot do USEFUL arithmetic on them. Arithmetic on
these storage classes is so slow that they are useless as types.
Yes, they do save storage but what is the point if you can't do
anything worthwhile with them?
See my post (No. 13) here, where I show that arithmetic on int32s is 12 times slower than
double arithmetic and where MathWorkser Loren Shure says "By
default, MATLAB variables are double precision arrays. In the olden
days, these were the ONLY kind of arrays in MATLAB. Back then even
character arrays were stored as double values."
For me the biggest flaw in Matlab is its lack of proper types,
such as those available in C and Fortran.
By the way Colin, what was your answer to Question 14?

A: Depends a bit what you want to test.
To test MATLAB fluency, there are several nice Stack Overflow questions that you could use to test e.g. array manipulations (example 1, example 2), or you could use fix-this problems like this question (I admit, I'm rather fond of that one), or look into this list for some highly MATLAB-specific stuff. If you want to be a bit mean, throw in a question like this one, where the best solution is a loop, and the typical MATLAB-way-of-thinking solution would just fill up the memory.
However, it may be more useful to ask more general programming questions that are related to your area of work and see whether they get the problem solved with MATLAB.
For example, since I do image analysis, I may ask them to design a class for loading images of different formats (a MATLAB expert should know how to do OOP, after all, it has been out for two years now), and then ask follow-ups as to how to deal with large images (I want to see a check on how much memory would be used - or maybe they know memory.m - and to hear about how MATLAB usually works with doubles), etc.


text:
Q: Braintree Api Integration with cakephp 3.0 I've an issue with braintree api integration and having an issue with generating the token from api, but it's showing an error-
"Class 'App\Controller\Braintree\ClientToken' not found".
I've adding the Braintree library in webroot directory and include by-
require_once('braincard\includes\braintree_init.php');
I'm generating the braintree token with following function.
Braintree\ClientToken::generate();
Regards

A: By simply using Braintree\ClientToken::generate();, you are indicating that it is relative to the current namespace, which is \App\Controller. Try \Braintree\ClientToken::generate(); instead, this should work.
You might also investigate how you can use Composer to move the library to a move "Cake-ish" folder (having it in the webroot sounds like a potential security hole), and autoload the class without needing to resort to require_once or the like.


text:
Q: How to check if message is flagged as "important" using Google Mail API? You can receive message flags such as "Read"/"Unread" or "Flagged"/"Not flagged" using Google Mail API. You can see this information in field labelIds in result of Users.messages: get function:

*

*If label STARRED presents, it means that message was marked with asterisk.

*If label UNREAD presents, it means that message is unread yet.

Question I
I can't find how to check if message was marked as "Important".
Does anyone know if there is a way to detect this flag using Google Mail API?
Question II
You can mark message with different asterisks (red, green, blue), but Google Mail API doesn't return this information in Users.messages: get function.
Can I determine what kind (what color) of asterisks has message using Google Mail API?

A: Based on saying "message flags" I assume you're using Gmail IMAP now?  The Gmail API does expose the common Gmail labels on a message (like Starred and Unread), but not anything IMAP-specific (e.g. \Deleted, \Recent).
IMAP \Flagged maps to the Star in the web interface and "STARRED" in the API:
https://developers.google.com/gmail/api/guides/labels
The Important label (corresponding to the \Important mailbox in IMAP) should be visible in the in the API as well (system label called "IMPORTANT").
The different color stars are not currently supported by API (refer to the above labels guide for the current authoritative list of supported SYSTEM labels).


text: Q: Upload video to youtube playlist in php I am trying to find how to use youtube data api v3 playlist functionalities but I am unable to find anything on the internet. your help will be highly appreciated and I will be very helpful to you.


text:
Q: Boost Python Hello World example not working in Python, AGAIN I have the same problem than the guy here
Boost Python Hello World example not working in Python
who solved his problem, without indicating how. The posts there being quite old, after having posted there also, I create now a new question here, for refreshing things a bit. So... :
My configuration : windows 8 62bits, python 2.7.3 32 bits, visual studio 2010 ultimate
I followed
http://www.boost.org/doc/libs/1_53_0/libs/python/doc/tutorial/doc/html/python/exposing.html
I have created a win32application project called CLIB in visual studio, and ticked "dll" but not "export symbols".
In VC++ directories in properties I put :
C:\Python27x86\include;C:\boost\boost_1_53_0;$(IncludePath)
for include directories and
C:\boost\boost_1_53_0\stage\lib;C:\Python27x86\libs;$(LibraryPath)
for library directories.
In CLIB.cpp I put
// CLIB.cpp : Defines the exported functions for the DLL application.
//

#include "stdafx.h"
#include <iostream>
#include <string>
#include <boost/python.hpp>

using namespace boost::python;

struct World
{
    void set(std::string msg) { this->msg = msg; }
    std::string greet() { return msg; }
    std::string msg;
};

BOOST_PYTHON_MODULE(hello)
{
    boost::python::class_<World>("World")
        .def("greet", &World::greet)
        .def("set", &World::set)
        ;
}

I tried with or without adding
#define BOOST_PYTHON_STATIC_LIB

Then I compiled in debug mode (with success), the output .dll (or .pyd, I have tried both without any success by modifying the target extension from .dll to .pyd in "general" in "configuration properties" of the project) CLIB.dll is in a directory whose path I added to the PYTHONPATH also. I have even tried to put a blank init.py in the same directory than the dll, and, whatever I do, I am not able to do a
import hello

in the python script (created from fresh either with notepad++ or with pyscripter 32 bits). So if someone could give precise help, that would be perfect.
Thx a lot.
////////////////////////// EDIT 1 ///////////////////////////
In the meantime I saw python 2.7 was compiled with mvs2008, so erase everything, installed python 3.3, rebuilt boost and boost.python with python 3.3, and retried, but... same result...
////////////////////////// EDIT 2 ///////////////////////////
As suggested a run the python script with the very verbose -vv command, here is the result :
PS C:\Users\TheUser\Desktop\CLIB\Release> python -vv .\script.py
import _frozen_importlib # frozen
import imp # builtin
import sys # builtin
# installing zipimport hook
import 'zipimport' # <class '_frozen_importlib.BuiltinImporter'>
# installed zipimport hook
# C:\Python33x86\Lib\encodings\__pycache__\__init__.cpython-33.pyc matches C:\Python33x86\Lib\encodings\__init__.py
# code object from C:\Python33x86\Lib\encodings\__pycache__\__init__.cpython-33.pyc
# C:\Python33x86\Lib\__pycache__\codecs.cpython-33.pyc matches C:\Python33x86\Lib\codecs.py
# code object from C:\Python33x86\Lib\__pycache__\codecs.cpython-33.pyc
import '_codecs' # <class '_frozen_importlib.BuiltinImporter'>
import 'codecs' # <_frozen_importlib.SourceFileLoader object at 0x01E50870>
# C:\Python33x86\Lib\encodings\__pycache__\aliases.cpython-33.pyc matches C:\Python33x86\Lib\encodings\aliases.py
# code object from C:\Python33x86\Lib\encodings\__pycache__\aliases.cpython-33.pyc
import 'encodings.aliases' # <_frozen_importlib.SourceFileLoader object at 0x01E91B90>
import 'encodings' # <_frozen_importlib.SourceFileLoader object at 0x01E503F0>
# C:\Python33x86\Lib\encodings\__pycache__\mbcs.cpython-33.pyc matches C:\Python33x86\Lib\encodings\mbcs.py
# code object from C:\Python33x86\Lib\encodings\__pycache__\mbcs.cpython-33.pyc
import 'encodings.mbcs' # <_frozen_importlib.SourceFileLoader object at 0x01E9E730>
# C:\Python33x86\Lib\encodings\__pycache__\utf_8.cpython-33.pyc matches C:\Python33x86\Lib\encodings\utf_8.py
# code object from C:\Python33x86\Lib\encodings\__pycache__\utf_8.cpython-33.pyc
import 'encodings.utf_8' # <_frozen_importlib.SourceFileLoader object at 0x01E9E8D0>
# C:\Python33x86\Lib\encodings\__pycache__\latin_1.cpython-33.pyc matches C:\Python33x86\Lib\encodings\latin_1.py
# code object from C:\Python33x86\Lib\encodings\__pycache__\latin_1.cpython-33.pyc
import 'encodings.latin_1' # <_frozen_importlib.SourceFileLoader object at 0x01E9E9B0>
# C:\Python33x86\Lib\__pycache__\io.cpython-33.pyc matches C:\Python33x86\Lib\io.py
# code object from C:\Python33x86\Lib\__pycache__\io.cpython-33.pyc
# C:\Python33x86\Lib\__pycache__\abc.cpython-33.pyc matches C:\Python33x86\Lib\abc.py
# code object from C:\Python33x86\Lib\__pycache__\abc.cpython-33.pyc
# C:\Python33x86\Lib\__pycache__\_weakrefset.cpython-33.pyc matches C:\Python33x86\Lib\_weakrefset.py
# code object from C:\Python33x86\Lib\__pycache__\_weakrefset.cpython-33.pyc
import '_weakrefset' # <_frozen_importlib.SourceFileLoader object at 0x01EA7150>
import 'abc' # <_frozen_importlib.SourceFileLoader object at 0x01E9EC30>
import 'io' # <_frozen_importlib.SourceFileLoader object at 0x01E9EB10>
# C:\Python33x86\Lib\encodings\__pycache__\cp850.cpython-33.pyc matches C:\Python33x86\Lib\encodings\cp850.py
# code object from C:\Python33x86\Lib\encodings\__pycache__\cp850.cpython-33.pyc
import 'encodings.cp850' # <_frozen_importlib.SourceFileLoader object at 0x01EA7F50>
# C:\Python33x86\Lib\__pycache__\site.cpython-33.pyc matches C:\Python33x86\Lib\site.py
# code object from C:\Python33x86\Lib\__pycache__\site.cpython-33.pyc
# C:\Python33x86\Lib\__pycache__\os.cpython-33.pyc matches C:\Python33x86\Lib\os.py
# code object from C:\Python33x86\Lib\__pycache__\os.cpython-33.pyc
import 'errno' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Python33x86\Lib\__pycache__\stat.cpython-33.pyc matches C:\Python33x86\Lib\stat.py
# code object from C:\Python33x86\Lib\__pycache__\stat.cpython-33.pyc
import 'stat' # <_frozen_importlib.SourceFileLoader object at 0x01EBD190>
# C:\Python33x86\Lib\__pycache__\ntpath.cpython-33.pyc matches C:\Python33x86\Lib\ntpath.py
# code object from C:\Python33x86\Lib\__pycache__\ntpath.cpython-33.pyc
# C:\Python33x86\Lib\__pycache__\genericpath.cpython-33.pyc matches C:\Python33x86\Lib\genericpath.py
# code object from C:\Python33x86\Lib\__pycache__\genericpath.cpython-33.pyc
import 'genericpath' # <_frozen_importlib.SourceFileLoader object at 0x01EBDE50>
import 'ntpath' # <_frozen_importlib.SourceFileLoader object at 0x01EBDAD0>
# C:\Python33x86\Lib\collections\__pycache__\__init__.cpython-33.pyc matches C:\Python33x86\Lib\collections\__init__.py
# code object from C:\Python33x86\Lib\collections\__pycache__\__init__.cpython-33.pyc
# C:\Python33x86\Lib\collections\__pycache__\abc.cpython-33.pyc matches C:\Python33x86\Lib\collections\abc.py
# code object from C:\Python33x86\Lib\collections\__pycache__\abc.cpython-33.pyc
import 'collections.abc' # <_frozen_importlib.SourceFileLoader object at 0x027C3FB0>
import '_collections' # <class '_frozen_importlib.BuiltinImporter'>
import 'operator' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Python33x86\Lib\__pycache__\keyword.cpython-33.pyc matches C:\Python33x86\Lib\keyword.py
# code object from C:\Python33x86\Lib\__pycache__\keyword.cpython-33.pyc
import 'keyword' # <_frozen_importlib.SourceFileLoader object at 0x027E1330>
# C:\Python33x86\Lib\__pycache__\heapq.cpython-33.pyc matches C:\Python33x86\Lib\heapq.py
# code object from C:\Python33x86\Lib\__pycache__\heapq.cpython-33.pyc
import 'itertools' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Python33x86\Lib\__pycache__\bisect.cpython-33.pyc matches C:\Python33x86\Lib\bisect.py
# code object from C:\Python33x86\Lib\__pycache__\bisect.cpython-33.pyc
import '_bisect' # <class '_frozen_importlib.BuiltinImporter'>
import 'bisect' # <_frozen_importlib.SourceFileLoader object at 0x027E1EF0>
import '_heapq' # <class '_frozen_importlib.BuiltinImporter'>
import 'heapq' # <_frozen_importlib.SourceFileLoader object at 0x027E1910>
# C:\Python33x86\Lib\__pycache__\weakref.cpython-33.pyc matches C:\Python33x86\Lib\weakref.py
# code object from C:\Python33x86\Lib\__pycache__\weakref.cpython-33.pyc
import 'weakref' # <_frozen_importlib.SourceFileLoader object at 0x027E1950>
# C:\Python33x86\Lib\__pycache__\reprlib.cpython-33.pyc matches C:\Python33x86\Lib\reprlib.py
# code object from C:\Python33x86\Lib\__pycache__\reprlib.cpython-33.pyc
import 'reprlib' # <_frozen_importlib.SourceFileLoader object at 0x027E9CF0>
import 'collections' # <_frozen_importlib.SourceFileLoader object at 0x01EC0CD0>
# C:\Python33x86\Lib\__pycache__\copyreg.cpython-33.pyc matches C:\Python33x86\Lib\copyreg.py
# code object from C:\Python33x86\Lib\__pycache__\copyreg.cpython-33.pyc
import 'copyreg' # <_frozen_importlib.SourceFileLoader object at 0x027EFD10>
import 'os' # <_frozen_importlib.SourceFileLoader object at 0x01EB3130>
# C:\Python33x86\Lib\__pycache__\re.cpython-33.pyc matches C:\Python33x86\Lib\re.py
# code object from C:\Python33x86\Lib\__pycache__\re.cpython-33.pyc
# C:\Python33x86\Lib\__pycache__\sre_compile.cpython-33.pyc matches C:\Python33x86\Lib\sre_compile.py
# code object from C:\Python33x86\Lib\__pycache__\sre_compile.cpython-33.pyc
import '_sre' # <class '_frozen_importlib.BuiltinImporter'>
# C:\Python33x86\Lib\__pycache__\sre_parse.cpython-33.pyc matches C:\Python33x86\Lib\sre_parse.py
# code object from C:\Python33x86\Lib\__pycache__\sre_parse.cpython-33.pyc
# C:\Python33x86\Lib\__pycache__\sre_constants.cpython-33.pyc matches C:\Python33x86\Lib\sre_constants.py
# code object from C:\Python33x86\Lib\__pycache__\sre_constants.cpython-33.pyc
import 'sre_constants' # <_frozen_importlib.SourceFileLoader object at 0x028054F0>
import 'sre_parse' # <_frozen_importlib.SourceFileLoader object at 0x027FD530>
import 'sre_compile' # <_frozen_importlib.SourceFileLoader object at 0x01EB3690>
# C:\Python33x86\Lib\__pycache__\functools.cpython-33.pyc matches C:\Python33x86\Lib\functools.py
# code object from C:\Python33x86\Lib\__pycache__\functools.cpython-33.pyc
import '_functools' # <class '_frozen_importlib.BuiltinImporter'>
import 'functools' # <_frozen_importlib.SourceFileLoader object at 0x027FD8D0>
import 're' # <_frozen_importlib.SourceFileLoader object at 0x01EBD5D0>
# C:\Python33x86\Lib\__pycache__\sysconfig.cpython-33.pyc matches C:\Python33x86\Lib\sysconfig.py
# code object from C:\Python33x86\Lib\__pycache__\sysconfig.cpython-33.pyc
import 'sysconfig' # <_frozen_importlib.SourceFileLoader object at 0x0280D9F0>
# C:\Python33x86\Lib\__pycache__\locale.cpython-33.pyc matches C:\Python33x86\Lib\locale.py
# code object from C:\Python33x86\Lib\__pycache__\locale.cpython-33.pyc
import '_locale' # <class '_frozen_importlib.BuiltinImporter'>
import 'locale' # <_frozen_importlib.SourceFileLoader object at 0x0281B810>
# C:\Python33x86\Lib\encodings\__pycache__\cp1252.cpython-33.pyc matches C:\Python33x86\Lib\encodings\cp1252.py
# code object from C:\Python33x86\Lib\encodings\__pycache__\cp1252.cpython-33.pyc
import 'encodings.cp1252' # <_frozen_importlib.SourceFileLoader object at 0x02825350>
import 'site' # <_frozen_importlib.SourceFileLoader object at 0x01EA4290>
Python 3.3.0 (v3.3.0:bd8afb90ebf2, Sep 29 2012, 10:55:48) [MSC v.1600 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
import 'math' # <class '_frozen_importlib.BuiltinImporter'>
Traceback (most recent call last):
  File ".\script.py", line 2, in <module>
    import CLIB
  File "<frozen importlib._bootstrap>", line 1558, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1525, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 586, in _check_name_wrapper
  File "<frozen importlib._bootstrap>", line 497, in set_package_wrapper
  File "<frozen importlib._bootstrap>", line 510, in set_loader_wrapper
  File "<frozen importlib._bootstrap>", line 1130, in load_module
  File "<frozen importlib._bootstrap>", line 313, in _call_with_frames_removed
ImportError: DLL load failed: The specified module could not be found.

A: There appears to be a difference between the the import statement(s), the extension module name, and the extension library name:
The BOOST_PYTHON_MODULE macro defines the module initializer function.  In CLIB.cpp change
BOOST_PYTHON_MODULE(hello)
to
BOOST_PYTHON_MODULE(CLIB)
Next, verify that the resulting output library has a CLIB prefix.  Python3.3 removed support for some of the rarely used module name variants.  Per the documentation, I would suggest trying a .pyd file extension first, and resorting to .dll if the .pyd does not work.  Thus, the resulting library should be CLIB.pyd.
Finally, when trying to import the extension use
import CLIB

instead of
import hello


text:
Q: Start animation when player enters specific distance I want to start an animation when my player enters a specific distance to an object, but my animation isn't starting. Any suggestion as to why it isn't starting?
Here is the code that I have so far:
using UnityEngine;
using System.Collections;
public class MoveTo : MonoBehaviour {
    public Transform Player;
    public Transform goal;
    public Animator ani;
    public Animator ani2;
    // Use this for initialization
    void Start ()
    {
        ani.Stop (); // this stop function is working accurate
        ani2.Stop ();
    }
    void Update()
    {
        float dist = Vector3.Distance (Player.position, transform.position);
        if (dist < 5)
        {
            ani.Play("Horse_Walk");// this is not working (Horse_Walk) is a state name
            ani2.Play("Horse_Run");
            pstart();
        }
    }
    void pstart(){
        NavMeshAgent agent=GetComponent<NavMeshAgent>();
        agent.destination = goal.position;
    }
}

A: There can be several reason including (1) wrong string  (2) string name not matched and finally which seems more appropriate reason is that you playing animation again. you should need be call it with bool
    bool isPlayAnim =true;
        void Update()
            {
                float dist = Vector3.Distance (Player.position, transform.position);
                if (dist < 5 && isPlayAnim)
                {
                    isPlayAnim = false;//again true it on you specfic event
                    ani.Play("Horse_Walk");// this is not working (Horse_Walk) is a state name
                    ani2.Play("Horse_Run");
                    pstart();
                }
            }

isPlayAnim bool you can make and use to play animation only one time and again true it in specific event.
Or
Alternatively you need to use collider and its event to run this update code. I guess it is best way to do this job .


text:
Q: It works if use 'int' but fails when I use 'long' . How do I make this function return long the function only returns value when I declare 'n' as int, but returns null when i use 'long'.
Given a string and a value n, the string should be concatenated n number of times. in the concatenated string, we will take the first n characters in that string and return the number of letter 'a' that appeared.
Print a single integer denoting the number of letter a's in the first n letters of the infinite string created by repeating s infinitely many times.
In this function, two parameters are passed, a string and a long value. The code works very well if use an int value instead of long. Please how do i fix this long and int issue ?
public class StringLettersRepeat {
    static long repeatedString(String s, long n) {
        String string = "";
        int count =0;

        for(int i=0; i<n; i++){
            string+=s;
        }

        char[] strChar = string.toCharArray();
        char[] result = new char[(int) n];

        for(int i=0; i<strChar.length;i++){
            result[i]=strChar[i];
        }
        for(char str : result){
            if('a'==str){
                count++;
            }
        }

        return count;
    }

    public static void main(String[] args) {
        long result = repeatedString("a", 1000l);
        System.out.println(result);
    }
}

I expect the output to return a value, which is the number of count.
for example, if I enter string "aba" and n=7, it should return 5.
But if i pass in a string, say 'a' with n=100000000000, it's supposed to return 100000000000 but it doesn't work. Please what's possibly wrong with my code?

A: Given your example of calling repeatedString("aba", 7), the resulting string would be "abaabaa", and has 5 a's, as you said.
But, you don't actually have to build that result string. Instead, realize that the result string is the original string repeated 2 times, plus the first 1 characters of the string, both of which can easily be calculated using division and remainder math:
long repeats = n / s.length();
long extra = n % s.length();

Now, if you count the number of a's in the string, you can multiply by repeats. You don't need to repeat the counting operation. If you then also count the number of a's in the first extra characters of string, you have your final result.
int countFull = 0, countExtra = 0;
for (int i = 0; i < s.length(); i++) {
    if (s.charAt(i) == 'a') {
        countFull++;
        if (i < extra)
            countExtra++;
    }
}

Then calculate the total and return it:
return countFull * repeats + countExtra;

This code also runs a lot faster, because you only have to iterate s once, it doesn't matter for performance what n is, and you don't copy any characters, so it also uses a lot less memory. It actually doesn't use any memory.
Big-O is:
  Performance: O(m) where m is length of input string.
  Memory: O(1)
Neither is related to n.
Test
System.out.println(repeatedString("aba", 7));
System.out.println(repeatedString("a", 100000000000L));

Output
5
100000000000


text:
Q: Titanium Saving the Recorded Audio Files in a folder, Uploading audio files to Web Server, How to save the file which is recorded in sound_record.js File from Appcellrator Titanium KitchenSick Demo.
file = recording.stop(); // file container TiFile Object
sound = Titanium.Media.createSound({sound:file}); // Sound Contains. TiMedia Object
I found these two lines which has the data, which is recorded, But i didnt get that, How to save these recorded data into iphone, so that they can have an access to these files which is recorded.
And also Uploading the Audio files to Web Server, Every where we have how to upload the Image which comes from Gallery, But there is no where its mentioned how we can upload the audio files such as .wav file which is recorded using sound_record.js.

A: I would checkout the KitchenSink, you'll find a lot of examples there. For saving I would checkout the filesystem.js and for upload the xhr_fileupload.js.


text:
Q: R xts: millisecond index How do I create an xts object whose indexes include milliseconds? I can't find any format spec in the POSIXlt help page but there is a reference to %OS in indexFormat().
UPDATE
xts example based on Gavin zoo answer:
> options(digits.secs = 3)
> data(sample_matrix)
> sample.xts = xts(sample_matrix, Sys.time() + seq(0, by = 0.1, length = 180))
> head(sample.xts)
                            Open     High      Low    Close
2012-03-20 08:49:02.820 50.03978 50.11778 49.95041 50.11778
2012-03-20 08:49:02.920 50.23050 50.42188 50.23050 50.39767
2012-03-20 08:49:03.020 50.42096 50.42096 50.26414 50.33236
2012-03-20 08:49:03.120 50.37347 50.37347 50.22103 50.33459
2012-03-20 08:49:03.220 50.24433 50.24433 50.11121 50.18112
2012-03-20 08:49:03.320 50.13211 50.21561 49.99185 49.99185

A: This works with package zoo so I suspect it works also with xts as the latter builds upon the former.
> ## create some times with milliseconds
> times <- Sys.time() + seq(0, by = 0.1, length = 10)
> times
 [1] "2012-03-19 22:10:57.763 GMT" "2012-03-19 22:10:57.863 GMT"
 [3] "2012-03-19 22:10:57.963 GMT" "2012-03-19 22:10:58.063 GMT"
 [5] "2012-03-19 22:10:58.163 GMT" "2012-03-19 22:10:58.263 GMT"
 [7] "2012-03-19 22:10:58.363 GMT" "2012-03-19 22:10:58.463 GMT"
 [9] "2012-03-19 22:10:58.563 GMT" "2012-03-19 22:10:58.663 GMT"
> ZOO <- zoo(1:10, order = times)
> index(ZOO)
 [1] "2012-03-19 22:10:57.763 GMT" "2012-03-19 22:10:57.863 GMT"
 [3] "2012-03-19 22:10:57.963 GMT" "2012-03-19 22:10:58.063 GMT"
 [5] "2012-03-19 22:10:58.163 GMT" "2012-03-19 22:10:58.263 GMT"
 [7] "2012-03-19 22:10:58.363 GMT" "2012-03-19 22:10:58.463 GMT"
 [9] "2012-03-19 22:10:58.563 GMT" "2012-03-19 22:10:58.663 GMT"

The trick to see the milliseconds is to alter the digits.secs option via options(). The above performed using:
> getOption("digits.secs")
[1] 3

Which is set using
> opts <- options(digits.secs = 3)

You can reset this to default (0) by doing options(opts). By default R doesn't print sub-second information because digits.secs defaults to 0. The data are recorded to sub-second accuracy though, even if not printed.
If this is not what you meant, can you explain what you did that was not working?


text:
Q: Extracting PostBack value in Jmeter I want to extract the PostBack password value in Jmeter but all my efforts so far are returning null.
The value needs to be extracted after clicking a button that sends this request:
javascript:__doPostBack('ctl00$ctl00$ContentPlaceHolder2$ContentPlaceHolder4$lbAddRecord','')

A dialog appears with the password.
Using google developer tools, I can see the full response with the info I need:
Rq0&t*Y32H

When I run the script in Jmeter, the response only contains:
1|#||4|9|pageRedirect||%2fWeb%2f|

I tried the following to extract the password value:

*

*regular expression extractor:

reference name: password
regular expression = (.+?)
template: $1$
match no: 1
default value: null

*xpath extractor:

reference name:password
xpath query: .//*[@id='txtPassword']
default value: null
How do I have to change my extractor query to get the password value?

A: You problem comes from the request that precedes the one you're trying to extract data from.
So investigate what is missing in it (headers, cookies, request parameter) that explain why you don't get the correct content.


text:
Q: Prove that the length of this curve decreases as one of its parameters increases The following is the problem statement of one of my assignment questions.

Consider the $\partial_t (t,s) = K(t, s)N(t, s)$  for all $t \geq 0$, and for all $s \in [0, 1]$, where $T(t, s) = \frac{\partial_sx(t, s)}{||\partial_sx(t, s)||}, \ N(t, s) = \frac{\partial_sT(t, s)}{||\partial_sT(t, s)||}, \ K = \frac{||\partial_sT(t, s)||}{||\partial_sx(t, s)||}$ for all $t\geq0$ for all $s \in [0, 1]$, and $x: [0, \infty] \rightarrow \mathbb{R}^n$ is an infinitely differentiable solution such that $||\partial_sx(t, s)||$ and $||\partial_sT(t, s)||$ are non-zero for all . Define $$L(t)=\int_0^1 ||\partial_sx(t, s)||ds \ \ \ \ \forall t \geq0$$
  Assume that $\partial_tL_t=\int_0^1 \partial_t||\partial_sx(t,s)||ds \ \ \ \ \forall t \geq0$.
  Show that the length of $ \{x(t, s): s\in [0,1]\}$  decreases as t increases.
  Hint: $||\partial_sx)t,s)|| = \partial_sx(t, s).T(t, s)$

I think essentially, we are to prove the inequality $\partial_t L_t=\int_0^1 \partial_t ||\partial_s x(t,s)||ds < 0$, because this would show that the length L decreases with increasing t. However, I don't have a clear strategy on how to approach this. I've been thinking about whether using the mean value theorem would work as I have seen it used to prove inequalities, though I don't yet know how to apply that here. So, hints on how to approach this would be much appreciated, thanks.


text:
Q: How to use the django test's database with Selenium? I am testing my django app with django TestCase class. For unit tests and integrations tests I encountered no problem with the database django create then destroy for the tests. But now i want to do some functional test using selenium. The problem is that selenium seem to not be able to access the db. Here is the test code of my test :
class HostTest(LiveServerTestCase, TestCase):

    def setUp(self):

        self.driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))

        # Setting up temporary test database

        # Setting up products
        self.product1 = Product.objects.create(
            id=1,
            name="apple",
            url="apple_url",
            nutriscore="A",
            img_url="apple_img_url",
            kcal=101,
            fat=201,
            protein=301,
            sugar=401,
        )

    def tearDown(self):
        self.driver.close()

    def test_new_user_reserach_and_add_favorite(self):
        driver = self.driver
        driver.get(self.live_server_url)
        self.assertIn("Accueil", driver.title)

        search_bar = driver.find_element_by_name("product_searched")
        search_bar.send_keys("apple")
        search_bar.send_keys(Keys.ENTER)
        self.assertIn("Recherche", driver.title)

        product = driver.find_element_by_class_name('product-presentation')

For this I have an error at the last line, and the error is long but its basically tell me that selenium cant find the element. I tried to print product1 in the test and it work. That why I'm pretty sure that the problem is with Selenium.
Here is the code of my view :
def product_research(request):
    no_repetition_result = []
    vectors = SearchVector('name', weight='A') + SearchVector('category__name', weight='B')
    query = SearchQuery(f'{request.GET.get("product_searched")}')

    research_result = Product.objects.annotate(rank=SearchRank(vectors, query)).order_by('-rank')

    for product in research_result:
        if product not in no_repetition_result:
            no_repetition_result.append(product)

    context = {
        "results": no_repetition_result,
    }
    request.session['research_parameter'] = request.GET.get("product_searched")
    return render(request, 'main_site/product_research.html', context)

And the html code charged to make appear the product on my web page :

    {% for product in results %}
        <div class="col-12 col-sm-6 col-lg-4"

    {% endfor %}

Note: When I take a look at the code of the page selenium open while testing, I dont see any product.

A: Check this answer
This is the same problem that you are facing and has a clean explanation.


text:
Q: Migration from Angular 1.3 to 1.5 I am getting the error that says
angular.js:13236 Error: [ng:areq] Argument 'fn' is not a function, got undefined
http://errors.angularjs.org/1.5.0/ng/areq?p0=fn&p1=not%20aNaNunction%2C%20got%20undefined
at http://localhost:3000/bower_components/angular/angular.js:68:12
at assertArg (http://localhost:3000/bower_components/angular/angular.js:1825:11)
at assertArgFn (http://localhost:3000/bower_components/angular/angular.js:1835:3)
at Promise.promise.error    (http://localhost:3000/bower_components/angular/angular.js:10979:11)
at Object.getUserChannels (http://localhost:3000/scripts/services/media-service.js:38:37)
at activate (http://localhost:3000/scripts/controllers/player-controller.js:63:22)
at new <anonymous> (http://localhost:3000/scripts/controllers/player-controller.js:28:9)

The controller and factory worked before the migration, I cant find any documentation that shows any changes to factories. To me it looks like the controller cannot find the function is the mediaSVC file

A: Did you check if you used lazy loading of your services and factories in 1.3? If so, please make sure they're loaded in advance before you start calling them when you migrated to 1.5. This was one of the things I've experienced when migrated the large enterprise app from 1.4 to 1.5:
http://www.diatomenterprises.com/migration-history-from-angularjs-1-3-to-1-5-and-then-2-0/
The lazy loading may require a bit of attention and another small library to let it work correctly in 1.5. I can assist you if the problem still exists.


text:
Q: Spark executor class create new serializer each time I am using Spark 2.3.1 in local mode and I see all my threads are blocked on creating Kyro serializers.
When I look in the code I find this line:
(org.apache.spark.executor.Executor: 319)
val resultSer = env.serializer.newInstance()

Inside the method it using
val clazz = Utils.classForName(name)

on line 205, which is syncronized

Why not reuse the classes by utilizing ThreadLocal or other means?


text:
Q: Laravel поддомен в route есть сайт site.ru
при переходе по ссылке site.ru/cabinet нужно, чтобы редирект был на
cabinet.site.ru
написал route так
Route::domain('{cabinet}.site.ru')->namespace('Cabinet')->middleware('auth')->group(function () {
    Route::get('/','ProfileController@index')->name('profile');
});

A: Для того, чтобы сделать редирект на поддомен нужно выполнить 2 шага:
// Шаг 1 (редирект на поддомен)

Route::get('cabinet', function () {
  return Redirect::to('http://cabinet.site.ru'); // указание протокола обязательно
});

// Шаг 2 (роуты для поддомена, namespace и middleware можно добавить)

Route::domain('{cabinet}.site.ru')->group(function () {
  Route::get('/', function($cabinet) {
    dd('Это главная страница поддомена!');
  });
  Route::get('user/{id}', function ($cabinet, $id) {
    dd('Это страница пользователя с id: ' . $id);
  });
 // здесь могут быть другие роуты поддомена
});

Route::get('/', 'PageController@index'); // роут для главной страницы основного сайта должен идти после роутов шага 1 и шага 2.


text:
Q: Discarding rows for particular column values for dyadic data I have data that looks something like this:
cnme1 cnme2 year  midonging  midonset
USA   RUS   1945  0          0
USA   RUS   1946  0          1
USA   RUS   1947  1          0
USA   RUS   1948  1          0
USA   RUS   1949  0          0
USA   UK    1945  0          0
USA   UK    1946  0          0
USA   UK    1947  0          0
.
.
.
USA  RUS   2010   0           0

Each row consists of a country-dyad year and variables for whether or not the country-dyad was involved in some sort of conflict. Some dyad-years (U.S.-Russia) have years of ongoing conflict, whereas others (U.S.-U.K.) have no conflict at all.
I want to subset the country-dyads that, at some point in time, were involved in some sort of conflict. So basically getting rid of any country-dyad (e.g. U.S.-U.K.) for which certain variables are coded '0' throughout time, and keep the ones where there was a conflict in during the dyad's history (e.g. U.S.-Syria or U.S.-Venezuela).

A: You can do as follows.
library(dplyr)

df %>% filter(midonging + midonset != 0)

# # A tibble: 3 x 5
#   cnme1 cnme2  year midonging midonset
#   <chr> <chr> <dbl>     <dbl>    <dbl>
# 1 USA   RUS    1946         0        1
# 2 USA   RUS    1947         1        0
# 3 USA   RUS    1948         1        0

Data
df <- structure(list(cnme1 = c("USA", "USA", "USA", "USA", "USA", "USA",
"USA", "USA"), cnme2 = c("RUS", "RUS", "RUS", "RUS", "RUS", "UK",
"UK", "UK"), year = c(1945, 1946, 1947, 1948, 1949, 1945, 1946,
1947), midonging = c(0, 0, 1, 1, 0, 0, 0, 0), midonset = c(0,
1, 0, 0, 0, 0, 0, 0)), row.names = c(NA, -8L), class = c("tbl_df",
"tbl", "data.frame"))

A: Using base R
df[rowSums(df[c("midonging", "midonset")]) >0,]


text:
Q: Keycloak server authentication I'm creating Java appliation, where I will need users to log in. Currently I'm verifying if I can configure Keycloak safe enough. I'd like to make sure my application is really authenticating users against my Keycloak server - eg I know there is something like DNS Poisining or other attacks, where my application could get to attackers server with duplicated/attackers Keycloak instance. What surprised me, I have currently configuration with follwing keys:
keycloak.auth-server-url=...
keycloak.realm=...
keycloak.resource=...
keycloak.public-client=true
keycloak.security-constraints[0].authRoles[0]=..
keycloak.security-constraints[0].securityCollections[0].patterns[0]=...
keycloak.principal-attribute=preferred_username

and no public key is needed. Even worse here: https://stackoverflow.com/a/40516696/520521 I see upvoted comment telling, my application may download key from (malicious) server.
Are there any extra steps I need to follow, to authenticate Keycloak server before starting to authenticate users against it?

A: Based on your configuration, it seems that you've defined your client in Keycloak as public. This allows your client to be able to call Keycloak without any authentication. This type of client is used for example when you're going to authenticate via js in webpage in which nothing can be hidden from attacker as they have access to the source of the page.
If you set the "Access Type" of your client to "confidential" (in Client Settings on Keycloak Admin UI) and save the settings, there will appear another tab (next to "Setting" tab of the client) titled "Credentials". There you can see the default secret that is created for your client. You should then put this secret as below in your keycloak.json file inside your application:
"credentials": {
    "secret": "paste-the-secret-value-here"
}

You can also re-generate the value by selecting the "Regenerate Secret" button.
You can also change the "Client Authenticator" there and set it to "X509 Certificate". Then you would be asked to define a regular expression to validate the "Subject DN" of the certificate that client will be using for authentication. Any certificate matching that regex would be considered as valid and authenticated. Then you have to setup your client to use such certificate instead of defining the "secret" value in the keycloak.json file.
There is of course another option which uses "Signed JWT" which is also secure and you can find the details about how to set it up in Keycloak documentation at Client Authentication section.

A: I can't see a word that this is the aim, but seeing where public and private key is placed I understand that answer is, that in realm settings -> keys -> active there is list of keys. You may download public key or certificate with button on right side. In my case of Spring boot, enter application.properties file a public key under keycloak.realm-key.


text:
Q: how to make a random question without repeating it? **So I have to make a random question for my logic quiz and I have a written code here. I do not know what is the syntax for java because I just started learning it and I started with kotlin so it is a bit unfamiliar to me. Here is the code: **
       Random r;
String [] quest = {"Which alphabet will be 14th to the left of 8th alphabet from the right in the following series of letters?" +
        "A O B P C Q D R E S F T G U H V I W J X K Y L Z M N.", "Hritik is taller than Salman who is shorter than Sanjay. Akshay is taller than " +
        "Shahrukh but shorter than Salman. Sanjay is shorter than Hritik. Who is the tallest?" , "Lali and Anju are a married couple. Tunu and Munu " +
        "are brothers. Tunu is the brother of Lali. How is Munu related to Anju?", "How many sets of two letters have as many letters " +
        "between them as in the English alphabetical order in the word 'WRISTWATCH'."};

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

    Button question = findViewById(R.id.btnQuestion);
    final TextView ask = findViewById(R.id.txtAsk);

    r = new Random();

    question.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            ask.setText(quest[r.nextInt(quest.length)]);

        }
    });
}

A: Do it as follows:
Random r = new Random();
String [] quest = {"Which alphabet will be 14th to the left of 8th alphabet from the right in the following series of letters?" +
        "A O B P C Q D R E S F T G U H V I W J X K Y L Z M N.", "Hritik is taller than Salman who is shorter than Sanjay. Akshay is taller than " +
        "Shahrukh but shorter than Salman. Sanjay is shorter than Hritik. Who is the tallest?" , "Lali and Anju are a married couple. Tunu and Munu " +
        "are brothers. Tunu is the brother of Lali. How is Munu related to Anju?", "How many sets of two letters have as many letters " +
        "between them as in the English alphabetical order in the word 'WRISTWATCH'."};

boolean [] usedIndices = new boolean[quest.length];

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

    Button question = findViewById(R.id.btnQuestion);
    final TextView ask = findViewById(R.id.txtAsk);

    question.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            int indextoBeUsed;
            do {
                indextoBeUsed = r.nextInt(quest.length);
            } while (usedIndices[indextoBeUsed]);
            usedIndices[indextoBeUsed] = true;
            ask.setText(quest[indextoBeUsed]);
        }
    });
}

The solution is quite straight forward. Feel free to comment in case of any doubt.


text:
Q: Initialize php class with same name If we have two or more classes with the same name, but in different folders, how would one differentiate between them during initialization?
require_once('database.php');
require_once('t/database.php');

$db = new Database(); // I want this to initialize the one in t/database.php
$globalDb = new Database(); // I want this to initialize database.php

A: This is what Namespaces are for.
But honestly, this sounds like an architectural problem. There are two ways you can approach this. If we were to answer your question as posed, you could solve your problem like so:
database.php
class Database{
    // ...
}

t/database.php
namespace T;
class Database{
    // ...
}

index.php
require_once('database.php');
require_once('t/database.php');

$db = new T\Database();
$globalDb = new Database();

But judging by your naming conventions, it appears as if you have two separate classes that are intended to interact with either the same - or similar - database instances.
I'm making some assumptions here, but the other way you can set up your logic is to condense your code down to a single Database class and operate on multiple connections over multiple instances.
Consider using dependency injection to manage your connections in a single unified class structure, especially if you're using the same type of RDBMS flavor across all connections.
Consider something like the following naive example:
class Database{
    private $conn;
    public function __construct(PDO $conn){
        $this->conn = $conn;
    }
    public function select(...$args) { // Select Logic goes here }
    public function insert(...$args) { // Insert Logic goes here }
    public function update(...$args) { // Update Logic goes here }
    public function delete(...$args) { // Delete Logic goes here }
}

It would be possible to operate over multiple connections at once by simply injecting different PDO instances into the same class:
require_once('database.php');
$conn1 = new PDO('mysql:host=localhost;dbname=test1', $user, $pass);
$conn2 = new PDO('mysql:host=localhost;dbname=test2', $user, $pass);
$db1 = new Database($conn1);
$db2 = new Database($conn2);

So while the first example may address your question directly, you may want to rethink your architecture if I'm on the right track with my second example.
And to echo everyone else, you should seriously consider using a proper Autoloader. Look into Composer and Autoloading - specifically PSR-4.

A:
If we have two or more classes with the same name, but in different folders, how would one differentiate between them during initialization?

Don't do that. Loading the PHP file which contains the second definition will throw an error:

Fatal error: Cannot declare class Database, because the name is already in use

You will need to rename one of the classes.
As an aside, you may want to consider using an autoloader in your application instead of calling require() manually.


text:
Q: store values after groupby and loc using df to select two columns col_1 and col_2 after groupby and loc and store at variable a in dataframe format
Python Code
import pandas as pd
import numpy as np

df = pd.DataFrame(dict(Gender=['M', 'F', 'M', 'F',
                           'F', 'M', 'M', np.nan],
                   State=['NY','IL', 'NY', 'CA',
                          'IL', 'CA', 'CA', 'IL'],
                   col_1=[10,20,30,np.nan,40,50,60,70],
                   col_2=[1,6,2,4,6,9,np.nan,3]))

d = df.groupby(['Gender','State']).sum()
d.loc['F']

Execution Result
       col_1    col_2
State
CA     0.0      4.0
IL     60.0     12.0

Expected Result (dataframe format)
  a =
           col_1    col_2

           0.0      4.0
           60.0     12.0

A: You can reset the index after obtaining grupby data d.
print(d.loc['F'].reset_index(drop=True))

   col_1  col_2
0    0.0    4.0
1   60.0   12.0


text:
Q: HtmlAgilityPack Multiple Types of Descendants I am trying to select a divs, spans, labels, etc basically any element with a certain attribute.
IEnumerable<HtmlNode> allDivsWithItemType = _doc.DocumentNode.Descendants("div").Where(d => d.Attributes.Contains("itemtype"));

Is there a way to rope all descendants into one like above? Since above only finds divs obviously.  I am trying to avoid duplicate code to add a whole extra line to replace one word.
For Example (Doesn't work)
IEnumerable<HtmlNode> allDivsWithItemType = _doc.DocumentNode.Descendants("*").Where(d => d.Attributes.Contains("itemtype"));

A: Try:
IEnumerable<HtmlNode> allDivsWithItemType = _doc.DocumentNode.Descendants()
   .Where(d => d.Attributes.Contains("itemtype"));


text:
Q: IBM AlchemyAPI - create corpus/knowledge graph with my data and perform concept search I'd like to create a corpus with my data set. I'd like something similar to creating a corpus with documents in Watson Concept Insights, but I did not find the corresponding API in Alchemy. How do you create a corpus/knowledge graph using AlchemyAPI? The relation extraction works only on the input. Is there way to perform relation extraction on the corpus to get related concepts?
I already used Watson Concept Insights. The customer requirement is to use AlchemyAPI.


text:
Q: How does .NET compiler compare two strings? string a="I am comparing 2 string";
string b="I am comparing 2 string";

if(a==b)
  return true;
else
  return false;

How does a .NET compiler compare two strings? Does a string work like a struct(int)?
string is class so a=b means we are comparing 2 object, but i want to compare 2 values.

A: The String class overloads the == operator, so yes it compares the values of the strings, just like comparing value types like int.
(On a side note, the compiler also interns literal strings in the code, so the string variables a and b will actually be referencing the same string object. If you use Object.ReferenceEquals(a,b) it will also return true.)

A: System.String is a class which has the == operator overloaded to compare the content of the strings. This allows it to be "value like" in comparison and yet still be a reference type in other respects.

A:
Although string is a reference type, the equality operators (==  and !=) are defined to compare the values of string objects, not references. This makes testing for string equality more intuitive.

C# string

A: Strings are compared by the Runtime, not the compiler. Comparison is performed by Equality operator.

A: There are different things to keep in mind here.
First, all identical constant strings will be interned so that both references are equal to start with. Therefore, even if you did a ReferenceEquals() here, you'd get "true" as result. So only for a string built (for instance with a StringBuilder, or read from a file etc.) you'd get another reference and therefore false when doing a reference equality comparison.
If both objects are known to be strings at compile time, the compiler will emit code to compare their value (== overloaded operator on System.String), not their references. Note that as soon as you compare it against an object type reference, this isn't the case anymore.
No runtime check is done to compare a string by value, and the compiler does not emit a .Equals() call for the == operator.

A: Notice that your question is a little tricky. Because ReferenceEquals will ALSO return true.
This is because of Interning : http://en.wikipedia.org/wiki/String_interning


text:
Q: Returning String from Javascript inside asp.net control I have this javascript function
 function getListOfUidMeter(){
    input = "";
    var tbl = document.getElementById('tableStripy'), i;
    for (i = 0; i < tbl.rows.length; i++) {
        input = input + tbl.rows[i].cells[11].outerText).split(",")[0] + ",";
    }
    return input;
}

this function return a string
i want get the output of this function inside asp page but i can't figure out how to do it
<form name="Form1" method="post" onkeypress="if (event.keyCode==13) {this.submit();event.returnValue=false;} else event.returnValue=true;">
<input class="lookup" type=hidden name="Id" value="<%=PageParams1.Id%>">
<input type=hidden name="SessionId" value="<%=PageParams1.SessionId%>">
<input type=hidden name="Command" value="">
<input type=hidden name="AccountID" value="<%=PageParams1.AccountID%>">
<input type=hidden name="UIDFACILITY" value="<%=PageParams1.UIDFACILITY%>">
<input type=hidden name="FACILITYID" value="<%=PageParams1.FACILITYID%>">
<input type=hidden name="METERID" value="<%=PageParams1.METERID%>">
<input type=hidden name="UIDMETER" value="<%=PageParams1.UIDMETER%>">
<input type=hidden name="UIDMeterHistory" value="<%=PageParams1.UIDMeterHistory%>">
<input type=hidden name="CustomerName" value="<%=PageParams1.CustomerName%>">
<input type=hidden name="CustomerId" value="<%=PageParams1.CustomerId%>">
<input type=hidden name="EntityParam" value="<%=PageParams1.EntityParam%>">
<input type=hidden name="SORT_BY" value="<%=PageParams1.SORT_BY%>">
<input type=hidden name="SORT_ORDER" value="<%=PageParams1.SORT_ORDER%>">
<input type=hidden name="Mode" value="<%=PageParams1.Mode%>">

  <nobr><%=Proxy1.i18n.FM("MeterHistory")%></nobr>

    <%=Proxy1.i18n.FM("ID")%>   <%=meterId %>
     <%if (PageParams1.Mode == "ServicePoint") {%>
            |  <a href="../../ccs/MainWebPart.aspx?Mode=

    <%=PageParams1.Mode%>&SessionId=<%=PageParams1.SessionId%>&Uid=
    <%=Proxy1.Session.GetPropertyValue("SERVICEPOINT_UID")%>">
    <%=Proxy1.i18n.FM("ServicePointSummary")%>
    <% } else if (PageParams1.Mode == "MarketParticipant") { %>
          |  <a href="../../ccs/MainWebPart.aspx?Mode=
    <%=PageParams1.Mode%>&SessionId=<%=PageParams1.SessionId%>&Uid=
    <%=Proxy1.Session.GetPropertyValue("MARKETPARTICIPANT_UID")%>">
    <%=Proxy1.i18n.FM("MarketParticipantSummary")%>
    <% } %>

  <nobr>
        <%if (PageParams1.AccountID) {%>
      <%=Proxy1.i18n.FM("AccountID")%>
      <a class="Link" onclick='window.navigate("../viewaccount/Meters.asp?Id=<%= escape(PageParams1.AccountID)%>&SessionId=<%=PageParams1.SessionId%>")'><%=PageParams1.AccountID %>

    <%} if (PageParams1.CustomerId) {%>
    <%=Proxy1.i18n.FM("CustomerID")%>
      <a class='Link' onclick='navigate("../../ccs/MainWebPart.aspx?Id=

    <%=escape(PageParams1.CustomerId)%>&SessionId=<%=PageParams1.SessionId%>"+"&Mode=Customer")'>
          <%=PageParams1.CustomerId%>

      <%} if (PageParams1.UIDFACILITY) {%>
        <%=Proxy1.i18n.FM("FacilityID")%>
        <a class=Link onclick='navigate("../cust_facility/Basics.asp?UIDFACILITY=<%=PageParams1.UIDFACILITY%>&SessionId=<%=PageParams1.SessionId%>&X_ROWPERPAGE=50")'>
            <%=PageParams1.FACILITYID%>

      <%}%>
  </nobr>

    <%= RenderTabs("MeterRead") %>

    <%          if (OperationError) ReportError(OperationError)%>

    <%if (PageParams1.Command=='Edit') { %>

              <%if (Proxy1.Allow("//ACCTMGT/ACCTCOMP/ACCTMET/@UPDATE")) {%>
              <%=Proxy1.i18n.FM("Save")%> |
              <%}%>
              <%if (PageParams1.EntityParam && Proxy1.Allow("//ACCTMGT/ACCTCOMP/ACCTMET/@REMOVE") ) { %><%=Proxy1.i18n.FM("Delete")%> |<% } %>
              <%=Proxy1.i18n.FM("Cancel")%>

    <%} else%>
        <%=tMeterHistoryTable %>

    <%if (PageParams1.Command != 'Edit') { %>

        <%
                    if (Proxy1.Allow("//FACILITY/ADD"))
                    {
                %>
                                <%=Proxy1.i18n.FM("Add")%>
                <%
                    }
                    if (Proxy1.Allow("//FACILITY/REEST_ACTION/@REESTIMATE")) { %>
                                Ristima
                <%
                    }
                    if (Proxy1.Allow("//FACILITY/REEST_ACTION_2")) { %>
                                Ristima lettura conferimento
                <%  }
                    if (Proxy1.Allow("//FACILITY/REEST_ACTION/@DISCHARGE")) { %>
                                Scarta
                <%  } %>

                            <%= Paginator_b(PageParams1.ROWPERPAGE, PageParams1.PAGENUMBER) %>

            <%
                }
            %>

<% =tTable %>

                            <input type="hidden" name = "OLD_STATUS" value = "<%=oldstatus_str%>">
                            <input type="hidden" name = "X_LSUSER" value = "<%=username_web.toUpperCase()%>">
                            <input type="hidden" name = "X_LSTIME" value = "<%=data_modifica%>">

    </form>

    <% }
    catch (e) {ReportError(e); } %>

I already call the javascript function inside it but how do i get the result to use it inside the asp page?

A: There are many ways to achieve that, however, since you're using hidden fields here is a simple way:

*

*Add a new hidden field for ex "hfTemp"

*in your Javascript function store the returned value in that hidden field.
$get('hfTemp').value = input

*in Asp.net after calling the JS function, use :
(VB)
   Dim JSValue As String = Request.Form("hfTemp")

(C#)
string JSValue = Request.Form("hfTemp");


text:
Q: Using geom_abline on log-log plots in RStudio? My goal is to plot several diagonal reference lines on a log-log plot. These lines will represent C where C=X x Y. Basically providing a reference for amount of material on a graph where the x-axis represents the total amount and the y-axis represents concentration of the material. Attached is an example of what I mean - I made this plot in Matlab. I am trying to reproduce similar plots in RStudio; however geom_abline does not seem to work when I apply log scale using scale_x_log10 and scale_y_log10. I can get the lines to plot when I do not apply the log scaling. Why does geom_abline seem to not work for log scale and what would be the best way to plot these diagonal lines on a log-log scale using the ggplot2 library? Thanks in advance.
Code for reference:
library(tidyverse)
breaks <- 10^(-10:10)
minor_breaks <- rep(1:9, 21)*(10^rep(-10:10, each=9))

ggplot(Re1, aes(x = Tonnage, y = Percent.grade, group = Type)) +
  geom_point(aes(shape=Type, color=Type)) +
  theme(panel.grid.major = element_blank(), panel.grid.minor = element_blank()) +
  geom_text_repel(aes(label=Name),size = 3) +

  geom_abline(intercept=0.000011,slope=-1*10^-14) +
  geom_abline(intercept=3*0.000011,slope=-1*10^-14) +

  scale_x_log10(breaks = breaks, minor_breaks = minor_breaks) +
  scale_y_log10(breaks = breaks, minor_breaks = minor_breaks) +
  annotation_logticks() +
  coord_equal() +
  theme_bw() +

  labs(
    x = "Metric Tons",
    y = "Weight % Re",

    shape = "Deposit Type",
    color = "Deposit Type",
    title = "Rhenium Grade-Tonnage Model"
  )

dput(Re1)
structure(list(Name = structure(c(13L, 2L, 3L, 11L, 12L, 18L,
14L, 19L, 4L, 17L, 23L, 7L, 8L, 22L, 10L, 1L, 9L, 15L, 5L, 24L,
20L, 21L, 16L, 6L), .Label = c("Bagdad", "Bingham", "Butte",
"Castle Dome", "Climax", "Copper Creek", "Ely", "Miami-Inspiration",
"Mineral Park", "Mission-Pima", "Morenci", "Mount Tolman", "Pebble",
"Quartz Hill", "Questa", "Ray", "San Manuel-Kalamazoo", "Santa Rita",
"Sierrita- Esperanza", "Silver Bell", "Thompson Creek", "Tomichi",
"Twin Buttes", "Urad-Henderson"), class = "factor"), Tonnage = c(5.94e+09,
3.23e+09, 5.22e+09, 5.22e+09, 2.177e+09, 3.03e+09, 1.6e+09, 2.262e+09,
1.438e+09, 1.39e+09, 9.4e+08, 7.54e+08, 1.591e+10, 7.11e+08,
9e+08, 1.6e+09, 8.76e+08, 4.24e+08, 8e+08, 4.37e+08, 2.68e+08,
2.12e+08, 1.583e+09, 7.5e+07), Grade = c(4.461e-07, 2.211e-07,
1.121e-07, 8.93e-08, 1.631e-07, 1.069e-07, 1.888e-07, 1.158e-07,
1.599e-07, 1.647e-07, 2.298e-07, 2.653e-07, 1.01e-08, 2.166e-07,
1.5e-07, 8.13e-08, 5.02e-08, 8.96e-08, 4.38e-08, 7.55e-08, 1.157e-07,
1.415e-07, 1.39e-08, 9.33e-08), Percent.grade = c(4.46128e-05,
2.21053e-05, 1.12069e-05, 8.9272e-06, 1.63068e-05, 1.06931e-05,
1.8875e-05, 1.15827e-05, 1.59944e-05, 1.64748e-05, 2.29787e-05,
2.65252e-05, 1.0057e-06, 2.16596e-05, 1.5e-05, 8.125e-06, 5.0228e-06,
8.9623e-06, 4.375e-06, 7.5515e-06, 1.15672e-05, 1.41509e-05,
1.3898e-06, 9.3333e-06), Contained = c(2650L, 714L, 585L, 466L,
355L, 324L, 302L, 262L, 230L, 229L, 216L, 200L, 160L, 154L, 135L,
130L, 44L, 38L, 35L, 33L, 31L, 30L, 22L, 7L), Type = structure(c(4L,
2L, 4L, 4L, 4L, 2L, 5L, 4L, 3L, 4L, 4L, 2L, 4L, 4L, 2L, 4L, 2L,
1L, 1L, 1L, 4L, 5L, 2L, 2L), .Label = c("Climax Mo", "Porphyry Cu",
"Porphyry Cu-Au", "Porphyry Cu-Mo", "Porphyry Mo"), class = "factor")), class = "data.frame", row.names = c(NA,
-24L))

Example of diagonal lines I am trying to recreate in RStudio
Diagonal lines plot when I remove #scale_*_log10
When I use scale_*_log10 the lines do not plot


text:
Q: File not written to by System.Data.SQLite on windows share after network failure I have the following scenario:
WPF Application using SQLite-file per System.Data.SQLite on a windows-share as backend. Client is Windows 7 Home Edition
A user reported, that she was using the software, saving the new data she entered, but then after a while when she re-visited the software, some of her stuff was gone.
She said the session lasted until about 11:50am - the timestamp on the SQLite file in question was 10:55am. I have a logfile in the same network share, it is written to using a filewriter with autoflush.
The logfile looks normal until 10:55am, then there is one line with rubbish (looks like several lines written together in one), then goes on as normal.
Clearly the network (or maybe the drive) must have had a hiccup at that time. Miraculously my application just continued as normal. No exceptions were thrown, according to the logfile all transactions are "completed". No journal file remains to tell the tale. This behaviour - although wonderous in itself - is not appreciated by the user :)
My question: what happened here and how can I prevent it in the future? Did Windows 7 cache the file in the standby list and not care at all about comitting the changes to the actual disk? Why is my application or the SQLite provider unaware of this?
I will now build a confirmation mechanism that checks the timestamp on the backend file to see if it was actually changed at all after the last transaction, but that seems a bit silly. Just as silly as being very pedantic with catching exceptions when they are not being thrown :)
Thank you
TL;DR
SQlite file shows no changes after momentarily hardware (network or drive) failure, but the application seemingly continues to function and no exceptions are thrown by System.Data.SQLite.

A: See section 3 of How To Corrupt An SQLite Database File; it appears that Windows did not sync the network share when SQLite told it to.