Questions about hexachord on p.31 of the Study of Counterpoint

Question: p. 31 of The Study of Counterpoint by Johann Joseph Fux (translated by Alfred Mann) says:

I don't understand what this page is telling us. I understand what a hexachord is. However, why note is G not a correct note in D Dorian mode? D Dorian mode is: D, E, F, G, A, B, C, and G is the 4th note in Dorian mode, right? So why is this note wrong?
Comment: Sorry, I do not understand what your reference is. Is "p.31" referring to a page number? Of what book? Maybe the book  "The study of counterpoint" by whom?
Comment: Hi sorry for the confusion, it's the page 31 from the book 'the study of counterpoint' by Johann Joseph Fux  (Author), Alfred Mann (Translator), many thanks
Comment: In order that this question receives some answers, you need to be a lot clearer with its wording. Thanks.
Comment: @Tim and nath, does this edit meet your approval?
Answer: The problem in that particular part of Fux's The Study of Counterpoint is not that G doesn't belong to the mode at all, but that the student is putting the G below D in the first measure. The first measure of a species counterpoint exercise must make the modality completely clear, but a G on the bottom would cause the exercise to sound initially as if it was in G Mixolydian instead of D Dorian. This is a problem in this context because the exercise will clearly end in D, and species counterpoint exercises don't modulate.
The upshot of this is that, although the initial consonance can be a P5th when a student is writing an upper counterpoint to a cantus firmus, it is not an option when writing a lower counterpoint. That's why the teacher says it wasn't the student's fault, he just hadn't told him about the rule yet.


Should I exclude an individual being evaluated from group average?

Question: I am working on some statistics of work related performances. Now at first I did my code to calculate the performance of a single individual and compared it to the average of a group in which the individual was included.
This got me thinking. Should I, or should I not include this individual in the group result average?
If I include the individual then the person is not only being compared to the group average but also to him- or herself and depending on the size of the group this might influence more or less.
On the other hand, if I remove the individual from the group, the group looses it's integrity and does not model reality.
Is there a general position on this? What questions do these two approaches answer?
If anyone could point me in a direction I could read more I would be grateful.
Comment: It's often done; whether it's a good idea depends on the research question, as @Dirk Horsten points out in his answer. Note that (missing values aside) the average of others is just (total - this value) / (count - 1) so (a point often missed in my experience) no loop should be needed to calculate these quantities.
Comment: I'm afraid I don't understand your formula to loop connection. You say just, implicating that the outcome is not affected much. But if the selected individual is an outlier and the group is small the outcome is severely affected. Math aside I am more interested in the loop part. Are you referring to programming? I do not frequent this forum usually and am not statistician so I am not familiar with the lingo.
Comment: When I say "just" I mean only that it's a trivial calculation; you are right that an outlier makes a big difference. Worked example: values  1, 2, 3; so total 6 and count 3. The means of others are a single vectorised calculation [(6 6 6) $-$ (1 2 3)] / (3 $-$ 1).  I've seen people write loops to do that. I am not a statistician either: as a geographer I probably qualify as a lower life-form.
Answer: The answer depends on the question, including its context.
Replace an employee or not?
Suppose you have 10 employees, hired through the same process. One of them is performing worse and you consider replacing him.
Then you should compare him with the expected performance of a new hire, and to estimate that, you must include all people you hired in the past.
Stick with the new recruiter?
Suppose you hired 9 employees yourself and one via a recruiter. Now you need one employee more. Will you go through the recruiter or not?
Now you must compare the individual with the other employees.
Comment: Thank you for the input. It seems it is not as simple as I would have hoped. I will have to put some thought into this and weigh the options.


No notification sound through Android device using GCM service

Question: I am delivering notifications through the GCM service to android devices. Delivering messages to client is not a problem its the fact that no sound is played when the notification is received on the phone which is the issue.
I am using the following code on the client side (mono android) to build up notification request
void createNotification(string title, string desc)
     {
       //Create notification
       var notificationManager = GetSystemService(Context.NotificationService) as NotificationManager;

    //Create an intent to show ui
    var uiIntent = new Intent(this, typeof(Main));

    //Create the notification
    var notification = new Notification(Android.Resource.Drawable.SymActionEmail, title);

    //Auto cancel will remove the notification once the user touches it
    notification.Flags = NotificationFlags.AutoCancel;

    //Set the notification info
    //we use the pending intent, passing our ui intent over which will get called
    //when the notification is tapped.
    notification.SetLatestEventInfo(this, title, desc, PendingIntent.GetActivity(this, 0, uiIntent, 0));

    //Show the notification
    notificationManager.Notify(1, notification);
}

Where in here can I place details of notification sound to play?  I have tried the Notification.Sound member but it asks for a uri which I dont have a reference to.
Answer: Adding this line of code in function activated default notification sound.
notification.Defaults = NotificationDefaults.Sound;

Answer: Add this if you want to play custom notification sound
  notification.sound = Uri.parse("android.resource://" + context.getPackageName() + "your_sound_file_name.mp3");


Golang Web: funçao para Head

Question: Boa noite,
Estou iniciando em GO, e estou com uma duvida que pode parecer simples. Estou criando um site com GO em Backend, minha duvida é tenho o index.html e o main.go criado e estão funcionando, mas no index  quero adicionar o conteudo de outro arquivo chamado head.html que tem todo o conteudo do que sera o cabeçalho do site, assim quando criar mais paginas reaproveito somente funçao do cabeçalho para replicar em todas as outras o head, alguem sabe como faço uma função para isso em Golang?
Comment: Depende, qual lib esta usando a lib nativa de HTTP? ou esta usando um framework?
Answer: Considerando que esteja usando o html/template, você pode uasr o {{template "nome do template"}} para que ele seja inserido.
Todos os "comandos", pode ser visualizados em https://golang.org/pkg/text/template/:
{{template "name"}}

    The template with the specified name is executed with nil data.

{{template "name" pipeline}}
    The template with the specified name is executed with dot set
    to the value of the pipeline.

Portanto, considerando que você tenha dois arquivos, poderia fazer:

header.html

{{define "header"}}

    Este é o cabeçalho de {{.Fulano}}

{{end}}

index.html

{{define "index"}}
{{template "header" .}}

    Este é o corpo de {{.Fulano}}

{{end}}

No Golang poderia usar:
package main

import (
    "html/template"
    "os"
)

func main() {
    t, err := template.ParseGlob(`path\to\*.html`)
    if err != nil {
        panic(err)
    }

    type Exemplo struct {
        Fulano string
    }

    if err = t.ExecuteTemplate(os.Stdout, "index", &Exemplo{Fulano: "Sicrano"}); err != nil {
        panic(err)
    }

}

Isso iria resultar em:

    Este é o cabeçalho de Sicrano

    Este é o corpo de Sicrano

Observe que é usado o {{define}} para dar nome para cada "arquivo". No segundo caso, no index.html, é usado o {{template "header" .}} e isso tem a intenção de injetar o conteúdo que foi definido usando {{define "header"}}.

Enfim, para injetar um no outro  utilize o {{define "nome}} e então utilize o {{template "nome"}} para inserir o conteúdo. No caso acima, é usado {{template "nome" .}} (note o . ao final) para que permitir o "header" ter acesso ao struct de Exemplo e ler o Fulano.
Comment: Era exatamente isso que eu estava precisando, apesar de parecer fácil não estava achando essa explicação na web, muito obrigado. Funcionou perfeitamente.

Golang Web: funçao para Head


Android content provider unable to update data

Question: In the project i am working i have to update data at run-time. But here when i am trying to update. The data is not updating in the database.I am using Contentprovider for insert/update/delete operations
Here is my code:
private void saveData()
    {
        String name1 = name.getText().toString();
        String phone  = mobile.getText().toString();
        String address = city.getText().toString();
        if (TextUtils.isEmpty(name1)||TextUtils.isEmpty(phone)||TextUtils.isEmpty(address))
        {
            if (TextUtils.isEmpty(name1))
            {
                name.setError("Feild can not be Empty");
            }
           else if (TextUtils.isEmpty(phone))
            {
                mobile.setError("Feild can not be Empty");
            }
           else if (TextUtils.isEmpty(address))
            {
                city.setError("Feild can not be Empty");
            }
        }
        else
        {
            ContentValues values = new ContentValues();
            values.put(DataProvider.Pname,name1);
            values.put(DataProvider.Pphone,phone);
            values.put(DataProvider.Paddress,address);
            values.put(DataProvider.PCategory,"Debt");
            values.put(DataProvider.Pamount,totamount);
            int a = getContentResolver().update(DataProvider.ContentUri_Person,values,DataProvider.PID+"=?",new String[]{String.valueOf(logid)});
            Toast.makeText(AddLog.this, String.valueOf(a)+"Value updated", Toast.LENGTH_SHORT).show();
            startActivity(returnback);
            finish();
        }
    }

Content provider class
public class DataProvider extends ContentProvider
{
    static final String ProviderName = "com.example.mrudu.accounts.provider";
    static final String URLPerson = "content://"+ProviderName+"/Person_Detail";
    static final String URLDetails = "content://"+ProviderName+"/Details";
    static final Uri ContentUri_Person = Uri.parse(URLPerson);
    static final Uri ContentUri_Details = Uri.parse(URLDetails);

    //Tables
    private static String PTableName = "Person_Detail";
    private static String DTableName = "Details";

    public static long insertId = 0;

    //Person_Detail Coloumns
    public static String PID = "_id";
    public static String Pname = "PName";
    public static String Pphone = "PMobile";
    public static String Paddress = "PCity";
    public static String PCategory = "PCategory";
    public static String Pamount = "PAmount";

    //Details coloumn
    public static String DID = "_id";
    public static String Dname = "DName";
    public static String Damount = "DAmount";
    public static String Ddate = "DDate";
    public static String DCategory = "DCategory";
    public static String Per_In = "Per_In";

    private static final int Person = 1;
    private static final int Person_ID = 2;
    private static final int Details = 3;
    private static final int Details_Id = 4;

    static UriMatcher uriMatcher = new UriMatcher(UriMatcher.NO_MATCH);
    static
    {
        uriMatcher.addURI(ProviderName,PTableName,Person);
        uriMatcher.addURI(ProviderName,PTableName+"/#",Person_ID);
        uriMatcher.addURI(ProviderName,DTableName,Details);
        uriMatcher.addURI(ProviderName,DTableName+"/#",Details_Id);
    }

    public static SQLiteDatabase sqLiteDatabase;
    private static String Databasename = "Accounts";
    private static int DatabaseVersion = 1;

    private class DatabaseHelper extends SQLiteOpenHelper
    {

        public DatabaseHelper(Context context)
        {
            super(context, Databasename, null, DatabaseVersion);
        }

        @Override
        public void onCreate(SQLiteDatabase sqLiteDatabase)
        {
            String Create_Person = " Create Table "+PTableName+"("+PID+" INTEGER PRIMARYKEY ,"+Pname+" TEXT ,"+Pphone+" TEXT ,"+Paddress+" TEXT ,"+PCategory+" TEXT ,"+Pamount+" REAL"+")";
            String Create_Details = " Create Table "+DTableName+"("+DID+" INTEGER PRIMARYKEY ,"+Dname+" TEXT ,"+DCategory+" TEXT ,"+Damount+" REAl ,"+Ddate+" TEXT ,"+Per_In+" INTEGER )";
            sqLiteDatabase.execSQL(Create_Person);
            sqLiteDatabase.execSQL(Create_Details);
        }

        @Override
        public void onUpgrade(SQLiteDatabase sqLiteDatabase, int i, int i1)
        {
            sqLiteDatabase.execSQL("Drop TABLE if exists"+PTableName);
            sqLiteDatabase.execSQL("Drop TABLE if exists"+DTableName);
            onCreate(sqLiteDatabase);
        }
    }
    @Override
    public boolean onCreate()
    {
        Context context = getContext();
        DatabaseHelper databaseHelper = new DatabaseHelper(context);
        sqLiteDatabase = databaseHelper.getWritableDatabase();
        return (sqLiteDatabase==null)?false:true;
    }
    @Override
    public Uri insert(Uri uri, ContentValues values)
    {
        switch (uriMatcher.match(uri))
        {
            case Person:
                long rowId = sqLiteDatabase.insert(PTableName,null,values);
                insertId = rowId;
                if (rowId>0)
                {
                   Uri _uri = ContentUris.withAppendedId(ContentUri_Person,rowId);
                    getContext().getContentResolver().notifyChange(_uri,null);
                    return _uri;
                }
                break;
            case Details:
                long rowId1 = sqLiteDatabase.insert(DTableName,null,values);
                if (rowId1>0)
                {
                    Uri _uri = ContentUris.withAppendedId(ContentUri_Details,rowId1);
                    getContext().getContentResolver().notifyChange(_uri,null);
                    return _uri;
                }
                break;
        }
        return null;
    }
    @Override
    public Cursor query(Uri uri, String[] projection, String selection,
                        String[] selectionArgs, String sortOrder)
    {
        SQLiteQueryBuilder sqLiteQueryBuilder = new SQLiteQueryBuilder();

        switch (uriMatcher.match(uri))
        {
            case Person_ID:
                sqLiteQueryBuilder.setTables(PTableName);
                sqLiteQueryBuilder.appendWhere(PID+ "="+ uri.getPathSegments().get(1));
                break;
            case Person:
                sqLiteQueryBuilder.setTables(PTableName);
                break;
            case Details_Id:
                sqLiteQueryBuilder.setTables(DTableName);
                sqLiteQueryBuilder.appendWhere(Per_In +"="+ uri.getPathSegments().get(1));
                break;
            case Details:
                sqLiteQueryBuilder.setTables(DTableName);
                break;
            default:
                throw new UnsupportedOperationException("Not yet implemented");
        }
        Cursor cursor = sqLiteQueryBuilder.query(sqLiteDatabase,projection,selection,selectionArgs,null,null,sortOrder);
        cursor.setNotificationUri(getContext().getContentResolver(),uri);
        return cursor;

    }
    @Override
    public int update(Uri uri, ContentValues values, String selection,
                      String[] selectionArgs)
    {
        int count = 0;
        switch (uriMatcher.match(uri))
        {
            case Person:
                count = sqLiteDatabase.update(PTableName,values,selection,selectionArgs);
                Log.d("Update","Person");
                break;
            case Person_ID:
                count = sqLiteDatabase.update(PTableName,values,PID+" = "+uri.getPathSegments().get(1)+(!TextUtils.isEmpty(selection)?" AND (" + selection + ')':""),selectionArgs);
                Log.d("Update","Person_Id");
                break;
            case Details:
                count = sqLiteDatabase.update(DTableName,values,selection,selectionArgs);
                Log.d("Update","Details");
                break;
            case Details_Id:
                count = sqLiteDatabase.update(DTableName,values,Per_In+" = "+uri.getPathSegments().get(1)+(!TextUtils.isEmpty(selection)?" AND (" + selection + ')':""),selectionArgs);
                Log.d("Update","Details_Id");
                break;
            default:
                throw new IllegalArgumentException("Unknown URI " + uri );
        }
        getContext().getContentResolver().notifyChange(uri,null);
        return count;
    }
    @Override
    public int delete(Uri uri, String selection, String[] selectionArgs) {
        // Implement this to handle requests to delete one or more rows.
        throw new UnsupportedOperationException("Not yet implemented");
    }

    @Override
    public String getType(Uri uri) {
        // TODO: Implement this to handle requests for the MIME type of the data
        // at the given URI.
        throw new UnsupportedOperationException("Not yet implemented");
    }
}

Thank you
Answer: There are two possible problems, that you can check. First, you can init SQLiteDatabase at the beginning of the CRUD operations:
SQLiteDatabase sqlDB = dbHelper.getWritableDatabase();
The second one - use SQLiteQueryBuilder and check query string. There you may have problem in SQL query.


SQL query with associated column

Question: I have the following tables:
Team
id | abbreviated_name
----------------------
1  | ATL
2  | BOS
3  | BRK

Schedule has two foreign keys home_team_id and visitor_team_id
id | game_date  | game_time | home_team_id | visitor_team_id
------------------------------------------------------------
1  | 2021-01-01 | 7:00p ET  | 1            | 2
2  | 2021-01-02 | 6:00p ET  | 2            | 3
3  | 2021-01-03 | 7:00p ET  | 1            | 3

How do I query for all the rows in Schedule given a team abbreviated name? Say I want to find all the rows where ATL is playing both home and away games. I tried the following but the resulting dataset is way off.
SELECT *
FROM schedule s
JOIN team t
WHERE s.home_team_id = (
    SELECT id
    FROM team
    WHERE team.abbreviated_name = 'ATL'
)
OR s.visitor_team_id = (
    SELECT id
    FROM team
    WHERE team.abbreviated_name = 'ATL'
)

Appreciate the help!
Answer: Your subquery is correct, but when same abbreviated name has more than one id's it returns more than one row, which will give error. Example:
id | abbreviated_name
----------------------
1  | ATL
4  | ATL

in satisfies this case.
Also join is not needed when using sub query, which will create extra records when join on conditions don't match
SELECT *
FROM schedule s
WHERE s.home_team_id in (
    SELECT id
    FROM team
    WHERE team.abbreviated_name = 'ATL'
)
OR s.visitor_team_id in (
    SELECT id
    FROM team
    WHERE team.abbreviated_name = 'ATL'
)

This is join version
SELECT *
FROM schedule s
LEFT JOIN team home_t on s.home_team_id=home_t.id
LEFT JOIN team visitor_t on s.visitor_team_id=visitor_t.id
WHERE home_t.abbreviated_name = 'ATL'
OR visitor_t.abbreviated_name = 'ATL'

Answer: You can do as shown below:
    SELECT
    s.id,
    s.game_date,
    s.game_time,
    s.home_team_id,
    homeTeam.abbreviated_name,
    s.visitor_team_id,
    visitorTeam.abbreviated_name

    FROM schedule s
    left join team homeTeam on homeTeam.id=s.home_team_id
    left join team visitorTeam on visitorTeam.id=s.visitor_team_id
   -- where homeTeam.abbreviated_name ='ATL' OR visitorTeam.abbreviated_name='ATL'

Answer: SELECT *
FROM schedule s
JOIN team t ON t.id IN (s.home_team_id, s.visitor_team_id)
WHERE t.abbreviated_name = 'ATL'

If you need abbreviated names for both commands then use, for example
SELECT s.*, t1.abbreviated_name, t2.abbreviated_name
FROM schedule s
JOIN team t1 ON t1.id = s.home_team_id
JOIN team t2 ON t2.id = s.visitor_team_id
WHERE 'ATL' IN (t1.abbreviated_name, t2.abbreviated_name)

Comment: it's not correct for this situation, because it'll return duplicated record, while we are going to show `home-team-name` and `visitor-team-name` beside each record from the `schedule` table
Comment: @hesamakbari The query must return duplicates. OP's query returns duplicates too - look carefully, he uses `SELECT * FROM schedule s JOIN team t`, i.e. he receives all **games**. The task is formulated as *query for all the rows in Schedule* - so team duplicates **must** exist in the output. Do not try to solve your task, solve OP's task.
Comment: the query written in the question was wrong, please mention the detail of the question
Comment: @hesamakbari I read the task in the question: *How do I query for all the rows in Schedule given a team abbreviated name?* What details do you mean? Please citate... PS. If you mean that OP needs abbreviations of both commands instead of codes, then he should say this explicitly. But he didn't say... PPS. Updated.
Comment: Just compare your answer with the corrected answer or @hesamakbari
Comment: @hesamakbari Please distinguish between the correct answer and the answer that satisfied the author (accepted). Yes, perhaps the author did not ask what he wanted to ask. And, perhaps, the answer that solves the problem somehow is enough for him.

SQL query with associated column


TSQL various Max date options not working

Question: I am trying to get the Maximum date and details on my report but they still return all entries within a given time span instead of just the latest entry details.
the table name is dbo.vwPupil_EventType:
EventID (int,not null)
PupilID (int,not null)
EventDate (datetime,null)
Header Note(text,null)
Event Type (varchar(100),null)
Module ID (int,null)

1st attempt generated error msg 306:

the text, ntext and image data types cannot be compared

SELECT   [Pupil ID], [Event Date],[Header Note], [Module ID], [Event ID] AS ID
FROM     dbo.vwPupil_EventType EV
WHERE    ([Module ID] = 22)
GROUP BY [Event ID],[Pupil ID], [Event Date],[Header Note],[Module ID]
HAVING   [Event Date]IN (SELECT MAX([Event Date])
                         FROM     dbo.vwPupil_EventType
                         WHERE    EV.[Event ID] = [Event ID])
ORDER    BY [Pupil ID]

Tried these other 2 options but still getting all entries within a date span instead of just the latest one:
SELECT   [Pupil ID], [Event Date], CAST([Header Note]AS VARCHAR(100))NOTE, [Module ID], [Event ID] AS ID
FROM     dbo.vwPupil_EventType EV
WHERE    ([Module ID] = 22)
GROUP BY [Event ID],[Pupil ID], [Event Date],CAST([Header Note]AS VARCHAR(100)),[Module ID]
HAVING   [Event Date]IN (SELECT MAX([Event Date])
                         FROM     dbo.vwPupil_EventType
                         WHERE    EV.[Event ID] = [Event ID])
ORDER BY [Pupil ID]

then tried
SELECT   [Pupil ID], MAX(CAST([Event Date] AS DATETIME)), CAST([Header Note]AS VARCHAR(100))NOTE, [Module ID], [Event ID] AS ID
FROM     dbo.vwPupil_EventType EV
WHERE    ([Module ID] = 22)
GROUP BY [Event ID],[Pupil ID], [Event Date],CAST([Header Note]AS VARCHAR(100)),[Module ID]
HAVING   [Event Date]IN (SELECT MAX([Event Date])
                         FROM     dbo.vwPupil_EventType
                         WHERE    EV.[Event ID] = [Event ID])
ORDER BY [Pupil ID]

Comment: I think no need of where clause in sub query and also if `[Event Date]` is not in datetime type then it should cast in subquery as well as in having clause
Comment: hi JaydipJ, thank you for your reply but response does not help much...with being new to sql, an example of what it should look like would help
Answer: This is typically solved using a window function:
select [Pupil ID], [Event Date],[Header Note], [Module ID], [ID]
from (
  SELECT   [Pupil ID], [Event Date],[Header Note], [Module ID], [Event ID] AS ID,
           row_number() over (partition by [Pupil ID] order by [Event Date] desc) as rn
  FROM     dbo.vwPupil_EventType EV
  WHERE    [Module ID] = 22
) t
where rn = 1;

If there are multiple rows with the same "max date", you'll only get one of them. If you want all of them returned use dense_rank() instead of row_number()
Comment: hello a-horse...thank you for providing your example...I have not really worked with over partition yet but will give it a go
Comment: Hello, after applying your script, now get message....Msg 208, Level 16, State 1, Line 1
Invalid object name 'dbo.vwPupil_EventType'.
Comment: @newangie: then apparently you do not have a table named `dbo.vwPupil_EventType` despite what you stated in your question
Comment: hello you are correct...have just retried it with the correct table and it does what I need, namely returned 1 line showing the latest entry...thank you so much for your patience and assistance with this
Answer: If I understood you requirement correctly they this may help you
SELECT   [Pupil ID],
         [Event Date],
         CAST([Header Note]AS VARCHAR(100)) NOTE,
         [Module ID],
         [Event ID] AS ID
FROM     dbo.vwPupil_EventType EV
WHERE    [Module ID] = 22
         AND CAST([Event Date] AS DATETIME) = (SELECT MAX(CAST([Event Date] AS DATETIME))
                                                FROM dbo.vwPupil_EventType)
ORDER BY [Pupil ID]


In ancient Greece, did they use the Pythagoras discovery of ratios to create tetra-chord?

Question: To my basic understanding: In ancient Greek they were primarily using tetra-chords
and there was three main standard divisions of these tetra-chords called genus.
In the same era Pythagoras discovers the relationship between intervals and ratios, 3:2 for a perfect fifth is an example. I've also read that the ancient Greeks used Pythagoras findings to help tune the tetra-chords since they spann a perfect fourth. However it got me wondering:
A) Did the ancient Greeks use Pythagoras findings to create the tetra-chord in the first place or did they just use it for tuning later on?
B) If Pythagoras did not have anything to do with the creation of tetra-chords, then who did?
Answer: I'm no expert on ancient Greek music, but Pythagoras did not invent the three tetrachord genera. It does appear that his mathematical work heavily influenced others who defined ancient music theory.
https://en.wikipedia.org/wiki/Musical_system_of_ancient_Greece
Pythagoras was born in the 6th century BCE, and he was the first to work out ratios of string lengths that produced certain tonal intervals such as the "perfect fifth." The systema teleion, from the 5th century BCE, discussed tetrachords as they were understood at that time. Historians do not agree on who invented Pythagorean tuning.
Ptolemy and Boethius, both famous historians in their day, actually attribute the tuning to Eratosthenes, not Pythagorus. (See: https://en.wikipedia.org/wiki/Pythagorean_tuning)
But it was Archyta, a Pythagorean disciple from the 4th century BCE, who defined the diatonic, chromatic, and enharmonic genera as we know them today.
Also indebted to Pythagoras were philosophers Aristoxenus and Cleonides -- contemporaries of Plato and Aristotle -- who wrote the first treatises on harmonics in the centuries that followed.
More info here:
https://www.ancient.eu/Greek_Music/
It's hard to say for sure, but it seems very likely that the many music schools that popped up in the 6th and 5th centuries BCE began to formulate music theory, and it's quite possible tetrachords go back centuries before that.
Comment: If you have a four-stringed lyre in your hand, it's pretty natural to tune it 8 9 10 12 or something similar, for maximum consonance.  So yes, I too am willing to bet that tetrachords go way back.
Comment: @Ringo  I dont think you're time-line might be correct. To my understanding Pythagoras was born and spent most of his life in the 6th century BC, so that before systema teleion had been elaborated in its entirety. +1 Otherwise a great answer considering its very hard to find facts from a ancient time!
Comment: Right, I think I got my centuries reversed because of the BCE thing. I'll amend my answer.


JSP / Tomcat / Apache setup overview on Fedora Core

Question: For someone with so much Java experience, boy do I feel clueless - thanks in advance for your help in my grocking the present (Feb, 2010) JSP environment.
Here's what I am hoping to learn:

Do I understand correctly that most people use Apache to "front-end" their Tomcat servers, such that Apache "talks" directly to web clients and "proxies" Tomcat servers?
Do I understand correctly that Apache isn't capable of serving JSP directly but requires a server (like Tomcat)?
Is there an RPM package for Fedora Core so I don't have to build one myself? Or, does Fedora Core's package installer do a good job on this one from source code? (Some do, some don't!)

While I'm here asking questions; Does Tomcat come with a working example that one can start hacking on as a way to get started quickly? If not, got a good suggestion?
Thanks folks,
RT
Answer: Yes, most often Tomcat is chained to a webserver such as httpd, communicating via the ajp protocol.  httpd is not capable of functioning as a servlet container and compiling JSP's, but Tomcat has poor performance serving static content (such as images) over HTTP.  By chaining the two together, you get the best of both worlds.  For development, most people don't care too much about Tomcat's static content performance so they go directly to port 8080.
For development on Fedora (if you want to test fronting Tomcat):

install the httpd package
install the tomcat6 package
Edit /etc/httpd/conf.d/proxy_ajp.conf and uncomment/create an appropriate ProxyPass line
Drop your .war into /var/lib/tomcat6/webapps/

For production on Fedora:

install httpd and tomcat6 packages
install mod_jk (you may need to download and compile this from the Tomcat website)
configure mod_jk per its documentation

(YMMV on whether Fedora's upgrade cycle is too quick for a production server)
Comment: Note: Recent versions of Fedora do not include a default proxy_ajp.conf file.  Instead, you need to make your own conf file in /etc/httpd/conf.d/ and give it a couple of lines like this: ProxyPass /myWebApp/ ajp://localhost:8009/myWebApp/
Answer: In my experience:

Do I understand correctly that most people use Apache to "front-end" their Tomcat servers, such that Apache "talks" directly to web clients and "proxies" Tomcat servers?

in all environments other than "development", Apache HTTP Server (or possibly some other HTTP load-balancer) is used in front of 1 or more Tomcat servers. For simple testing or development, it should be fine to use the Tomcat http listener directly.

Do I understand correctly that Apache isn't capable of serving JSP directly but requires a server (like Tomcat)?

yes.

Is there an RPM package for Fedora
  Core so I don't have to build one
  myself? Or, does Fedora Core's package
  installer do a good job on this one
  from source code? (Some do, some
  don't!)

I'm not a Fedora user, but it appears there are rpm packages for both tomcat5 and tomcat6.
https://admin.fedoraproject.org/pkgdb/packages/index/?searchwords=tomcat*
Comment: Check jpackage also for RPMs. I use them for CentOS [RHEL], but I believe they have Fedora repos.


Drush affected by El Capitan?

Question: After updating my Mac from Yosemite to El Capitan, I am noticing drush does not run properly on any of my sites. Doing a simple:
drush status-report

Command core-requirements needs a higher bootstrap level to run - you[error]
will need to invoke drush from a more functional Drupal environment
to run this command.
The drush command 'status-report' could not be executed.             [error]
Drush was not able to start (bootstrap) the Drupal database.         [error]
Hint: This may occur when Drush is trying to:
  * bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for
details.
  * connect the database through a socket. The socket file may be
wrong or the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.

This is now happening on all my Drupal sites locally, and yes, I am at the root of the Drupal install directory where this command would normally work. I've updated Composer and made sure that stable Drush 7.0.0 is running. Has anyone else come across this behaviour?
Fortunately, I made a full bootable backup of Yosemite so I will 'simply' roll my Mac back to how it was setup prior to the so-called upgrade of El Capitan. Normally I wait at least a month or two before upgrading to Apple's latest release but I got reckless and now this is the price. Sometimes I just want to switch to Ubuntu full time and say goodbye to the Mac OS.
Using:

Mac OS 10.11
MAMP PRO 3.2.1
Little Snitch 3.6 (mentioning this because of this thread)
Composer version 1.0-dev
Drush 7.0.0

2015-10-17 - Update #################################
First off, thank you for the folks who commented on the original issue. I have decided for better or worse to try again. I updated Yosemite, where Drush, Mamp and everything was working fine, to El Capitan.
I removed drush by editing the .json file for composer by removing the lines for drush and then running composer global update which then finished the job by removing the actual drush files. Composer is up to date, and then drush7 was installed successfully with
composer global require drush/drush:7.0.0
However, once I navigate to a directory with a Drupal install, I am told after running some commands that 'No drupal site was found' and yet, the commands seem to complete regardless. Here are some examples:
drush cron results in the following:
 No Drupal site found, only 'drush' cache was cleared.
 'all' cache was cleared.

drush updb results in the following:
 No database updates required
 No Drupal site found, only 'drush' cache was cleared.
 'all' cache was cleared.

drush dl hacked results in the following:
 Project hacked (7.x-2.0-beta5) downloaded to
 /Users/[me]/Sites/[path]/drupal/sites/all/modules/contrib/hacked

Note there was no 'drupal not found' message on the last command. So, my concern is why the 'No Drupal site found' message is showing up. Here is what my .bash_profile looks like:
export PATH="/Applications/MAMP/bin/php/php5.4.42/bin:$HOME/.composer/vendor/bin:$PATH"
export PATH

export DRUSH_PHP='/Applications/MAMP/bin/php/php5.4.42/bin/php'

export PATH=/usr/local/bin:$PATH

None of these settings were changed from how it was in Yosemite. If anyone can shed some light on these issues, I'd really appreciate it. Thanks again.
Comment: How did you install Drush in the first place? Homebrew? Tarball? Do your sites work at all?
Comment: Drush was installed with Composer. All of my sites worked just fine, and drush worked on every one of them. I have since reverted back to Yosemite and everything is working perfectly but I'm interested to learn if anyone else has encountered this issue. It may have to do with El Capitan's System Integrity Protection
Comment: More likely some system paths got overwritten.
Comment: Yes, or previously created directories within one or more of the disallowed place, such as /System, /bin, /usr (but not /usr/local), and /sbin no longer have permission to run. I have read that some folks had success with using symlinks. I will stay with Yosemite for a bit longer until I have time to devote to updating both the operating system and the broken applications.
Comment: Yupp, I think I'll wait too. During past OSX upgrades I also did it like you WITHOUT having created a backup before. Then I always ended up completely reinstalling my whole system. Which was a big pain while being in a hurry with running projects. But still, a fresh install maybe was the better choice after all.
Comment: FWIW, I upgraded to El Capitan last week and so far everything (including Drush) works perfectly. You (arguably) shouldn't have stuff in system folders anyway, so forcing that correction isn't a terrible thing. `/usr/local` can still be written to, that was always the best place to put this stuff anyway
Comment: @PWM Check `drush status` it-self (with `-v` and `-d`), not `status-report`. It'll show you at which points it fails (whether it's database issue or bootstrap files).
Comment: @kenorb - thanks for your comment. `drush status-report` gives you the details of what you'd see on the screen of the same name in a Drupal install, while `drush status` is about drush itself. At the moment, I'm still using Yosemite so both commands are working fine but I do recall they - and all drush commands - were failing. I think that aliases might do the trick when I eventually go back to using El Capitan.
Answer: Homebrew
Install Drush by Homebrew:
brew install drush

via Phar binary
sudo wget -O /usr/local/bin/drush http://files.drush.org/drush.phar
sudo chmod +x /usr/local/bin/drush

Answer: Add this to your .bash_profile file (found here: ~/.bash_profile)
export PATH="/usr/local/lib/drush:$PATH"

If you already have an 'export PATH=", add it like this (colon separated):
export PATH="/other/path:/usr/local/lib/drush:$PATH"

Comment: Thanks Mike. Drush was installed with Composer however, so my PATH is `~/.composer/vendor/drush/drush/drush`.
Answer: I think I found the answer! I added /Applications/MAMP/Library/bin: to my PATH, so that it went from this:
    export PATH="/Applications/MAMP/bin/php/php5.4.42/bin:$HOME/.composer/vendor/bin:$PATH"

To this:
    export PATH="/Applications/MAMP/bin/php/php5.4.42/bin:$HOME/.composer/vendor/bin:/Applications/MAMP/Library/bin:$PATH"

And now I am not getting any messages about 'No Drupal site found'. Hope this helps out others.
Answer: To make it simpler, you may also install drush via:
COMPOSER_BIN_DIR=/usr/local/bin composer global require drush/drush:7

which would automatically install drush binary into /usr/local/bin, so you don't have to add vendor/bin dir into your PATH.
However still you need to add path to your php binary.
If you've installed php via brew, add this line into your ~/.bashrc:
which brew && brew --prefix homebrew/php/php56 > /dev/null && export PATH="$(brew --prefix homebrew/php/php56)/bin:$PATH"

However since you're using MAMP, this can help:
PHP_VER="5.4.42"
export PATH="$PATH:/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php/php$PHP_VER/bin"

Then make sure you configured your mysql socket correctly by linking into it:
ln -vs /Applications/MAMP/tmp/mysql/mysql.sock /var/mysql/mysql.sock

or adding into your php.ini (pdo_mysql.default_socket) or in settings.php (unix_socket).
Answer: $ brew install homebrew/php/drush
this worked for me, on MacBook Pro - mama - el capitan
I installed brew first, then the above command which installed composer as well.

Drush affected by El Capitan?


Asus Z8NA-D6, not powering up/no signal for monitor

Question: I have a Asus Z8NA-D6 motherboard. Been running fine so far with one E5504 Xeon processor.
I have added another Xeon E5504 CPU to the second slot and it will not power up (or there is no signal to the monitor).
The status lights turn on as normal. no error led.
Nothing happens other then the leds start and both cpus/fans power up. HDD power up.
I tried clearing CMOS.
Any sugestions?
http://www.asus.com/Server_Workstation/Server_Motherboards/Z8NAD6/#download
Update.
Removing ram for second cpu makes it boot atleast.
itboots with memory pluged in for cpu 1. (2 4gb modules) when addin one more to the second cpu it still boots but bios only see the 2 blocks at cpu 1)
Comment: Does the second CPU work on the known working CPU slot - the one the processor is in now? This would help to tell if its a CPU problem.
Comment: added info in question. both cpu works
Comment: It sounds like there's either something wrong at the second CPU slot or the ram - is it still under warranty?
Comment: So it seems that a slight difference in the memory blocks are the fault, even though they are used for seperate cpu slots. Going over the tech specs for both types, i cant tell any differents, but some other site was posting same issue and telling that the ram blocks need to be exactly identical. I wrote down the serial numbers ( on a pc thats not plugged in right now), and will post em later.  Solution, only running with one of the types. Thanks for the assist.
Answer: You just check with the manual how to install RAM the way it works with 2 CPU. If you have done it properly, then maybe the RAMs are of different type and motherboard doesnt like it. If it still doesnt work, try the following: power off, change slots of all rams to different one, power on again, then power off, put as it was supposed to be, power on. If it's still not working, there might be either dodgy RAM or you have burned one of the slots, so in this case, try to avoid using the faulty slot, so it might work but with less RAM available than installed.


Inverter array (vetor) sem uma função externa, 'manualmente'

Question: Amigos, eu sempre inverti vetores usando um auxiliar numa função externa(acho que o jeito padrão), contudo até pouco tempo atrás um amigo me disse que tinha um jeito de inverter vetores sem usar um auxiliar, pedi para me mostrar mas acabou que não me mostrou? Procurei na net algo feito de tal maneira e não achei nada.
Como faço isso.
     aux = vetor[i+8];
     vetor[i+8] = vetor[i];
     vetor[i] = aux;

Comment: O uso de variável auxiliar é a forma canónica de trocar o valor de 2 variáveis. As outras formas de o fazer são "artificiais". Continua a fazer com o uso de auxiliar que fazes bem (o compilador vai optimizar o código melhor que tu consegues com "truques").
Comment: Um "truque" comum para trocar o valor de 2 variáveis sem usar uma variável auxiliar é o chamado *XOR swap*. Ver, por exemplo, http://pt.stackoverflow.com/questions/9497/como-funciona-o-algoritmo-do-xor-swap
Comment: pmg desculpe peguei essa função apenas para demonstrar o uso que faço dos auxiliares irei altera-lá para deixar mais clara. Quero aprender apenas para motivo que curiosidade, pode ser que nem use no dia - a -dia, mas que mal faz
Answer: O truque está na construção do ciclo for, tem de contar do fim para o principio do array (vetor)
#include <stdio.h>

int main() {

   int original[] = {1,2,3,4,5,6};
   int count = sizeof(original) / sizeof(int); // 6, numero de elementos no array original
   int revertido[count], i, j; // declaramos que o array revertido vai ter o mesmo numero de elementos que original

   // vamos iniciar o i em count - 1, (5 indexes dos elementos do array original) vai servir para percorrermos o original do fim para o inicio, subtraimos 1 a cada volta
   // vamos iniciar o j em 0 para podermos armazenar cada valor do original a partir do index 0 no array revertido, j vai ser cada index do array revertido
   // o loop e finalizado quando j < count (quando j for 5), iria dar o mesmo resultado se a condicao fosse i >= 0

   for (i = count-1, j = 0; j < count; i--, j++) {
      revertido[j] = original[i]; // no primeiro loop o ultimo valor do original vai ser o primeiro valor (com index 0) do array revertido, no segundo loop o penultimo do original vai ser o segundo do revertido, etc...
   }

   for (i = 0; i < count; i++) {
      printf("%d \n", revertido[i]);
   }

   return (0);
}

Uma vez entendida a lógica, se quiser simplificar, dá para resolver usando apenas a variável i no loop, e assim nem precisamos do j:
for ( i = 0; i < count; i++) {
   revertido[i] = original[count - i - 1];
}

// Se i for zero, count - i - 1 será o
// último elemento (original[6 - 0 - 1] = original[5]), se for 1, será o
// penúltimo, e assim sucessivamente.

Answer: Apesar da sua pergunta ser em linguagem C, apenas como contribuição à sua pergunta, na linguagem C++ (Orientada a Objetos) podemos utilizar um método muito útil para isso e abstrair essa complexidade:
#include <vector>
#include <algorithm>

void main() {
  std::vector<int> vetor_xpto;
  //quando popular pode usar...
  std::reverse(vetor_xpto.begin(), vetor_xpto.end());
}

Comment: Não esquecendo se o propósito é aprendizado de lógica, minha resposta não deve ser considerada :-)
Answer: Você pode usar pointers, movendo pelos endereços e fazendo as substituições. Muitos dizem que é mais lento, mas eu entendo o contrário (até porque depende de outros fatores do hardware como memória cache etc.). Você evita de usar mais espaço na memória (o dobro) apenas movendo entre os endereços. O processador poupa "baldeação" entre registradores etc. Para complementar, os programadores de estúdios grandes normalmente usam quase tudo em pointers. Porque você pode fazer até embaixadinha com os dados do seu programa. Obrigado.


What am I not getting about foreach loops?

Question: It was always my understanding that
foreach (@arr)
{
    ....
}

and
for(my $i=0; $i<@arr; $i++)
{
    .....
}

were functionally equivalent.
However, in all of my code, whenever I use a foreach loop I run into problems that get fixed when I change to a for loop. It always has to do with comparing the values of two things, usually with nested loops.
Here is an example:
for(my $i=0; $i<@files; $i++)
{
    my $sel;
    foreach (@selected)
    {
        if(files[$i] eq selected[$_])
        {
            $selected='selected';
        }
    }
    <option value=$Files[$i] $sel>$files[$i]</option>
}

The above code falls between select tags in a cgi program.
Basically I am editing the contents of a select box according to user specifications.
But after they add or delete choices I want the choices that were origionally selected to remain selected.
The above code is supposed to accomplish this when reassembling the select on the next form. However, with the foreach version it only gets the first choice that's selected and skips the rest. If I switch it to a 3 part for loop, without changing anything else, it will work as intended.
This is only a recent example, so clearly I am missing something here, can anyone help me out?
Comment: Ask question again after `use warnings;`
Comment: http://stackoverflow.com/questions/23348505/c-style-loops-vs-perl-loops has some good discussion.
Comment: Thanks Toby, I probably should have inferred that earlier, that's actually really convenient.
Comment: `for (my $i=0; $i<@arr; $i++)` is functionally equivalent to `for my $i (0..$#arr)`, not `for my $ele (@#arr)`
Answer: Let's assume that @files is a list of filenames.
In the following code, $i is the array index (i.e. it's an integer):
for (my $i=0; $i<@files; $i++) { ... }

In the following code, $i is set to each array item in turn (i.e. it's a filename):
foreach my $i (@files) { ... }

So for example:
use strict;
use warnings;

my @files = (
   'foo.txt',
   'bar.txt',
   'baz.txt',
);

print "for...\n";
for (my $i=0; $i<@files; $i++) {
   print "\$i is $i.\n";
}

print "foreach...\n";
foreach my $i (@files) {
   print "\$i is $i.\n";
}

Produces the following output:
for...
$i is 0.
$i is 1.
$i is 2.
foreach...
$i is foo.txt.
$i is bar.txt.
$i is baz.txt.

foreach loops are generally preferred for looping through arrays to avoid accidental off-by-one errors caused by things like for (my $i=1;...;...) or for (my $i=0;$i<=@arr;...).
That said, for and foreach are actually implemented as synonyms in Perl, so the following script produces identical output to my previous example:
use strict;
use warnings;

my @files = (
   'foo.txt',
   'bar.txt',
   'baz.txt',
);

print "for...\n";
foreach (my $i=0; $i<@files; $i++) {
   print "\$i is $i.\n";
}

print "foreach...\n";
for my $i (@files) {
   print "\$i is $i.\n";
}

It it simply customary to refer to the second type of loop as a foreach loop, even if the source code uses the keyword for to perform the loop (as has become quite common).
Comment: Your perception that `for` and `foreach` have different implications isn't correct, however I have hacked your answer rather more than I intended. Please revert it to the original if you feel I have corrupted what you intended to say


Is there a way to track an URL traffics if the page doesn't exist but was directed to a working page?

Question:
A user enters https://example.com/mypage on the browser
.httaccess redirects to https://example.com/myfinallandingpage

I would like to track the traffics of /mypage.
/mypage is not an actual page, but /myfinallandingpage is a working page.
Does anybody know a way to do this?
Answer: Out of the box you can't measure server-side redirects such as 301 or 302 since the browser JavaScript, and thus Google Analytics won't be executed on the redirect source pages.
However you can by doing a little customization:

Insert a URL parameter on the redirect destination page eg https://example.org/destination-page?ref=https://example.org/source-page and track whatever you want on that destination apge
Perform server-side tracking: you could handle your redirects at PHP level, allowing you to use a GA server-side tracking library with GA Client ID retrieved via the cookies in HTTP headers
Comment: If I redirect the new URL with a parameter attached, will my Google Analytics record the full URI? i.e /myfinallandingpage?redirect=mypage
Comment: Yes by default GA records full URLs


How to modify json response?

Question: I'm having trouble filtering my database query result in the API.
Maybe I'll introduce my code first and then explain what I mean.
    @Entity
    @Validated
    public class Ksiazka {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private int idKsiazka;
    private int idKategoria;
    private String isbn;
    @JsonView(DoubleName.class)
    private String tytul;
    @JsonView(DoubleName.class)
    private String autor;
    private int stron;
    private String wydawnictwo;
    private int rokWydania;
    private String opis;

    public Ksiazka(){ }

    public Ksiazka(int idKsiazka, int idKategoria, String isbn, String tytul, String autor, int stron, String wydawnictwo, int rokWydania, String opis) {
        this.idKsiazka = idKsiazka;
        this.idKategoria = idKategoria;
        this.isbn = isbn;
        this.tytul = tytul;
        this.autor = autor;
        this.stron = stron;
        this.wydawnictwo = wydawnictwo;
        this.rokWydania = rokWydania;
        this.opis = opis;
    }

    public int getIdKsiazka() {
        return idKsiazka;
    }

    public void setIdKsiazka(int idKsiazka) {
        this.idKsiazka = idKsiazka;
    }

    public int getIdKategoria() {
        return idKategoria;
    }

    public void setIdKategoria(int idKategoria) {
        this.idKategoria = idKategoria;
    }

    public String getIsbn() {
        return isbn;
    }

    public void setIsbn(String isbn) {
        this.isbn = isbn;
    }

    public String getTytul() {
        return tytul;
    }

    public void setTytul(String tytul) {
        this.tytul = tytul;
    }

    public String getAutor() {
        return autor;
    }

    public void setAutor(String autor) {
        this.autor = autor;
    }

    public int getStron() {
        return stron;
    }

    public void setStron(int stron) {
        this.stron = stron;
    }

    public String getWydawnictwo() {
        return wydawnictwo;
    }

    public void setWydawnictwo(String wydawnictwo) {
        this.wydawnictwo = wydawnictwo;
    }

    public int getRokWydania() {
        return rokWydania;
    }

    public void setRokWydania(int rokWydania) {
        this.rokWydania = rokWydania;
    }

    public String getOpis() {
        return opis;
    }

    public void setOpis(String opis) {
        this.opis = opis;
    }
}

@JsonView(DoubleName.class)
@RequestMapping(method = RequestMethod.POST, value = "/getAll")
public List<Ksiazka> find(@RequestParam("id") int id){
    List<String> autor = ksiazkaRepo.findInfoById(id); // get result as as  list
    List<Ksiazka> ksiazkaList = new ArrayList<>(); // create list from Ksiazka
    for (String autors : autor) { // returned result you can loop
        Ksiazka ksiazka = new Ksiazka(); // create Object to Ksiazka
        ksiazka.setAutor(autors);
        ksiazkaList.add(ksiazka); //add created object to List
    }
    return ksiazkaList; // return your list
}

@Repository
public interface KsiazkaRepo extends JpaRepository<Ksiazka, Integer> {

    @Query(value = "SELECT ksiazka.tytul, ksiazka.autor FROM IEci8d0gZc.ksiazka WHERE ksiazka.rok_wydania = :id", nativeQuery = true)
    List<String> findInfoById(@Param("id") int id); // here you

}

Getting to the point.
By creating such a query, for example, "rok_wydania" = 2014, you get the result in the form:
[
    {
        "tytul": null,
        "autor": "Język C++. Kompendium wiedzy,Bjarne Stroustrup"
    },
    {
        "tytul": null,
        "autor": "Kali Linux. Testy penetracyjne,Joseph Muniz, Aamir Lakhani"
    },
    {
        "tytul": null,
        "autor": "Praca z zastanym kodem. Najlepsze techniki,Michael Feathers"
    },
    {
        "tytul": null,
        "autor": "Tajemnice JavaScriptu. Podręcznik ninja,John Resig, Bear Bibeault"
    },
    {
        "tytul": null,
        "autor": "Java EE 6. Tworzenie aplikacji w NetBeans 7,David R. Heffelfinger"
    },
    {
        "tytul": null,
        "autor": "Projektowanie stron internetowych. Przewodnik dla początkujących webmasterów po HTML5, CSS3 i grafice. Wydanie IV,Jennifer Niederst Robbins"
    }
]

Everything is cool, because it extracts the data I need from databases, but the answer in JSON is not what I would like.
How to check if the answer is divided into 2. In the sense that the title "title" falls into the place and the author falls accordingly to the place "author".
To make it look something like this:
[
    {
        "tytul": "Język C++. Kompendium wiedzy",
        "autor": ",Bjarne Stroustrup"
    },
    {
        "tytul": "Kali Linux. Testy penetracyjne",
        "autor": "Joseph Muniz, Aamir Lakhani"
    },
    {
        "tytul": "Praca z zastanym kodem. Najlepsze techniki",
        "autor": "Michael Feathers"
    },
    {
        "tytul": "Tajemnice JavaScriptu. Podręcznik ninja",
        "autor": "John Resig, Bear Bibeault"
    },
    {
        "tytul": "Java EE 6. Tworzenie aplikacji w NetBeans 7",
        "autor": "David R. Heffelfinger"
    },
    {
        "tytul": "Projektowanie stron internetowych. Przewodnik dla początkujących webmasterów po HTML5, CSS3 i grafice. Wydanie IV",
        "autor": "Jennifer Niederst Robbins"
    }
]

Any ideas what should be changed? :D
Thanks,
SM
Comment: Please show `findTitleById` method
Comment: Or, where are you actually using `findInfoById`?
Comment: Sorry. My mistake. I put wrong method there. UPDATED
Comment: Okay, so you do `SELECT ksiazka.tytul, ksiazka.autor`, which is 2 strings, then there are multiple `rok_wydania`, so how are you expecting to get both columns of info?
Answer: Try to find your entity (ksiazka) by id.
Optional<Ksiazka> maybeKsiazka = Optional.ofNullable(ksiazkaRepo.findOne(id));
if (maybeKsiazka.isPresent() {
     return maybeKsiazka.get();
}

If you want to do it in separate query you can do query for tytul some like below
@Query(value = "SELECT k.tytul FROM Ksiazka k WHERE k.idKsiazka= :id")
Optional<String> findTytulById(@Param("id") int id);

Comment: Note: the result in the question is a list, not a single object
Comment: @cricket_007 you're right ... I misunderstood what the variable "id" means in this case
Answer: The issue is that you never set the title in the loop, so it's null
To illustrate,
List<String> autors = ksiazkaRepo.findInfoById(id);

List<Ksiazka> ksiazkaList = new ArrayList<>();
for (String a : autors) {
    Ksiazka ksiazka = new Ksiazka();
    ksiazka.setAutor(a);
    ksiazka.setTitle("you're missing this data from the query result");
    ksiazkaList.add(ksiazka);
}

You need to adjust the return type of the findInfo method to be a class with two fields that match the columns being selected if that's all you want displayed. Otherwise, I'm not sure I understand why returning a list of Ksiazka wouldn't show all the other null fields in the JSON
I presume that's what your DoubleName class is for? If so, you'd do
List<DoubleName> info = ksiazkaRepo.findInfoById(id);

List<Ksiazka> ksiazkaList = new ArrayList<>();
for (DoubleName d : info) {
   ...

How to modify json response?


When do we use local alternatives?

Question: I am trying to get a better grasp of the local asymptotic framework, i.e. for parameter sequences of the form:
$$\theta_n = \theta_0 + \frac{h}{\sqrt{n}} $$
Where $n$ denotes sample size and $\theta_n$ corresponds to a sequence of probability distributions on the same sigma algebra and sample space. I would like to know reasons for and against adopting a local asymptotic framework, compared to the standard approach of fixing parameter values and letting $n$ go to infinity.
I came across two reasons for adopting a local asymptotic framework:
First, in a local asymptotic framework, slightly disturbing estimators
that dominate the Maximum Likelihood estimator under fixed asymptotics, such as the Hodges estimator, are rendered inconsistent. So the local asymptotic framework helps to point out shortcomings of some "weird" estimators. For a detailed example, see the first set of David Pollard's "Asymptopia" handouts. p. 12-13.
Second, heuristics suggest that local asymptotics may be a more interesting approximation to the statistical decision problem that we face in practice. Take the toy example, where we observe realizations $\epsilon_i \sim \mathcal{N}(\theta_n,1)$ and test the null hypothesis $H_0: \theta = 0$ vs. $H_1: \theta = \bar{\theta}$, with $\bar{\theta} := n^{-1}\sum_{i=1}^n \epsilon_i$.
First look at the properties of the test when $\theta_n$ is fixed at the value of $1$. The variance of the estimator will be $\frac{1}{n}$, so under the null hypothesis the distribution of statistic collapses at $0$. Since $\bar{\theta}$ will approach the true value of one, we will reject $H_0$ with probability one as $n \to \infty$ ("the test is consistent").
Now, let $\theta_n = n^{-0.5}$. For each value of $n$, the probability of observing $\bar{\theta} = \theta_n$ will be the same under the null (ca. 15% in a one-sided test). See the figure, where the two cases are plotted, with $n \in \{1,10\}$.
The second example seems more appropriate when we see asymptotics as an approximation to the situation that we face with a given sample. We are typically comparing two hypotheses were neither is obviously true or false. The local framework seems to preserve this property asymptotically.

Since fixed asymptotics are still widely used, there must be reasons against employing local asymptotics. So what are these reasons? And what would be further reasons for using local asymptotics?
Comment: This question is answered explicitly in section 7.3 of Van der Vaart's Asymptotic Statistics.
Answer: The LAN use mentioned by @nth is in my experience a little less common in practice, and mainly of theoretical interest. More common uses I know of are

Relative efficiency of estimators: since most reasonable tests have asymptotically trivial power functions, i.e., completely error-free, we can't directly compare tests using the asymptotic power functions (and finite sample power functions are usually hard to compute). So we "normalize" the tests using local alternatives to obtain a non-degenerate power functions in the limit, which can then be used to compare test sequences (with many caveats). You can read about this use in van der Vaart, the same text cited by @nth.

Approximating the finite-sample power of an alternative, or carrying out approximate sample size calculations. This is very useful, analogous to using an asymptotic distribution to approximate a finite-sample confidence interval. You can find an example Thomas Ferguson, A course in large-sample theory, chapter 10.

When do we use local alternatives?


É possível trabalhar com tabelas de atributos de objetos espaciais no Delphi e dbExpress?

Question: Tenho um banco de dados espacial no MySQL onde estão armazenados a geometria e os atributos dos objetos espaciais.
Eu tentei criar um formulário básico, o mais básico possível utilizando SQLConnection, Provider, Dataset, ClientDataset e dbware, para editar as informações dos objetos.
A diferença foi quando dei o select * no dataset, pois o Delphi não tem suporte para dados tipo Geometry do MySQL, então exclui o campo do tipo Geometry.
Aparentemente funciona normalmente porém as edições dos atributos não são feitas mesmo dando o apply updates, é necessário fazer alguma coisa a mais no Delphi? Ou o dbExpress não realiza esse processo?
Alguém já tentou trabalhar nessa abordagem que comentei?
Se alguém quiser reproduzir está o SQL com um minimo BD com apenas um objeto espacial.
-- --------------------------------------------------------
-- Host:                         localhost
-- Server version:               5.6.20-log - MySQL Community Server (GPL)
-- Server OS:                    Win64
-- HeidiSQL Version:             126.96.36.19967
-- --------------------------------------------------------

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;

-- Dumping database structure for gis
CREATE DATABASE IF NOT EXISTS `gis` /*!40100 DEFAULT CHARACTER SET utf8 */;
USE `gis`;

-- Dumping structure for table gis.amf
CREATE TABLE IF NOT EXISTS `amf` (
  `OGR_FID` int(11) NOT NULL AUTO_INCREMENT,
  `SHAPE` geometry NOT NULL,
  `id` decimal(10,0) DEFAULT NULL,
  `name` varchar(254) DEFAULT NULL,
  `hectares` double(19,11) DEFAULT NULL,
  `x` double(19,11) DEFAULT NULL,
  `y` double(19,11) DEFAULT NULL,
  `x2` varchar(254) DEFAULT NULL,
  `y2` varchar(254) DEFAULT NULL,
  UNIQUE KEY `OGR_FID` (`OGR_FID`),
  SPATIAL KEY `SHAPE` (`SHAPE`)
) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=utf8;

-- Dumping data for table gis.amf: 15 rows
/*!40000 ALTER TABLE `amf` DISABLE KEYS */;
INSERT INTO `amf` (`OGR_FID`, `SHAPE`, `id`, `name`, `hectares`, `x`, `y`, `x2`, `y2`) VALUES
    (1, _binary 0x0100000001030000000100000028000000981F7D4A75C12441B8CA9D5EF0966141B032C3DF00C12441B8C1F28EED96614138FF43758AC02441D3D16617EA96614178F362ED1DC024418ED5CE32E7966141A87C8B0BA2BF2441B00B4DDDE3966141D07EE85D49BF244117C4C4C5E1966141280649E105BF24416CFB560DE0966141F8590FB0B5BE24415A8EB6FEDD966141803BCD6574BE24415827993CDC966141E0E057200ABE2441089569FED9966141C0D6349EC5BD24419259D6E9D89661418806CBA263BD24413A7ACDEDD6966141F0B4B7B208BD2441CB8DC6AED496614150D59F29C4BC2441D037F4FCD2966141D08DA97C56BC244166144B8CD1966141E01DDBBDC1BB24417640D08ECF96614118A4DFD17BBB24413E383C93CE966141A052A72116BB2441EC2C9925CD966141E8E54440B2BA244119A0437ECB966141B845560660BA2441D6B6ADC6CA9661419898D87F51BA2441400EEBB0CA9661412053A4974BBA2441F76170A9CA966141E04A35303BBA244188D5D88ACA9661414895531721BA244178653593CA966141C040138131BA24411C059293D09661414072122648BA24412F8540BFD696614158E3F2B25FBA244192584EE1DD966141D8D01AAF7CBA2441746B3DEBE5966141F085D2E48DBA2441B958AB38EA966141B0319E98ADBA2441E0D27747F3966141A0C0DAAA05BB24410856ABC3F3966141504C6CA2CCBB244141DF224BF496614130FFEE88A4BC24414FB6CD9DF5966141600BB362E8BD2441AC9C224FF2966141D0CC553C2EBE244180172257EE966141B03E682B3DBF2441EAD4215BEC96614120000B0583BF2441175A2253F0966141F85D729A0CC02441EDA7551EF1966141B82C875AABC02441653C0075F0966141981F7D4A75C12441B8CA9D5EF0966141, 0, '15', 16.49848504330, 679523.38008600000, 9221914.59363000000, '37° 22\' 28.99" W', '7° 2\' 11.06" S'),
    (2, _binary 0x010000000103000000010000000F000000607EBC0915C324415FF1C17222986141C0F183A4F0C32441AB0917A120986141509A4CBA44C424412E6821AC2098614118BC4BD85BC42441FD722AAF2098614118BC4BD85BC42441ADD5A28AEF9761417078C58A72C12441ADD5A28AEF976141D85EABFB8DC12441B06C4447F4976141583CE3B788C12441278960ADF497614118DEF9B838C124411242E3BCFA97614178E70D295DC124414FDF792B0298614198B630A475C12441D65DBE2907986141F0FE3734ADC124417689BF1710986141F83C3ED4DCC12441EC4116AD1A98614120D84DE453C2244142436CCD1F986141607EBC0915C324415FF1C17222986141, 0, '1', 14.02872517270, 680315.53151200000, 9224249.43888000000, '37° 22\' 3.45" W', '7° 0\' 54.97" S'),
    (3, _binary 0x010000000103000000010000000E000000E0F1BC9EE5C824419B563413CC97614120C4DC7CF9C424419B563413CC97614120C4DC7CF9C42441ADD5A28AEF9761411076A680C5C82441ADD5A28AEF976141482A7C2FCCC8244159396DECE9976141E0057BD8D4C82441BC577D19E1976141A0C0B4D1D6C8244153932FA4DD97614100AA5039D8C8244121840B2EDB97614120A96BE0D8C824410968B41FDA976141F0807455DCC82441E611F2D5D5976141E010739DDCC824410596A57CD5976141A8375421E1C82441B8355B4CD19761413816A60AE3C82441041F1FFCCD976141E0F1BC9EE5C824419B563413CC976141, 0, '4', 14.02769543310, 680819.96229800000, 9223917.75257000000, '37° 21\' 46.97" W', '7° 1\' 5.71" S'),
    (4, _binary 0x010000000103000000010000001800000050F9D70F3AC5244194DF57CC20986141F8872DB289C524418AF03CB319986141689151C889C52441772350B319986141288D41C79CC5244174C8DC0118986141E0D0D67AF1C5244182919BE610986141F86F7FCB1FC62441517B0CA00C986141E060961756C624418AAE313F07986141F037CC0AEEC62441B8B78EDF05986141E80F424422C72441C92F020F06986141507089AE89C7244156127FF20598614158B836A107C824417BF7EF9005986141281E566059C8244135E2B66005986141C8845F0EADC824413C9724B305986141D0D045C0B1C824414FDF792B0298614130588ACDB4C82441D85C11E0FF976141B8617710B9C824412A14D60FFB97614150297804BFC82441E358157BF5976141E89EDBE3BFC82441278960ADF49761415893DF18C5C82441273AE0E1EF9761411076A680C5C82441ADD5A28AEF97614120C4DC7CF9C42441ADD5A28AEF97614118BC4BD85BC42441ADD5A28AEF97614118BC4BD85BC42441FD722AAF2098614150F9D70F3AC5244194DF57CC20986141, 0, '2', 14.02784704860, 680721.06814300000, 9224201.91733000000, '37° 21\' 50.23" W', '7° 0\' 56.47" S'),
    (5, _binary 0x010000000103000000010000000D000000588E94CEE1C624418253F36FA9976141B0444721C8C424418253F36FA9976141B0444721C8C424419B563413CC97614120C4DC7CF9C424419B563413CC976141E0F1BC9EE5C824419B563413CC976141185D7DB4E6C824415A7B7A45CB97614140E27DACEAC82441A2A3A462C7976141B877860AF6C82441F0D65A68BA97614130B784A1F8C82441390A7073B7976141307C8084FEC82441DA00F7BAB097614150D86B76FEC8244149CCC5BAB0976141683E9E8556C72441FF934BF1AA976141588E94CEE1C624418253F36FA9976141, 0, '6', 14.02825620420, 680805.13664500000, 9223644.06518000000, '37° 21\' 47.43" W', '7° 1\' 14.62" S'),
    (6, _binary 0x010000000103000000010000000D00000020C4DC7CF9C42441ADD5A28AEF97614120C4DC7CF9C424419B563413CC976141B0444721C8C424419B563413CC976141A891D01764C124419B563413CC976141D871379C18C12441E611F2D5D5976141B84A00A208C12441224EDAE6D7976141B81AC36EBCC02441224EDAE6D797614118D1EE2CCCC0244153932FA4DD976141A866927BCFC024412E37DBD8DE976141D8D4D54E4BC124411B84DCC4E89761417078C58A72C12441ADD5A28AEF97614118BC4BD85BC42441ADD5A28AEF97614120C4DC7CF9C42441ADD5A28AEF976141, 0, '3', 14.02846133560, 680324.71767800000, 9223917.64989000000, '37° 22\' 3.11" W', '7° 1\' 5.77" S'),
    (7, _binary 0x010000000103000000010000001600000010CA1A3C25C124418253F36FA997614110CA1A3C25C12441DDFA37C37B976141E05DB08364BD2441DDFA37C37B9761413049B26360BD24413A2A026281976141409F090F3CBD2441AB91FA0990976141A8B24E8136BD24417885844792976141F0B854F232BD24417885844792976141C823A1432EBD2441A1B1152B9497614110E3304C65BD24419CD5C1699F976141B0F2B503CDBD24416B746DB0A697614180C22F8865BF24418ED14ADAA2976141C874C66345BF24417885844792976141706EC0F248BF24417885844792976141F06D473947BF24413621E2639197614188D527744CC02441AB91FA099097614100531A247AC024418B857BCD8F976141986AEB4C7AC02441AB91FA0990976141A8B5E2CF7BC024417885844792976141F0BBE84078C024417885844792976141885B336685C0244147445CC3A5976141E8F4718A80C024418253F36FA997614110CA1A3C25C124418253F36FA9976141, 0, '7', 13.92974024410, 679826.91611100000, 9223287.42356000000, '37° 22\' 19.26" W', '7° 1\' 26.34" S'),
    (8, _binary 0x010000000103000000010000000C000000B0444721C8C424419B563413CC976141B0444721C8C424418253F36FA997614110CA1A3C25C124418253F36FA9976141E8F4718A80C024418253F36FA9976141B0EA853B70C02441453B3CC5B59761416034A9F070C02441390A7073B7976141E8E85C2F72C02441F0D65A68BA9761410022536873C02441B19EA34FBD97614130C0D36E3BC124413DCBD61CBD976141708F3FB564C124419EBED8FECB976141A891D01764C124419B563413CC976141B0444721C8C424419B563413CC976141, 0, '5', 14.02830437450, 680292.02617900000, 9223630.66760000000, '37° 22\' 4.14" W', '7° 1\' 15.11" S'),
    (9, _binary 0x010000000103000000010000000B000000E82F60DFA3C124416914F1C255976141207B949292BE24416914F1C2559761417098F9057CBE24417CC5B9E561976141E0FB11D320BE2441C75A66E26897614148A92CCAF8BD2441B7F498F36B9761419825BE7BB2BD24417A00726D6F976141980109F96ABD2441E9CE88F672976141E05DB08364BD2441DDFA37C37B97614110CA1A3C25C12441DDFA37C37B976141E82F60DFA3C12441DDFA37C37B976141E82F60DFA3C124416914F1C255976141, 0, '9', 14.02819636160, 679911.46004000000, 9222992.94250000000, '37° 22\' 16.47" W', '7° 1\' 35.92" S'),
    (10, _binary 0x010000000103000000010000001B000000E82BE81E3EC32441D5C4B38D9C9761417889F68975C3244178858447929761413083F01879C324417885844792976141A0D96B897CC324411A4348A491976141E8B5E8CB86C32441AB91FA0990976141B83AC71487C32441DE6798FE8F97614138295ED4D1C32441CD40ABB08A976141F0C684FF10C42441D649003784976141101D6DCC47C42441CE8380977E9761411093BC6362C42441DDFA37C37B976141E82F60DFA3C12441DDFA37C37B97614110CA1A3C25C12441DDFA37C37B97614110CA1A3C25C124418253F36FA9976141B0444721C8C424418253F36FA9976141588E94CEE1C624418253F36FA9976141A0DB8D81D9C62441E75D8B54A9976141B88D2E708DC624417038CB36A8976141504A7DD129C624410F8D29C0A6976141600452C5BEC5244121F24C3AA597614168875CF15EC5244125BA440BA4976141E84FB84A08C52441C7D4AF15A3976141F8E0C2A3D4C424413412AF43A2976141A87CFE180CC424413C62BD7F9F9761410063C691C2C3244105124E7B9E976141F0EA7DC77FC324415E8A36939D976141007EBF1B3EC3244148B1498E9C976141E82BE81E3EC32441D5C4B38D9C976141, 0, '8', 13.92952781570, 680289.53027100000, 9223329.55106000000, '37° 22\' 4.19" W', '7° 1\' 24.92" S'),
    (11, _binary 0x010000000103000000010000000E000000E030C396E0C224416914F1C255976141E030C396E0C22441B9E82C952D97614130DA2A7EB5BF2441B9E82C952D976141D8C2628A95BF24412DCDF8F139976141F03E6FCAF4BF2441A634D70B3E97614170054A98E0BF24410C1C17EA4197614158C7882CB3BF2441B02F2E9D4A97614198DCE1924DBF24413FF072514E976141D8A56BECD4BE24418CFF1CB0499761418030981FA2BE24411BC061644D97614150E8FDB19FBE2441BCC8ECB24E976141207B949292BE24416914F1C255976141E82F60DFA3C124416914F1C255976141E030C396E0C224416914F1C255976141, 0, '11', 14.02833711550, 680081.38860400000, 9222678.34417000000, '37° 22\' 10.90" W', '7° 1\' 46.14" S'),
    (12, _binary 0x010000000103000000010000001000000048FE0724ECC524416914F1C255976141E030C396E0C224416914F1C255976141E82F60DFA3C124416914F1C255976141E82F60DFA3C12441DDFA37C37B9761411093BC6362C42441DDFA37C37B976141C88038D47FC424413B515AA178976141880B914D98C42441E258AF50769761415863F14EECC4244195478441739761415821A0650BC524414236593270976141F097F6E711C524417A00726D6F976141988B6A4749C52441C75A66E26897614170806B9360C52441EA79A9216697614110C44D2074C524413B73030D649761418863C2B392C52441292A5F716097614188879861CDC5244182361AD85997614148FE0724ECC524416914F1C255976141, 0, '10', 14.02804577130, 680380.12466700000, 9222971.45419000000, '37° 22\' 1.20" W', '7° 1\' 36.56" S'),
    (13, _binary 0x010000000103000000010000000B00000090F06BADAEC42441B9E82C952D97614190F06BADAEC424416D1B30FBF39661418015C9CE8CC424414D1E147DF396614168B93ECEF2C32441E20542CF18976141B0B0841AEEBF244141AD74A414976141A0971546E2BF24411AC9B0081A97614188C99BFDC1BF244171E14BBF289761412031CA1ABBBF2441FBE056692B97614130DA2A7EB5BF2441B9E82C952D976141E030C396E0C22441B9E82C952D97614190F06BADAEC42441B9E82C952D976141, 0, '13', 12.89274416940, 680250.52935000000, 9222394.36923000000, '37° 22\' 5.35" W', '7° 1\' 55.36" S'),
    (14, _binary 0x01000000010300000001000000170000007054F1A1BDC42441C91BDF32F496614190F06BADAEC424416D1B30FBF396614190F06BADAEC42441B9E82C952D976141E8D0A4D7A5C62441B9E82C952D976141980F70BAAFC62441FBE056692B97614148531B2BBFC62441BDD73705289761418025004FD6C62441F26FDE202297614130F9F173EAC6244180A973811C976141485A40D0EFC6244167098DE31A97614180C19504F3C624411AC9B0081A976141703D72A504C72441A14CAF541597614158031D7815C7244101A366B50F97614110E30C141BC72441475513700D976141186696304CC72441BDAC7431FC966141083D41834DC7244157E6C95DFB966141E0B7A2744DC724412D51A35DFB966141800228078DC62441C2A3C961F9966141C053234F69C624418D40F4F7F896614180F9863854C62441756CD0C0F896614190D96EDCCBC52441A12F3574F7966141B8DD85F789C5244170F436CDF6966141285488AE0AC52441450FC151F59661417054F1A1BDC42441C91BDF32F4966141, 0, '14', 12.89252647880, 680682.27854300000, 9222283.26931000000, '37° 21\' 51.27" W', '7° 1\' 58.93" S'),
    (15, _binary 0x010000000103000000010000000F000000E8D0A4D7A5C62441B9E82C952D97614190F06BADAEC42441B9E82C952D976141E030C396E0C22441B9E82C952D976141E030C396E0C224416914F1C25597614148FE0724ECC524416914F1C255976141F852637DFBC52441A09D67B95397614190850EFF11C62441325A446A4F976141E876033C14C62441BCC8ECB24E9761412071F56D2CC62441CF2DE8F44697614158FB2D3944C624410C1C17EA4197614170C68DB250C62441ED615E453F976141A05DF7CE6FC6244114EBD676399761414059488F87C62441235F61F233976141D804E4B899C624417060A13E30976141E8D0A4D7A5C62441B9E82C952D976141, 0, '12', 14.02823761420, 680523.28082700000, 9222663.87336000000, '37° 21\' 56.50" W', '7° 1\' 46.56" S');
/*!40000 ALTER TABLE `amf` ENABLE KEYS */;

-- Dumping structure for table gis.geometry_columns
CREATE TABLE IF NOT EXISTS `geometry_columns` (
  `F_TABLE_CATALOG` varchar(256) DEFAULT NULL,
  `F_TABLE_SCHEMA` varchar(256) DEFAULT NULL,
  `F_TABLE_NAME` varchar(256) NOT NULL,
  `F_GEOMETRY_COLUMN` varchar(256) NOT NULL,
  `COORD_DIMENSION` int(11) DEFAULT NULL,
  `SRID` int(11) DEFAULT NULL,
  `TYPE` varchar(256) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- Dumping data for table gis.geometry_columns: ~0 rows (approximately)
/*!40000 ALTER TABLE `geometry_columns` DISABLE KEYS */;
INSERT INTO `geometry_columns` (`F_TABLE_CATALOG`, `F_TABLE_SCHEMA`, `F_TABLE_NAME`, `F_GEOMETRY_COLUMN`, `COORD_DIMENSION`, `SRID`, `TYPE`) VALUES
    (NULL, NULL, 'amf', 'SHAPE', 2, 1, 'POLYGON');
/*!40000 ALTER TABLE `geometry_columns` ENABLE KEYS */;

-- Dumping structure for table gis.spatial_ref_sys
CREATE TABLE IF NOT EXISTS `spatial_ref_sys` (
  `SRID` int(11) NOT NULL,
  `AUTH_NAME` varchar(256) DEFAULT NULL,
  `AUTH_SRID` int(11) DEFAULT NULL,
  `SRTEXT` varchar(2048) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

-- Dumping data for table gis.spatial_ref_sys: ~0 rows (approximately)
/*!40000 ALTER TABLE `spatial_ref_sys` DISABLE KEYS */;
INSERT INTO `spatial_ref_sys` (`SRID`, `AUTH_NAME`, `AUTH_SRID`, `SRTEXT`) VALUES
    (1, NULL, NULL, 'PROJCS["SIRGAS_2000_UTM_Zone_24S",GEOGCS["GCS_SIRGAS_2000",DATUM["Sistema_de_Referencia_Geocentrico_para_las_AmericaS_2000",SPHEROID["GRS_1980",6378137.0,298.257222101]],PRIMEM["Greenwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",10000000.0],PARAMETER["Central_Meridian",-39.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Latitude_Of_Origin",0.0],UNIT["Meter",1.0]]');
/*!40000 ALTER TABLE `spatial_ref_sys` ENABLE KEYS */;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

Comment: @QMechanic73 cara consegui finalmente, praticamente sem querer, no provider eu coloquei em updatemode upwherekeyonly, e puff deu o apply updates, porém não sei explicar e nem sei o porque.
Comment: @QMechanic73 é justamente o tipo de dado GEOMETRY que o Delphi não consegue entender. Dá uma olhada nesse [link](http://stackoverflow.com/questions/28136489/editing-attributes-of-spatial-data-in-delphi-mysql-dbexpress)
Comment: Este é o tipo [link](http://edndoc.esri.com/arcsde/9.1/general_topics/wkb_representation.htm), tenho que encontrar uma forma de ler esse tipo de arquivo.
Comment: @QMechanic73 então dei uma estudada e cheguei uma conclusão, como tinha uma tabela de objetos espaciais o qual não podia trazer o campo do tipo GEOMETRY, eu fazia o select em todos os campos menos esse, ou seja nos atributos, quando ia dar o update como estava no `upWhereAll` ele incluia o campo tipo GEOMETRY e no reconcile error dava aquele erro de registro modificado por outro usuário. Deixando `upWhereKeyOnly` ele bota os campos modificados na query e o id, ai não da problema.
Comment: @QMechanic73 então desculpa por ter dito que era o problema do decimal, e acabei fazendo você dar a resposta abaixo.
Comment: @QMechanic73 não gosto de responder as minhas próprias  perguntas, delete sua resposta e coloque a solução que eu aceito.
Answer: Atualização: A solução encontrada para contornar esse problema, segundo o autor foi fazer um SELECT em todos os campos menos o campo do tipo Geometry, e alterar o modo de atualização de upWhereAll para upWhereKeyOnly.
Ao colocar os campos modificados na query e o ID a atualização será baseada em colunas chaves especificas. Assim não sendo necessário o código abaixo.

Como citado por você, o problema acontece quando esses dados são importados para o seu programa, que ao invés de vir no formato xx.xxxx retorna xx,xxx e por causa disto o ApplyUpdates não funciona.
Você pode tentar fazer um replace trocando , por . assim:
function replaceComma(const str : string ): string;
begin
Result := StringReplace(str, ',', '.', [rfReplaceAll]);
end;

Esse replace pode ser chamado antes de salvar os dados, poderá usa-lo no evento BeforePost do DataSet.
Comment: @user21051 você pode fazer um for nos Fields do dataset no beforePost como sugerido pelo QMechanic73, se forem vários fields ou um a um mesmo se forem poucos


Use any method to determine if the series converges or diverges

Question: $\sum_{n=1}^\infty \frac{10}{[6n+11]^{\frac{4}{3}}}$
So I think it converges but I'm not sure
Comment: do you know about LCT and p-test?
Comment: I've heard about the comparison test, but I'm not sure what the p-test is?
Comment: Note that this is bounded by $2/n^{4/3}$. Then use the integral test to conclude convergence.
Answer: $$\frac{10}{(6n+11)^{4/3}}\approx \frac{10}{(6n)^{4/3}}$$ when n is large enough
since$$\sum \frac{1}{n^{4/3}}>\sum \frac{10}{(6n)^{4/3}}$$ and since $\sum \frac{1}{n^{4/3}}$ converges by p test so,
$$\sum \frac{10}{(6n)^{4/3}}$$  converges  too
Comment: Just as written by ketan,$\sum \frac{10}{(6n)^{4/3}}$ converges to $3.30279$ while $\sum \frac{10}{(6n+11)^{4/3}}$ converges to $2.06778$.
Answer: The integral comparison test
shows that
$\sum_{n \ge 1} \frac1{n^p}$
converges for $p > 1$.
Your series has $p = \frac{4}{3}$,
so it converges.


How to use term id in content paths using path auto?

Question: How can I use term id instead of term name in path auto?I have a category field in my content type named "field_article_category" and there is a token [node:field_article_category] for it but it is replaced by term name not term id.is there anyway to get term id instead of term name?
Comment: You can select multiple terms during creating a node (if it supports multiple select). For example, if you select 2 terms for one node, you can check one of them by selecting delta. For the first selected term it should be 0, for the second term should be 1 and so on. For first term: [node:field_catalog:0:tid] - taxonomy term it for the first selected term.
Answer: You likely need the Entity tokens module from http://drupal.org/project/entity for now. We are working on adding the more detailed field tokens into Drupal 7.
Comment: Thanks Dave.I installed entity and now just one of the term reference fields(I have 4 term reference fieds) is expandable.why?
Answer: The token you should use for the taxonomy term ID is [node:field_article_category:id].
I have a "Categories" vocabulary, and this is the list of the tokens associated to that vocabulary for the nodes.

If you install the Token module, apart from having more tokens available, you will also have a list of the available tokens, from which I have taken the previous screenshot. The list is available after the fields to set the patterns for the automatic aliases, in the "Replacement patterns" fieldset.

I have noticed that out of four vocabularies I associated with content types, only two are listed as tokens; in my case, thought, I don't see all the tokens for that vocabulary, which is different from your case, where you seem to see only part of the tokens associated with a vocabulary.
Comment: If I type "[node:field_category:tid]" I get this error: "The Pattern for all article paths is using the following invalid tokens: [node:field_article_category:tid]".
Comment: Is your screenshot from drupal 7?
Comment: The screenshot is from Drupal 7.
Comment: If you are using "[node:field_category:tid]", why is the error for "[node:field_article_category:tid]"?
Comment: sorry, it is [node:field_article_category:tid] which causes the error.For article_category I have just one token: [node:field_article_category] which is not expandable
Comment: I am not clear why you are using "[node:field_article_category:tid]" when the field is "field_category"; if that is the field name, then you should use "[node:field_category:tid]."
Comment: Edited the main post
Answer: in the 'Automated alias settings' of Pathauto you will find the section 'Taxonomy term paths', there is a sub-section called 'Replacement patterns'. Here you will find several patters. The pattern <code>[tid]</code> is the pattern used to show the unique ID of the taxonomy term.
I hope have understood well your question.


Variance of Bayesian posterior

Question: Setup
Let $f(\theta)$ be a prior on $\Theta$, and $X_1,\dots,X_n$ are iid according to $P_\theta$. From Bayes' rule, we derive the posterior as
$$
g(\theta\mid x_1,\dots,x_n)=\frac{\Pr(x_1,\dots,x_n\mid\theta)f(\theta)}{\int_\Theta \Pr(x_1,\dots,x_n\mid\theta)f(\theta)d\theta}
$$
where $\Pr(x_1,\dots,x_n\mid\theta)=P_\theta(x_1)\times\cdots\times P_\theta(x_n)$. Thus the $x$'s induce a distribution over the Bayesian posterior, with mean equal to the prior:
$$
E_{\mathrm{x}_n}[g(\theta\mid\mathrm{x}_n)]=f(\theta)
$$
where $\mathrm{x}_n=(x_1,\dots,x_n)$.
Questions
Is it true in general that the variance of the posterior is increasing in $n$?
Note that I'm NOT asking about whether the variance of $\theta$ computed using the posterior, i.e.
$$Var(\theta)=\int(\theta-E(\theta))^2g(\theta\mid\mathrm{x}_n)d\theta,$$ would increase with $n$. This variance I know is decreasing in $n$. Rather, I'm asking  whether the variance of the distribution over posteriors induced by $\mathrm{x}_n$ is increasing in $n$. In other word, is the following expression
$$
E_{\mathrm{x}_n}[g(\theta\mid\mathrm{x}_n)-f(\theta)]^2 = E_{\mathrm{x}_n}[g^2(\theta\mid\mathrm{x}_n)]-f^2(\theta)
$$
increasing in $n$? Since $n$ does not enter $f(\theta)$, my question amounts to whether $E_{\mathrm x_n}[g^2(\theta\mid \mathrm x_n)]$  is increasing in $n$?
What about the specific case where $f(\theta)$ and $P_\theta$ are both normal distributions (and thus $g(\theta\mid\mathrm{x}_n)$ is normal as well)?
Comment: http://math.stackexchange.com/q/1434243/
Answer: Quite to the contrary, the variance of the posterior will decrease, as the posterior will concentrate more and more around the MLE as $n$ increases. This is known as "likelihood dominance", i.e. the data (likelihood) will "outvote" the effect of the prior in large samples.
Comment: @HerrK.: I suggest you rephrase your question more precisely, as it is unclear as stated.
Comment: I think you're talking about the variance of $\theta$ computed using the posterior, i.e. $Var(\theta)=\int (\theta-E(\theta))^2g(\theta\mid\mathrm{x}_n)d\theta$. What I'm asking about is something different. The signals $\mathrm{x}_n$ induce a distribution over the possible posteriors, and I'm asking whether the variance of this distribution (of posteriors) is increasing in $n$.
Comment: @Xi'an: question revised.

Variance of Bayesian posterior


Unable to use Composer (for Drush) on Bluehost - install problem

Question: I apparently successfully installed Composer (for use with Drush) on bluehost. See messages below. It does not work, however. When I type composer.phar I get nothing or "command not found" among other error messages. See below.
I am a newbie so it may be that install worked just fine, but I just don't know how to properly execute composer to make sure it works.
I am using instructions found at http://avantidevelopment.com/install-composer-on-bluehost/ & https://www.drupal.org/node/2366283.
email@example.com [~/bin]# cd ~
email@example.com [~]# mkdir ~/common
firstname.lastname@example.com [~]# cd ~/common
email@example.com [~/common]# curl -sS https://getcomposer.org/installer | /ramdisk/php/54/bin/php54-cli
#!/usr/bin/env php
All settings correct for using Composer
Downloading...

Composer successfully installed to: /home5/columck5/common/composer.phar
Use it: php composer.phar
firstname.lastname@example.com [~/common]# which php-cli
/usr/bin/php-cli
PHP Version     5.4.24

email@example.com [/ramdisk/php/54/bin]# cd ~/common
email@example.com [~/common]# ls -l
total 1164

drwxr-xr-x  2 columck5 columck5    4096 Oct 29 08:37 ./

drwx--x--- 21 columck5 nobody      4096 Oct 28 09:15 ../

-rwxr-xr-x  1 columck5 columck5 1176136 Oct 29 08:37 composer.phar*

-rw-r--r--  1 columck5 columck5     575 Oct 29 08:38 error_log

email@example.com [~/common]# composer.phar

-bash: composer.phar: command not found

firstname.lastname@example.com [~/common]# composer
email@example.com [~/common]# php composer

Status: 404 Not Found
Content-type: text/html

No input file specified.

email@example.com [~/common]# php-cli composer.phar
firstname.lastname@example.com [~/common]# php-cli composer

Could not open input file: composer

Answer: Content-type:text-html means your script is running from CGI instead of CLI.
so try to fix your install so that the PHP in the path uses a CLI
One simple way to do is to write php path to php-cli instead of php-cgi.
# .bash_profile
export DRUSH_PHP=/ramdisk/php/54/bin/php54-cli

Comment: Sorry to be such a dummy, but the export line should be inserted as the last line of .bash_profile? There is so much to learn when trying to build a site using Drupal!
Comment: its not really important, put it in last.
Answer: What finally worked was adding the following to .bash_profile.
alias composer="/ramdisk/php/54/bin/php54-cli ~/common/composer.phar"
export DRUSH_PHP=/ramdisk/php/54/bin/php54-cli
alias drush="~/.composer/vendor/bin/drush"