text:
Q: Bind data repeater inside data repeater in ASP.NET I'm learning .NET at the moment, so forgive me if this is a silly question.
I have two MSSQL tables, one called 'Comment' and the other called 'CommentAdditionalAuthor'.  The Comment table holds data from a comment form, such as comment title, date, main author name etc.  The CommentAdditionalAuthor table contains information about other authors who contributed to the comment.  So there is a one-to-many relationship there - each comment can have one or more additional authors.
I have a repeater control which binds data from the Comment table, which works nicely.  Now what I want to do though is output the author details alongside the comment.  So effectively a repeater within a repeater.
I've tried to clean up this code as much as possible but sorry that it's still pretty lengthy as I'd like to keep it relevant to what I'm doing so I can hopefully understand the solution.  Having found other examples of this, I'm struggling to implement them as they bind to the data in different ways, which I just can't make work in my application.
The code in the aspx file is like this:

    <asp:Repeater ID="rptComments" runat="server">
    <ItemTemplate>

Submitted to <%# GetPageDetails(Eval("nodeid")) %> article on <%# Eval("created") %>

Name <%# Eval("firstname") %> <%# Eval("surname") %>

Occupation <%# Eval("occupation") %>

Affiliation <%# Eval("affiliation") %>

Email <a href='mailto:<%# Eval("email") %>'><%# Eval("email") %> Publish email: <%# Eval("publishemail") %>

Competing interests? <%# Eval("competingintereststext") %>

eLetter title <%# Eval("title") %>

<%# Eval("comment").ToString().Replace("\n", "
")%>

Additional authors

                <asp:Repeater id="rptAdditionalAuthors" runat="server">
                    <ItemTemplate>
                        <%# Eval("firstnameother")%>

                        <%# Eval("surnameother")%>

                        <%# Eval("occupationother")%>

                        <%# Eval("affiliationother")%>

                        <%# Eval("emailother")%>

                    </ItemTemplate>
                </asp:Repeater>

    </ItemTemplate>
</asp:Repeater>

And here's what the code-behind is doing:
    private void BindData()
    {
        var rr = _sqlHelper.ExecuteReader(string.Format("select * from comment {0} order by created desc", Filter));

        var commentDt = new DataTable("Comments");
        commentDt.Columns.Add("id", Type.GetType("System.Int32"));
        commentDt.Columns.Add("nodeid", Type.GetType("System.Int32"));
        commentDt.Columns.Add("firstname", Type.GetType("System.String"));
        commentDt.Columns.Add("surname", Type.GetType("System.String"));
        commentDt.Columns.Add("occupation", Type.GetType("System.String"));
        commentDt.Columns.Add("affiliation", Type.GetType("System.String"));
        commentDt.Columns.Add("title", Type.GetType("System.String"));
        commentDt.Columns.Add("email", Type.GetType("System.String"));
        commentDt.Columns.Add("publishemail", Type.GetType("System.Boolean"));
        commentDt.Columns.Add("competinginterests", Type.GetType("System.Boolean"));
        commentDt.Columns.Add("competingintereststext", Type.GetType("System.String"));
        commentDt.Columns.Add("comment", Type.GetType("System.String"));
        commentDt.Columns.Add("statusid", Type.GetType("System.Int32"));
        commentDt.Columns.Add("spam", Type.GetType("System.Boolean"));
        commentDt.Columns.Add("ham", Type.GetType("System.Boolean"));
        commentDt.Columns.Add("created",Type.GetType("System.DateTime"));

        while (rr.Read())
        {
            var dr = commentDt.NewRow();
            dr["id"] = rr.GetInt("id");
            dr["nodeid"] = rr.GetInt("nodeid");
            dr["firstname"] = rr.GetString("firstname");
            dr["surname"] = rr.GetString("surname");
            dr["occupation"] = rr.GetString("occupation");
            dr["affiliation"] = rr.GetString("affiliation");
            dr["title"] = rr.GetString("title");
            dr["email"] = rr.GetString("email");
            dr["publishemail"] = rr.IsNull("publishemail") == true ? false : rr.GetBoolean("publishemail");
            dr["competinginterests"] = rr.IsNull("competinginterests") == true ? false : rr.GetBoolean("competinginterests");
            dr["competingintereststext"] = rr.GetString("competingintereststext");
            dr["comment"] = rr.GetString("comment");
            dr["statusid"] = rr.GetInt("statusid");
            dr["spam"] = rr.IsNull("spam") == true ? false : rr.GetBoolean("spam");
            dr["ham"] = rr.IsNull("ham") == true ? false : rr.GetBoolean("ham");
            dr["created"] = rr.GetDateTime("created");

            commentDt.Rows.Add(dr);

            /* My failing attempt at the second bind:
            var rrAuthor = _sqlHelper.ExecuteReader(string.Format("select * from CommentOtherAuthor WHERE commentid = 81"));

            var otherAuthorDt = new DataTable("OtherAuthors");
            otherAuthorDt.Columns.Add("firstname", Type.GetType("System.String"));
            otherAuthorDt.Columns.Add("surname", Type.GetType("System.String"));
            otherAuthorDt.Columns.Add("occupation", Type.GetType("System.String"));
            otherAuthorDt.Columns.Add("affiliation", Type.GetType("System.String"));
            otherAuthorDt.Columns.Add("email", Type.GetType("System.String"));

            while (rrAuthor.Read())
            {
                var drAuthor = otherAuthorDt.NewRow();
                drAuthor["firstnameother"] = rr.GetString("firstname");
                drAuthor["surnameother"] = rr.GetString("surname");
                drAuthor["occupationother"] = rr.GetString("occupation");
                drAuthor["affiliationother"] = rr.GetString("affiliation");
                drAuthor["emailother"] = rr.GetString("email");
                otherAuthorDt.Rows.Add(drAuthor);
            }
            rptAdditionalAuthors.DataBind();
            */
        }

        var pgitems = new PagedDataSource
            {
                DataSource = commentDt.DefaultView,
                AllowPaging = true,
                PageSize = 25,
                CurrentPageIndex = CurrentPage
            };

        rptComments.DataSource = pgitems;
        rptComments.DataBind();

        if (pgitems.PageCount > 1)
        {

            var pages = new ArrayList();
            for (var i = 0; i < pgitems.PageCount; i++)
                pages.Add((i + 1).ToString());

            rptPages.DataSource = pages;
            rptPages.DataBind();
            rptPages.Visible = true;
        }
        else
        {
            rptPages.Visible = false;

        }
    }

The code-behind stuff doesn't work because of the second repeater I've set up, but the first repeater does work if I remove all that stuff.  I thought it best to keep it in there so you can see my 'logic' (probably not very logical ;) ).  Also worth noting that in the second data set I've hard-coded it to get the additional author details with id 81 - that was just to get the repeater working - obviously I need to substitute this with the id value from the Comment table, to get the authors for the current comment in the loop.
If anyone can help me get this second repeater working I'd be most grateful.  It's over the edge of my learning curve at the moment!
Thanks folks!

A: There are several articles available online on Nested repeaters, including this one.
In essence, you need to first create your DataSet and define the relationships between the DataTables in code-behind, and then bind the child repeater to the child rows. The article linked to above has a full working example that's prety easy to modify.
if that article doesn't suit your needs, try one of these.


text:
Q: Namespace Alias in Laravel I apologize if this is duplicate; please guide me to the right directions.
I know we can create class aliases in Laravel from /config/app.php. However trying to create namespace aliases using the same method fails.
    /*
    |--------------------------------------------------------------------------
    | Class Aliases
    |--------------------------------------------------------------------------
    |
    | This array of class aliases will be registered when this application
    | is started. However, feel free to register as many as you wish as
    | the aliases are "lazy" loaded so they don't hinder performance.
    |
    */

    'aliases' => [
    ...

    /*
    *    My custom namespace aliases
    */
    'MyNamespace' => 'App\Models\MyNamespace',

    ],

Testing this in thinker returns the following results:
>> new \MyNamespace\MyClass();

PHP Fatal error:  Class 'MyNamespace/MyClass' not found in Psy Shell code on line 1

Do you know a way to create namespace alias in Laravel?

A: Make your code PSR-4 compatible and put it in composer.json
"autoload": {
    "psr-4": {
      "MyNamespace\\": "src/MyNameSpace",
    }
},

Then run composer dumpautoload. So long as you stick to the convention of subfolders being namespaces, your classes will autoload.
src/MyNamespace/SomeClass.php would have namespace MyNamespace; and class SomeClass.
src/MyNamespace/Something/SomethingElse.php would have namespace MyNamespace\Something; and class SomethingElse.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Why is "liquorice" pronounced (or spelt) so strangely? Liquorice is pronounced ˈlɪkərɪʃ. But every other word I can think of ending with -ice is pronounced differently (such as police or rice). How did liquorice get such a strange pronunciation, or alternatively, to be spelt like that?

A: As a supplement: The pronunciation with [ɪʃ] may also have been influenced by a very old variant of what is now lecherous: lickerish, which broadened its sense to "greedy, desirous" and at one time had the side meaning "tempting to the appetite".

A: I have always pronounced liquorice with 's' not 'sh'.  I had never heard it pronounced as 'sh' until I moved from Scotland to England, so as far as I'm concerned, the English pronounce it incorrectly and the Scots pronounce it correctly.

A: I had this argument in school with my English teacher; I pronounced it with the iss, not the ish.  She showed me a dictionary where it was pronounced ish, but instead of taking her word I decided to do some research in older dictionaries... we were both right.  The original way was the way I had said it with the iss sound, but due to an overwhelming amount of people pronouncing it ish it was changed. Shortly after it had been changed, there were two ways printed and an explanation, but now it seems this has been lost over the years and simply changed to ish.   I refuse to roll with the masses and still pronounce it iss not ish.
Ah well, it is my choice; and in my mind, I am equally correct saying it this way.

A: I am Scottish but moved with my family to England as a child. Having been brought up most of my childhood in England I always used the 'liquorish' pronunciation but was told off by my Scottish mother who always wrote it 'licorice' - using the 'riss' pronunciation

A: It's possible that the pronunciation of the common noun liquorice was influenced by the plant's Latinized genus name Liquiritia, anglicized as /lɪkwɪɹɪʃə/ (and these days less often used than the official Greek name Glycyrrhiza). Other plants where English speakers tend to use the genus name more than the English name include eucalyptus (gum tree) and ficus (weeping fig).
So if people sometimes heard the term Liquiritia in reference to liquorice, the pronunciations might have converged over time. This convergence may have been helped along by the fact that the English word can be traced back to the Latin one through French.

A: It actually used to be pronounced /lɪkoɹˈɛs/, as evidenced by the Old French word we borrowed it from, "licoresse".
The last phoneme probably shifted from /s/ to /ʃ/ due to a similar process that happened with the words "pressure" and "sugar".
Why it changed and not other similar words? Who knows. English speakers for a long time have had a twisted lack of consistency. Why are the two words, from the same language and borrowed at roughly the same time period, "prestige" and "vestige" pronounced so differently?

A: Liquorice (American English: licorice) is a word that derives from the Old French licoresse (the equivalent of the modern French règlisse). The English word kept the pronunciation of the original word.
There is another word that has a similar pronunciation of -rice, and that has origin from a French word: caprice (AmE /kəˈpris/, BrE /kəˈpriːs/).


text:
Q: mpld3.fig_to_html throws AttributeError: module 'matplotlib.dates' has no attribute '_SwitchableDateConverter' I am using mpld3.fig_to_html form the last three months its working fine but from the last two days, it's showing error. All of my code stop workings. Can anyone suggest to me how to solve this error?
AttributeError: module 'matplotlib.dates' has no attribute '_SwitchableDateConverter'

also, this simple code throws the same error.
fig = plt.figure()
plt.scatter([1, 10], [5, 9])
html_graph = mpld3.fig_to_html(fig)

collab file: https://colab.research.google.com/drive/17W1_vfOZTYmhodzziNEC7wPiuZuF9Cc1?usp=sharing.

A: If you're using colab, restart your runtime then reinstall older mpld3 version with !pip install matplotlib==3.2.1 mpld3==0.5.5


text:
Q: react-admin: Material Design Update How much effort would it be to update the framework to the newest material design standards eg used in material-ui?
Specifically I'm looking into updating text-input fields to the outline textfield design. Is there a way to easily "import" the newest material design standards on bulk without touching every single component?

A: I think it's a great deal of work indeed: You'll need to fork the ra-ui-materialui package, upgrade the dependency to material_ui, and fix all the things. And you can trow away your work just after that, since material-ui is again going to break BC with V4.
This has been discussed in the react-admin repository:

Material-ui 3 is a BC break over material-ui 1, so upgrading that dependency would be a BC break for react-admin, too. We'd have to release react-admin 3.0. Since the latest stable (2.0) is not that old (May 2018), we'll wait a few more weeks before breaking BC again.

I advise you to use material ui v1, or to wait a few more months until the react-admin core team makes the switch to material ui v4.


text:
Q: Why do numbers appear over open and/or pinned apps when i hold down Super? When i hold down the super (windows) key, numbers and in some cases letters appear over open apps and other unity things (workspace switcher, trash).
The first 10 Open or pinned apps are numbered 1, 2, 3..  ..8, 9, 0. Subsequent apps are not numbered.
What are the numbers/letters for?

A: If you press super+the number/letter it will focus/open that program the same way your mouse would.
All the key board shortcuts available for unity are listed here.
Here is a quick list:

A: while holding the SUPER key, you can press the numbers/letters that appeared and the get the same effect as a mouse click on that symbol would have.
To learn more about the keyboard shortcuts of unity look here.


text:
Q: JavaScript prototype naming standards Is there some sort of standard or convention on naming JavaScript prototypes?
I find myself in the need to add methods on prototypes of both native and user-defined functions quite often, and so I usually store the prototypes themselves in local variables:
var functionPrototype = Function.prototype;
var objectPrototype = Object.prototype;
var arrayPrototype = Array.prototype;

Although the names are very descriptive, they are unnecessarily long.

A: I believe that there's no standard convention on naming prototype objects. So I created my own standard.
As I mentioned in my comment above choosing a standard is just a matter of style or preference. However once you choose one you should stick to it.
Here's the standard I use now:
var functProto = Function.prototype;
var objectProto = Object.prototype;
var arrayProto = Array.prototype;

var boolProto = Boolean.prototype;
var numberProto = Number.prototype;
var stringProto = String.prototype;

var classProto = Class.prototype;
var rectProto = Rectangle.prototype;
var myClassProto = MyClass.prototype;

In general here are the guidelines for naming a prototype:

*

*It should be in camel case.

*It should end in Proto.

*If the abbreviation of the constructor name is more than 3 characters then use it.

*Otherwise use the full name of the constructor.

This keeps very long constructor names like Function, Boolean and Rectangle short while keeping longer names long.


text:
Q: Trying to find HLSL Compiler Googling for "HLSL compiler" and a few things, I'm frustratingly unable to find where to look for a standalone HLSL compiler for D3D9 so I can tell which lines are causing problems.
I can't see anything in my SDK but perhaps it has a name I am not recognising?

A: The HLSL compiler is called fxc.exe and is located in the DirectX SDK under Utilities.
The path on my system is:
C:\Program Files (x86)\Microsoft DirectX SDK (February 2010)\Utilities\bin\x64\fxc.exe

A: For HLSL Effects that you can use in XNA/DX (PS 2.0-3.0) you can try:
3DPee (Tridipy) player and shader editor
It operates on images and video.
It supports multi pass technique, vertext shader, and has a nice editor with error message reporting on compile.
It's an alpha version i have developed but it can be useful.
Screenshot:


text:
Q: Generate box.com upload widget programatically/automatically I have a project in which I want to generate upload widgets for different folders automatically (and by that I mean I want to generate them from my application, and not to go each time on Box.com website and manually click on the generate embeded widget code). Let me explain a bit: so, presume I have 1 account from which I want my users to interact with Box.com. I am working in a PHP environment, and I easily get my access token and my refresh token. I managed to comply a small library of cUrl requests for a simple file-handling process, but I recently saw that you can do it by widgets generated from box.com. The view/download widget is easy to generate for certain folders, but I'm having trouble with the upload widget. I need to access Box.com website and manually click some links to generate an uploading script.
Can I do it without manually clicking on links on the Box.com?
This is an example of generated upload widget from Box.com:
<script
src="https://YOUR_BOX_APP.app.box.com/embed/upload.js?token=TOKEN_GENERATED_FOR_UPLOAD&folder_id=YOUR_FOLDER_ID&w=385&h=385&i=&d=1&t=YOUR_TITLE&r=1"
type="text/javascript">
</script>

When I looked a bit inside that script, I saw that it uses the Box.com V1 uploading api, and not the V2 api.
As final questions:
How can I generate that token from within the script to actually map onto my folder id element?
Is there any default token that goes with any folder id I might use?
EDIT:
I guess I found my answer here, though it's not for a long time:
http://developers.box.net/w/page/35640290/APiFunction_toggle_folder_email

A: You can make the same request in V2:
curl https://api.box.com/2.0/folders/FOLDER_ID \
-H "Authorization: Bearer ACCESS_TOKEN" \
-d '{"folder_upload_email": {"access": "open"}}' \
-X PUT


text:
Q: Считывание с клавиатуры в Windows Forms С++ Как считать символ введенный с клавиатуры в Windows Forms С++(без из пользования консоли)?
Задача состоит в том, что при клике на Button, а затем нажатии на рандомную клавишу(допустим s), на Button появлялся символ с этой клавиши(s).

A: Microsoft Keyboard Layout Creator 1.4  либа UiPath Robot если надо прост измените названия


text:
Q: libsvm prediction problem using a generated model I have a question regarding libsvm predicting accuracy. I generated svm model file using easy.py. Now, when I am trying to predict the test vectors programatically in python, it shows wrongly predicted labels (all 1's) whereas, using easy.py I get an accuracy of 91%.
Each line of my test and train data is in the following format:
1 1:255 2:246 3:218 4:198 5:186 6:168 7:177 8:218 9:255 10:255 11:255 12:255 13:255 14:255 15:255 16:255 17:255 18:255 19:255 20:255 21:255 22:255 23:255 24:255 25:255 26:219 27:185 28:162 29:145 30:144 31:255 32:253 33:228 34:197

The code is as follows, am I doing anything wrong over here?
wimn_model = svm.svm_model("newtraindata.txt.model")
#load model
wimn_f_test=open('newtestdata.txt','r');
#load test data and train data
wimn_f_train=open('newtraindata.txt','r');

ii=0
for eachline in wimn_f_test:
        vec=eachline
        v=vec.split()
        vector={}
        ii=ii+1
        #print v[0]
        wimn_test_labels.append(int(v[0]))
        for i in range(1,len(v)):
                s=v[i].split(":")
                #print s[1]
                vector[i]=int(s[1])
        wimn_test_vectors.append(vector)
print "wimn test "+str(len(wimn_test_vectors))
# get the training and testing vectors and labels.
ii=0
for eachline in wimn_f_train:
        vec=eachline
        v=vec.split()
        vector={}
        ii=ii+1
        wimn_train_labels.append(int(v[0]))
        #print v[0]
        for i in range(1,len(v)):
                s=v[i].split(":")
                #print s[1]
                vector[i]=int(s[1])
        wimn_train_vectors.append(vector)
print "wimn train "+str( len(wimn_train_vectors))

s=len(wimn_train_labels)
for i_s in range(0,s):
        #print i_s
        ww.append(wimn_model.predict(wimn_train_vectors[i_s]))

# wrongly predicted labels are in ww. correct labels are in wimn_train_labels, wimn_test_labels.

A: One needs to load the scaled input values in order to get the predicted values. The problem got solved.
But there seems to be some dis-similarity between easy.py generated predicted labels and the ones when I load a model and predict the labels.
There is no proper documentation on libsvm on the web.


text:
Q: Display Different Content from a Post In Different Pages (The Post and the Index Page) Let's say I have a MarkDown file which is a post in a Jekyll static web site. It resides in _posts and it is named 2020-05-16-my-post.md. Assume its content is given by:
---
title: 'My Post'
date:   2020-05-16
author: My Name
layout: post
class:  news
---
This is the 1st sentence which is should appear both on the index page and the post.
This is the 2nd sentence which should appear only on the index page.
This is the 3rd sentence which should appear only on the post.
This is the 4th sentence which should appear on both.

This is the beginning of the 2nd paragraph...

So in the 1st paragraph we have 4 sentences. Which I want some of them to appear only in the index page (2nd sentence) some of them only in the post (3rd) and the rest on both.
Let's assume that in the index page I use something like:

  {% for post in site.posts %}

      {{ post.title }}
      {{ post.excerpt }}

  {% endfor %}

So in the index page it uses what's in the 1st paragraph of the page (As I didn't explicitly define the excerpt tag).
I thought I could do something like that:
This is the 1st sentence which is should appear both on the index page and the post.
{% if page.layout == "index" %}
This is the 2nd sentence which should appear only on the index page.
{% endif %}
{% if page.layout == "post" %}
This is the 3rd sentence which should appear only on the post.
{% endif %}
This is the 4th sentence which should appear on both.

This is the beginning of the 2nd paragraph...

But it seems Jekyll renders the page only in single context (Of its explicit YAML).
Is there a way to do so? Namely different pages will draw different rendering of the content?
Remark
I am aware of the options to use excerpts and excerpt_separator. Yet they are not satisfying in my use case.


text:
Q: After reducing Mutt storage size, how do I get that storage reflected back into df My goal is to get back the storage space in my opt directory.
I want to be able to see it growing in size so that regular maintenance checks mean I can down size it when space is needed.
Before I removed mail from mutt I got this disk size output (abreviated):
Filesystem          1K-blocks      Used Available Use% Mounted on
/dev/sda1            38314216  12189488  24155376  34% /
/dev/sda3           144053404 133666076   3046736  98% /opt
192.168.1.161:/home 237256704  51089408 175959040  23% /opt/www/etl/sftp-homes

Opt drive is low on space (as above):
So I removed old emails (logging), using this
>mutt
shift + D
~d>4m
q

This looked like it worked within mutt, as mutt seemed to do its job of removing said files.
but df does not give me any of that space back, it is still exactly the same.
I assume mutt is hold the file size and possibly needs to be restarted???
or mariadb needs to be restarted/cleaned to release the dbase size???
Or does Centos need to be restarted??? (seems extreme)
How do I regain that disk space, or is there another clean up solution here.
FYI, I could not find a way to restart mutt?
and restarting mariadb did not work. the majority of the file is held in ibdata1

A: Seems this is a problem with mariadb.
https://stackoverflow.com/questions/3456159/how-to-shrink-purge-ibdata1-file-in-mysql
https://www.thegeekstuff.com/2016/02/mysql-innodb-file-per-table/
Here is the detail stating the same problem, and that it is too hard:
There is a major drawback with the default big MySQL system tablespace approach.
Take this scenario as an example: You've uploaded 100GB worth of data into multiple tables in your MySQL.
Now, the ibdata1 file size will be around 100GB+.
# cd /var/lib/mysql

# ls -lh ibdata1
-rw-r-----. 1 mysql mysql 101G Jan 21 21:10 ibdata1

After few days, you deleted around 50GB worth of data from all those tables. The ibdata1 file size will not be reduced to around 50GB+, it will still stay at around 100GB+.
In the above case, later when you add 10GB worth of data to the tables, the ibdata1 file size doesn't grow to 110GB, and stays at 100GB. Because, the file still has the unused space inside from the above 50GB of deleted data.
The problem is, you can't reclaim those unused space after you delete the 50GB of data from ibdata1 file. There is a way to do it, but is too complicated, and involves taking the MySQL database down, and dropping all tables etc.


text:
Q: String vs StringBuilder - Number of objects I came across two code snippets which were creating a query to be executed further:
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("SELECT * FROM EMPLOYEE ");
stringBuilder.append("WHERE SALARY > ? ");
stringBuilder.append("GROUP BY DEPT");

And
String string = "SELECT * FROM EMPLOYEE " +
"WHERE SALARY > ? " +
"GROUP BY DEPT";

According to my analysis, both the snippets create 4 objects. First snippet creates a StringBuilder object and 3 string objects while the second snippet creates 4 String objects. Is my analysis correct?
How snippet one is more efficient than snippet 2?

A: Your first analysis is correct, but second snippet creates only one String Object. Because, it's a compile time concatenation of Strings literals.

A: Not exactly...
The first version creates 1 StringBuilderevery execution and 3 String constants (created/interned once per JVM start). It will create another String object every execution when you go to use the value via stringBuilder.toString().
The second creates 1 String constant (created/interned once per JVM start) because the value of the entire concatenation is known at compile time. It is equivalent in effect to:
String string = "SELECT * FROM EMPLOYEE WHERE SALARY > ? GROUP BY DEPT";

A: The StringBuilder example will create 4 objects.
Whereas the second example will just create one String object. Even though you have concatenated 3 String literals, model Java compilers are smart enough to detect that you have concatenated static String literals and thus will append all of them into one and create a single String object.
Therefore,
String string = "SELECT * FROM EMPLOYEE " +
"WHERE SALARY > ? " +
"GROUP BY DEPT";

is same as
String string = "SELECT * FROM EMPLOYEE WHERE SALARY > ? GROUP BY DEPT";

A: Strings are immutable so each time you do a concatenation (. operator) you're creating a new String object in memory. With StringBuilder you're adding the text to the same object so a new ones do not need to be created.

A: The first snippet create 1 object. It's concatenate in compile-time.
StringBuilder has better performance when you are concatenating mutable strings. For example, with your example:
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("SELECT * FROM EMPLOYEE ");
if(salary > 0) {
    stringBuilder.append("WHERE SALARY > ? ");
}
if(group == true) {
    stringBuilder.append("GROUP BY DEPT");
}

String string = "SELECT * FROM EMPLOYEE ";
if(salary > 0) {
    string = string + "WHERE SALARY > ? ";
}
if(group == true) {
    string = = string + "GROUP BY DEPT";
}


text:
Q: Why does $L \cap (M + N) = (L \cap M) + (L \cap N) $ not hold for subspaces Let $L$, $M$, and $N$ are subspaces of a vector space. Prove that following is not necessarily true.
$L \cap (M + N) = (L \cap M) + (L \cap N) $
This problem is given in 'Finite dimensional vector spaces' by Halmos. I was using 'if a vector belongs to L.H.S. then it must belong to R.H.S and vice versa' argument. Neither I can disprove it using this argument nor I could find a case where this is wrong!

A: Try it in $\mathbb{R}^3$ with $M,N$ subspaces such that $M + N = \mathbb{R}^3$, such as $M$ being the $xy$ plane and $N$ the $z$ axis. Then $L\cap (M + N) = L$, but you should be able to find some $L$ (such as a slanted plane) for which $(L\cap M) + (L\cap N)$ is a strict subset of $L$.


text:
Q: Can Video capture in windows media foundation used for screen capturing? can desktop screen be captured using Video capture in windows media foundation.
After reading windows developer guide, it seems it is used for capturing video from devices such camera or other external devices.
If yes, is it hardware accelerated API or software base?

A: For desktop screen capture you should look at the output duplication feature implemented through IDXGIOutputDuplication. What you do is obtain the DXGI object for the video adapter you need, enumerate the outputs to find the needed one (or all if you do a simultaneous capture from multiple screens) and duplicate it through a call to IDXGIOutput1::DuplicateOutput. The duplication gives you access to the GPU video surface that can be mapped to CPU readable memory - so yes it is accelerated.
Here is a complete sample from Microsoft on this matter.

A: I see that you need resolve very specific task and I think that there is a solution which is very close to your needs. On site "CodeProject" there is article "CaptureManager SDK". It includes interesting example code for streaming desktop screen and output speaker buffer by Media Foundation. It can stream to web browser by MP4 format. I think you can find it interesting.


text:
Q: Elasticsearch query existence of field of dictionary I am having troubles with an exist query in Elasticsearch.
My docuemnts have a inner object (a dictionary mapping strings to float values).
I want to query the inner dictionary for the existance of a specific string and weight the result with the float value that is mapped to that string.
At the moment I was trying
  "query": {
     "nested": {
       "path": "words",
       "query": {
         "function_score": {
           "query": {
             "exists": {
               "field": term
             }
           },
           "functions": [
             {
               "field_value_factor": {
                 "field": term
               }
             }
           ]
         }
       }
     }
  },

Where words is the dictionary and term is the string I am looking for.
This however is not working
{"type":"illegal_state_exception","reason":"[nested] nested object under path [words] is not of nested type"}}}]},"status":400}',

Does anyone know why?
Edit:
Elasticsearch version: oss 6.1.3.
As for the structure it is more difficult, however it is something like:
Doc:
  _id: 1
  words:
    string1: value1
    string2: value2

Edit2: Fixed a problem with parenthesis, now the error makes more sense, but still I don't know why it's not working


text:
Q: Genatragted MySQL table name by Hibernate is different I am generating MySQL table by Hibernate as follows:-
    @Entity
    @Table(name = "buyerPartyDetails")
    public class BuyerPartyDetails {
    .......
    }

But in MySQL the actual table name is as  buyerpartydetails I was expecting it should be buyerPartyDetails. How do I force hibernte to genarate table name as my espection?

A: You can force Hibernate to quote the identifiers by setting:
hibernate.globally_quoted_identifiers=true

or
hibernate.globally_quoted_identifiers_skip_column_definitions=true

which will generate quoted table names in DDL. It might however require SET GLOBAL SQL_MODE=ANSI_QUOTES; as by default MySQL uses backticks  ` to quote the names.


text:
Q: Out of bounds exception on array that has not been initialized to a specific size C# Coding for unity
I have several arrays set as such.
public float[] arrayName;

no set number of elements anywhere in my code
I can access the arrays up to 6 no problems but when I get to 7 I get an out of bounds exception.
No where in my code does it initialize them to a specific amount and even when I try
public float[] arrayName = new float[8]

for instance then run a debug log to get the length
I still get 7 and cannot access past 6. I am far from an expert.
Here is the thing...
I also have a couple texture 2d arrays...
public Texture2D[] arrayName;

which I was having the same problem with but when I set them like this
public Texture2D[] arrayName = new Texture2D[8];

all is fine.
I am so confused...
I have also tried this.
public float[] array name = new float[] {1f, 2f, 3f, 4f ,5f, 6f, 7f, 8f}

etc. same result
Somehow my arrays are being limited to 7. As I am asking this I am going to try creating new arrays which will be initialized like such
public float[] newArrayName = new float[8];

and see what happens. But I would love to learn what I am obviously doing wrong or not understanding. Thanks
These are my arrays. All work perfect up to when I try to access 7. Then Get out of bounds errors.
 public Texture2D[] terrainTexture;
public Texture2D[] terrainTextureNormal;
public float[] normalScale;
public Color[] specular;
public float[] metallic;
public float[] smoothness;
public float[] maxHeight;
public float[] minHeight;
public float[] maxSteepness;
public float[] minSteepness;
public float[] weight;
public float[] blend;

The code I use to assign the control settings to the arrays. All do as expected 0 to 6
#region Texture One Foldout
terrain.showTextureOne = EditorGUILayout.Foldout(terrain.showTextureOne, "   Texture One", EditorStyles.boldLabel);
if (terrain.showTextureOne)
{
        GUILayout.Space(20);
        terrain.terrainTexture[0] = (Texture2D)EditorGUILayout.ObjectField("Diffuse", terrain.terrainTexture[0], typeof(Texture2D), true);
        GUILayout.Space(2);
        terrain.terrainTextureNormal[0] = (Texture2D)EditorGUILayout.ObjectField("Normal Map", terrain.terrainTextureNormal[0], typeof(Texture2D), true);
        GUILayout.Space(6);
        terrain.normalScale[0] = EditorGUILayout.Slider("Normal Scale", terrain.normalScale[0], 0f, 1f);
        GUILayout.Space(10);
        terrain.metallic[0] = EditorGUILayout.Slider("Metallic",terrain.metallic[0], 0f, 1f);
        GUILayout.Space(10);
        terrain.smoothness[0] = EditorGUILayout.Slider("Smoothness", terrain.smoothness[0], 0f, 1f);
        GUILayout.Space(10);
        terrain.maxHeight[0] = EditorGUILayout.Slider("Max Height", terrain.maxHeight[0], 0f, terrain.terrainHeight);
        GUILayout.Space(10);
        terrain.minHeight[0] = EditorGUILayout.Slider("Min Height", terrain.minHeight[0], 0f, terrain.terrainHeight);
        GUILayout.Space(10);
        terrain.maxSteepness[0] = EditorGUILayout.Slider("Max Steepness",terrain.maxSteepness[0], 0, 90);
        GUILayout.Space(10);
        terrain.minSteepness[0] = EditorGUILayout.Slider("Min Steepness", terrain.minSteepness[0], 0, 90);
        GUILayout.Space(10);
        terrain.weight[0] = EditorGUILayout.Slider("Weight", terrain.weight[0], 0f, 1f);
        GUILayout.Space(10);

        terrain.size[0] = EditorGUILayout.Vector2Field("Size", terrain.size[0]);
        terrain.offset[0] = EditorGUILayout.Vector2Field("Offset", terrain.offset[0]);
        GUILayout.Space(10);
        GUILayout.BeginHorizontal();

        if (GUILayout.Button("Set Properties"))
        {
            terrain.ModifyTextures();
        }
        if (GUILayout.Button("Save Properties"))
        {
            terrain.SaveEditorSettings();
        }
        GUILayout.EndHorizontal();

    }

When I copy paste working code and simply modify 6 to 7 for example which is all that is and has been needed, chaos! :) Example notice the Texture2D Arrays modified and work with no errors. Arrays declared exactly the same but as you can see I change one 6 to 7 as in the normalScale line, nothing but out of bounds errors. There have been other things I have forgotten to change in other code which has caused this but I have painstakingly made sure that is not the problem.
#region Texture Eight Foldout
terrain.showTextureEight = EditorGUILayout.Foldout(terrain.showTextureEight, "   Texture Eight", EditorStyles.boldLabel);
    if (terrain.showTextureEight)
    {
        GUILayout.Space(20);
        terrain.terrainTexture[7] = (Texture2D)EditorGUILayout.ObjectField("Diffuse", terrain.terrainTexture[7], typeof(Texture2D), true);
        GUILayout.Space(2);
        terrain.terrainTextureNormal[7] = (Texture2D)EditorGUILayout.ObjectField("Normal Map", terrain.terrainTextureNormal[7], typeof(Texture2D), true);
        GUILayout.Space(6);

        terrain.normalScale[7] = EditorGUILayout.Slider("Normal Scale", terrain.normalScale[7], 0f, 1f);
        GUILayout.Space(6);
        terrain.metallic[6] = EditorGUILayout.Slider("Metallic", terrain.metallic[6], 0f, 1f);
        GUILayout.Space(10);
        terrain.smoothness[6] = EditorGUILayout.Slider("Smoothness", terrain.smoothness[6], 0f, 1f);

This is my custom editor. One through 7 work as planned. Click 8 and ... ?


text:
Q: What's the meaning of idiom 'one less thing'? What's the meaning of "one less thing" in the following sentence.

That's one less thing you'll have to think about in launching a
  business.

Thanks in advance.

A: When you launch a business you have to think about many things—a long list of things.
Every time you encounter a new problem, you add it to the list. The list is longer by one, and you have one thing more or one more thing to think about. And
Each time you are able to cross something off that list, the list grows shorter by one. That's one thing less or one less thing you have to think about.

A: I think it means:
That you have lots of things to think about in launching a business; and this is one of those many things that you don't have to think about.
*PS---(I am not a teacher nor an expert, so don't really count on that answer).

A:
That's one less thing you'll have to think about in launching a business.

Means:
You don't have to think about that thing when launching a business. It's probably already done,  or something not to be done at all, so you don't have to think about it anymore.


text:
Q: "Project coverage is set to 0%" – JaCoCo and Sonar in Jenkins with Ant I moved my job from a single Hudson machine to a multi-slave Jenkins environment, and now JaCoCo coverage no longer works.
WORKING (old):
Hudson 2.0.1,
Jenkins Sonar Plugin 1.7.1,
Sonar 2.1.2
BROKEN (new):
Jenkins 1.446,
Jenkins Sonar Plugin 1.7.2,
Sonar 2.1.2
My Hudson job is called Pinnacle and it used to run on a single Hudson server with Sonar on the same machine. I set up my (NO MAVEN) build by doing the following.
1) Added an Ant target to my build.xml called test-with-coverage
2) Configured the Pinnacle job in Hudson to "invoke standalone Sonar Analysis" with these properties:
sonar.projectKey=com.skyboximaging:pinnacle
sonar.projectName="Pinnacle"
sonar.projectVersion=1.0
sources=Pinnacle/src/java
tests=Pinnacle/test/java
binaries=Pinnacle/classes
sonar.jacoco.reportPath=Pinnacle/jacoco.exec
sonar.jacoco.antTargets=test-with-coverage

(Note that the code is checked out into Pinnacle directory in the Jenkins job workspace.)
3) Configured Sonar "general settings" to use JaCoCo for code coverage
Everything worked beautifully!
But in the new Jenkins environment, I see this error in the Jenkins build output:
23:15:17.863 INFO  Sensor JaCoCoSensor...
23:15:17.868 INFO  Project coverage is set to 0% as no JaCoCo execution data has been dumped: /var/lib/jenkins/workspace/Pinnacle/Pinnacle/jacoco.exec

That file does not exist on the slave where the build ran. (The directory /var/lib/jenkins/workspace/Pinnacle/Pinnacle does exist.)
All other sensors (FindBugs, PMD, etc) appear to be working OK. Just JaCoCo is broken.
Does Sonar/JaCoCo even work in a multi-slave Jenkins environment?
I suspect that the Ant task test-with-coverage is not getting run. How does Sonar locate the build.xml? And what is different between old and new installations?

A: I've recently setup and successfully got Sonar and Jacoco running together. Since I'm recent with the topic, I figured I'd check on stackoverflow for similar issues and help out. I am getting results from Jacoco, but found you had to explicitly set the following parameters in addition to the properties you've listed in your post:
sonar.core.codeCoveragePlugin=jacoco
sonar.jacoco.reportPath=tests/jacoco-exec/jacoco.exec
sonar.dynamicAnalysis=reuseReports
sonar.surefire.reportsPath=tests/test-reports

You have to set sonar.core.codeCoveragePlugin=jacoco if you want to be able to use the sonar.jacoco.reportPath property. Otherwise, you will have to use the sonar.jacoco.itReportPath property. However, I recommend just setting the codeCoveragePlugin and reportPath properties. Otherwise, it won't display under the default coverage widget in sonar. Please make note, you cannot use the default coverage tool and jacoco together. It has to be one or the other. I decided to use Jacoco.
Your ant target must be configured to generate the jacoco.exec results prior to running the sonar tasks:
<jacoco:coverage enabled="${tests.code.coverage}" destfile="${jacoco.exec.dest}">
  <junit fork="yes" printsummary="withOutAndErr" dir="${tests.working.dir}">
  ...

Be sure to tell sonar to reuse reports and any sunfire reports if you're running junit before sonar, that is if you're running junit outside of sonar:
sonar.dynamicAnalysis=reuseReports
sonar.jacoco.reportPath=tests/jacoco-exec/jacoco.exec
sonar.surefire.reportsPath=tests/test-reports

For whatever reason, if you need more verbose debugging, use the following property:
sonar.verbose=true


text:
Q: how to pass an object to a directive template in angularjs? I am trying to make a re-usable directive with ui-bootstrap modal.
It's almost working except the options
here is the directive :
directive('update', function() {
return {
  restrict: "E",
  templateUrl: "tplModal.html",
  scope: {
    selected:"="
  },
  link: function(scope, elm, attr){
    scope.open = function (obj) {
      scope.shouldBeOpen = true;
    };

    scope.close = function () {
      scope.shouldBeOpen = false;
    };

    scope.opts = {
      backdropFade: true,
      dialogFade:true
    };
  }
}

})
and tplModal.html
<button class='btn' ng-click='open(selected)'>Update</button>

 {{selected.name}}

            <button class="btn btn-warning cancel" ng-click="close()">Cancel</button>

despite the scope.opts, there is no fade effect.
here is the whole code :
http://plnkr.co/edit/Ab4BOH?p=preview
what am i doing wrong ?

A: The problem is that you add opts property to scope in the post-linking function, which will be called after modal directive's linking function, so the modal directive will never get those options.
The solution is to move scope.opts = ... to pre-linking function:
directive('update', function() {
    return {
        ...
        compile: function() {
            return {
                pre: function(scope, elm, attr){
                    ...
                    scope.opts = {
                        backdropFade: true,
                        dialogFade: true
                    };
                }
            };
        }
    }
}

http://plnkr.co/edit/iZaEiM?p=preview


text:
Q: If one rounds digits one by one starting from the end, then is the rounding same as when "cut-offing" around required the precision? If one rounds digits one by one starting from the end, then is the rounding same as when "cut-offing" around required the precision?
That is does (for $1/10^3$):
$0.84562...4356 \rightarrow 0.8456 \rightarrow 0.846$
produce the same as
$0.84562...4356 \rightarrow 0.84562...436$
$ \rightarrow 0.84562...44 \rightarrow 0.84562...4$
up until: $\rightarrow 0.846$

A: No, you cant't use these methods equivalently.
For example by the sequence of rounding we have:
$$.846 \approx .85 \approx .9$$
while the single rounding (which is the proper method) gives us:
$$.846 \approx .8$$


text:
Q: Load only specific functions from include file My guess is no, but just asking to make sure.
It would be great if I could instead of including a big beats of a file with lots of functions I don't need only load functions I need from it.
Like: Include function_xyz and function_123 from file.php.
I cant edit the file I am including from its from another software
Sidequestion: could I unload this functions after? If yes would that make sense memory and performance wise since they are loaded and then unloaded.

A: The best way would be to split your file into smaller files with less functions.
Howerver, if you want to keep all your functions inside a big file,
you can declare your functions inside an if statement :
if($shouldIDeclareThisFunction) {
    function myFunc() {
         //do stuff
    }
}

A: Try this:
index.php
<?php

    $checkFlag = true;

    include 'inc.php';
?>

inc.php
<?php

if ($checkFlag == true) {

    function test1() {

    }

    function test2() {

    }

} else {

    function test3() {

    }

}
?>

Do like this.


text:
Q: Issues in preserving Excel formatting with Python's xlrd and xlutils Simply put, I would like to preserve all of the formatting of one Excel file into another. However, despite using the formatting_info=True flag, the formatting only appears for all of the unchanged cells within the changed row. Any advice?
import xlrd, xlutils
from xlrd import open_workbook
from xlutils.copy import copy

inBook = xlrd.open_workbook(r"path/to/file/format_input.xls", formatting_info=True, on_demand=True)
outBook = xlutils.copy.copy(inBook)

outBook.get_sheet(0).write(0,0,'changed!')
outBook.save(r"path/to/file/format_output.xls")

enter image description here

A: xlwt.write accept style informations as its third argument. Unfortunately, xlrd and xlwt use two very different XF object format. So you cannot directly copy the cell's style from the workbook read by xlrd to the workbook created by xlwt.
The workaround is the use an xlutils.XLWTWriter to copy the file, and then get back the style informations of that object to save the style of the cell you will update.
First you need that patch function by John Machin provided in a very similar question:
from xlutils.filter import process,XLRDReader,XLWTWriter

#
# suggested patch by John Machin
# https://stackoverflow.com/a/5285650/2363712
#
def copy2(wb):
    w = XLWTWriter()
    process(
        XLRDReader(wb,'unknown.xls'),
        w
        )
    return w.output[0][1], w.style_list

Then in you main code:
import xlrd, xlutils
from xlrd import open_workbook
from xlutils.copy import copy

inBook = xlrd.open_workbook(r"/tmp/format_input.xls", formatting_info=True, on_demand=True)
inSheet = inBook.sheet_by_index(0)

# Copy the workbook, and get back the style
# information in the `xlwt` format
outBook, outStyle = copy2(inBook)

# Get the style of _the_ cell:
xf_index = inSheet.cell_xf_index(0, 0)
saved_style = outStyle[xf_index]

# Update the cell, using the saved style as third argument of `write`:
outBook.get_sheet(0).write(0,0,'changed!', saved_style)
outBook.save(r"/tmp/format_output.xls")

A: I had similar issues while using openpyxl - for some reason this just doesn't seem to handled very well in the modules available. I ended up just restyling the cells as needed after I had input my data, using the syntax below:
#Formatting
from openpyxl.styles import Style, Color, PatternFill, Alignment, Font, NumberFormat
#Allows for conditional formatting
from openpyxl.formatting import CellIsRule #Allows for Conditional Formatting

for cell in changed_cells:
    cell.style = Style(fill=PatternFill(patternType='solid', fgColor=Color('FFff8888')),
                         font=Font(name="Arial",size=11),
                         alignment=Alignment(horizontal="center"))

Info on the syntax for implementing this kind of thing with xlrd can be found here.


text:
Q: Custom excel date I'm a newbie here after being promoted to an office role after being a service Engineer,
What I wish to achieve is a self-populating cell as below
Sun 2 Mar to Sat 8 Mar 2014
The next cell would read
Sun 9 Mar to Sat 15 Mar 2014
If anyone can help I be so great full
How do I input self-learning in to excel
Many thanks to all that view & help

A: In A1 enter:
=TEXT(DATE(2014,3,2)+7*(ROW()-1),"ddd d mmm") &  " to " & TEXT(DATE(2014,3,2)+7*ROW()-1,"ddd d mmm yyyy")

and copy down

A: This formula can be copied horizontally:
=TEXT(DATE(2014,3,2)+7*(COLUMN()-1),"ddd d mmm") &  " to " & TEXT(DATE(2014,3,2)+7*COLUMN()-1,"ddd d mmm yyyy")

EDIT #1:
This formula has the time as well:
="8 am " & TEXT(DATE(2014,3,2)+7*(COLUMN()-1),"ddd d mmm") &  " to 8 am " & TEXT(DATE(2014,3,2)+7*COLUMN()-1,"ddd d mmm yyyy")


text:
Q: Finding multiple substrings using boundaries in Java Alright so here is my problem. Basically I have a string with 4 words in it, with each word seperated by a #. What I need to do is use the substring method to extract each word and print it out. I am having trouble figuring out the parameters for it though. I can always get the first one right, but the following ones generally have problems.
Here is the first piece of the code:
word = format.substring( 0 , format.indexOf('#') );

Now from what I understand this basically means start at the beginning of the string, and end right before the #. So using the same logic, I tried to extract the second word like so:
wordTwo = format.substring ( wordlength + 1 , format.indexOf('#') );
//The plus one so I don't start at the #.

But with this I continually get errors saying it doesn't exist. I figured that the compiler was trying to read the first # before the second word, so I rewrote it like so:
wordTwo = format.substring (wordlength + 1, 1 + wordLength + format.indexOf('#') );

And with this it just completely screws it up, either not printing the second word or not stopping in the right place. If I could get any help on the formatting of this, it would be greatly appreciated. Since this is for a class, I am limited to using very basic methods such as indexOf, length, substring etc. so if you could refrain from using anything to complex that would be amazing!

A: If you have to use substring then you need to use the variant of indexOf that takes a start. This means you can start look for the second # by starting the search after the first one. I.e.
wordTwo = format.substring ( wordlength + 1 , format.indexOf('#', wordlength + 1 ) );

There are however much better ways of splitting a string on a delimiter like this. You can use a StringTokenizer. This is designed for splitting strings like this. Basically:
StringTokenizer tok = new StringTokenizer(format, "#");
String word = tok.nextToken();
String word2 = tok.nextToken();
String word3 = tok.nextToken();

Or you can use the String.split method which is designed for splitting strings. e.g.
String[] parts = String.split("#");
String word = parts[0];
String word2 = parts[1];
String word3 = parts[2];

A: You can go with split() for this kind of formatting strings.
For instance if you have string like,
String text = "Word1#Word2#Word3#Word4";

You can use delimiter as,
String delimiter = "#";

Then create an string array like,
  String[] temp;

For splitting string,
temp = text.split(delimiter);

You can get words like this,
temp[0] = "Word1";
temp[1] = "Word2";
temp[2] = "Word3";
temp[3] = "Word4";

A: Use split() method to do this with "#" as the delimiter
String  s = "hi#vivek#is#good";
String temp = new String();

String[] arr = s.split("#");

for(String x : arr){

  temp = temp + x;
}

Or if you want to exact each word... you have it already in arr
arr[0] ---> First Word
arr[1] ---> Second Word
arr[2] ---> Third Word

A: I suggest that you've a look at the Javadoc for String before you proceed further.
Since this is your homework, I'll give you a couple of hints and maybe you can solve it yourself:

*

*The format for subString is public void subString(int beginIndex, int endIndex). As per the javadoc for this method:

Returns a new string that is a substring of this string. The substring
  begins at the specified beginIndex and extends to the character at
  index endIndex - 1. Thus the length of the substring is
  endIndex-beginIndex.

Note that if you've to use this method, understand that you'll have to shift your beginIndex and endIndex each time because in your situation, you'll have multiple words that are separated by #.

*

*However if you look closely, there's another method in String class that might be helpful to you. That's the public String[] split(String regex) method. The javadoc for this one states:

Splits this string around matches of the given regular expression.
  This method works as if by invoking the two-argument split method with
  the given expression and a limit argument of zero. Trailing empty
  strings are therefore not included in the resulting array.

The split() method looks pretty interesting for your case. You can split your String with the delimiter that you have as the parameter to this method, get the String array and work with that.
Hope this helps you to understand your problem and get started towards a solution :)

A: Since this is a home work, it may be better to have try to write it your self. But I will give a clue.
Clue:

The indexOf method has another overload: int indexOf(int chr,
  int fromIndex) which find the first character chr in the string
  from the fromIndex.

http://docs.oracle.com/javase/1.4.2/docs/api/java/lang/String.html
From this clue, the program will look something like this:

*

*Find the index of the first '#' from the start of the string.

*Extract the word from 0th character to that index.

*Find the index of the first '#' from the character AFTER the first '#'.

*Extract the word from the first '#' that index.
... Just do it until you get 4 words or the string ends.

Hope this helps.

A: I don't know why you're forced to use String#substring, but as others have mentioned, it seems like the wrong method for the kind of functionality you need.
String#split(String regex) is what you would use for such a problem, or, if your input sequence is something you don't control, I would suggest you look at the overloaded method String#split(String regex, int limit); this way you can impose a limit on the amount of matches you make, controlling your resulting array.


text:
Q: Перемещение кнопки по форме мышью в WPF Как можно реализовать перемещение кнопки мышью по форме?
Ранее я это делал в WinForm вот так:
bool iMove = false;
Point dot;
void nazatie(object sender, MouseEventArgs e)///MouseDown
{
    Button temp = sender as Button;
    if(e.Button == MouseButtons.Left)
    {
        iMove = true;
        dot = e.Location;
    }
}

void naved(object sender, MouseEventArgs e)///MouseMove
{
    Button temp = sender as Button;
    if (iMove)
    {
        temp = (Button)sender;
        temp.Top += e.Y - dot.Y;
        temp.Left += e.X - dot.X;
    }
}

Как перемещение кнопки можно сделать в wpf, используя мышь?

A: В WPF идея такая же: запоминать точку клика и двигать по дельте. Нюанс в том, что контролы имеют абсолютные координаты только внутри Canvas (ну или с помощью отступов).
MainWindow.xaml
<Window x:Class="MouseMovableControl.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
    <Canvas>
        <Label x:Name="btn" Content="Movable"
               MouseDown="Btn_OnMouseDown"
               MouseMove="Btn_OnMouseMove"
               MouseUp="Btn_OnMouseUp" />
    </Canvas>
</Window>

MainWindow.xaml.cs
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;

namespace MouseMovableControl
{
    public partial class MainWindow
    {
        private Point? _movePoint;

        public MainWindow() => InitializeComponent();

        private void Btn_OnMouseDown(object sender, MouseButtonEventArgs e)
        {
            _movePoint = e.GetPosition(btn);
            btn.CaptureMouse();
        }

        private void Btn_OnMouseUp(object sender, MouseButtonEventArgs e)
        {
            _movePoint = null;
            btn.ReleaseMouseCapture();
        }

        private void Btn_OnMouseMove(object sender, MouseEventArgs e)
        {
            if (_movePoint == null)
                return;
            var p = e.GetPosition(this) - (Vector)_movePoint.Value;
            Canvas.SetLeft(btn, p.X);
            Canvas.SetTop(btn, p.Y);
        }
    }
}

Конкретно батоны двигать несколько затруднительно, потому что они проглатывают сообщения о кликах мыши.


text:
Q: Possible bug with FourierTransform linearity Each component is easily transformed but the sum is not:
FourierTransform[f''[x], x, k]
FourierTransform[f'[x], x, k]

-k^2 FourierTransform[f[x], x, k]
-I k FourierTransform[f[x], x, k]

FourierTransform[f''[x] + f'[x], x, k]

FourierTransform[f'[x] + f''[x], x, k] (*!!*)

LaplaceTransform behaves correctly:
LaplaceTransform[f''[x] + f'[x], x, k]

-f[0]-k f[0]+k LaplaceTransform[f[x],x,k] + k^2 LaplaceTransform[f[x],x,k] - f'[0]

Just in case. Win7 V9.0.1.0
As acl has noticed on chat, Distribute would be quick fix but not sure how stable for more complicated cases:
Distribute[ FourierTransform[f''[x] + f'[x], x, k]]

-I k FourierTransform[f[x],x,k]-k^2 FourierTransform[f[x],x,k]

A: We can find examples where linearity does not apply - it is conditional upon the relevant transforms existing (e.g. for reasons of convergence).  For example
expr1 = FourierTransform[f'[x] - f[x], x, k]
(* FourierTransform[-f[x] + Derivative[1][f][x], x, k] *)

expr2 = Distribute@expr1
(* FourierTransform[-f[x], x, k] - I k FourierTransform[f[x], x, k] *)

Block[{f = Exp}, {expr1, expr2}]
(* {0, FourierTransform[-E^x, x, k] - I k FourierTransform[E^x, x, k]} *)

Distribution is not valid as the transform of $e^x$ does not exist.  I can therefore understand why this simplification is not enabled by default, though I'm sure that in other areas Mathematica makes assumptions that are far more questionable.
It is arguable that analogy with LaplaceTransform would suggest that distribution should take place, though analogy with Integrate would lead to the opposite conclusion.  Automatic distribution of Integrate would cause problems for many sensible integrands.
In this case, I see the following differences between Fourier and Laplace transforms:

*

*Fourier transforms are undefined for a much larger range of
interesting functions than Laplace transforms, increasing the risk
that distribution leads to an unexpected result.

*Applications I'm aware of for Laplace transforms (e.g. solving
differential equations) almost invariably require distribution over
Plus. Fourier transforms have a much wider range of uses.

*Laplace transforms are more "Applied Maths" than Fourier transforms.  Applied mathematicians have different expectations of correctness.


text:
Q: Doctrine\Persistence\Mapping\MappingException: File mapping drivers must have a valid directory path, however the given path seems to be incorrect I'm running unit tests via docker like thus
doby phpunit
docker-compose run --rm -v $SSH_AUTH_SOCK:/tmp/ssh_auth_sock -e SSH_AUTH_SOCK=/tmp/ssh_auth_sock php bash -c 'bin/phpunit --filter SendEmailsCommandTest'
I receive the following error
Doctrine\Persistence\Mapping\MappingException: File mapping drivers must have a valid directory path, however the given path [/var/source/application/models/Content.php] seems to be incorrect!
Content.php
<?php
namespace MyDomain\Model;

use Exception as ModelException;
use Doctrine\ODM\MongoDB\Mapping\Annotations as ODM;

/**
 * @ODM\Document(
 *     db="mydb",
 *     collection="Content"
 * )
 */
class Content
{
    /** @ODM\Id */
    protected $id;
    /**
     * @ODM\Field(type="string")
     */
    protected $contentId;
    /**
     * @ODM\Field(type="string")
     */
    protected $content;
...
}

I've logged into the running docker container and the files exist in the path above.
/var/source/application/models
- Content.php
- ...

Has anyone had a similar problem running tests through docker and doby?


text:
Q: CGBitmapContextCreate: unsupported parameter combination I'm getting this error when creating a bitmap context:
CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 24 bits/pixel; 3-component color space; kCGImageAlphaNone; 7936 bytes/row.
Here's the code (note that the context is based on the parameters of an existing CGImage:
context = CGBitmapContextCreate(NULL,
                                (int)pi.bufferSizeRequired.width,
                                (int)pi.bufferSizeRequired.height,
                                CGImageGetBitsPerComponent(imageRef),
                                0,
                                CGImageGetColorSpace(imageRef),
                                CGImageGetBitmapInfo(imageRef));

Width is 2626, height is 3981. I've leaving bytesPerRow at zero so that it gets calculated automatically for me, and it's chosen 7936 of its own accord.
So, where on Earth is the inconsistency? It's driving me nuts.

A:
CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 24 bits/pixel; 3-component color space; kCGImageAlphaNone; 7936 bytes/row.

In the Quartz 2D Programming documentation is a list of the supported pixel formats. The 8/3/24 combination is not supported but 8/3/32 is, independent of using alpha or not.

A: Heinrich gave you a good background to the answer. Just thought I'd offer up my specific case, as an alternative to tarmes' answer. The problem with that answer is that it doesn't solve the issue if you want an alpha channel present. I was using a category called UIImage+Alpha by Trevor Harmon when I encountered this issue. In the code I found this comment:
// The bitsPerComponent and bitmapInfo values are hard-coded to prevent an "unsupported parameter combination" error

Now this hardcoded fix was in one of the methods calling CGBitmapContextCreate, but not the one following it. So for me it was simply a matter of following the author's own advice to fix the problem in one of his other methods ;)
Clearly some part of the CGBitmapInfo is not getting passed correctly from the image in question, though why I don't know.
So use these constants in the bitmapInfo if you're working with the alpha channel: kCGBitmapByteOrderDefault | kCGImageAlphaPremultipliedFirst
Otherwise, I'd just like to point out it's a really useful class if you're dealing with aliasing issues!
(Also, worth mentioning this problem only turned up in Xcode 6....)

A: For reasons that I don't understand I solved this by setting the BitmapInfo parameter to kCGImageAlphaNoneSkipLast.

A: I'm not sure it would help anybody or not, I just run into the similar issue and try anyway as suggested but no luck.
My issue is:
CCLabelTTF *header_txt = [CCLabelTTF
   labelWithString:header
   fontName:fontname fontSize:header_fontsize
   dimensions:CGSizeMake(header_fontsize*9, txt_h)
   hAlignment:kCCTextAlignmentLeft
   vAlignment:kCCVerticalTextAlignmentCenter];

With Error:

< Error >: CGBitmapContextCreate: unsupported parameter combination: 8 integer bits/component; 8 bits/pixel; 1-component color space; kCGImageAlphaNone; 2147483648 bytes/row.

Then I found a mistake is that header_fontsize is not assigned any values (because I mistake fontsize with header_fontsize). The error lies here: dimensions:CGSizeMake(header_fontsize*9, txt_h) with header_fontsize unassigned any value (it's not 0, assign header_fontsize = 0still ok); reassign a value to header_fontsize fixed the issue.
Hope this will help someone in similar case, such as Sprite case.

A: Some pixel formats are just unsupported.
You can check in advance if any image is supported with:
extension CGImage {
  public var hasCGContextSupportedPixelFormat: Bool {
    guard let colorSpace = self.colorSpace else {
      return false
    }
    #if os(iOS) || os(watchOS) || os(tvOS)
    let iOS = true
    #else
    let iOS = false
    #endif

    #if os(OSX)
    let macOS = true
    #else
    let macOS = false
    #endif
    switch (colorSpace.model, bitsPerPixel, bitsPerComponent, alphaInfo, bitmapInfo.contains(.floatComponents)) {
    case (.unknown, 8, 8, .alphaOnly, _):
      return macOS || iOS
    case (.monochrome, 8, 8, .none, _):
      return macOS || iOS
    case (.monochrome, 8, 8, .alphaOnly, _):
      return macOS || iOS
    case (.monochrome, 16, 16, .none, _):
      return macOS
    case (.monochrome, 32, 32, .none, true):
      return macOS
    case (.rgb, 16, 5, .noneSkipFirst, _):
      return macOS || iOS
    case (.rgb, 32, 8, .noneSkipFirst, _):
      return macOS || iOS
    case (.rgb, 32, 8, .noneSkipLast, _):
      return macOS || iOS
    case (.rgb, 32, 8, .premultipliedFirst, _):
      return macOS || iOS
    case (.rgb, 32, 8, .premultipliedLast, _):
      return macOS || iOS
    case (.rgb, 64, 16, .premultipliedLast, _):
      return macOS
    case (.rgb, 64, 16, .noneSkipLast, _):
      return macOS
    case (.rgb, 128, 32, .noneSkipLast, true):
      return macOS
    case (.rgb, 128, 32, .premultipliedLast, true):
      return macOS
    case (.cmyk, 32, 8, .none, _):
      return macOS
    case (.cmyk, 64, 16, .none, _):
      return macOS
    case (.cmyk, 128, 32, .none, true):
      return macOS
    default:
      return false
    }
  }
}

See https://developer.apple.com/library/archive/documentation/GraphicsImaging/Conceptual/drawingwithquartz2d/dq_context/dq_context.html for more information (and the list of supported pixel formats)


text:
Q: ajax form only works inline So, I have following for ajax:
//Ajax
    jQuery(document).ready(function() {
            jQuery('.my_popup_contact_open').click(function(e) {
                e.preventDefault();
                jQuery.ajax({
                    type: "GET",
                    url: "<?php echo admin_url('admin-ajax.php'); ?>",
                    dataType: 'html',
                    data: ({ action: 'rh_contact_form_support'}),
                    success: function(data){
                          jQuery('.rhm_contact_support').html(data);
                },
                error: function(data)
                {
                alert("Error!");
                return false;
                }
                });
         });
     });

For my my_js.js file, I have following setup:
//header script:
(function ($, root, undefined) {
$(function () {
    'use strict';

      //js goes here

    // Default line End
 });
})(jQuery, this);

When I put the ajax js in the my_js.php, the function does not work. It only seems to work when I put the code inline at the bottom of php page.
Any suggestions to why it does not work when it is placed in "my_js.js"?
Thanks!

A: Your problem is the following line in the $.ajax
 url: "<?php echo admin_url('admin-ajax.php'); ?>",

It works inline because php will find and parse the <?php ?> tags in your HTML, generating the correct url but it won't parse tags in external javascript files  so your url probably ends up unprocessed, performing ajax on an invalid URL and the server complains with a 505.
To check if this is the case, open the browser terminal and search for said url in the external javascript file (under the sources tab if in chrome). If it's unprocessed, that's your culprit.

A: You cannot make use of any php code inside a js file.The easiest solution for that is make your my_js.js to my_js.php.Then if you want to use your js code inside my_js.php just use incluce/include or require/require_once in php..
Example:
my_js.php
(function ($, root, undefined) {
$(function () {
    'use strict';

      //js goes here

        //Ajax
      jQuery(document).ready(function() {
            jQuery('.my_popup_contact_open').click(function(e) {
                e.preventDefault();
                jQuery.ajax({
                    type: "GET",
                    url: "<?php echo admin_url('admin-ajax.php'); ?>",
                    dataType: 'html',
                    data: ({ action: 'rh_contact_form_support'}),
                    success: function(data){
                          jQuery('.rhm_contact_support').html(data);
                },
                error: function(data)
                {
                alert("Error!");
                return false;
                }
                });
         });
     });
    // Default line End
 });
})(jQuery, this);

index.php (Sample php file)
<!DOCTYPE html>
<html>
<head>
<title></title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script><?php require_once('my_js.php ');?></script>
</head>
<body>
</body>
</html>

i hope that helps you. :D


text:
Q: Script logon to a 'Cisco' VPN in windows I would like to sync my development database with actual data from the production databases on a regular basis (say, weekly). I already have the scripts to do this, and the amount of data is not huge.
The problem is that we access the client network through a VPN, so at the moment I have to manually connect (using the cisco vpn client), run the sync, and then disconnect.
Is there anyway to have this done through a script, so that I can set the whole thing up on a schedule and forget about it?

A: If you're using the older IPSec Cisco VPN Client, you can use %ProgramFiles%\Cisco Systems\VPN Client\vpnclient.exe (or vpnclient on Linux, etc.):
Usage:
 vpnclient connect <profile> [user <username>] [eraseuserpwd | pwd <password>]
                             [nocertpwd] [cliauth] [stdin] [sd]
 vpnclient disconnect
 vpnclient stat [reset] [traffic] [tunnel] [route] [firewall] [repeat]
 vpnclient notify
 vpnclient verify [autoinitconfig]
 vpnclient suspendfw
 vpnclient resumefw

A: If you are using AnyConnect as the client there is a file in the program folder called vpncli.exe. Use the /? switch to check usage. I assume that their other clients have something similar. This should do it for you.


text:
Q: Drag object with touchesMoved along offset vector / delta? In the touchesMoved method, what is the math to have an object on the screen move along a dragging touch vector?  For instance, if I touch beneath my object (Y > object.y), and drag "up", I want the object to move from its current x,y location along the same vector that my finger moves.
Currently I have it working that the drag motion snaps my object to my finger's location, but sometimes my finger hits the edge of the screen before I get my object positioned correctly.
If I know my "touch down location" and the "current touch location" what is the math to determine where to move object.position?

A: I would look into UIPanGestureRecognizer.  It's what I use when I want to accomplish something like what you are describing.
This is what I used to learn about them but then took it further in other forms:
http://www.cocoanetics.com/2010/11/draggable-buttons-labels/
Good luck!

A: I hope that you have already received the answer of figured it out yourself, but.
Assume that your object's Upper Left Corner (ULC) is at Object.X, ObjectY.
Assume that the CGPoint returned by touchsBegan is Touch.X, Touch.Y.
The offset (Delta)  will be:

*

*Delta.X = Touch.X - Object.X

*Delta.Y = Touch.Y - Object.X
Subtract these from each point returned by touchesMoved and your ULC should move as you expect rather than snapping to your finger.
Good luck.


text:
Q: Passing multiple parameters to function using onclick I am making a todo app. When I click the edit button i want to send the items id and title to the editItem function. I am having trouble with figuring out how to pass to parameters using template strings. It works fine when I just send item.id but when I add the second parameter (item.title) I get an error
<button onclick='data.editItem(${item.id}, ${item.title})'class="editItem">Edit</button>

full code
const data = new State()

data.mockData.map(item => {
    let markup =`
 ${item.title}
<button onclick='data.deleteItem(${item.id})'class="deleteItem" >Delete</button>
<button onclick='data.editItem(${item.id}${item.title})'class="editItem">Edit</button>
<button class="completeItem">Complete</button>

`
document.querySelector('ul').insertAdjacentHTML('beforeend', markup)

})

A: I realize this is a slightly different approach than yours, but would something like this work for you?

Item1 Title
  <button id="button1" onclick="handleClick(this.id)" class="editItem">
      Edit
  </button>

Note: I've edited the code above to further address questioner's need.

A: You can try use with quotes:
<button onclick='data.editItem(${item.id}, "${item.title}")'class="editItem">Edit</button>

A: I think it should be;
<button onclick="editItem(item.id, item.title)" />


text:
Q: Python Print to File Not Working I am trying to execute this script:
text_file = open("/Users/test/Test/test.txt", "r")
f = open('/Users/test/TEST/test2.txt','w')
list1 = text_file.readlines()
for item in list1:
    number=0
    while number < 7:
        string=str(item)+str(number)
        number = number + 1
        f.write(string)

The file test.txt contains:
a
b
c
d

Expected output when I open test2:
a0
a1
a2
a3
a4
....(actual writing)
d6

Actual output:
a
0a
1a
2a
3a
4b
0b
1b
2b
3b
4c
0c
1c
2c
3c
4d0d1d2d3d4

Just WHAT is going on?
Any help would be appreciated

A: You forgot to strip the '\n' from item. Use str.rstrip for that.
for item in list1:
    for number in xrange(7):
        string = item.rstrip() + str(number)
        f.write(string + '\n')


text:
Q: single sided t-testing using bins in r I want to calculate the t-test statistic of the variables MarketCap, ExReturn based on the 5 groupings provided by the ESG.quint variables.
If possible I would also like to run regressions with a variable called Mkt-RF as the explanatory variable and the ExReturn the dependent variable. If possible any suggestions as how to run a regression based on the quintile bins in the data attached would be greatly appreciated.
Thanks in advance
My data looks like this:
structure(list(ESG.quint = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
), Date = structure(c(14640, 14668, 14699, 14729, 14760, 14790,
14821, 14852, 14882, 14913, 14943, 14974, 15005, 15033, 15064,
15094, 15125, 15155, 15186, 15217, 15247, 15278, 15308, 15339,
15370, 15399, 15430, 15460, 15491, 15521, 15552, 15583, 15613,
15644, 15674, 15705, 15736, 15764, 15795, 15825, 15856, 15886,
15917, 15948, 15978, 16009, 16039, 16070, 16101, 16129, 16160,
16190, 16220, 16251, 16282, 16311, 16343, 16374, 16402, 16435,
16465, 16493, 16525, 16555, 16584, 16616, 16647, 16678, 16708,
16738, 16769, 16800, 16829, 16860, 16891, 16920, 16952, 16982,
17011, 17044, 17074, 17105, 17135, 17166, 17197, 17225, 17256,
17284, 17317, 17347, 17378, 17409, 17439, 17470, 17500, 17531,
17562, 17590, 17621, 17651, 17682, 17712, 17743, 17774, 17804,
17835, 17865, 17896, 17927, 17955, 17986, 18016, 18047, 18077,
18108, 18138, 18169, 18200, 18229, 18261, 18292, 14699, 14729,
14760, 14790, 14821, 14852, 14882, 14913, 14943, 14974, 15005,
15033, 15064, 15094, 15125, 15155, 15186, 15217, 15247, 15278,
15308, 15339, 15370, 15399, 15430, 15460, 15491, 15521, 15552,
15583, 15613, 15644, 15674, 15705, 15736, 15764, 15795, 15825,
15856, 15886, 15917, 15948, 15978, 16009, 16039, 16070, 16101,
16129, 16160, 16190, 16220, 16251, 16282, 16311, 16343, 16374,
16402, 16435, 16465, 16493, 16525, 16555, 16584, 16616, 16647,
16678, 16708, 16738, 16769, 16800, 16829, 16860, 16891, 16920,
16952, 16982, 17011, 17044, 17074, 17105, 17135, 17166, 17197,
17225, 17256, 17284, 17317, 17347, 17378, 17409, 17439, 17470,
17500, 17531, 17562, 17590, 17621, 17651, 17682, 17712, 17743,
17774, 17804, 17835, 17865, 17896, 17927, 17955, 17986, 18016,
18047, 18077, 18108, 18138, 18169, 18200, 18229, 18261, 18292,
14699, 14729, 14760, 14790, 14821, 14852, 14882, 14913, 14943,
14974, 15005, 15033, 15064, 15094, 15125, 15155, 15186, 15217,
15247, 15278, 15308, 15339, 15370, 15399, 15430, 15460, 15491,
15521, 15552, 15583, 15613, 15644, 15674, 15705, 15736, 15764,
15795, 15825, 15856, 15886, 15917, 15948, 15978, 16009, 16039,
16070, 16101, 16129, 16160, 16190, 16220, 16251, 16282, 16311,
16343, 16374, 16402, 16435, 16465, 16493, 16525, 16555, 16584,
16616, 16647, 16678, 16708, 16738, 16769, 16800, 16829, 16860,
16891, 16920, 16952, 16982, 17011, 17044, 17074, 17105, 17135,
17166, 17197, 17225, 17256, 17284, 17317, 17347, 17378, 17409,
17439, 17470, 17500, 17531, 17562, 17590, 17621, 17651, 17682,
17712, 17743, 17774, 17804, 17835, 17865, 17896, 17927, 17955,
17986, 18016, 18047, 18077, 18108, 18138, 18169, 18200, 18229,
18261, 18292, 14699, 14729, 14760, 14790, 14821, 14852, 14882,
14913, 14943, 14974, 15005, 15033, 15064, 15094, 15125, 15155,
15186, 15217, 15247, 15278, 15308, 15339, 15370, 15399, 15430,
15460, 15491, 15521, 15552, 15583, 15613, 15644, 15674, 15705,
15736, 15764, 15795, 15825, 15856, 15886, 15917, 15948, 15978,
16009, 16039, 16070, 16101, 16129, 16160, 16190, 16220, 16251,
16282, 16311, 16343, 16374, 16402, 16435, 16465, 16493, 16525,
16555, 16584, 16616, 16647, 16678, 16708, 16738, 16769, 16800,
16829, 16860, 16891, 16920, 16952, 16982, 17011, 17044, 17074,
17105, 17135, 17166, 17197, 17225, 17256, 17284, 17317, 17347,
17378, 17409, 17439, 17470, 17500, 17531, 17562, 17590, 17621,
17651, 17682, 17712, 17743, 17774, 17804, 17835, 17865, 17896,
17927, 17955, 17986, 18016, 18047, 18077, 18108, 18138, 18169,
18200, 18229, 18261, 18292, 14640, 14668, 14699, 14729, 14760,
14790, 14821, 14852, 14882, 14913, 14943, 14974, 15005, 15033,
15064, 15094, 15125, 15155, 15186, 15217, 15247, 15278, 15308,
15339, 15370, 15399, 15430, 15460, 15491, 15521, 15552, 15583,
15613, 15644, 15674, 15705, 15736, 15764, 15795, 15825, 15856,
15886, 15917, 15948, 15978, 16009, 16039, 16070, 16101, 16129,
16160, 16190, 16220, 16251, 16282, 16311, 16343, 16374, 16402,
16435, 16465, 16493, 16525, 16555, 16584, 16616, 16647, 16678,
16708, 16738, 16769, 16800, 16829, 16860, 16891, 16920, 16952,
16982, 17011, 17044, 17074, 17105, 17135, 17166, 17197, 17225,
17256, 17284, 17317, 17347, 17378, 17409, 17439, 17470, 17500,
17531, 17562, 17590, 17621, 17651, 17682, 17712, 17743, 17774,
17804, 17835, 17865, 17896, 17927, 17955, 17986, 18016, 18047,
18077, 18108, 18138, 18169, 18200, 18229, 18261, 18292), class = "Date"),
    ExReturn = c(NaN, -0.02, 0.05, 0.01, -0.05, -0.05, 0.03,
    -0.02, 0.06, 0.01, -0.03, 0.01, 0, 0.01, -0.01, 0.01, -0.03,
    -0.04, 0.01, -0.06, -0.03, -0.01, -0.02, -0.03, 0.03, 0.04,
    0.02, 0, -0.03, -0.01, 0, 0.01, 0, -0.01, -0.02, 0.01, 0,
    0.02, 0.01, -0.01, 0, -0.02, 0.02, 0.02, 0.02, 0.01, 0.02,
    0, 0.03, 0.02, -0.01, 0.01, 0.01, 0.01, 0.01, 0, -0.04, -0.01,
    -0.02, -0.01, 0.03, 0.05, 0.01, 0.01, 0.01, -0.01, 0.03,
    -0.01, -0.04, 0.02, 0.03, 0.02, 0, -0.02, 0, 0.02, 0, -0.02,
    0.04, 0.02, -0.02, -0.01, -0.01, -0.01, 0.02, 0.01, -0.02,
    0.01, -0.02, -0.01, 0.01, -0.01, 0, 0.01, -0.02, 0, 0.01,
    0, -0.01, -0.01, 0, 0, 0, 0, -0.03, -0.04, -0.05, -0.03,
    0.03, 0, -0.03, 0, -0.04, -0.02, -0.01, -0.05, 0.02, 0.02,
    -0.01, 0, 0.02, 0.07, -0.01, -0.07, 0, 0.01, -0.04, 0.01,
    -0.01, -0.02, 0.02, 0.03, -0.01, -0.03, -0.01, -0.02, -0.04,
    -0.03, -0.04, -0.04, 0.01, -0.01, 0.02, 0.06, 0.03, 0, -0.03,
    -0.04, -0.03, 0.01, 0.01, 0.01, 0, -0.04, 0.01, 0.05, -0.02,
    0.02, 0, 0, -0.01, 0.04, 0, 0.02, 0.02, 0.02, 0.01, 0.01,
    0.03, 0, 0.01, 0.03, -0.02, 0.02, 0, -0.06, -0.02, 0, -0.02,
    0.07, 0.03, 0.02, 0.01, 0.01, -0.02, 0.02, -0.04, -0.02,
    0.01, 0.02, 0.01, -0.03, -0.01, 0, 0.01, 0.02, -0.04, 0.04,
    0.01, 0, -0.01, -0.01, 0.06, 0.03, -0.02, 0.02, 0.02, 0.02,
    0, 0.03, 0.01, 0, -0.01, -0.04, 0, 0, 0, -0.03, -0.01, -0.01,
    -0.04, 0.03, -0.02, -0.01, -0.05, 0, -0.03, 0.05, 0.01, -0.02,
    0.01, -0.03, -0.01, 0.01, -0.04, 0.01, 0, -0.01, 0.01, 0.03,
    0.02, -0.01, -0.07, -0.04, 0.02, -0.05, 0.03, -0.01, -0.01,
    0.01, 0.01, -0.02, 0, 0.01, -0.02, -0.05, -0.02, -0.04, -0.05,
    -0.01, -0.03, -0.02, 0.01, 0, 0.03, -0.02, -0.04, -0.05,
    0.03, 0.02, 0.01, 0, -0.03, 0, 0.01, 0.02, 0.03, 0, -0.02,
    -0.02, 0.04, 0.02, 0, 0.03, 0.02, -0.02, 0.02, 0.04, -0.02,
    -0.02, 0.01, -0.01, -0.01, -0.04, -0.01, -0.03, 0.01, 0,
    0, 0.05, 0.02, 0.02, -0.01, -0.02, 0.02, -0.02, 0, 0.02,
    0, 0.01, -0.02, -0.02, 0.01, 0.01, 0.02, -0.03, 0.04, 0.04,
    0.01, 0, -0.01, 0.03, 0.05, 0, 0, 0.02, -0.02, 0.01, 0.01,
    -0.02, -0.02, -0.03, -0.05, 0.01, 0.02, -0.01, 0, 0.02, -0.02,
    0, 0.01, 0.01, -0.02, -0.06, -0.03, -0.03, 0.03, 0.02, -0.02,
    0.02, -0.01, -0.03, -0.01, -0.03, 0.01, -0.01, 0.02, 0.04,
    0.03, 0.04, 0, -0.07, -0.04, 0.03, -0.04, 0.03, 0.03, -0.02,
    0.06, -0.01, -0.03, -0.01, 0.01, -0.02, -0.03, -0.01, -0.05,
    -0.06, 0, -0.01, -0.02, 0.01, 0.01, 0, -0.01, -0.02, -0.01,
    0.01, 0.02, 0.01, -0.02, -0.05, 0, 0, 0.02, 0.02, 0.01, 0,
    -0.03, 0.06, 0.02, 0.03, 0.04, 0.01, -0.02, 0.02, 0.04, 0,
    0, 0.03, -0.01, -0.02, -0.01, -0.01, -0.01, 0.03, -0.01,
    0.02, 0.05, 0.02, 0, 0.03, -0.01, 0.02, 0, -0.02, -0.01,
    0, -0.01, -0.04, -0.01, 0.02, -0.02, 0, -0.03, 0.04, 0.01,
    -0.03, 0.03, 0.02, 0.03, 0.07, 0.01, 0.01, 0.05, 0, -0.02,
    0.02, 0.01, -0.02, -0.01, -0.02, -0.01, -0.01, -0.01, -0.01,
    -0.01, -0.01, -0.03, 0.01, -0.01, -0.02, -0.03, 0.01, -0.04,
    0.03, 0.01, 0, 0.02, -0.02, 0, -0.01, -0.02, 0.01, 0.01,
    0.03, 0.03, 0.01, NaN, -0.01, 0.05, 0.03, -0.05, -0.02, 0.03,
    -0.04, 0.03, 0.04, 0.01, 0.05, 0.01, -0.01, 0, 0.01, 0, -0.05,
    -0.01, -0.05, -0.02, 0, -0.01, 0, 0.05, 0.04, -0.03, 0, -0.02,
    -0.02, 0.04, 0.01, 0.03, -0.01, 0, 0, 0.03, 0.05, 0.02, -0.02,
    0.02, -0.04, 0.04, 0.03, 0.03, 0.03, -0.01, 0, 0.02, 0.04,
    -0.02, 0.01, 0.04, -0.02, -0.03, -0.02, -0.03, 0, -0.01,
    0.02, 0.04, 0.04, 0.04, -0.01, 0.03, -0.06, 0.05, -0.03,
    -0.04, 0.01, 0.06, -0.01, -0.02, 0, 0.01, -0.01, 0.01, -0.05,
    0.05, 0.01, 0.01, 0, 0, 0.03, 0.04, 0.01, 0.03, 0.04, 0.01,
    0, 0.01, 0, 0.01, 0.01, -0.06, 0, 0.01, 0, 0, 0, 0.02, 0,
    0.03, -0.02, -0.02, -0.05, -0.03, -0.04, 0.03, 0.03, -0.01,
    0.03, -0.03, 0, 0.01, -0.02, -0.01, -0.01, 0.05, 0.02, -0.01
    ), MarketCap = c(6788.22, 7079.19, 4598.03, 5480.38, 4618.41,
    3144.02, 3324.98, 1059.64, 2736.01, 2937.47, 2832.5, 2068.74,
    2071.09, 2165.97, 499.1, 499.13, 1917.16, 547.45, 1484.01,
    1697.49, 1249.31, 1161.33, 1014.06, 1329.12, 709.77, 1207.65,
    1266.19, 1163.34, 1717.12, 1622.93, 1603.46, 1395.53, 1677.67,
    1997.5, 1849.81, 1445.63, 1702.73, 1657.38, 1855.32, 1788.72,
    2115.94, 559.09, 2257.38, 948.61, 2193.62, 2596.5, 2568.12,
    2457.07, 2721.85, 2892.34, 2777.16, 2616.36, 2890.38, 441.5,
    420.99, 447.4, 1177.14, 1169.72, 419.05, 3758.27, 1095.37,
    920.31, 1214.23, 1143.88, 1299.86, 1220.71, 1354.93, 1463.34,
    1461.72, 1479.1, 1695.54, 1712.11, 1865.37, 1475.08, 1790.13,
    2070.56, 1697.21, 1764.14, 2143.54, 1585.71, 284.94, 1754.86,
    1758.55, 332.08, 1861.99, 318.66, 508.72, 489.77, 540.44,
    487.09, 523.27, 515.04, 2234.32, 2167.55, 2286.64, 1983.85,
    1980.53, 1957.57, 2462.75, 2441.69, 1447.63, 3150.08, 2842.88,
    3012.29, 2805.26, 2858.78, 2517.79, 1331.1, 1454.68, 1370.62,
    1279.6, 1364.74, 1188.39, 1186.87, 1748.85, 1043.63, 1803.36,
    1121.96, 1168.8, 1304.53, 1904.87, 15087.14, 15128.88, 15462.98,
    12064.74, 11382.16, 12173.64, 13839.83, 14907.24, 15234.8,
    3394.75, 1425.23, 1537.69, 2904.32, 2627.26, 1447.57, 2355.97,
    2135.62, 589.37, 1092.05, 1160.68, 1230.05, 15709.47, 17374.01,
    18782.76, 18295.05, 18072.22, 17696.88, 18229.11, 19062.95,
    19615.57, 18219.92, 18073.59, 19173.5, 19440.97, 22220.9,
    20922.23, 21032.48, 21236.53, 21185.24, 3509.02, 21386.35,
    3998.69, 20270.13, 21039.94, 23770.39, 21881.7, 4073.81,
    27958.84, 28380.43, 25958.89, 22945.52, 2765.33, 2648.91,
    2896.46, 6382.79, 29981.53, 3168.61, 27979.53, 34249.42,
    32883.61, 11551.23, 8342.21, 8952.77, 8644.4, 9287.62, 40886.59,
    40080.95, 40670.72, 47796.27, 10494.65, 10433.29, 38241.41,
    10317.05, 41601.58, 45025.44, 39949.46, 14114.66, 6308.74,
    3349.05, 7610.54, 11270.68, 3380.04, 7450.19, 3490.88, 2027.67,
    3495.45, 3222.32, 3410.21, 3623.97, 3469.06, 34136.77, 32879.43,
    4596.94, 34581.46, 34082.17, 9002.01, 31303.14, 28786.33,
    32599.15, 27933.34, 30509.43, 31684.25, 29589.68, 31171.28,
    28951.03, 6052.68, 5859.24, 3518.83, 5948.66, 6341.79, 6072.73,
    3476.95, 4145.74, 3047.36, 3096.5, 1903.47, 1816.71, 1820.89,
    1351.2, 3821.15, 3360.74, 3262.87, 3210.14, 4457.25, 5425.24,
    4776.65, 4491.22, 4174.87, 4418.8, 6048.79, 20445.68, 18526.54,
    17461.55, 17890.85, 4362.38, 17307.84, 15428.93, 3314.68,
    3532.51, 18068.2, 3330.51, 3542.03, 3462.4, 3650.96, 3563.79,
    3505.06, 3424.6, 3540.22, 3751, 3596.29, 3514.44, 3942.06,
    3642.68, 4109.78, 4161.59, 4742.38, 4353.45, 4961.53, 21247.01,
    5201.95, 23794.32, 4684.82, 6049.06, 5807.53, 5164.62, 5902.54,
    4750.89, 6884.88, 5431.41, 5849.91, 7501.92, 6860.27, 7068,
    30388.5, 5407.61, 4631, 4415.45, 3884.95, 5100.84, 39647.43,
    37441.64, 37383.27, 36502.04, 39119.49, 6522.88, 5984.22,
    6918.81, 5568.73, 5065.15, 4325.44, 11756.63, 5205.61, 8133.07,
    5488.42, 8273.11, 3472.92, 6004.93, 15686.87, 32232.23, 28277.19,
    12610.94, 36023.4, 12274.91, 15014.91, 13034.7, 15982.93,
    15312.29, 13459.36, 16042.47, 11498.78, 13271.44, 31860.03,
    9540.96, 9910.91, 34386.61, 10316.95, 10150.8, 8495.03, 9360.87,
    10714.83, 10129.79, 10564.92, 9402.63, 8946.72, 26736.45,
    30257.4, 28732.22, 32068.05, 29084.77, 28659.03, 4483.56,
    4485.35, 3761.74, 4794.95, 6013.84, 6035.03, 7413.99, 8331.07,
    2839.16, 2857.72, 2540.6, 2240.77, 1694.99, 1669.42, 1586.78,
    1902.91, 1914.53, 16758.77, 15916.99, 2728.67, 2547.86, 2638.9,
    2680.63, 15555.74, 1919.77, 1519.11, 13704.87, 12944.16,
    1703.85, 2225.82, 1712.69, 1616.88, 2460.8, 2372.24, 2311.44,
    2396.14, 2193.23, 2641.63, 2482.57, 2304.77, 2712.54, 2759.91,
    2645.78, 3081.96, 2719.04, 3145.42, 2945.8, 3367.14, 2849.49,
    2510, 3295.8, 3254.44, 3479.56, 3719.37, 3455.17, 4710.82,
    2344.73, 3653.37, 3953.61, 28903.71, 28922.77, 27692.12,
    3707.19, 4207.75, 34384.67, 4785.6, 6137.78, 6423.01, 5053.05,
    4046.56, 3867.73, 5437.4, 6003.28, 5021.78, 4909.94, 4669.88,
    4992.02, 40555.71, 37086.69, 8224.15, 36028.97, 7798.67,
    8348.44, 7222.55, 38931.85, 30796.85, 26329.29, 4381.6, 4228.62,
    27583.44, 9664.65, 25599.68, 29271.86, 27920.87, 28051.37,
    25648.48, 26053.7, 27517.01, 7915.78, 8788.53, 5288.95, 5683.22,
    5429.89, 4757.46, 7120.78, 7215.78, 3715.18, 6013.15, 7125.3,
    6993.55, 6875.77, 3567.06, 3497.77, 8755.85, 9500.49, 9425.31,
    9860.46, 10252.78, 9539.14, 38373.95, 37667.55, 42190.76,
    35818.49, 36246.08, 39513.58, 36879.16, 47732.1, 798.25,
    911.04, 14278.97, 14340.61, 12705.01, 17154.06, 17779.49,
    18208.17, 17057.87, 18233.44, 17534.44, 20779.09, 20310.52,
    20193.67, 20428.55, 20132.77, 20480.14, 20107.82, 18613.66,
    14881.71, 15837.15, 15710.01, 16394.13, 18256.12, 18673.35,
    16380.95, 19761.84, 19032.73, 18717.18, 18574.95, 19255.01,
    20160.57, 19693.94, 19175.72, 20724.11, 17713.94, 21933.27,
    21903.08, 23220.59, 21509.95, 23905.71, 20778.7, 22626.24,
    22672.35, 24550.68, 25587.29, 25860, 24622.41, 27513.46,
    27495.09, 29747.2, 23125.05, 31383.91, 30304.73, 29035.68,
    30017.85, 29919.38, 30423.94, 30657.97, 31516.5, 33268.1,
    34263.61, 37510.74, 34184.53, 35720.48, 31594.21, 35234.87,
    28653.16, 32661.46, 33081.23, 38941.89, 36873.59, 35641.02,
    29892.49, 34284.08, 28870.38, 27755.92, 32157.47, 40125.62,
    40538.85, 39059.46, 38196.38, 35432.56, 35548.39, 39348.29,
    42679.34, 47525.78, 47463.58, 47884.13, 46630.1, 49177.75,
    49531.08, 44739.25, 43026.4, 45953.22, 45237.85, 42918.32,
    44040.73, 40993.36, 39747.62, 39476.1, 41576.47, 40470.87,
    41477.54, 41589.63, 31626.84, 35741.59, 36547.22, 37007.11,
    39630.74, 41660.94, 39956.68, 38687.28, 39236.93, 41001.33,
    38993.45, 46127.37, 45333.08, 47329.05, 46803.12, 46405.4
    )), row.names = c(NA, -599L), groups = structure(list(ESG.quint = c(1,
2, 3, 4, 5), .rows = list(1:121, 122:240, 241:359, 360:478, 479:599)), row.names = c(NA,
-5L), class = c("tbl_df", "tbl", "data.frame"), .drop = TRUE), class = c("grouped_df",
"tbl_df", "tbl", "data.frame")

A: I ended up using the filter function
desc <- CombData %>%
  group_by(ESG.quint, Date) %>%
  summarize_at(vars(ExReturn, MarketCap, `Mkt-RF`, BookMarketRatio), function(x) {mean(x, na.rm = TRUE)})
desc1 <- desc %>%
  filter(ESG.quint == 5)


text:
Q: a variant of MLE of a normal distribution It is well-known that if we have "n" sample observations from normal distribution with unknown mean, then the sample mean would be the MLE for the mean of the normal distribution.
However, let's assume that before we collect our sample, somebody has already collected "n" sample observations, and the only information we get from that guy is that all the "n" sample observations were smaller or equal to A for some real number A.
Is there any way we could somehow use "n" and "A" into MLE for the mean when we collect our sample?
Any input would be greatly appreciated. I'm just curious.


text:
Q: Bluetooth: bluetooth_adapter_winrt.cc Getting Default Adapter failed I'm trying to learn how to use selenium and python , I want to crawl the news title & news date of this website
but I have a problem that I don't know how to solve.
This is my code :
from selenium import webdriver
from bs4 import BeautifulSoup
import pandas as pd
import time
import json
driver = webdriver.Chrome("./chromedriver")
driver.implicitly_wait(10)
driver.get("https://www.thestandnews.com/search/?q=%E6%96%B0%E5%86%A0%E8%82%BA%E7%82%8E")
soup = BeautifulSoup(driver.page_source, "lxml")
pages_remaining = True
page_num = 1

My_array = []
while pages_remaining:
 print("Page Number:", page_num)

 soup = BeautifulSoup(driver.page_source, "lxml")
""" #undoned

 tags_lis = soup.find_all("li")
 for tag in tags_lis:
    tag_a = tag.find("a")
    tag_span = tag.find("span")
    title = tag_a.text
    date = tag_span.text
    temp = {"title": title , "date": date}
    print(temp)
    My_array.append(temp)
   """
  try:
    #Press button of next page
    #next_link =driver.find_element_by_xpath()
    nextPg = '//*[@id="___gcse_1"]/div/div/div/div[5]/div[2]/div/div/div[2]/div/div[%d]' % (page_num + 1)
    print(nextPg)
    next_link = driver.find_element_by_xpath(nextPg)
    next_link.click()

    time.sleep(5)
    if page_num < 10:
        page_num = page_num + 1
    else:
        pages_remaining = False
  except Exception:
    pages_remaining = False
driver.close()

and this is the error message, can anyone give a hint ,thanks!
DevTools listening on ws://127.0.0.1:49952/devtools/browser/749fcb19-d13a-4f38-9d7c-3da58726e10a
[13744:13732:0517/214816.873:ERROR:browser_switcher_service.cc(238)] XXX Init()
Page Number: 1
//*[@id="___gcse_1"]/div/div/div/div[5]/div[2]/div/div/div[2]/div/div[2]
[13744:13732:0517/214824.321:ERROR:device_event_log_impl.cc(162)] [21:48:24.321] Bluetooth:
bluetooth_adapter_winrt.cc:1055 Getting Default Adapter failed.
Page Number: 2
//*[@id="___gcse_1"]/div/div/div/div[5]/div[2]/div/div/div[2]/div/div[3]


text:
Q: How to show PHP values from sql query through javascript variable onto screen I am looking to have my sql query ( that is put into php) put into a javascript variable to put on the screen for my npc dialogue:
i.e (quick example not exact)
$getdetails=mysql= Select * from quests WHERE npc='Person"

While ($row= mysql_fetch_array($getdetails)
{
    $activequest= $row['questname'];
    $showactive= "<tr> <td> $activequest </td></tr>";
}

(i have the dialogue in a html table where the options pop up for a user to click on)
this would make a list of results as a list:
-quest one
-quest two
-quest three
how do i get that list of results from my php to show onto my screen through a javascript variable and put it on the screen so a user can choose which quest theyd like to get dialogue for  -- im using innerhtml to put the dialogue on the screen for the regular static options which works fine  id like to do the same for the result options  so if there is 3 quests they are listed or if there is 5 quests they are listed etc.


text:
Q: Altering a List in Python I'm working on a problem in python were I have a list of lists. It looks like the following:
   [[bob, masters, 1], [sheila, brown, 9], [jack,hardy,15], [bob, masters,
   41], [mike,benson, 21], [jack, hardy, 100]]

What I am trying to accomplish is convert this list of lists into a list of lists of lists(not sure that is the correct terminology). So I want my new or altered list to look like this:
   [[[bob, masters, 1],[bob, masters, 41]], [[sheila, brown, 9]],
   [[jack,hardy,15], [jack, hardy, 100]],[[mike,benson, 21]]]

So to sum it up I want to make a list for each person's list inside of one big list.
I'm new to python so I don't know what the best route I can take is. When I read in each line and add it to the original list I use the split function which turns it into the list of lists I showed up top. If anyone could point me in the right the direction that would be helpful. I'm not sure if I should change the list I already have made, or change the way I make the list when I read the text from the file.
Here is the code I currently have that makes my list of lists:
   f = open("input.txt", "r")
   inputText = []
   i = 0
   # adds each line of input file to a list
   for line in f:
      inputText.insert(i, line.split())
       i = i+1

Any help would be greatly appreciated. Thanks.

A: I'd create a new list and use a groupby function:
import collections

def groupby(iterable, key_fn):
    grouped = collections.defaultdict(list)
    for item in iterable:
        key = key_fn(item)
        grouped[key].append(item)
    return grouped

input_list = [['bob', 'masters', 1], ['sheila', 'brown', 9], ['jack','hardy',15], ['bob', 'masters',
   41], ['mike','benson', 21], ['jack', 'hardy', 100]]
grouped = groupby(input_list, lambda item: item[0])
final_result = list(grouped.values())
print(final_result)

Which outputs
[[['bob', 'masters', 1], ['bob', 'masters', 41]], [['sheila', 'brown', 9]], [['jack', 'hardy', 15], ['jack', 'hardy', 100]], [['mike', 'benson', 21]]]

A: Assuming your input file looks something like this:
bob masters 1
sheila brown 9
jack hardy 15
bob masters 41
mike benson 21
jack hardy 100

You might want to use an intermediary dict:
data_dict = {}
with open("input.txt") as f:
    for line in f:
        first_name, last_name, number = line.split()
        if not (first_name, last_name) in data_dict:
            data_dict[(first_name, last_name)] = []
        data_dict[(first_name, last_name)].append(number)

At this point, data_dict looks like this:
{('bob', 'masters'): ['1', '41'], ('sheila', 'brown'): ['9'], ('jack', 'hardy'): ['15', '100'], ('mike', 'benson'): ['21']}

You can then always convert this to your desired list structure:
data_list = []
for (first_name, last_name), numbers in data_dict.items():
    data_list.append([])
    for number in numbers:
        data_list[-1].append([first_name, last_name, number])

So you have data_list:
[[['bob', 'masters', '1'], ['bob', 'masters', '41']], [['sheila', 'brown', '9']], [['jack', 'hardy', '15'], ['jack', 'hardy', '100']], [['mike', 'benson', '21']]]